|
@@ -65,7 +65,7 @@ open class ReportService( |
|
|
var rowIndex = startRow |
|
|
var rowIndex = startRow |
|
|
var columnIndex = startColumn |
|
|
var columnIndex = startColumn |
|
|
result.forEachIndexed { index, obj -> |
|
|
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()) |
|
|
tempCell.setCellValue((index + 1).toDouble()) |
|
|
val keys = obj.keys.toList() |
|
|
val keys = obj.keys.toList() |
|
|
keys.forEachIndexed { keyIndex, key -> |
|
|
keys.forEachIndexed { keyIndex, key -> |
|
@@ -1846,22 +1846,22 @@ open class ReportService( |
|
|
if (args != null) { |
|
|
if (args != null) { |
|
|
var statusFilter: String = "" |
|
|
var statusFilter: String = "" |
|
|
if (args.containsKey("teamId")) |
|
|
if (args.containsKey("teamId")) |
|
|
sql.append("and t.id = :teamId") |
|
|
|
|
|
|
|
|
sql.append(" and t.id = :teamId") |
|
|
if (args.containsKey("custId")) |
|
|
if (args.containsKey("custId")) |
|
|
sql.append("and c.id = :custId") |
|
|
|
|
|
|
|
|
sql.append(" and c.id = :custId") |
|
|
if (args.containsKey("subsidiaryId")) |
|
|
if (args.containsKey("subsidiaryId")) |
|
|
sql.append("and ss.id = :subsidiaryId") |
|
|
|
|
|
|
|
|
sql.append(" and ss.id = :subsidiaryId") |
|
|
if (args.containsKey("status")) |
|
|
if (args.containsKey("status")) |
|
|
statusFilter = when (args.get("status")) { |
|
|
statusFilter = when (args.get("status")) { |
|
|
"Potential Overconsumption" -> "and " + |
|
|
|
|
|
|
|
|
"Potential Overconsumption" -> " and " + |
|
|
" (COALESCE((tns.totalConsumed * sa.hourlyRate), 0) / p.expectedTotalFee) >= :lowerLimit " + |
|
|
" (COALESCE((tns.totalConsumed * sa.hourlyRate), 0) / p.expectedTotalFee) >= :lowerLimit " + |
|
|
" and (COALESCE((tns.totalConsumed * sa.hourlyRate), 0) / p.expectedTotalFee) <= 1 " + |
|
|
" and (COALESCE((tns.totalConsumed * sa.hourlyRate), 0) / p.expectedTotalFee) <= 1 " + |
|
|
" or (COALESCE(tns.totalConsumed, 0) / COALESCE(p.totalManhour, 0)) >= :lowerLimit " + |
|
|
" or (COALESCE(tns.totalConsumed, 0) / COALESCE(p.totalManhour, 0)) >= :lowerLimit " + |
|
|
" and (COALESCE(tns.totalConsumed, 0) / COALESCE(p.totalManhour, 0)) <= 1 " |
|
|
" and (COALESCE(tns.totalConsumed, 0) / COALESCE(p.totalManhour, 0)) <= 1 " |
|
|
"All" -> "and " + |
|
|
|
|
|
|
|
|
"All" -> " and " + |
|
|
" (COALESCE((tns.totalConsumed * sa.hourlyRate), 0) / p.expectedTotalFee) >= :lowerLimit " + |
|
|
" (COALESCE((tns.totalConsumed * sa.hourlyRate), 0) / p.expectedTotalFee) >= :lowerLimit " + |
|
|
" or (COALESCE(tns.totalConsumed, 0) / COALESCE(p.totalManhour, 0)) >= :lowerLimit " |
|
|
" or (COALESCE(tns.totalConsumed, 0) / COALESCE(p.totalManhour, 0)) >= :lowerLimit " |
|
|
// "Overconsumption" -> "and " + |
|
|
|
|
|
|
|
|
// "Overconsumption" -> " and " + |
|
|
// " ((COALESCE((tns.totalConsumed * sa.hourlyRate), 0) / p.expectedTotalFee) >= 1 " + |
|
|
// " ((COALESCE((tns.totalConsumed * sa.hourlyRate), 0) / p.expectedTotalFee) >= 1 " + |
|
|
// " or (COALESCE(tns.totalConsumed, 0) / COALESCE(p.totalManhour, 0)) >= 1) " |
|
|
// " or (COALESCE(tns.totalConsumed, 0) / COALESCE(p.totalManhour, 0)) >= 1) " |
|
|
|
|
|
|
|
@@ -2403,7 +2403,7 @@ open class ReportService( |
|
|
|
|
|
|
|
|
for(item in queryList){ |
|
|
for(item in queryList){ |
|
|
val hourlyRate = (item.getValue("hourlyRate") as BigDecimal).toDouble() |
|
|
val hourlyRate = (item.getValue("hourlyRate") as BigDecimal).toDouble() |
|
|
if(item["code"] !in costAndExpenseList){ |
|
|
|
|
|
|
|
|
if(item["code"] !in costAndExpenseList.map { it["code"] }){ |
|
|
costAndExpenseList.add( |
|
|
costAndExpenseList.add( |
|
|
mapOf( |
|
|
mapOf( |
|
|
"code" to item["code"], |
|
|
"code" to item["code"], |
|
@@ -2414,13 +2414,13 @@ open class ReportService( |
|
|
"budget" to item["expectedTotalFee"], |
|
|
"budget" to item["expectedTotalFee"], |
|
|
"totalManhours" to item["normalConsumed"] as Double + item["otConsumed"] as Double, |
|
|
"totalManhours" to item["normalConsumed"] as Double + item["otConsumed"] as Double, |
|
|
"manhourExpenditure" to (hourlyRate * item["normalConsumed"] as Double ) |
|
|
"manhourExpenditure" to (hourlyRate * item["normalConsumed"] as Double ) |
|
|
+ (hourlyRate * item["otConsumed"]as Double * otFactor) |
|
|
|
|
|
|
|
|
+ (hourlyRate * item["otConsumed"] as Double * otFactor) |
|
|
) |
|
|
) |
|
|
) |
|
|
) |
|
|
}else{ |
|
|
}else{ |
|
|
val existingMap = costAndExpenseList.find { it.containsValue(item["code"]) }!! |
|
|
val existingMap = costAndExpenseList.find { it.containsValue(item["code"]) }!! |
|
|
costAndExpenseList[costAndExpenseList.indexOf(existingMap)] = existingMap.toMutableMap().apply { |
|
|
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 ) |
|
|
put("manhourExpenditure", get("manhourExpenditure") as Double + ((hourlyRate * item["normalConsumed"] as Double ) |
|
|
+ (hourlyRate * item["otConsumed"]as Double * otFactor))) |
|
|
+ (hourlyRate * item["otConsumed"]as Double * otFactor))) |
|
|
} |
|
|
} |
|
|