From e34cc36087a7047c1c15d0d48dba099b85694e7b Mon Sep 17 00:00:00 2001 From: "MSI\\derek" Date: Fri, 24 May 2024 15:39:42 +0800 Subject: [PATCH] update --- .../ffii/tsms/modules/report/service/ReportService.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt b/src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt index 169519b..744b5a1 100644 --- a/src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt +++ b/src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt @@ -1521,7 +1521,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 " @@ -1533,6 +1533,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 " @@ -1545,11 +1546,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' " @@ -1591,7 +1592,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, "