Procházet zdrojové kódy

update

tags/Baseline_30082024_BACKEND_UAT
MSI\derek před 1 rokem
rodič
revize
87a2002570
4 změnil soubory, kde provedl 28 přidání a 12 odebrání
  1. +2
    -2
      src/main/java/com/ffii/tsms/modules/data/service/StaffsService.kt
  2. +1
    -1
      src/main/java/com/ffii/tsms/modules/data/web/models/NewStaffRequest.kt
  3. +25
    -9
      src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt
  4. binární
      src/main/resources/templates/report/AR08_Monthly Work Hours Analysis Report.xlsx

+ 2
- 2
src/main/java/com/ffii/tsms/modules/data/service/StaffsService.kt Zobrazit soubor

@@ -209,8 +209,8 @@ open class StaffsService(

@Transactional(rollbackFor = [Exception::class])
open fun saveOrUpdate(req: NewStaffRequest): Staff {
val staff = if(req.id > 0L) find(req.id).get() else Staff()
if (req.id > 0L) {
val staff = if(req.id != null) find(req.id).get() else Staff()
if (req.id != null) {
updateStaff(req, staff)
} else {
saveStaff(req)


+ 1
- 1
src/main/java/com/ffii/tsms/modules/data/web/models/NewStaffRequest.kt Zobrazit soubor

@@ -5,7 +5,7 @@ import jakarta.validation.constraints.NotNull
import java.time.LocalDate

data class NewStaffRequest(
val id: Long,
val id: Long?,

// @field:NotNull(message = "Staff userId cannot be empty")
// val userId: Long,


+ 25
- 9
src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt Zobrazit soubor

@@ -16,7 +16,7 @@ import java.time.LocalDate
import java.time.format.DateTimeFormatter
import java.util.*

data class DayInfo(val date: String, val weekday: String)
data class DayInfo(val date: String?, val weekday: String?)
@Service
open class ReportService {
private val DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy/MM/dd")
@@ -310,9 +310,11 @@ open class ReportService {

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
rowIndex = 7
println(daysOfMonth)
daysOfMonth.forEach { dayInfo ->
rowIndex++
rowSize++
println(dayInfo)
sheet.getRow(rowIndex).getCell(0).apply {
setCellValue(dayInfo.date)
cellStyle.setFont(boldFont)
@@ -326,12 +328,16 @@ open class ReportService {
rowIndex += 1
sheet.getRow(rowIndex).getCell(0).apply {
setCellValue("Sub-total")
cellStyle.setFont(boldFont)
cellStyle.alignment = HorizontalAlignment.CENTER
}
sheet.addMergedRegion(CellRangeAddress(rowIndex,rowIndex , 0, 1))
//
rowIndex += 1
sheet.getRow(rowIndex).getCell(0).apply {
setCellValue("Total Normal Hours [A]")
// cellStyle.setFont(boldFont)
cellStyle.alignment = HorizontalAlignment.CENTER
}
sheet.addMergedRegion(CellRangeAddress(rowIndex,rowIndex , 0, 1))
//
@@ -339,12 +345,16 @@ open class ReportService {
sheet.getRow(rowIndex).getCell(0).apply {
setCellValue("Total Other Hours [B]")
sheet.addMergedRegion(CellRangeAddress(rowIndex,rowIndex , 0, 1))
cellStyle.setFont(boldFont)
cellStyle.alignment = HorizontalAlignment.CENTER
}

rowIndex += 1
sheet.getRow(rowIndex).getCell(0).apply {
setCellValue("Total Spent Manhours [A+B]")
// cellStyle.borderBottom = BorderStyle.DOUBLE
// cellStyle.setFont(boldFont)
cellStyle.alignment = HorizontalAlignment.CENTER
cellStyle.borderBottom = BorderStyle.DOUBLE
}
sheet.addMergedRegion(CellRangeAddress(rowIndex,rowIndex , 0, 1))
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -363,7 +373,7 @@ open class ReportService {
columnIndex += 1
getCell(columnIndex).setCellValue("Daily Manhour Spent\n" + "(Excluding Leave Hours)")
getCell(columnIndex).cellStyle.alignment = HorizontalAlignment.CENTER
// columnSize = columnIndex
columnSize = columnIndex
}
sheet.addMergedRegion(CellRangeAddress(6,6 , 2, columnIndex))
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -389,17 +399,23 @@ open class ReportService {
}

rowIndex = 8
println("rowSize is: $rowSize")
// println("rowSize is: $rowSize")
if (sheet.getRow(rowIndex - 1).getCell(2).stringCellValue == "Leave Hours") {
for (i in 0 until rowSize) {
val cell = sheet.getRow(rowIndex + i)?.getCell(columnIndex) ?: sheet.getRow(rowIndex + i)?.createCell(columnIndex)
cell?.cellFormula = "SUM(${getColumnAlphabet(2)}${rowIndex+1+i}:${getColumnAlphabet(columnIndex)}${rowIndex+1+i})" // should columnIndex - 2
val cell = sheet.getRow(rowIndex)?.getCell(columnIndex) ?: sheet.getRow(rowIndex + i)?.createCell(columnIndex)
cell?.cellFormula = "SUM(${getColumnAlphabet(2)}${rowIndex+1}:${getColumnAlphabet(columnIndex)}${rowIndex+1})" // should columnIndex - 2
rowIndex++
// cell?.setCellValue("testing")
// rowIndex++
}
// for (i in 0 until columnSize) {
// val cell = sheet.getRow(rowIndex)
// }
// println(columnSize)
for (i in 0 until columnSize) { // minus last col
val cell = sheet.getRow(rowIndex)?.getCell(2) ?: sheet.getRow(rowIndex)?.createCell(2)
cell?.cellFormula = "SUM(${getColumnAlphabet(2)}${rowIndex}:${getColumnAlphabet(columnIndex + i)}${rowIndex})"
cell?.cellStyle?.dataFormat = accountingStyle
cell?.cellStyle?.setFont(boldFont)
// cell?.cellStyle.borderBottom = border
}
}

return workbook


binární
src/main/resources/templates/report/AR08_Monthly Work Hours Analysis Report.xlsx Zobrazit soubor


Načítá se…
Zrušit
Uložit