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 ba2c720..394d060 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 @@ -3867,7 +3867,7 @@ open class DashboardService( } createCell(10).apply { - setCellValue(financialSummaryByProject.cumulativeExpenditure) + setCellValue(financialSummaryByProject.totalExpenditure) cellStyle.apply { setFont(normalFont) dataFormat = accountingStyle @@ -3876,7 +3876,7 @@ open class DashboardService( } createCell(11).apply { - setCellValue(financialSummaryByProject.totalInvoiced) + setCellValue(financialSummaryByProject.manhoursExpenditure) cellStyle.apply { setFont(normalFont) dataFormat = accountingStyle @@ -3885,7 +3885,7 @@ open class DashboardService( } createCell(12).apply { - cellFormula = "IF(I${rowIndex}-L${rowIndex}<0,0,I${rowIndex}-L${rowIndex})" + setCellValue(financialSummaryByProject.projectExpense) cellStyle.apply { setFont(normalFont) dataFormat = accountingStyle @@ -3894,6 +3894,24 @@ open class DashboardService( } createCell(13).apply { + setCellValue(financialSummaryByProject.totalInvoiced) + cellStyle.apply { + setFont(normalFont) + dataFormat = accountingStyle + } + CellUtil.setAlignment(this, HorizontalAlignment.RIGHT) + } + + createCell(14).apply { + cellFormula = "IF(I${rowIndex}-L${rowIndex}<0,0,I${rowIndex}-N${rowIndex})" + cellStyle.apply { + setFont(normalFont) + dataFormat = accountingStyle + } + CellUtil.setAlignment(this, HorizontalAlignment.RIGHT) + } + + createCell(15).apply { setCellValue(financialSummaryByProject.totalReceived) cellStyle.apply { setFont(normalFont) 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 6236ac3..9b87a43 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 @@ -30,7 +30,9 @@ data class FinancialSummaryByProject ( val subsidiaryName: String?, 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/java/com/ffii/tsms/modules/report/service/ReportService.kt b/src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt index 0059f45..5649623 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 @@ -506,7 +506,7 @@ open class ReportService( val descriptionCell = row.createCell(1) descriptionCell.setCellValue( - if (item["description"] != null) item.getValue("description").toString() else "N/A" + if (item["name"] != null) item.getValue("name").toString() else "N/A" ) val clientCell = row.createCell(2) @@ -587,7 +587,8 @@ open class ReportService( val uninvoiceCell = row.createCell(14) uninvoiceCell.apply { cellFormula = - " IF(H${rowNum}-N${rowNum}<0, 0, H${rowNum}-N${rowNum})" + " H${rowNum}-N${rowNum} " +// " IF(H${rowNum}-N${rowNum}<0, 0, H${rowNum}-N${rowNum})" // " IF(I${rowNum}<=J${rowNum}, I${rowNum}-L${rowNum}, IF(AND(I${rowNum}>J${rowNum}, J${rowNum}J${rowNum}, J${rowNum}>=L${rowNum}), J${rowNum}-L${rowNum}, 0))) " cellStyle.dataFormat = accountingStyle } @@ -695,7 +696,8 @@ open class ReportService( val sumUInvoiceCell = row.createCell(14) sumUInvoiceCell.apply { - cellFormula = "IF(H${rowNum+1}-N${rowNum+1}<0,0,H${rowNum+1}-N${rowNum+1})" +// cellFormula = "IF(H${rowNum+1}-N${rowNum+1}<0,0,H${rowNum+1}-N${rowNum+1})" + cellFormula = " H${rowNum+1}-N${rowNum+1} " cellStyle = boldFontCellStyle cellStyle.dataFormat = accountingStyle } @@ -2195,7 +2197,7 @@ open class ReportService( + " where pe.deleted = false " + " group by projectId " + " ) " - + " select p.code, p.description, c.name as client, IFNULL(s2.name, \"N/A\") as subsidiary, concat(t.code, \' - \', t.name) as teamLead, p.planStart , p.planEnd , p.expectedTotalFee, ifnull(p.subContractFee, 0) as subContractFee, " + + " select p.code, p.name, p.description, c.name as client, IFNULL(s2.name, \"N/A\") as subsidiary, concat(t.code, \' - \', t.name) as teamLead, p.planStart , p.planEnd , p.expectedTotalFee, ifnull(p.subContractFee, 0) as subContractFee, " + " IFNULL(cte_i.sumIssuedAmount, 0) as sumIssuedAmount, IFNULL(cte_i.sumPaidAmount, 0) as sumPaidAmount" + " ,0 as totalCumulativeExpenditure, IFNULL(cte_e.amount,0) as projectExpense " + " from project p" diff --git a/src/main/resources/templates/report/[Dashboard] Financial Summary for project.xlsx b/src/main/resources/templates/report/[Dashboard] Financial Summary for project.xlsx index bb7e7f9..4c31e48 100644 Binary files a/src/main/resources/templates/report/[Dashboard] Financial Summary for project.xlsx and b/src/main/resources/templates/report/[Dashboard] Financial Summary for project.xlsx differ