NEW Add total of time spent in timespent page at top of page too.

This commit is contained in:
Laurent Destailleur
2018-02-09 23:52:43 +01:00
parent 633dc507fe
commit e984d7df9f
7 changed files with 85 additions and 26 deletions

View File

@@ -213,11 +213,9 @@ function updateTotal(days,mode)
}
});
if (document.getElementById('totalDay['+days+']')) // May be null if no task records to output (nbline is also 0 in this case)
{
document.getElementById('totalDay['+days+']').innerHTML = pad(total.getHours())+':'+pad(total.getMinutes());
//addText(,total.getHours()+':'+total.getMinutes());
}
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()));
}
else
{
@@ -257,10 +255,10 @@ function updateTotal(days,mode)
}
}
}
if (document.getElementById('totalDay['+days+']')) // May be null if no task records to output (nbline is also 0 in this case)
{
document.getElementById('totalDay['+days+']').innerHTML = total;
}
if (total) jQuery('.totalDay'+days).addClass("bold");
else jQuery('.totalDay'+days).removeClass("bold");
jQuery('.totalDay'+days).text(total);
}
}

View File

@@ -940,7 +940,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
print "</td>\n";
// Planned Workload
print '<td align="right">';
print '<td align="right" class="leftborder plannedworkload">';
if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin');
else print '--:--';
print '</td>';
@@ -1224,7 +1224,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
print "</td>\n";
// Planned Workload
print '<td align="right">';
print '<td align="right" class="leftborder plannedworkload">';
if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin');
else print '--:--';
print '</td>';

View File

@@ -10,13 +10,13 @@ PrivateProject=Project contacts
ProjectsImContactFor=Projects I'm explicitely a contact of
AllAllowedProjects=All project I can read (mine + public)
AllProjects=All projects
MyProjectsDesc=This view is limited to projects you are a contact for.
MyProjectsDesc=This view is limited to projects you are a contact for
ProjectsPublicDesc=This view presents all projects you are allowed to read.
TasksOnProjectsPublicDesc=This view presents all tasks on projects you are allowed to read.
ProjectsPublicTaskDesc=This view presents all projects and tasks you are allowed to read.
ProjectsDesc=This view presents all projects (your user permissions grant you permission to view everything).
TasksOnProjectsDesc=This view presents all tasks on all projects (your user permissions grant you permission to view everything).
MyTasksDesc=This view is limited to projects or tasks you are a contact for.
MyTasksDesc=This view is limited to projects or tasks you are a contact for
OnlyOpenedProject=Only open projects are visible (projects in draft or closed status are not visible).
ClosedProjectsAreHidden=Closed projects are not visible.
TasksPublicDesc=This view presents all projects and tasks you are allowed to read.

View File

