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 f37d223..fdb23b2 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 @@ -2975,10 +2975,11 @@ open class ReportService( } // if (timesheets.isNotEmpty()) { - val combinedTeamCodeColNumber = grades.size + val combinedTeamCodeColNumber = grades.size * 2 val sortedGrades = grades.sortedBy { it.id } val sortedTeams = teams.sortedBy { it.id } + logger.info(timesheets.filter { it.project?.teamLead?.team?.id != it.staff?.team?.id }.size) val groupedTimesheets = timesheets .filter { it.project?.teamLead?.team?.id != it.staff?.team?.id } .groupBy { timesheetEntry -> @@ -3060,6 +3061,16 @@ open class ReportService( alignment = HorizontalAlignment.CENTER } } + + createCell(columnIndex++).apply { + val cellValue = grade.name.trim().substring(0,1) + grade.name.trim().substring(grade.name.length - 1) + " - Cost Adjusted by Salary Point" + setCellValue(cellValue) + val cloneStyle = workbook.createCellStyle() + cloneStyle.cloneStyleFrom(boldFontWithBorderStyle) + cellStyle = cloneStyle.apply { + alignment = HorizontalAlignment.CENTER + } + } } createCell(columnIndex++).apply { @@ -3106,8 +3117,26 @@ open class ReportService( grade.id )]?.sumOf { it.getValue("salary") } ?: 0.0 - cellStyle = normalFontWithBorderStyle - cellStyle.dataFormat = accountingStyle + val cloneStyle = workbook.createCellStyle() + cloneStyle.cloneStyleFrom(normalFontWithBorderStyle) + cellStyle = cloneStyle.apply { + dataFormat = accountingStyle + } + } + + createCell(columnIndex++).apply { + setCellValue( + groupedTimesheets[Triple( + team.id, + chargedTeam.id, + grade.id + )]?.sumOf { it.getValue("manHour") * it.getValue("salary") } ?: 0.0) + + val cloneStyle = workbook.createCellStyle() + cloneStyle.cloneStyleFrom(normalFontWithBorderStyle) + cellStyle = cloneStyle.apply { + dataFormat = accountingStyle + } } } @@ -3149,6 +3178,13 @@ open class ReportService( cellStyle = normalFontWithBorderStyle cellStyle.dataFormat = accountingStyle } + + createCell(columnIndex++).apply { + val currentCellLetter = CellReference.convertNumToColString(this.columnIndex) + cellFormula = "sum(${currentCellLetter}${startRow}:${currentCellLetter}${endRow})" + cellStyle = normalFontWithBorderStyle + cellStyle.dataFormat = accountingStyle + } } createCell(columnIndex++).apply { diff --git a/src/main/resources/templates/report/Cross Team Charge Report.xlsx b/src/main/resources/templates/report/Cross Team Charge Report.xlsx index e3c005a..1a4889b 100644 Binary files a/src/main/resources/templates/report/Cross Team Charge Report.xlsx and b/src/main/resources/templates/report/Cross Team Charge Report.xlsx differ