diff --git a/module/execution/model.php b/module/execution/model.php index 0ef664f61f..0be6e9e89d 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -2588,8 +2588,16 @@ class executionModel extends model ->andWhere('status')->in('closed,cancel') ->fetch('totalLeft'); + $totalHours = $this->dao->select('sum(t1.days * t1.hours) AS totalHours')->from(TABLE_TEAM)->alias('t1') + ->leftJoin(TABLE_USER)->alias('t2') + ->on('t1.account=t2.account') + ->where('t1.root')->eq($execution->id) + ->andWhere('t1.type')->eq('execution') + ->andWhere('t2.deleted')->eq(0) + ->fetch('totalHours'); + + $execution->totalHours = $totalHours; $execution->days = $execution->days ? $execution->days : ''; - $execution->totalHours = $this->dao->select('sum(days * hours) AS totalHours')->from(TABLE_TEAM)->where('root')->eq($execution->id)->andWhere('type')->eq('execution')->fetch('totalHours'); $execution->totalEstimate = round((float)$total->totalEstimate, 1); $execution->totalConsumed = round((float)$total->totalConsumed, 1); $execution->totalLeft = round((float)($total->totalLeft - $closedTotalLeft), 1); diff --git a/module/project/model.php b/module/project/model.php index 736a09f423..9cc4326ee6 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -533,9 +533,11 @@ class projectModel extends model $workhour = new stdclass(); $workhour->totalHours = $this->dao->select('sum(t1.days * t1.hours) AS totalHours')->from(TABLE_TEAM)->alias('t1') ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.root=t2.id') + ->leftJoin(TABLE_USER)->alias('t3')->on('t1.account=t3.account') ->where('t2.id')->in($projectID) ->andWhere('t2.deleted')->eq(0) ->andWhere('t1.type')->eq('project') + ->andWhere('t3.deleted')->eq(0) ->fetch('totalHours'); $workhour->totalEstimate = $total->totalEstimate; $workhour->totalConsumed = $totalConsumed;