diff --git a/src/main/java/com/ffii/tsms/modules/data/service/SalaryEffectiveService.kt b/src/main/java/com/ffii/tsms/modules/data/service/SalaryEffectiveService.kt index 2411719..b484692 100644 --- a/src/main/java/com/ffii/tsms/modules/data/service/SalaryEffectiveService.kt +++ b/src/main/java/com/ffii/tsms/modules/data/service/SalaryEffectiveService.kt @@ -174,7 +174,7 @@ open class SalaryEffectiveService( val staffs = staffRepository.findAll().sortedBy { it.staffId }.filter { it.deleted == false } val result = mutableListOf() - val dateList = (0..ChronoUnit.MONTHS.between(startDate, endDate)).map { startDate.withDayOfMonth(1).plusMonths(it) } + val dateList = (0..ChronoUnit.MONTHS.between(startDate.withDayOfMonth(1), endDate.withDayOfMonth(1))).map { startDate.withDayOfMonth(1).plusMonths(it) } // logger.info(dateList) staffs.forEach { staff -> 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 bf8dc06..f257cdd 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 @@ -553,20 +553,20 @@ open class ReportService( val uninvoiceCell = row.createCell(14) uninvoiceCell.apply { cellFormula = - " IF(H${rowNum}-M${rowNum}<0, 0, H${rowNum}-M${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 } val cpiCell = row.createCell(15) cpiCell.apply { - cellFormula = "IF(J${rowNum} = 0, 0, M${rowNum}/(J${rowNum}+K${rowNum}))" + cellFormula = "IF(J${rowNum} = 0, 0, N${rowNum}/(J${rowNum}))" cellStyle = boldFontCellStyle } val projectedCpiCell = row.createCell(16) projectedCpiCell.apply { - cellFormula = "IF(J${rowNum} = 0, 0, H${rowNum}/(J${rowNum}+K${rowNum}))" + cellFormula = "IF(J${rowNum} = 0, 0, H${rowNum}/(J${rowNum}))" cellStyle = boldFontCellStyle } @@ -579,7 +579,7 @@ open class ReportService( val unsettledAmountCell = row.createCell(18) unsettledAmountCell.apply { - cellFormula = "M${rowNum}-Q${rowNum}" + cellFormula = "N${rowNum}-R${rowNum}" cellStyle = boldFontCellStyle cellStyle.dataFormat = accountingStyle } @@ -746,7 +746,7 @@ open class ReportService( val row7: Row = sheet.getRow(rowNum) val cell3 = row7.createCell(2) cell3.apply { - cellFormula = "L${lastRowNum}" + cellFormula = "M${lastRowNum}" cellStyle.dataFormat = accountingStyle } @@ -754,7 +754,7 @@ open class ReportService( val row8: Row = sheet.getRow(rowNum) val cell4 = row8.createCell(2) cell4.apply { - cellFormula = "M${lastRowNum}" + cellFormula = "N${lastRowNum}" cellStyle.dataFormat = accountingStyle } @@ -762,7 +762,7 @@ open class ReportService( val row9: Row = sheet.getRow(rowNum) val cell5 = row9.createCell(2) cell5.apply { - cellFormula = "N${lastRowNum}" + cellFormula = "O${lastRowNum}" cellStyle.dataFormat = accountingStyle } @@ -770,7 +770,7 @@ open class ReportService( val row10: Row = sheet.getRow(rowNum) val cell6 = row10.createCell(2) cell6.apply { - cellFormula = "Q${lastRowNum}" + cellFormula = "R${lastRowNum}" cellStyle.dataFormat = accountingStyle } @@ -778,7 +778,7 @@ open class ReportService( val row11: Row = sheet.getRow(rowNum) val cell7 = row11.createCell(2) cell7.apply { - cellFormula = "R${lastRowNum}" + cellFormula = "S${lastRowNum}" cellStyle.dataFormat = accountingStyle } @@ -949,6 +949,12 @@ open class ReportService( ) } } + + println("groupedTimesheets") + println(groupedTimesheets) + + monthlyStaffSalaryEffective.forEach { if(it.staff.staffId == "B130") println(it) } + println("grouped Project Expense") println(groupedProjectExpense) // groupedTimesheets.entries.forEach { (key, value) -> @@ -995,7 +1001,7 @@ open class ReportService( val lastRow = rowIndex - 1 if (lastRow == 16) { cellFormula = - "C{currentRow}-B{currentRow}".replace("{currentRow}", rowIndex.toString()) + "D{currentRow}-C{currentRow}-B{currentRow}".replace("{currentRow}", rowIndex.toString()) } else { cellFormula = "IF(B{currentRow}>0,E{lastRow}-B{currentRow}-C{currentRow},E{lastRow}+D{currentRow}-C{currentRow})".replace( @@ -1039,7 +1045,7 @@ open class ReportService( val lastRow = rowIndex - 1 if (lastRow == 16) { cellFormula = - "C{currentRow}-B{currentRow}".replace("{currentRow}", rowIndex.toString()) + "D{currentRow}-C{currentRow}-B{currentRow}".replace("{currentRow}", rowIndex.toString()) } else { cellFormula = "IF(B{currentRow}>0,E{lastRow}-B{currentRow}-C{currentRow},E{lastRow}+D{currentRow}-C{currentRow})".replace( @@ -1090,7 +1096,7 @@ open class ReportService( createCell(4).apply { val lastRow = rowIndex - 1 if (lastRow == 16) { - cellFormula = "C{currentRow}-B{currentRow}".replace("{currentRow}", rowIndex.toString()) + cellFormula = "D{currentRow}-C{currentRow}-B{currentRow}".replace("{currentRow}", rowIndex.toString()) } else { cellFormula = "IF(B{currentRow}>0,E{lastRow}-B{currentRow}-C{currentRow},E{lastRow}+D{currentRow}-C{currentRow})".replace( @@ -1134,7 +1140,7 @@ open class ReportService( val lastRow = rowIndex - 1 if (lastRow == 16) { cellFormula = - "C{currentRow}-B{currentRow}".replace("{currentRow}", rowIndex.toString()) + "D{currentRow}-C{currentRow}-B{currentRow}".replace("{currentRow}", rowIndex.toString()) } else { cellFormula = "IF(B{currentRow}>0,E{lastRow}-B{currentRow}-C{currentRow},E{lastRow}+D{currentRow}-C{currentRow})".replace( @@ -1178,7 +1184,7 @@ open class ReportService( val lastRow = rowIndex - 1 if (lastRow == 16) { cellFormula = - "C{currentRow}-B{currentRow}".replace("{currentRow}", rowIndex.toString()) + "D{currentRow}-C{currentRow}-B{currentRow}".replace("{currentRow}", rowIndex.toString()) } else { cellFormula = "IF(B{currentRow}>0,E{lastRow}-B{currentRow}-C{currentRow},E{lastRow}+D{currentRow}-C{currentRow})".replace(