|
|
@@ -1523,7 +1523,7 @@ open class ReportService( |
|
|
|
+ " result.teamCode, " |
|
|
|
+ " result.custCode, " ) |
|
|
|
if (args.get("outstanding") as Boolean) { |
|
|
|
sql.append(" result.totalBudget - COALESCE(i.issueAmount , 0) + COALESCE(i.issueAmount, 0) - COALESCE(i.paidAmount, 0) as `Receivable Remained`, ") |
|
|
|
sql.append(" result.projectFee - (result.totalBudget - COALESCE(i.issueAmount , 0) + COALESCE(i.issueAmount, 0) - COALESCE(i.paidAmount, 0)) as `Receivable Remained`, ") |
|
|
|
} |
|
|
|
sql.append( |
|
|
|
" DATE_FORMAT(result.actualEnd, '%d/%m/%Y') as actualEnd " |
|
|
@@ -1535,6 +1535,7 @@ open class ReportService( |
|
|
|
+ " min(t.code) as teamCode, " |
|
|
|
+ " min(c.code) as custCode, " |
|
|
|
+ " min(p.actualEnd) as actualEnd, " |
|
|
|
+ " min(p.expectedTotalFee) as projectFee, " |
|
|
|
+ " sum(COALESCE(tns.totalConsumed*sal.hourlyRate, 0)) as totalBudget " |
|
|
|
+ " FROM ( " |
|
|
|
+ " SELECT " |
|
|
@@ -1547,11 +1548,11 @@ open class ReportService( |
|
|
|
+ " GROUP BY t.staffId, t.projectTaskId " |
|
|
|
+ " order by t.staffId " |
|
|
|
+ " ) AS tns " |
|
|
|
+ " inner join project_task pt ON tns.taskId = pt.id " |
|
|
|
+ " left JOIN staff s ON tns.staffId = s.id " |
|
|
|
+ " right join project_task pt ON tns.taskId = pt.id " |
|
|
|
+ " left join project p on p.id = pt.project_id " |
|
|
|
+ " left JOIN staff s ON p.teamLead = s.id " |
|
|
|
+ " left join salary sal on s.salaryId = sal.salaryPoint " |
|
|
|
+ " left JOIN team t ON s.teamId = t.id " |
|
|
|
+ " left join project p on p.id = pt.project_id " |
|
|
|
+ " left join customer c on c.id = p.customerId " |
|
|
|
+ " where p.deleted = false " |
|
|
|
+ " and p.status = 'Completed' " |
|
|
@@ -1593,7 +1594,7 @@ open class ReportService( |
|
|
|
+ " p.name, " |
|
|
|
+ " t.code as team, " |
|
|
|
+ " c.code as client, " |
|
|
|
+ " p.expectedTotalFee as plannedBudget, " |
|
|
|
+ " p.expectedTotalFee * 0.8 as plannedBudget, " |
|
|
|
+ " COALESCE(tns.totalBudget, 0) as actualConsumedBudget, " |
|
|
|
+ " COALESCE(p.totalManhour, 0) as plannedManhour, " |
|
|
|
+ " COALESCE(tns.totalConsumed, 0) as actualConsumedManhour, " |
|
|
|