diff --git a/src/main/java/com/ffii/tsms/modules/data/service/StaffsService.kt b/src/main/java/com/ffii/tsms/modules/data/service/StaffsService.kt index 039e152..573fd41 100644 --- a/src/main/java/com/ffii/tsms/modules/data/service/StaffsService.kt +++ b/src/main/java/com/ffii/tsms/modules/data/service/StaffsService.kt @@ -410,12 +410,16 @@ open class StaffsService( + " coalesce (s.joinDate, '') as employmentDate," + " g.code as grade," + " p.description ," - + " s.salaryId," + + " s.salaryId, " + + " s2.lowerLimit, " + + " s2.upperLimit, " + + " s2.hourlyRate, " + " coalesce (s.email , '') as email," + " s.departDate" + " from staff s" + " left join team on team.id = s.teamId" + " left join grade g on g.id = s.gradeId" + + " left join salary s2 on s2.salaryPoint = s.salaryId" + " left join `position` p on p.id = s.currentPosition" + " where s.deleted = false " ) 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 5a7689f..3206391 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 @@ -5741,6 +5741,7 @@ open class ReportService( "select " + "s.staffId, " + "s.name, " + + "s.departDate, " + "COALESCE(s.email, '') as email, " + "t.code as team, " + "lmd.lastRecordDate " + @@ -5752,7 +5753,17 @@ open class ReportService( "order by lmd.lastrecorddate " ) - val results = jdbcDao.queryForList(sql.toString(), mapOf("searchDate" to date.format(formatter))).map { + val results = jdbcDao.queryForList(sql.toString(), mapOf("searchDate" to date.format(formatter))) + .filter{ + val departDate = it["departDate"] as? java.sql.Date + if (departDate != null) { + val currentDate = Date.from(LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toInstant()) + departDate.after(currentDate) + } else { + false // Exclude entries with null departDate + } + } + .map { result -> StaffLastRecordData( result["staffId"] as String, @@ -5907,7 +5918,11 @@ open class ReportService( val gradeCell = row.createCell(4) val positionCell = row.createCell(5) val salaryPointCell = row.createCell(6) - val emailCell = row.createCell(7) + val lowerLimitCell = row.createCell(7) + val upperLimitCell = row.createCell(8) + val hourlyRateCell = row.createCell(9) + val emailCell = row.createCell(10) + val activeCell = row.createCell(11) staffIdCell.apply { setCellValue(it.getValue("staffId") as String) @@ -5946,11 +5961,44 @@ open class ReportService( cellStyle = blackFontStyle } + lowerLimitCell.apply{ + setCellValue((it.getValue("lowerLimit") as Int).toString()) + cellStyle = blackFontStyle + } + + upperLimitCell.apply{ + setCellValue((it.getValue("upperLimit") as Int).toString()) + cellStyle = blackFontStyle + } + + hourlyRateCell.apply{ + setCellValue((it.getValue("hourlyRate") as BigDecimal).toString()) + cellStyle = blackFontStyle + } + emailCell.apply { setCellValue(it.getValue("email") as String) cellStyle = blackFontStyle } + activeCell.apply { + var active: Boolean + var uniCode: String + val departDate = it["departDate"] as? java.sql.Date + + if (departDate != null) { + val currentDate = Date.from(LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toInstant()) + active = departDate.after(currentDate) + } else { + active = true // Exclude entries with null departDate + } + + uniCode = if (active) "\u2713" else "\u2717" + + setCellValue(uniCode) + cellStyle = blackFontStyle + } + startRowIndex++ } diff --git a/src/main/resources/templates/report/Staff Information.xlsx b/src/main/resources/templates/report/Staff Information.xlsx index c60fe27..f6477bf 100644 Binary files a/src/main/resources/templates/report/Staff Information.xlsx and b/src/main/resources/templates/report/Staff Information.xlsx differ