Ver código fonte

update report

tags/Baseline_30082024_BACKEND_UAT
cyril.tsui 1 ano atrás
pai
commit
b89945212d
6 arquivos alterados com 15 adições e 15 exclusões
  1. +4
    -4
      src/main/java/com/ffii/tsms/modules/project/service/InvoiceService.kt
  2. +10
    -10
      src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt
  3. +1
    -1
      src/main/java/com/ffii/tsms/modules/timesheet/service/TimesheetsService.kt
  4. BIN
      src/main/resources/templates/report/AR03_Resource Overconsumption.xlsx
  5. BIN
      src/main/resources/templates/report/AR05_Project Completion Report.xlsx
  6. BIN
      src/main/resources/templates/report/AR06_Project Completion Report with Outstanding Accounts Receivable v02.xlsx

+ 4
- 4
src/main/java/com/ffii/tsms/modules/project/service/InvoiceService.kt Ver arquivo

@@ -362,7 +362,7 @@ open class InvoiceService(

// Check the import invoice with the data in DB
for (i in 2..sheet.lastRowNum){
val sheetInvoice = ExcelUtils.getCell(sheet, i, 0).toString()
val sheetInvoice = BigDecimal(ExcelUtils.getCell(sheet, i, 0).toString()).toInt().toString()
val sheetProjectCode = ExcelUtils.getCell(sheet, i, 1).stringCellValue
checkInvoiceNo(sheetInvoice, invoices, invoicesResult, true)
checkProjectCode(sheetProjectCode, projects, newProjectCodes)
@@ -398,7 +398,7 @@ open class InvoiceService(
// val paymentMilestoneId = getMilestonePaymentId(ExcelUtils.getCell(sheet, i, 1).stringCellValue, ExcelUtils.getCell(sheet, i, 5).stringCellValue)
// val milestonePayment = milestonePaymentRepository.findById(paymentMilestoneId).orElseThrow()
val invoice = Invoice().apply {
invoiceNo = ExcelUtils.getCell(sheet, i, 0).toString()
invoiceNo = BigDecimal(ExcelUtils.getCell(sheet, i, 0).toString()).toInt().toString()
projectCode = ExcelUtils.getCell(sheet, i, 1).stringCellValue
projectName = ExcelUtils.getCell(sheet, i, 2).stringCellValue
team = ExcelUtils.getCell(sheet, i, 3).stringCellValue
@@ -447,7 +447,7 @@ open class InvoiceService(
val duplicateItemsInInvoice = checkDuplicateItemInImportedInvoice(sheet,2,0)

for (i in 2..sheet.lastRowNum){
val sheetInvoice = ExcelUtils.getCell(sheet, i, 0).toString()
val sheetInvoice = BigDecimal(ExcelUtils.getCell(sheet, i, 0).toString()).toInt().toString()
val sheetProjectCode = ExcelUtils.getCell(sheet, i, 1).stringCellValue
checkInvoiceNo(sheetInvoice, invoices, invoicesResult, false)
checkProjectCode(sheetProjectCode, projects, newProjectCodes)
@@ -489,7 +489,7 @@ open class InvoiceService(
}

for (i in 2..sheet.lastRowNum){
val invoice = getInvoiceByInvoiceNo(ExcelUtils.getCell(sheet, i, 0).toString())
val invoice = getInvoiceByInvoiceNo(BigDecimal(ExcelUtils.getCell(sheet, i, 0).toString()).toInt().toString())
invoice.paidAmount = ExcelUtils.getCell(sheet, i, 5).numericCellValue.toBigDecimal()
invoice.receiptDate = ExcelUtils.getCell(sheet, i, 4).dateCellValue.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()
saveAndFlush(invoice)


+ 10
- 10
src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt Ver arquivo

@@ -65,7 +65,7 @@ open class ReportService(
var rowIndex = startRow
var columnIndex = startColumn
result.forEachIndexed { index, obj ->
var tempCell = sheet.getRow(rowIndex).createCell(columnIndex)
var tempCell = (sheet.getRow(rowIndex) ?: sheet.createRow(rowIndex)).createCell(columnIndex)
tempCell.setCellValue((index + 1).toDouble())
val keys = obj.keys.toList()
keys.forEachIndexed { keyIndex, key ->
@@ -1846,22 +1846,22 @@ open class ReportService(
if (args != null) {
var statusFilter: String = ""
if (args.containsKey("teamId"))
sql.append("and t.id = :teamId")
sql.append(" and t.id = :teamId")
if (args.containsKey("custId"))
sql.append("and c.id = :custId")
sql.append(" and c.id = :custId")
if (args.containsKey("subsidiaryId"))
sql.append("and ss.id = :subsidiaryId")
sql.append(" and ss.id = :subsidiaryId")
if (args.containsKey("status"))
statusFilter = when (args.get("status")) {
"Potential Overconsumption" -> "and " +
"Potential Overconsumption" -> " and " +
" (COALESCE((tns.totalConsumed * sa.hourlyRate), 0) / p.expectedTotalFee) >= :lowerLimit " +
" and (COALESCE((tns.totalConsumed * sa.hourlyRate), 0) / p.expectedTotalFee) <= 1 " +
" or (COALESCE(tns.totalConsumed, 0) / COALESCE(p.totalManhour, 0)) >= :lowerLimit " +
" and (COALESCE(tns.totalConsumed, 0) / COALESCE(p.totalManhour, 0)) <= 1 "
"All" -> "and " +
"All" -> " and " +
" (COALESCE((tns.totalConsumed * sa.hourlyRate), 0) / p.expectedTotalFee) >= :lowerLimit " +
" or (COALESCE(tns.totalConsumed, 0) / COALESCE(p.totalManhour, 0)) >= :lowerLimit "
// "Overconsumption" -> "and " +
// "Overconsumption" -> " and " +
// " ((COALESCE((tns.totalConsumed * sa.hourlyRate), 0) / p.expectedTotalFee) >= 1 " +
// " or (COALESCE(tns.totalConsumed, 0) / COALESCE(p.totalManhour, 0)) >= 1) "

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

for(item in queryList){
val hourlyRate = (item.getValue("hourlyRate") as BigDecimal).toDouble()
if(item["code"] !in costAndExpenseList){
if(item["code"] !in costAndExpenseList.map { it["code"] }){
costAndExpenseList.add(
mapOf(
"code" to item["code"],
@@ -2414,13 +2414,13 @@ open class ReportService(
"budget" to item["expectedTotalFee"],
"totalManhours" to item["normalConsumed"] as Double + item["otConsumed"] as Double,
"manhourExpenditure" to (hourlyRate * item["normalConsumed"] as Double )
+ (hourlyRate * item["otConsumed"]as Double * otFactor)
+ (hourlyRate * item["otConsumed"] as Double * otFactor)
)
)
}else{
val existingMap = costAndExpenseList.find { it.containsValue(item["code"]) }!!
costAndExpenseList[costAndExpenseList.indexOf(existingMap)] = existingMap.toMutableMap().apply {
put("totalManhours", get("manhours") as Double + (item["normalConsumed"] as Double + item["otConsumed"] as Double))
put("totalManhours", get("totalManhours") as Double + (item["normalConsumed"] as Double + item["otConsumed"] as Double))
put("manhourExpenditure", get("manhourExpenditure") as Double + ((hourlyRate * item["normalConsumed"] as Double )
+ (hourlyRate * item["otConsumed"]as Double * otFactor)))
}


+ 1
- 1
src/main/java/com/ffii/tsms/modules/timesheet/service/TimesheetsService.kt Ver arquivo

@@ -256,7 +256,7 @@ open class TimesheetsService(

timesheetRepository.saveAll(timesheetList)
logger.info("---------end-------")
logger.info("Not Exist Project List: "+ notExistProjectList.joinToString(", "))
logger.info("Not Exist Project List: "+ notExistProjectList.distinct().joinToString(", "))

return if (sheet.lastRowNum > 0) "Import Excel success btw " + notExistProjectList.joinToString(", ") else "Import Excel failure"
}

BIN
src/main/resources/templates/report/AR03_Resource Overconsumption.xlsx Ver arquivo


BIN
src/main/resources/templates/report/AR05_Project Completion Report.xlsx Ver arquivo


BIN
src/main/resources/templates/report/AR06_Project Completion Report with Outstanding Accounts Receivable v02.xlsx Ver arquivo


Carregando…
Cancelar
Salvar