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 5649623..ed60147 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 @@ -3734,11 +3734,14 @@ open class ReportService( if (monthList.isEmpty()) { throw IllegalArgumentException("illegal time period") } - val result = manhourSummary.groupBy { mapOf("staff" to it["staff"], "projectCode" to it["projectCode"], "projectName" to it["projectName"], "client" to it["client"]) } + val result = manhourSummary.groupBy { mapOf("projectCode" to it["projectCode"], "projectName" to it["projectName"], "client" to it["client"]) } .map { entry -> val monthlyConsumption = entry.value.associate { it["recordMonth"] to it["consumed"] } - mapOf("staff" to entry.key["staff"], "projectCode" to entry.key["projectCode"], "projectName" to entry.key["projectName"], "client" to entry.key["client"]) + monthlyConsumption + mapOf("projectCode" to entry.key["projectCode"], + "projectName" to entry.key["projectName"], + "client" to entry.key["client"]) + monthlyConsumption } + .sortedBy { it["projectCode"] as String } //start from col4 var rowIndex = 1 var columnIndex = 1 @@ -3749,7 +3752,7 @@ open class ReportService( tempCell.setCellValue(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy/MM/dd")).toString()) //write months header rowIndex = 5 - columnIndex = 4 + columnIndex = 3 tempRow = getOrCreateRow(sheet, rowIndex) for (curr in monthList) { tempCell = getOrCreateCell(tempRow, columnIndex) @@ -3764,25 +3767,25 @@ open class ReportService( rowIndex = 6 for ( curr in result) { tempRow = getOrCreateRow(sheet, rowIndex) +// columnIndex = 0 +// tempCell = getOrCreateCell(tempRow, columnIndex) +// CellUtil.setCellStyleProperties(tempCell, +// cellBorderArgs(1,1,1,1) +// + fontArgs2(sheet, "Times New Roman",false)) +// tempCell.setCellValue(curr["staff"].toString()) columnIndex = 0 tempCell = getOrCreateCell(tempRow, columnIndex) - CellUtil.setCellStyleProperties(tempCell, - cellBorderArgs(1,1,1,1) - + fontArgs2(sheet, "Times New Roman",false)) - tempCell.setCellValue(curr["staff"].toString()) - columnIndex = 1 - tempCell = getOrCreateCell(tempRow, columnIndex) CellUtil.setCellStyleProperties(tempCell, cellBorderArgs(1,1,1,1) + fontArgs2(sheet, "Times New Roman",false)) tempCell.setCellValue(curr["projectCode"].toString()) - columnIndex = 2 + columnIndex = 1 tempCell = getOrCreateCell(tempRow, columnIndex) CellUtil.setCellStyleProperties(tempCell, cellBorderArgs(1,1,1,1) + fontArgs2(sheet, "Times New Roman",false)) tempCell.setCellValue(curr["projectName"].toString()) - columnIndex = 3 + columnIndex = 2 tempCell = getOrCreateCell(tempRow, columnIndex) CellUtil.setCellStyleProperties(tempCell, cellBorderArgs(1,1,1,1) @@ -3796,7 +3799,7 @@ open class ReportService( if (curr.containsKey(month.key.toString())) { manhour = curr[month.key.toString()] as Double } - columnIndex = month.value + columnIndex = month.value - 1 tempCell = getOrCreateCell(tempRow, columnIndex) tempCell.setCellValue(manhour) CellUtil.setCellStyleProperties(tempCell, @@ -4436,7 +4439,6 @@ open class ReportService( val crossTeamMultiplier = 1.15 val hourlyRate = (thisSE?.salary?.hourlyRate ?: ts.staff!!.salary.hourlyRate).toDouble() val normalCost = normalHour.times(hourlyRate) -// val otCost = otHour.times(thisSE.salary.hourlyRate.toDouble()).times(otMultiplier) val otCost = otHour.times(hourlyRate) val staff = ts.staff!! val project = ts.project!!