NEW Show total of time consumed in week in time spent entry page

This commit is contained in:
Laurent Destailleur 2018-02-26 14:09:15 +01:00
parent cb45c86711
commit de89893d57
7 changed files with 45 additions and 59 deletions

View File

@ -216,6 +216,21 @@ function updateTotal(days,mode)
if (total.getHours() || total.getMinutes()) jQuery('.totalDay'+days).addClass("bold");
else jQuery('.totalDay'+days).removeClass("bold");
jQuery('.totalDay'+days).text(pad(total.getHours())+':'+pad(total.getMinutes()));
var total = new Date(0);
total.setHours(0);
total.setMinutes(0);
for (var i=0; i<7; i++)
{
var taskTime= new Date(0);
result=parseTime(jQuery('.totalDay'+i).text(),taskTime);
if (result >= 0)
{
total.setHours(total.getHours()+taskTime.getHours());
total.setMinutes(total.getMinutes()+taskTime.getMinutes());
}
}
jQuery('.totalDayAll').text(pad(total.getHours())+':'+pad(total.getMinutes()));
}
else
{
@ -260,7 +275,6 @@ function updateTotal(days,mode)
else jQuery('.totalDay'+days).removeClass("bold");
jQuery('.totalDay'+days).text(total);
}
}

View File

@ -2964,12 +2964,12 @@ class CommandeFournisseur extends CommonOrder
}
}elseif(! empty($conf->global->SUPPLIER_ORDER_MORE_THAN_WISHED) )
{//set livraison to 'tot' if more products received than wished. (and if $closeopenorder is set to 1 of course...)
$close=0;
if( count($diff_array) > 0 )
{//there are some difference between the two arrays
//scan the array of results
foreach($diff_array as $key => $value)
{//if the quantity delivered is greater or equal to wish quantity
@ -2977,11 +2977,11 @@ class CommandeFournisseur extends CommonOrder
{
$close++;
}
}
}
if($close == count($diff_array))
{//all the products are received equal or more than the wished quantity
if ($closeopenorder)
@ -3001,8 +3001,8 @@ class CommandeFournisseur extends CommonOrder
}
return 4;
}
}
else
{//all the products are not received
@ -3012,7 +3012,7 @@ class CommandeFournisseur extends CommonOrder
}
return 4;
}
}
else
{
@ -3157,40 +3157,6 @@ class CommandeFournisseurLigne extends CommonOrderLine
}
}
/**
* Mise a jour de l'objet ligne de commande en base
*
* @return int <0 si ko, >0 si ok
*/
public function updateTotal()
{
$this->db->begin();
// Mise a jour ligne en base
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseurdet SET";
$sql.= " total_ht='".price2num($this->total_ht)."'";
$sql.= ",total_tva='".price2num($this->total_tva)."'";
$sql.= ",total_localtax1='".price2num($this->total_localtax1)."'";
$sql.= ",total_localtax2='".price2num($this->total_localtax2)."'";
$sql.= ",total_ttc='".price2num($this->total_ttc)."'";
$sql.= " WHERE rowid = ".$this->rowid;
dol_syslog(get_class($this)."::updateTotal", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
$this->db->commit();
return 1;
}
else
{
$this->error=$this->db->error();
$this->db->rollback();
return -2;
}
}
/**
* Insert line into database
*

View File

@ -595,10 +595,15 @@ if (count($tasksarray) > 0)
if ($isdiff)
{
print '<tr class="oddeven othertaskwithtime">';
print '<td colspan="'.$colspan.'">';
print '<td colspan="3">';
print $langs->trans("OtherFilteredTasks");
print '</td>';
print '<td align="center">';
print '<td align="right" class="leftborder plannedworkload"></td>';
print '<td></td>';
print '<td></td>';
print '<td></td>';
print '<td class="leftborder"></td>';
print '<td class="center">';
$timeonothertasks=($totalforeachday[$daytoparse] - $totalforvisibletasks[$daytoparse]);
//if ($timeonothertasks)
//{

View File

@ -531,8 +531,8 @@ $colspan=7;
if ($conf->use_javascript_ajax)
{
print '<tr class="liste_total">
<td class="liste_total" colspan="'.$colspan.'">';
print '<tr class="liste_total">';
print '<td class="liste_total" colspan="'.$colspan.'">';
print $langs->trans("Total");
print ' - '.$langs->trans("ExpectedWorkedHours").': <strong>'.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).'</strong>';
print '</td>';
@ -547,8 +547,8 @@ if ($conf->use_javascript_ajax)
print '<td class="liste_total hide'.$idw.($cssweekend?' '.$cssweekend:'').'" align="center"><div class="totalDay'.$idw.'">&nbsp;</div></td>';
}
print '<td class="liste_total"></td>
</tr>';
print '<td class="liste_total center"><div class="totalDayAll">&nbsp;</div></td>';
print '</tr>';
}
@ -625,7 +625,7 @@ if (count($tasksarray) > 0)
$cssweekend='weekend';
}
print '<td align="center'.($cssweekend?' '.$cssweekend:'').'">';
print '<td class="center hide'.$idw.' '.($cssweekend?' '.$cssweekend:'').'">';
$tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd');
$timeonothertasks=($totalforeachday[$tmpday] - $totalforvisibletasks[$tmpday]);
if ($timeonothertasks)
@ -658,7 +658,7 @@ if (count($tasksarray) > 0)
print '<td class="liste_total hide'.$idw.($cssweekend?' '.$cssweekend:'').'" align="center"><div class="totalDay'.$idw.'">&nbsp;</div></td>';
}
print '<td class="liste_total"></td>
print '<td class="liste_total center"><div class="totalDayAll">&nbsp;</div></td>
</tr>';
}
}

View File

@ -79,11 +79,7 @@ $projectstatic = new Project($db);
$extrafields_project = new ExtraFields($db);
$extrafields_task = new ExtraFields($db);
if ($projectid > 0 || ! empty($ref))
{
// fetch optionals attributes and labels
$extralabels_projet=$extrafields_project->fetch_name_optionals_label($projectstatic->table_element);
}
$extralabels_projet=$extrafields_project->fetch_name_optionals_label($projectstatic->table_element);
$extralabels_task=$extrafields_task->fetch_name_optionals_label($object->table_element);
@ -278,10 +274,9 @@ if (! empty($project_ref) && ! empty($withproject))
// To show all time lines for project
$projectidforalltimes=0;
if (GETPOST('projectid'))
if (GETPOST('projectid','none'))
{
$projectidforalltimes=GETPOST('projectid','int');
$projectidforalltimes=GETPOST('projectid','int');
}

View File

@ -407,6 +407,9 @@ td.onholidayallday {
td.leftborder, td.hide0 {
border-left: 1px solid #ccc;
}
td.leftborder, td.hide6 {
border-right: 1px solid #ccc;
}
td.actionbuttons a {
padding-left: 6px;

View File

@ -411,6 +411,9 @@ td.actionbuttons a {
td.leftborder, td.hide0 {
border-left: 1px solid #ccc;
}
td.leftborder, td.hide6 {
border-right: 1px solid #ccc;
}
select.flat, form.flat select {
font-weight: normal;