Commit cf7cf8e1 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Add humanreadible project status to the sheet.

parent 7739ed40
...@@ -48,7 +48,7 @@ if (!$obj->load( $timesheet_id, false ) && ($timesheet_id > 0) ) { ...@@ -48,7 +48,7 @@ if (!$obj->load( $timesheet_id, false ) && ($timesheet_id > 0) ) {
// setup the title block // setup the title block
// Fill the title block either with 'Edit' or with 'New' depending on // Fill the title block either with 'Edit' or with 'New' depending on
// if timesheet_id has been transmitted via GET or is empty // if timesheet_id has been transmitted via GET or is empty
$ttl = $timesheet_id > 0 ? "Edit Timesheet" : "New Timesheet"; $ttl = ( $timesheet_id > 0 ) ? "Edit Timesheet" : "New Timesheet";
$titleBlock = new CTitleBlock( $ttl, 'timesheet.png', $m, "$m.$a" ); $titleBlock = new CTitleBlock( $ttl, 'timesheet.png', $m, "$m.$a" );
$titleBlock->addCrumb( "?m=timesheet", "view all timesheets" ); $titleBlock->addCrumb( "?m=timesheet", "view all timesheets" );
if ($canDelete && ($timesheet_id > 0) ) { if ($canDelete && ($timesheet_id > 0) ) {
...@@ -276,10 +276,13 @@ else { ...@@ -276,10 +276,13 @@ else {
</table> </table>
<?php <?php
// Get Project Status information.
$project_types = dPgetSysVal("ProjectStatus");
// Find all tasks in this timesheet period and account them to the project. // Find all tasks in this timesheet period and account them to the project.
function showproject() function showproject()
{ {
global $AppUI, $period, $obj; global $AppUI, $period, $obj, $project_types;
$q = new DBQuery(); $q = new DBQuery();
$q->addQuery('project_id'); $q->addQuery('project_id');
...@@ -328,7 +331,7 @@ function showproject() ...@@ -328,7 +331,7 @@ function showproject()
{ {
$taskDate = new CDate($logitem['task_log_date']); $taskDate = new CDate($logitem['task_log_date']);
if ($period->GetMonth() == $taskDate->GetMonth()) { if ($period->GetMonth() == $taskDate->GetMonth()) {
$amount = $amount + $logitem["task_log_hours"]; $amount = $amount + $logitem['task_log_hours'];
} }
// else do not account the worked hours to the project for this month // else do not account the worked hours to the project for this month
} }
...@@ -337,7 +340,7 @@ function showproject() ...@@ -337,7 +340,7 @@ function showproject()
echo $amount; echo $amount;
$timesheet_worked = $timesheet_worked + $amount; $timesheet_worked = $timesheet_worked + $amount;
echo '</td>'; echo '</td>';
echo '<td>' . $row["project_status"] . '</td>'; echo '<td>' . $project_types[$row['project_status']] . '</td>';
echo '</tr>'; echo '</tr>';
} }
$obj->timesheet_worked = $timesheet_worked; $obj->timesheet_worked = $timesheet_worked;
...@@ -345,7 +348,7 @@ function showproject() ...@@ -345,7 +348,7 @@ function showproject()
function showtimesheetproject() function showtimesheetproject()
{ {
global $timesheet_id; global $timesheet_id, $project_types;
$q = new DBQuery(); $q = new DBQuery();
$q->addQuery('timesheet_id'); $q->addQuery('timesheet_id');
...@@ -371,8 +374,8 @@ function showtimesheetproject() ...@@ -371,8 +374,8 @@ function showtimesheetproject()
echo '<td><a href="?m=projects&a=view&project_id=' . $project["project_id"] . '">' . $project["project_name"] . '</a>'; echo '<td><a href="?m=projects&a=view&project_id=' . $project["project_id"] . '">' . $project["project_name"] . '</a>';
// echo '<td><a href="?m=projects&a=view&project_id=' . $row["timesheet_project"] . '">' . $project["project_name"] . '</a>'; // echo '<td><a href="?m=projects&a=view&project_id=' . $row["timesheet_project"] . '">' . $project["project_name"] . '</a>';
echo '</td>'; echo '</td>';
echo '<td>' . $row["timesheet_project_amount"] . '</td>'; echo '<td>' . $row['timesheet_project_amount'] . '</td>';
echo '<td>' . $project["project_status"] . '</td>'; echo '<td>' . $project_types[$project['project_status']] . '</td>';
echo '</tr>'; echo '</tr>';
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment