Browse Source

Update repot

tags/Baseline_30082024_BACKEND_UAT
MSI\2Fi 1 year ago
parent
commit
a8b57dbe7f
1 changed files with 16 additions and 12 deletions
  1. +16
    -12
      src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt

+ 16
- 12
src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt View File

@@ -449,8 +449,7 @@ open class ReportService(


val totalFeeCell = row.createCell(7) val totalFeeCell = row.createCell(7)
val totalFee = val totalFee =
(item["expectedTotalFee"]?.let { it as Double } ?: 0.0) - (item["subContractFee"]?.let { it as Double }
?: 0.0)
(item["expectedTotalFee"]?.let { it as Double } ?: 0.0)
totalFeeCell.apply { totalFeeCell.apply {
setCellValue(totalFee) setCellValue(totalFee)
cellStyle.dataFormat = accountingStyle cellStyle.dataFormat = accountingStyle
@@ -479,7 +478,7 @@ open class ReportService(
} }


val issuedCell = row.createCell(11) val issuedCell = row.createCell(11)
val issuedAmount = item["issuedAmount"]?.let { it as BigDecimal } ?: BigDecimal(0)
val issuedAmount = item["sumIssuedAmount"]?.let { it as BigDecimal } ?: BigDecimal(0)
issuedCell.apply { issuedCell.apply {
setCellValue(issuedAmount.toDouble()) setCellValue(issuedAmount.toDouble())
cellStyle = boldFontCellStyle cellStyle = boldFontCellStyle
@@ -496,7 +495,7 @@ open class ReportService(


val cpiCell = row.createCell(13) val cpiCell = row.createCell(13)
cpiCell.apply { cpiCell.apply {
cellFormula = "IF(L${rowNum} = 0, 0, L${rowNum}/J${rowNum})"
cellFormula = "IF(J${rowNum} = 0, 0, L${rowNum}/J${rowNum})"
cellStyle = boldFontCellStyle cellStyle = boldFontCellStyle
} }


@@ -507,7 +506,7 @@ open class ReportService(
} }


val receivedAmountCell = row.createCell(15) val receivedAmountCell = row.createCell(15)
val paidAmount = item["paidAmount"]?.let { it as BigDecimal } ?: BigDecimal(0)
val paidAmount = item["sumPaidAmount"]?.let { it as BigDecimal } ?: BigDecimal(0)
receivedAmountCell.apply { receivedAmountCell.apply {
setCellValue(paidAmount.toDouble()) setCellValue(paidAmount.toDouble())
cellStyle.dataFormat = accountingStyle cellStyle.dataFormat = accountingStyle
@@ -590,7 +589,7 @@ open class ReportService(


val lastCpiCell = row.createCell(13) val lastCpiCell = row.createCell(13)
lastCpiCell.apply { lastCpiCell.apply {
cellFormula = "SUM(N15:N${rowNum})"
cellFormula = "IF(J${rowNum}=0,0,L${rowNum}/J${rowNum})"
cellStyle = boldFontCellStyle cellStyle = boldFontCellStyle
cellStyle.dataFormat = accountingStyle cellStyle.dataFormat = accountingStyle
} }
@@ -599,7 +598,7 @@ open class ReportService(


val lastPCpiCell = row.createCell(14) val lastPCpiCell = row.createCell(14)
lastPCpiCell.apply { lastPCpiCell.apply {
cellFormula = "SUM(O15:O${rowNum})"
cellFormula = "=IF(J${rowNum}=0,0,H${rowNum}/J${rowNum})"
cellStyle = boldFontCellStyle cellStyle = boldFontCellStyle
cellStyle.dataFormat = accountingStyle cellStyle.dataFormat = accountingStyle
} }
@@ -1940,7 +1939,6 @@ open class ReportService(
+ " group by p.code" + " group by p.code"
+ " )" + " )"
+ " select p.code, p.description, c.name as client, IFNULL(s2.name, \"N/A\") as subsidiary, concat(t.code, \' - \', t.name) as teamLead, p.planStart , p.planEnd , p.expectedTotalFee, ifnull(p.subContractFee, 0) as subContractFee, " + " select p.code, p.description, c.name as client, IFNULL(s2.name, \"N/A\") as subsidiary, concat(t.code, \' - \', t.name) as teamLead, p.planStart , p.planEnd , p.expectedTotalFee, ifnull(p.subContractFee, 0) as subContractFee, "
// + " IFNULL(cte_ts.normalConsumed, 0) as normalConsumed, IFNULL(cte_ts.otConsumed, 0) as otConsumed, IFNULL(cte_ts.hourlyRate, 0) as hourlyRate, "
+ " IFNULL(cte_i.sumIssuedAmount, 0) as sumIssuedAmount, IFNULL(cte_i.sumPaidAmount, 0) as sumPaidAmount" + " IFNULL(cte_i.sumIssuedAmount, 0) as sumIssuedAmount, IFNULL(cte_i.sumPaidAmount, 0) as sumPaidAmount"
+ " ,0 as totalCumulativeExpenditure " + " ,0 as totalCumulativeExpenditure "
+ " from project p" + " from project p"
@@ -3096,8 +3094,14 @@ open class ReportService(


val result = updatedList.map { item -> val result = updatedList.map { item ->
val budget = (item["budget"] as? Double)?.times(0.8) ?: 0.0 val budget = (item["budget"] as? Double)?.times(0.8) ?: 0.0
val budgetRemain = budget - (item["totalCumulativeExpenditure"] as? Double ?: 0.0)
val remainingPercent = (budgetRemain / budget)
val totalCumulativeExpenditure = (item["totalCumulativeExpenditure"] as? BigDecimal ?: 0.0).toDouble()
val budgetRemain = budget.minus(totalCumulativeExpenditure)
// val remainingPercent = (budgetRemain).div(budget)
// println("-----------------------------------${item["code"]}-------------------------------")
// println("budget: $budget")
// println("totalCumulativeExpenditure: $totalCumulativeExpenditure")
// println("budgetRemain: $budgetRemain")
// println("remainingPercent: $remainingPercent")
item.toMutableMap().apply { item.toMutableMap().apply {
put("budgetPercentage", remainingPercent) put("budgetPercentage", remainingPercent)
} }
@@ -3930,7 +3934,7 @@ open class ReportService(
+ " select p.id from project p" + " select p.id from project p"
+ " where p.status = 'On-going'" + " where p.status = 'On-going'"
) )
if (teamLeadId != null){
if (teamLeadId != null && teamLeadId > 0){
sql.append( "and p.teamLead = :teamLeadId " ) sql.append( "and p.teamLead = :teamLeadId " )
} }
sql.append(" ) and t.recordDate >= p.actualStart ") sql.append(" ) and t.recordDate >= p.actualStart ")
@@ -3971,7 +3975,7 @@ open class ReportService(
+ " select p.id from project p" + " select p.id from project p"
+ " where p.status = 'On-going'" + " where p.status = 'On-going'"
) )
if(teamLeadId != null){
if(teamLeadId != null && teamLeadId > 0){
sql.append(" and p.teamLead = :teamLeadId ") sql.append(" and p.teamLead = :teamLeadId ")
} }
sql.append(" )) order by staffId, salaryId, date ") sql.append(" )) order by staffId, salaryId, date ")


Loading…
Cancel
Save