Kaynağa Gözat

Revert "report update, handle no column return"

This reverts commit 4c75aeb4fc.
tags/Baseline_30082024_BACKEND_UAT
leoho2fi 1 yıl önce
ebeveyn
işleme
7b722e820c
1 değiştirilmiş dosya ile 15 ekleme ve 19 silme
  1. +15
    -19
      src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt

+ 15
- 19
src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt Dosyayı Görüntüle

@@ -1488,31 +1488,27 @@ private fun createLateStartReport(
lateStartData: List<Map<String, Any>>,
evaluator: FormulaEvaluator
) {
var dataRowIndex = 6

// Populate the rows with data from the database
var dataRowIndex = 6 // Starting from row 7
lateStartData.forEachIndexed { index, data ->
val row = sheet.getRow(dataRowIndex) ?: sheet.createRow(dataRowIndex)
populateDataRow(workbook, sheet, row, data, index)
dataRowIndex++
}

// Only apply conditional formatting if there is data
if (lateStartData.isNotEmpty()) {
val sheetCF = sheet.sheetConditionalFormatting
val rule1 = sheetCF.createConditionalFormattingRule("J7 < 60")
val pattern1 = rule1.createPatternFormatting().apply {
fillBackgroundColor = IndexedColors.RED.index
fillPattern = PatternFormatting.SOLID_FOREGROUND
}
val rule2 = sheetCF.createConditionalFormattingRule("J7 >= 60")
val pattern2 = rule2.createPatternFormatting().apply {
fillBackgroundColor = IndexedColors.YELLOW.index
fillPattern = PatternFormatting.SOLID_FOREGROUND
}
val region = CellRangeAddress(6, dataRowIndex - 1, 9, 9) // Column J
sheetCF.addConditionalFormatting(arrayOf(region), arrayOf(rule1, rule2))
}
// Update conditional formatting to apply to the new range of column J
val sheetCF = sheet.sheetConditionalFormatting
val rule1 = sheetCF.createConditionalFormattingRule("J7 < 60")
val pattern1 = rule1.createPatternFormatting().apply {
fillBackgroundColor = IndexedColors.RED.index
fillPattern = PatternFormatting.SOLID_FOREGROUND
}
val rule2 = sheetCF.createConditionalFormattingRule("J7 >= 60")
val pattern2 = rule2.createPatternFormatting().apply {
fillBackgroundColor = IndexedColors.YELLOW.index
fillPattern = PatternFormatting.SOLID_FOREGROUND
}
val region = CellRangeAddress(dataRowIndex - lateStartData.size, dataRowIndex - 1, 9, 9) // Column J
sheetCF.addConditionalFormatting(arrayOf(region), arrayOf(rule1, rule2))
}
private fun setTeamAndClientIds(sheet: Sheet, team: List<Team>, teamId: Long, customer: List<Customer>, clientId: Long) {
// Set the 'teamId' value in cell C3


Yükleniyor…
İptal
Kaydet