| @@ -136,6 +136,7 @@ open class ReportService( | |||
| "planStart" to item.getValue("planStart"), | |||
| "planEnd" to item.getValue("planEnd"), | |||
| "expectedTotalFee" to item.getValue("expectedTotalFee"), | |||
| "subContractFee" to item.getValue("subContractFee"), | |||
| "normalConsumed" to manHourRate, | |||
| "otConsumed" to manOtHourRate, | |||
| "issuedAmount" to item.getValue("sumIssuedAmount"), | |||
| @@ -445,7 +446,7 @@ open class ReportService( | |||
| endDateCell.setCellValue(if (item["planEnd"] != null) item.getValue("planEnd").toString() else "N/A") | |||
| val totalFeeCell = row.createCell(7) | |||
| val totalFee = item["expectedTotalFee"]?.let { it as Double } ?: 0.0 | |||
| val totalFee = (item["expectedTotalFee"]?.let { it as Double } ?: 0.0) - (item["subContractFee"]?.let { it as Double } ?: 0.0) | |||
| totalFeeCell.apply { | |||
| setCellValue(totalFee) | |||
| cellStyle.dataFormat = accountingStyle | |||
| @@ -1924,7 +1925,7 @@ open class ReportService( | |||
| + " left join project p on p.code = i.projectCode" | |||
| + " 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," | |||
| + " 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" | |||
| + " from project p" | |||
| @@ -2063,11 +2064,11 @@ open class ReportService( | |||
| + " tm.code as team, " | |||
| + " concat(c.code, ' - ',c.name) as client, " | |||
| + " COALESCE(concat(ss.code, ' - ', ss.name), 'N/A') as subsidiary, " | |||
| + " p.expectedTotalFee * 0.8 as plannedBudget, " | |||
| + " (p.expectedTotalFee - ifnull(p.subContractFee, 0)) * 0.8 as plannedBudget, " | |||
| + " sum(t.consumedBudget) as actualConsumedBudget, " | |||
| + " COALESCE(p.totalManhour, 0) as plannedManhour, " | |||
| + " sum(t.normalConsumed + COALESCE(t.otConsumed, 0)) as actualConsumedManhour, " | |||
| + " sum(t.consumedBudget) / p.expectedTotalFee * 0.8 as budgetConsumptionRate, " | |||
| + " sum(t.consumedBudget) / (p.expectedTotalFee - ifnull(p.subContractFee, 0)) * 0.8 as budgetConsumptionRate, " | |||
| + " sum(t.normalConsumed + COALESCE(t.otConsumed, 0)) / COALESCE(p.totalManhour, 0) as manhourConsumptionRate, " | |||
| + " case " | |||
| + " when (sum(t.consumedBudget) / p.expectedTotalFee) >= :lowerLimit and (sum(t.consumedBudget) / p.expectedTotalFee) <= 1 " | |||
| @@ -2115,7 +2116,7 @@ open class ReportService( | |||
| else -> "" | |||
| } | |||
| } | |||
| sql.append(" group by p.code, p.name, tm.code, c.code, c.name, ss.code, ss.name,p.expectedTotalFee, p.totalManhour, p.expectedTotalFee ") | |||
| sql.append(" group by p.code, p.name, tm.code, c.code, c.name, ss.code, ss.name, p.expectedTotalFee, p.subContractFee, p.totalManhour, p.expectedTotalFee ") | |||
| sql.append(statusFilter) | |||
| return jdbcDao.queryForList(sql.toString(), args) | |||
| } | |||
| @@ -2754,7 +2755,7 @@ open class ReportService( | |||
| + " left join salary s2 on s.salaryId = s2.salaryPoint" | |||
| + " left join team t2 on t2.id = s.teamId" | |||
| + " )" | |||
| + " select p.code, p.description, c.name as client, IFNULL(s2.name, \'NA\') as subsidiary, concat(t.code, \' - \', t.name) as teamLead, p.expectedTotalFee," | |||
| + " select p.code, p.description, c.name as client, IFNULL(s2.name, \'NA\') as subsidiary, concat(t.code, \' - \', t.name) as teamLead, p.expectedTotalFee, ifnull(p.subContractFee, 0) as subContractFee" | |||
| + " SUM(IFNULL(cte_ts.normalConsumed, 0)) as normalConsumed," | |||
| + " SUM(IFNULL(cte_ts.otConsumed, 0)) as otConsumed," | |||
| + " IFNULL(cte_ts.hourlyRate, 0) as hourlyRate" | |||
| @@ -2789,7 +2790,7 @@ open class ReportService( | |||
| } | |||
| sql.append( | |||
| " group by p.code, p.description , c.name, teamLead, p.expectedTotalFee , hourlyRate, s2.name order by p.code" | |||
| " group by p.code, p.description , c.name, teamLead, p.expectedTotalFee, p.subContractFee , hourlyRate, s2.name order by p.code" | |||
| ) | |||
| val args = mapOf( | |||
| @@ -2811,7 +2812,7 @@ open class ReportService( | |||
| "client" to item["client"], | |||
| "subsidiary" to item["subsidiary"], | |||
| "teamLead" to item["teamLead"], | |||
| "budget" to item["expectedTotalFee"], | |||
| "budget" to item["expectedTotalFee"] as Double - item["subContractFee"] as Double, | |||
| "totalManhours" to item["normalConsumed"] as Double + item["otConsumed"] as Double, | |||
| "manhourExpenditure" to (hourlyRate * item["normalConsumed"] as Double) | |||
| + (hourlyRate * item["otConsumed"] as Double * otFactor) | |||