* adjust the total left and total consumed.

This commit is contained in:
wangchunsheng
2011-09-21 05:26:22 +00:00
parent 201b8c8d05
commit 9d2597eea8
2 changed files with 14 additions and 6 deletions
+9 -1
View File
@@ -279,7 +279,14 @@ class projectModel extends model
/* Get total estimate, consumed and left hours of project. */
$emptyHour = (object)array('totalEstimate' => 0, 'totalConsumed' => 0, 'totalLeft' => 0, 'progress' => 0);
$hours = $this->dao->select('project, SUM(estimate) AS totalEstimate, SUM(consumed) AS totalConsumed, SUM(`left`) AS totalLeft')
$hours = $this->dao->select('project, SUM(estimate) AS totalEstimate, SUM(consumed) AS totalConsumed')
->from(TABLE_TASK)
->where('project')->in(array_keys($projects))
->andWhere('deleted')->eq(0)
->groupBy('project')
->fetchAll('project');
$lefts = $this->dao->select('project, SUM(`left`) AS totalLeft')
->from(TABLE_TASK)
->where('project')->in(array_keys($projects))
->andWhere('closedReason')->ne('cancel')
@@ -287,6 +294,7 @@ class projectModel extends model
->andWhere('deleted')->eq(0)
->groupBy('project')
->fetchAll('project');
foreach($lefts as $projectID => $projectLefts) $hours[$projectID]->totalLeft = $projectLefts->totalLeft;
/* Round them. */
foreach($hours as $hour)
+5 -5
View File
@@ -52,22 +52,22 @@ var browseType = '<?php echo $browseType;?>';
<?php
$totalEstimate += $task->estimate;
$totalConsumed += $task->consumed;
$totalLeft += ($task->status == 'cancel' ? 0 : $task->left);
$totalLeft += (($task->status == 'cancel' or $task->closedReason == 'cancel') ? 0 : $task->left);
if($task->status == 'wait')
{
$statusWait++;
$statusWait ++;
}
elseif($task->status == 'doing')
{
$statusDoing++;
$statusDoing ++;
}
elseif($task->status == 'done')
{
$statusDone++;
$statusDone ++;
}
elseif($task->status == 'closed')
{
$statusClosed++;
$statusClosed ++;
}
?>
<tr class='a-center'>