Browse Source

update cost and expense report dataformat

tags/Baseline_30082024_BACKEND_UAT
MSI\derek 1 year ago
parent
commit
4f8b669cb6
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt

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

@@ -2207,6 +2207,9 @@ open class ReportService(
val templateInputStream = resource.inputStream val templateInputStream = resource.inputStream
val workbook: Workbook = XSSFWorkbook(templateInputStream) val workbook: Workbook = XSSFWorkbook(templateInputStream)


val accountingStyle = workbook.createDataFormat().getFormat("_(* #,##0.00_);_(* (#,##0.00);_(* \"-\"??_);_(@_)")
val percentStyle = workbook.createDataFormat().getFormat("0.00%")

val sheet = workbook.getSheetAt(0) val sheet = workbook.getSheetAt(0)
var rowNum = 0 var rowNum = 0
rowNum = 1 rowNum = 1
@@ -2282,23 +2285,29 @@ open class ReportService(
val budget = item["budget"] as Double * 0.8 val budget = item["budget"] as Double * 0.8
cell5.apply { cell5.apply {
setCellValue(budget) setCellValue(budget)
// cellStyle.dataFormat = accountingStyle
} }
CellUtil.setCellStyleProperty(cell5, "dataFormat", accountingStyle)


val cell6 = row.getCell(6) ?: row.createCell(6) val cell6 = row.getCell(6) ?: row.createCell(6)
val manHoutsSpentCost = item["manhourExpenditure"] as Double val manHoutsSpentCost = item["manhourExpenditure"] as Double
cell6.apply { cell6.apply {
setCellValue(manHoutsSpentCost) setCellValue(manHoutsSpentCost)
} }
CellUtil.setCellStyleProperty(cell6, "dataFormat", accountingStyle)


val cell7 = row.getCell(7) ?: row.createCell(7) val cell7 = row.getCell(7) ?: row.createCell(7)
cell7.apply { cell7.apply {
cellFormula = "F${rowNum+1}-G${rowNum+1}" cellFormula = "F${rowNum+1}-G${rowNum+1}"
} }
CellUtil.setCellStyleProperty(cell7, "dataFormat", accountingStyle)


val cell8 = row.getCell(8) ?: row.createCell(8) val cell8 = row.getCell(8) ?: row.createCell(8)
cell8.apply { cell8.apply {
cellFormula = "H${rowNum+1}/F${rowNum+1}" cellFormula = "H${rowNum+1}/F${rowNum+1}"
} }
CellUtil.setCellStyleProperty(cell8, "dataFormat", percentStyle)

sheet.setRowBreak(rowNum++); sheet.setRowBreak(rowNum++);
} }




Loading…
Cancel
Save