Parcourir la source

update

tags/Baseline_30082024_BACKEND_UAT
MSI\derek il y a 1 an
Parent
révision
514d2cdcfa
1 fichiers modifiés avec 25 ajouts et 25 suppressions
  1. +25
    -25
      src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt

+ 25
- 25
src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt Voir le fichier

@@ -435,29 +435,29 @@ open class ReportService(
daysOfMonth.forEach { dayInfo ->
rowIndex++
rowSize++
tempCell = sheet.createRow(rowIndex).createCell(0)
tempCell = sheet.getRow(rowIndex).createCell(0)
tempCell.setCellValue(dayInfo.date)
tempCell.cellStyle.dataFormat = dateStyle
tempCell.cellStyle.setFont(boldFont)
// cellStyle.alignment = HorizontalAlignment.LEFT
tempCell = sheet.createRow(rowIndex).createCell(1)
tempCell = sheet.getRow(rowIndex).createCell(1)
tempCell.setCellValue(dayInfo.weekday)
tempCell.cellStyle.setFont(boldFont)
// cellStyle.alignment = HorizontalAlignment.LEFT
}

rowIndex += 1
tempCell = sheet.createRow(rowIndex).createCell(0)
tempCell = sheet.getRow(rowIndex).createCell(0)
sheet.addMergedRegion(CellRangeAddress(rowIndex,rowIndex , 0, 1))
tempCell.setCellValue("Sub-total")
tempCell.cellStyle.setFont(boldFont)
CellUtil.setAlignment(tempCell, HorizontalAlignment.CENTER)
CellUtil.setCellStyleProperties(tempCell, DoubleBorderBottom)
tempCell = sheet.createRow(rowIndex).createCell(1)
tempCell = sheet.getRow(rowIndex).createCell(1)
CellUtil.setCellStyleProperties(tempCell, DoubleBorderBottom)

rowIndex += 1
tempCell = sheet.createRow(rowIndex).createCell(0)
tempCell = sheet.getRow(rowIndex).createCell(0)
tempCell.setCellValue("Total Normal Hours [A]")
CellUtil.setAlignment(tempCell, HorizontalAlignment.CENTER)

@@ -467,21 +467,21 @@ open class ReportService(
if (timesheets.isNotEmpty()) {
timesheets.forEach { t ->
normalConsumed += t.normalConsumed!!
otConsumed += t.otConsumed ?: 0.0
otConsumed += t.otConsumed ?: 0.0
}
}
tempCell = sheet.createRow(rowIndex).createCell(2)
tempCell = sheet.getRow(rowIndex).createCell(2)
tempCell.setCellValue(normalConsumed)
tempCell.cellStyle.dataFormat = accountingStyle

sheet.addMergedRegion(CellRangeAddress(rowIndex,rowIndex , 0, 1))
//
rowIndex += 1
tempCell = sheet.createRow(rowIndex).createCell(0)
tempCell = sheet.getRow(rowIndex).createCell(0)
tempCell.setCellValue("Total Other Hours [B]")
CellUtil.setAlignment(tempCell, HorizontalAlignment.CENTER)
tempCell.cellStyle.setFont(boldFont)
tempCell = sheet.createRow(rowIndex).createCell(2)
tempCell = sheet.getRow(rowIndex).createCell(2)
tempCell.setCellValue(otConsumed)
tempCell.cellStyle.dataFormat = accountingStyle

@@ -490,7 +490,7 @@ open class ReportService(

// Total Leave Hours
rowIndex += 1
tempCell = sheet.createRow(rowIndex).createCell(0)
tempCell = sheet.getRow(rowIndex).createCell(0)
tempCell.setCellValue("Total Leave Hours")
CellUtil.setAlignment(tempCell, HorizontalAlignment.CENTER)
sheet.addMergedRegion(CellRangeAddress(rowIndex,rowIndex , 0, 1))
@@ -499,22 +499,22 @@ open class ReportService(
leaveHours += l.leaveHours!!
}
}
tempCell = sheet.createRow(rowIndex).createCell(2)
tempCell = sheet.getRow(rowIndex).createCell(2)
tempCell.setCellValue(leaveHours)
tempCell.cellStyle.dataFormat = accountingStyle

// Total Spent Manhours
rowIndex += 1
tempCell = sheet.createRow(rowIndex).createCell(0)
tempCell = sheet.getRow(rowIndex).createCell(0)
tempCell.setCellValue("Total Spent Manhours [A+B]")
tempCell.cellStyle.setFont(boldFont)
CellUtil.setAlignment(tempCell, HorizontalAlignment.CENTER)
CellUtil.setCellStyleProperties(tempCell, DoubleBorderBottom)
tempCell = sheet.createRow(rowIndex).createCell(1)
tempCell = sheet.getRow(rowIndex).createCell(1)
CellUtil.setAlignment(tempCell, HorizontalAlignment.CENTER)
CellUtil.setCellStyleProperties(tempCell, DoubleBorderBottom)

tempCell = sheet.createRow(rowIndex).createCell(2)
tempCell = sheet.getRow(rowIndex).createCell(2)
tempCell.cellFormula = "C${rowIndex-2}+C${rowIndex-1}"
tempCell.cellStyle.dataFormat = accountingStyle
CellUtil.setCellStyleProperties(tempCell, DoubleBorderBottom)
@@ -524,7 +524,7 @@ open class ReportService(
rowIndex = 7
columnIndex = 2
projectList.forEachIndexed { index, title ->
tempCell = sheet.createRow(7).createCell(columnIndex + index)
tempCell = sheet.getRow(7).createCell(columnIndex + index)
tempCell.setCellValue(title)
CellUtil.setAlignment(tempCell, HorizontalAlignment.RIGHT)
CellUtil.setCellStyleProperties(tempCell, ThinBorderBottom)
@@ -533,13 +533,13 @@ open class ReportService(
if (timesheets.isNotEmpty()) {
projectList.forEach { _ ->
for (i in 0 until rowSize) {
tempCell = sheet.createRow(8 + i).createCell(columnIndex)
tempCell = sheet.getRow(8 + i).createCell(columnIndex)
tempCell.setCellValue(0.0)
tempCell.cellStyle.dataFormat = accountingStyle
}
timesheets.forEach { timesheet ->
dayInt = timesheet.recordDate!!.dayOfMonth
tempCell = sheet.createRow(dayInt.plus(7)).createCell(columnIndex)
tempCell = sheet.getRow(dayInt.plus(7)).createCell(columnIndex)
tempCell.setCellValue(timesheet.normalConsumed!!)

}
@@ -550,46 +550,46 @@ open class ReportService(
if (leaves.isNotEmpty()) {
leaves.forEach { leave ->
for (i in 0 until rowSize) {
tempCell = sheet.createRow(8 + i).createCell(columnIndex)
tempCell = sheet.getRow(8 + i).createCell(columnIndex)
tempCell.setCellValue(0.0)
tempCell.cellStyle.dataFormat = accountingStyle

}
dayInt = leave.recordDate!!.dayOfMonth
tempCell = sheet.createRow(dayInt.plus(7)).createCell(columnIndex)
tempCell = sheet.getRow(dayInt.plus(7)).createCell(columnIndex)
tempCell.setCellValue(leave.leaveHours!!)

}
}
///////////////////////////////////////////////////////// Leave Hours ////////////////////////////////////////////////////////////////////
tempCell = sheet.createRow(rowIndex).createCell(columnIndex)
tempCell = sheet.getRow(rowIndex).createCell(columnIndex)
tempCell.setCellValue("Leave Hours")
CellUtil.setCellStyleProperties(tempCell, ThinBorderBottom)

columnIndex += 1
tempCell = sheet.createRow(rowIndex).createCell(columnIndex)
tempCell = sheet.getRow(rowIndex).createCell(columnIndex)
tempCell.setCellValue("Daily Manhour Spent\n(Excluding Leave Hours)")
CellUtil.setCellStyleProperties(tempCell, ThinBorderBottom)

sheet.addMergedRegion(CellRangeAddress(6,6 , 2, columnIndex))
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
rowIndex = 8
// if (sheet.createRow(rowIndex - 1).getCell(2).stringCellValue != "Leave Hours") {
if (sheet.getRow(rowIndex - 1).getCell(2).stringCellValue != "Leave Hours") {
// cal daily spent manhour
for (i in 0 until rowSize) {
tempCell = sheet.createRow(rowIndex).createCell(columnIndex)
tempCell = sheet.getRow(rowIndex).createCell(columnIndex)
tempCell.cellFormula = "SUM(${getColumnAlphabet(2)}${rowIndex+1}:${getColumnAlphabet(columnIndex - 2)}${rowIndex+1})" // should columnIndex - 2
rowIndex++
}
// cal subtotal
println(rowIndex)
for (i in 0 until columnSize - 2) { // minus last col
tempCell = sheet.createRow(rowIndex).createCell(2 + i)
tempCell = sheet.getRow(rowIndex).createCell(2 + i)
tempCell.cellFormula = "SUM(${getColumnAlphabet(2 + i)}9:${getColumnAlphabet(2 + i)}${rowIndex})"
tempCell.cellStyle.dataFormat = accountingStyle
tempCell.cellStyle.setFont(boldFont)
CellUtil.setCellStyleProperties(tempCell, DoubleBorderBottom)
// }
}
}
return workbook
}


Chargement…
Annuler
Enregistrer