diff --git a/src/main/java/com/ffii/tsms/modules/data/service/DashboardService.kt b/src/main/java/com/ffii/tsms/modules/data/service/DashboardService.kt index 394d060..f7600e4 100644 --- a/src/main/java/com/ffii/tsms/modules/data/service/DashboardService.kt +++ b/src/main/java/com/ffii/tsms/modules/data/service/DashboardService.kt @@ -1060,9 +1060,9 @@ open class DashboardService( + " when coalesce(round(p.totalFee / (COALESCE(expenditure.cumulativeExpenditure,0)),3),0) < 1 then 'Negative'" + " end as projectedCashFlowStatus," + " case" - + " when p.totalFee - sum(i.issueAmount) >= 0 then coalesce(round(p.totalFee - sum(i.issueAmount),2),0)" - + " when p.totalFee - sum(i.issueAmount) < 0 then 0" - + " when p.totalFee - sum(i.issueAmount) is null then 0" + + " when p.totalFee - sum(coalesce(i.issueAmount, 0)) >= 0 then coalesce(round(p.totalFee - sum(coalesce(i.issueAmount, 0)),2),0)" + + " when p.totalFee - sum(coalesce(i.issueAmount, 0)) < 0 then 0" + + " when p.totalFee - sum(coalesce(i.issueAmount, 0)) is null then 0" + " end as totalUninvoiced" + " from team t" + " left join (" @@ -1319,9 +1319,9 @@ open class DashboardService( + " when coalesce(round(p.expectedTotalFee / (COALESCE(expenditure.cumulativeExpenditure,0)),3),0) < 1 then 'Negative'" + " end as projectedCashFlowStatus," + " case" - + " when p.expectedTotalFee - sum(i.issueAmount) >= 0 then coalesce(round(p.expectedTotalFee - sum(i.issueAmount),2),0)" - + " when p.expectedTotalFee - sum(i.issueAmount) < 0 then 0" - + " when p.expectedTotalFee - sum(i.issueAmount) is null then 0" + + " when p.expectedTotalFee - sum(coalesce(i.issueAmount, 0)) >= 0 then coalesce(round(p.expectedTotalFee - sum(coalesce(i.issueAmount, 0)),2),0)" + + " when p.expectedTotalFee - sum(coalesce(i.issueAmount, 0)) < 0 then 0" + + " when p.expectedTotalFee - sum(coalesce(i.issueAmount, 0)) is null then 0" + " end as totalUninvoiced" + " from team t" + " left join project p on t.teamLead = p.teamLead" @@ -3449,7 +3449,7 @@ open class DashboardService( } createCell(9).apply { - setCellValue(financialSummaryByClient.cumulativeExpenditure) + setCellValue(financialSummaryByClient.totalExpenditure) cellStyle.apply { setFont(normalFont) dataFormat = accountingStyle @@ -3457,8 +3457,9 @@ open class DashboardService( CellUtil.setAlignment(this, HorizontalAlignment.RIGHT) } + createCell(10).apply { - setCellValue(financialSummaryByClient.totalInvoiced) + setCellValue(financialSummaryByClient.manhoursExpenditure) cellStyle.apply { setFont(normalFont) dataFormat = accountingStyle @@ -3467,7 +3468,7 @@ open class DashboardService( } createCell(11).apply { - cellFormula = "IF(H${rowIndex}-K${rowIndex}<0,0,H${rowIndex}-K${rowIndex})" + setCellValue(financialSummaryByClient.projectExpense) cellStyle.apply { setFont(normalFont) dataFormat = accountingStyle @@ -3476,6 +3477,24 @@ open class DashboardService( } createCell(12).apply { + setCellValue(financialSummaryByClient.totalInvoiced) + cellStyle.apply { + setFont(normalFont) + dataFormat = accountingStyle + } + CellUtil.setAlignment(this, HorizontalAlignment.RIGHT) + } + + createCell(13).apply { + cellFormula = "IF(H${rowIndex}-M${rowIndex}<0,0,H${rowIndex}-M${rowIndex})" + cellStyle.apply { + setFont(normalFont) + dataFormat = accountingStyle + } + CellUtil.setAlignment(this, HorizontalAlignment.RIGHT) + } + + createCell(14).apply { setCellValue(financialSummaryByClient.totalReceived) cellStyle.apply { setFont(normalFont) @@ -3903,7 +3922,7 @@ open class DashboardService( } createCell(14).apply { - cellFormula = "IF(I${rowIndex}-L${rowIndex}<0,0,I${rowIndex}-N${rowIndex})" + cellFormula = "IF(I${rowIndex}-N${rowIndex}<0,0,I${rowIndex}-N${rowIndex})" cellStyle.apply { setFont(normalFont) dataFormat = accountingStyle diff --git a/src/main/java/com/ffii/tsms/modules/data/web/models/ExportDashboardExcelRequest.kt b/src/main/java/com/ffii/tsms/modules/data/web/models/ExportDashboardExcelRequest.kt index 9b87a43..ba44282 100644 --- a/src/main/java/com/ffii/tsms/modules/data/web/models/ExportDashboardExcelRequest.kt +++ b/src/main/java/com/ffii/tsms/modules/data/web/models/ExportDashboardExcelRequest.kt @@ -8,7 +8,9 @@ data class FinancialSummaryByClient ( val projectNo: Double, val totalFee: Double, val totalBudget: Double, - val cumulativeExpenditure: Double, + val totalExpenditure: Double, + val manhoursExpenditure: Double, + val projectExpense: Double, val totalInvoiced: Double, val totalReceived: Double, ) diff --git a/src/main/resources/templates/report/[Dashboard] Financial Summary for client.xlsx b/src/main/resources/templates/report/[Dashboard] Financial Summary for client.xlsx index 7eb2f65..5d18dd6 100644 Binary files a/src/main/resources/templates/report/[Dashboard] Financial Summary for client.xlsx and b/src/main/resources/templates/report/[Dashboard] Financial Summary for client.xlsx differ