| @@ -1521,7 +1521,7 @@ open class ReportService( | |||||
| + " result.teamCode, " | + " result.teamCode, " | ||||
| + " result.custCode, " ) | + " result.custCode, " ) | ||||
| if (args.get("outstanding") as Boolean) { | 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( | sql.append( | ||||
| " DATE_FORMAT(result.actualEnd, '%d/%m/%Y') as actualEnd " | " DATE_FORMAT(result.actualEnd, '%d/%m/%Y') as actualEnd " | ||||
| @@ -1533,6 +1533,7 @@ open class ReportService( | |||||
| + " min(t.code) as teamCode, " | + " min(t.code) as teamCode, " | ||||
| + " min(c.code) as custCode, " | + " min(c.code) as custCode, " | ||||
| + " min(p.actualEnd) as actualEnd, " | + " min(p.actualEnd) as actualEnd, " | ||||
| + " min(p.expectedTotalFee) as projectFee, " | |||||
| + " sum(COALESCE(tns.totalConsumed*sal.hourlyRate, 0)) as totalBudget " | + " sum(COALESCE(tns.totalConsumed*sal.hourlyRate, 0)) as totalBudget " | ||||
| + " FROM ( " | + " FROM ( " | ||||
| + " SELECT " | + " SELECT " | ||||
| @@ -1545,11 +1546,11 @@ open class ReportService( | |||||
| + " GROUP BY t.staffId, t.projectTaskId " | + " GROUP BY t.staffId, t.projectTaskId " | ||||
| + " order by t.staffId " | + " order by t.staffId " | ||||
| + " ) AS tns " | + " ) 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 salary sal on s.salaryId = sal.salaryPoint " | ||||
| + " left JOIN team t ON s.teamId = t.id " | + " 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 " | + " left join customer c on c.id = p.customerId " | ||||
| + " where p.deleted = false " | + " where p.deleted = false " | ||||
| + " and p.status = 'Completed' " | + " and p.status = 'Completed' " | ||||
| @@ -1591,7 +1592,7 @@ open class ReportService( | |||||
| + " p.name, " | + " p.name, " | ||||
| + " t.code as team, " | + " t.code as team, " | ||||
| + " c.code as client, " | + " c.code as client, " | ||||
| + " p.expectedTotalFee as plannedBudget, " | |||||
| + " p.expectedTotalFee * 0.8 as plannedBudget, " | |||||
| + " COALESCE(tns.totalBudget, 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, " | ||||