diff --git a/src/main/java/com/ffii/tsms/modules/project/service/InvoiceService.kt b/src/main/java/com/ffii/tsms/modules/project/service/InvoiceService.kt index f89ee29..0628d8e 100644 --- a/src/main/java/com/ffii/tsms/modules/project/service/InvoiceService.kt +++ b/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 val emptyRowList: MutableList = 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) { 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 || newProjectCodes.size >= 1 || @@ -394,9 +394,9 @@ open class InvoiceService( } 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 { invoiceNo = ExcelUtils.getCell(sheet, i, 0).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() dueDate = ExcelUtils.getCell(sheet, i, 11).dateCellValue.toInstant().atZone(ZoneId.systemDefault()).toLocalDate() 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) } 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 ba386ac..b8e5d16 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 @@ -2543,7 +2543,7 @@ open class ReportService( setCellValue(budget) // cellStyle.dataFormat = accountingStyle } - CellUtil.setCellStyleProperty(cell5, "dataFormat", accountingStyle) + CellUtil.setCellStyleProperty(cell6, "dataFormat", accountingStyle) val cell7 = row.getCell(7) ?: row.createCell(7) val manHoutsSpentCost = item["manhourExpenditure"] as Double