| @@ -1395,14 +1395,17 @@ open class ReportService( | |||||
| + " SELECT " | + " SELECT " | ||||
| + " s.teamId, " | + " s.teamId, " | ||||
| + " pt.project_id, " | + " pt.project_id, " | ||||
| + " SUM(tns.totalConsumed) AS totalConsumed " | |||||
| + " SUM(tns.totalConsumed) AS totalConsumed, " | |||||
| + " sum(tns.totalBudget) as totalBudget " | |||||
| + " FROM ( " | + " FROM ( " | ||||
| + " SELECT " | + " SELECT " | ||||
| + " t.staffId, " | + " t.staffId, " | ||||
| + " sum(t.normalConsumed + COALESCE(t.otConsumed, 0)) as totalConsumed, " | + " sum(t.normalConsumed + COALESCE(t.otConsumed, 0)) as totalConsumed, " | ||||
| + " t.projectTaskId AS taskId " | |||||
| + " t.projectTaskId AS taskId, " | |||||
| + " sum(t.normalConsumed + COALESCE(t.otConsumed, 0)) * min(sal.hourlyRate) as totalBudget " | |||||
| + " FROM timesheet t " | + " FROM timesheet t " | ||||
| + " LEFT JOIN staff s ON t.staffId = s.id " | + " LEFT JOIN staff s ON t.staffId = s.id " | ||||
| + " left join salary sal on sal.salaryPoint = s.salaryId " | |||||
| + " GROUP BY t.staffId, t.projectTaskId " | + " GROUP BY t.staffId, t.projectTaskId " | ||||
| + " ) AS tns " | + " ) AS tns " | ||||
| + " INNER JOIN project_task pt ON tns.taskId = pt.id " | + " INNER JOIN project_task pt ON tns.taskId = pt.id " | ||||
| @@ -1416,7 +1419,7 @@ open class ReportService( | |||||
| + " t.code as team, " | + " t.code as team, " | ||||
| + " c.code as client, " | + " c.code as client, " | ||||
| + " p.expectedTotalFee as plannedBudget, " | + " p.expectedTotalFee as plannedBudget, " | ||||
| + " COALESCE((tns.totalConsumed * sa.hourlyRate), 0) as actualConsumedBudget, " | |||||
| + " COALESCE(tns.totalBudget, 0) as actualConsumedBudget, " | |||||
| + " COALESCE(p.totalManhour, 0) as plannedManhour, " | + " COALESCE(p.totalManhour, 0) as plannedManhour, " | ||||
| + " COALESCE(tns.totalConsumed, 0) as actualConsumedManhour, " | + " COALESCE(tns.totalConsumed, 0) as actualConsumedManhour, " | ||||
| + " (COALESCE((tns.totalConsumed * sa.hourlyRate), 0) / p.expectedTotalFee) as budgetConsumptionRate, " | + " (COALESCE((tns.totalConsumed * sa.hourlyRate), 0) / p.expectedTotalFee) as budgetConsumptionRate, " | ||||