瀏覽代碼

1. Invoice:

Remove mandatory field checking on milestone and stage column
2. Report
Accounting stype on cost and expense report
tags/Baseline_30082024_BACKEND_UAT
MSI\2Fi 1 年之前
父節點
當前提交
bf2626ff1a
共有 2 個檔案被更改,包括 16 行新增15 行删除
  1. +15
    -14
      src/main/java/com/ffii/tsms/modules/project/service/InvoiceService.kt
  2. +1
    -1
      src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt

+ 15
- 14
src/main/java/com/ffii/tsms/modules/project/service/InvoiceService.kt 查看文件

@@ -344,7 +344,8 @@ open class InvoiceService(


// For checking mandatory field in each row // For checking mandatory field in each row
val emptyRowList: MutableList<Int> = mutableListOf() val emptyRowList: MutableList<Int> = mutableListOf()
val mandatoryColumns = listOf(0,1,4,5,10,11,12) // Mandatory Field in column 0,1,4,5,10,11,12
// Beria cannot provide Payment Milestone when importing the invoice, so it cannot be checked and import to DB
val mandatoryColumns = listOf(0,1,10,11,12) // Mandatory Field in column 0,1,10,11,12


if (workbook == null) { if (workbook == null) {
return InvoiceResponse(false, "No Excel import", newProjectCodes, emptyRowList, invoicesResult, ArrayList(), ArrayList()) // if workbook is null return InvoiceResponse(false, "No Excel import", newProjectCodes, emptyRowList, invoicesResult, ArrayList(), ArrayList()) // if workbook is null
@@ -373,15 +374,14 @@ open class InvoiceService(
} }
} }


if (newProjectCodes.size == 0){
val milestonepaymentWithCode = getMilestonePaymentWithProjectCode(projectsCodes)
// println("newProjectCodes == 0")
// println(checkMilestonePayment(sheet, 2, 5, 0, 1, milestonepaymentWithCode))
val paymenMilestones = checkMilestonePaymentByStageAndDescription(sheet, 2, 4,5, 0, 1, milestonepaymentWithCode)
if (paymenMilestones.isNotEmpty()){
return InvoiceResponse(false, "Imported Invoice's format is incorrect", newProjectCodes, emptyRowList, invoicesResult, duplicateItemsInInvoice, paymenMilestones)
}
}
// Beria cannot provide Payment Milestone when importing the invoice, so it cannot be checked and import to DB
// if (newProjectCodes.size == 0){
// val milestonepaymentWithCode = getMilestonePaymentWithProjectCode(projectsCodes)
// val paymenMilestones = checkMilestonePaymentByStageAndDescription(sheet, 2, 4,5, 0, 1, milestonepaymentWithCode)
// if (paymenMilestones.isNotEmpty()){
// return InvoiceResponse(false, "Imported Invoice's format is incorrect", newProjectCodes, emptyRowList, invoicesResult, duplicateItemsInInvoice, paymenMilestones)
// }
// }


if (invoicesResult.size >= 1 || if (invoicesResult.size >= 1 ||
newProjectCodes.size >= 1 || newProjectCodes.size >= 1 ||
@@ -394,9 +394,9 @@ open class InvoiceService(
} }


for (i in 2..sheet.lastRowNum){ for (i in 2..sheet.lastRowNum){
val paymentMilestoneId = getMilestonePaymentId(ExcelUtils.getCell(sheet, i, 1).stringCellValue, ExcelUtils.getCell(sheet, i, 5).stringCellValue)
// println("paymentMilestoneId--------------: $paymentMilestoneId")
val milestonePayment = milestonePaymentRepository.findById(paymentMilestoneId).orElseThrow()
// Beria cannot provide Payment Milestone when importing the invoice, so it cannot be checked and import to DB
// 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 { val invoice = Invoice().apply {
invoiceNo = ExcelUtils.getCell(sheet, i, 0).stringCellValue invoiceNo = ExcelUtils.getCell(sheet, i, 0).stringCellValue
projectCode = ExcelUtils.getCell(sheet, i, 1).stringCellValue projectCode = ExcelUtils.getCell(sheet, i, 1).stringCellValue
@@ -411,7 +411,8 @@ open class InvoiceService(
invoiceDate = ExcelUtils.getCell(sheet, i, 10).dateCellValue.toInstant().atZone(ZoneId.systemDefault()).toLocalDate() invoiceDate = ExcelUtils.getCell(sheet, i, 10).dateCellValue.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()
dueDate = ExcelUtils.getCell(sheet, i, 11).dateCellValue.toInstant().atZone(ZoneId.systemDefault()).toLocalDate() dueDate = ExcelUtils.getCell(sheet, i, 11).dateCellValue.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()
issueAmount = ExcelUtils.getCell(sheet, i, 12).numericCellValue.toBigDecimal() issueAmount = ExcelUtils.getCell(sheet, i, 12).numericCellValue.toBigDecimal()
this.milestonePayment = milestonePayment
// Beria cannot provide Payment Milestone when importing the invoice, so it cannot be checked and import to DB
// this.milestonePayment = milestonePayment
} }
saveAndFlush(invoice) saveAndFlush(invoice)
} }


+ 1
- 1
src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt 查看文件

@@ -2543,7 +2543,7 @@ open class ReportService(
setCellValue(budget) setCellValue(budget)
// cellStyle.dataFormat = accountingStyle // cellStyle.dataFormat = accountingStyle
} }
CellUtil.setCellStyleProperty(cell5, "dataFormat", accountingStyle)
CellUtil.setCellStyleProperty(cell6, "dataFormat", accountingStyle)


val cell7 = row.getCell(7) ?: row.createCell(7) val cell7 = row.getCell(7) ?: row.createCell(7)
val manHoutsSpentCost = item["manhourExpenditure"] as Double val manHoutsSpentCost = item["manhourExpenditure"] as Double


Loading…
取消
儲存