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