Browse Source

update project manhour report

pull/3/head
MSI\derek 7 months ago
parent
commit
f9def8e643
1 changed files with 15 additions and 13 deletions
  1. +15
    -13
      src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt

+ 15
- 13
src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt View File

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


Loading…
Cancel
Save