@@ -345,7 +345,7 @@ $tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($proj
llxHeader("",$title,"",'','','',array('/core/js/timesheet.js'));
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project');
//print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project');
$param='';
$param.=($mode?'&mode='.$mode:'');
@@ -375,7 +375,7 @@ print '<input type="hidden" name="addtimemonth" value="'.$tmp['mon'].'">';
print '<input type="hidden" name="addtimeday" value="'.$tmp['mday'].'">';
$head=project_timesheet_prepare_head($mode, $usertoprocess);
dol_fiche_head($head, 'inputperday', '', -1, 'task');
dol_fiche_head($head, 'inputperday', $langs->trans('TimeSpent'), -1, 'task');
// Show description of content
print '<div class="hideonsmartphone">';
@@ -474,7 +474,7 @@ print '<td>'.$langs->trans("Project").'</td>';
print '<td>'.$langs->trans("ThirdParty").'</td>';
//print '<td>'.$langs->trans("RefTask").'</td>';
print '<td>'.$langs->trans("Task").'</td>';
print '<td align="right" class="maxwidth100">'.$langs->trans("PlannedWorkload").'</td>';
print '<td align="right" class="leftborder plannedworkload maxwidth100">'.$langs->trans("PlannedWorkload").'</td>';
print '<td align="right" class="maxwidth100">'.$langs->trans("ProgressDeclared").'</td>';
/*print '<td align="right" class="maxwidth100">'.$langs->trans("TimeSpent").'</td>';
if ($usertoprocess->id == $user->id) print '<td align="right" class="maxwidth100">'.$langs->trans("TimeSpentByYou").'</td>';
@@ -517,6 +517,32 @@ print '<td class="center">'.$langs->trans("Note").'</td>';
print '<td class="center"></td>';
print "</tr>\n";
$colspan = 8;
if ($conf->use_javascript_ajax)
{
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>';
$tmparray = dol_getdate($daytoparse,true); // detail of current day
$idw = $tmparray['wday'];
$cssweekend='';
if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css.
{
$cssweekend='weekend';
}
print '<td class="liste_total center'.($cssweekend?' '.$cssweekend:'').'"><div class="totalDay0">&nbsp;</div></td>';
print '<td class="liste_total"></td>
<td class="liste_total"></td>
</tr>';
}
if (count($tasksarray) > 0)
{
@@ -565,8 +591,6 @@ if (count($tasksarray) > 0)
}
}
$colspan = 8;
// There is a diff between total shown on screen and total spent by user, so we add a line with all other cumulated time of user
if ($isdiff)
{
@@ -605,7 +629,7 @@ if (count($tasksarray) > 0)
$cssweekend='weekend';
}
print '<td class="liste_total hide0 center'.($cssweekend?' '.$cssweekend:'').'"><div id="totalDay[0]">&nbsp;</div></td>';
print '<td class="liste_total center'.($cssweekend?' '.$cssweekend:'').'"><div class="totalDay0">&nbsp;</div></td>';
print '<td class="liste_total"></td>
<td class="liste_total"></td>

View File

@@ -347,7 +347,7 @@ $tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($proj
llxHeader("",$title,"",'','','',array('/core/js/timesheet.js'));
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project');
//print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project');
$param='';
$param.=($mode?'&mode='.$mode:'');
@@ -376,7 +376,7 @@ print '<input type="hidden" name="month" value="'.$month.'">';
print '<input type="hidden" name="year" value="'.$year.'">';
$head=project_timesheet_prepare_head($mode, $usertoprocess);
dol_fiche_head($head, 'inputperweek', '', -1, 'task');
dol_fiche_head($head, 'inputperweek', $langs->trans('TimeSpent'), -1, 'task');
// Show description of content
print '<div class="hideonsmartphone">';
@@ -477,7 +477,7 @@ print '<td>'.$langs->trans("Project").'</td>';
print '<td>'.$langs->trans("ThirdParty").'</td>';
//print '<td>'.$langs->trans("RefTask").'</td>';
print '<td>'.$langs->trans("Task").'</td>';
print '<td align="right" class="maxwidth75">'.$langs->trans("PlannedWorkload").'</td>';
print '<td align="right" class="leftborder plannedworkload maxwidth75">'.$langs->trans("PlannedWorkload").'</td>';
print '<td align="right" class="maxwidth75">'.$langs->trans("ProgressDeclared").'</td>';
/*print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpent").'</td>';
if ($usertoprocess->id == $user->id) print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpentByYou").'</td>';
@@ -522,11 +522,37 @@ for ($idw=0; $idw<7; $idw++)
$cssweekend='weekend';
}
print '<td width="6%" align="center" class="hide'.$idw.($cssweekend?' '.$cssweekend:'').'">'.dol_print_date($dayinloopfromfirstdaytoshow, '%a').'<br>'.dol_print_date($dayinloopfromfirstdaytoshow, 'dayreduceformat').'</td>';
print '<td width="6%" align="center" class="bold hide'.$idw.($cssweekend?' '.$cssweekend:'').'">'.dol_print_date($dayinloopfromfirstdaytoshow, '%a').'<br>'.dol_print_date($dayinloopfromfirstdaytoshow, 'dayreduceformat').'</td>';
}
print '<td></td>';
print "</tr>\n";
$colspan=7;
if ($conf->use_javascript_ajax)
{
print '<tr class="liste_total">
<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>';
for ($idw = 0; $idw < 7; $idw++)
{
$cssweekend='';
if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css.
{
$cssweekend='weekend';
}
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>';
}
// By default, we can edit only tasks we are assigned to
$restrictviewformytask=(empty($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED)?1:0);
@@ -584,8 +610,6 @@ if (count($tasksarray) > 0)
}
}
$colspan=7;
// There is a diff between total shown on screen and total spent by user, so we add a line with all other cumulated time of user
if ($isdiff)
{
@@ -632,7 +656,7 @@ if (count($tasksarray) > 0)
$cssweekend='weekend';
}
print '<td class="liste_total hide'.$idw.($cssweekend?' '.$cssweekend:'').'" align="center"><div id="totalDay['.$idw.']">&nbsp;</div></td>';
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>';

View File

@@ -404,6 +404,9 @@ td.onholidaymorning, td.onholidayafternoon {
td.onholidayallday {
background-color: #f4eede;
}
td.leftborder, td.hide0 {
border-left: 1px solid #ccc;
}
td.actionbuttons a {
padding-left: 6px;
@@ -597,6 +600,9 @@ textarea.centpercent {
.wordbreak {
word-break: break-all;
}
.bold {
font-weight: bold !important;
}
.nobold {
font-weight: normal !important;
}

View File

@@ -408,6 +408,10 @@ td.onholidayallday {
td.actionbuttons a {
padding-left: 6px;
}
td.leftborder, td.hide0 {
border-left: 1px solid #ccc;
}
select.flat, form.flat select {
font-weight: normal;
font-size: unset;
@@ -594,6 +598,9 @@ textarea.centpercent {
.wordbreak {
word-break: break-all;
}
.bold {
font-weight: bold !important;
}
.nobold {
font-weight: normal !important;
}