|
|
@@ -435,7 +435,7 @@ open class ReportService( |
|
|
|
val uninvoiceCell = row.createCell(12) |
|
|
|
uninvoiceCell.apply { |
|
|
|
cellFormula = |
|
|
|
" IF(I${rowNum}-L${rowNum}<0, 0, I${rowNum}-L${rowNum})" |
|
|
|
" IF(H${rowNum}-L${rowNum}<0, 0, H${rowNum}-L${rowNum})" |
|
|
|
// " IF(I${rowNum}<=J${rowNum}, I${rowNum}-L${rowNum}, IF(AND(I${rowNum}>J${rowNum}, J${rowNum}<L${rowNum}), 0, IF(AND(I${rowNum}>J${rowNum}, J${rowNum}>=L${rowNum}), J${rowNum}-L${rowNum}, 0))) " |
|
|
|
cellStyle.dataFormat = accountingStyle |
|
|
|
} |
|
|
@@ -529,6 +529,11 @@ open class ReportService( |
|
|
|
CellUtil.setCellStyleProperty(sumUInvoiceCell, "borderBottom", BorderStyle.DOUBLE) |
|
|
|
|
|
|
|
val lastCpiCell = row.createCell(13) |
|
|
|
lastCpiCell.apply { |
|
|
|
cellFormula = "SUM(N15:N${rowNum})" |
|
|
|
cellStyle = boldFontCellStyle |
|
|
|
cellStyle.dataFormat = accountingStyle |
|
|
|
} |
|
|
|
CellUtil.setCellStyleProperty(lastCpiCell, "borderTop", BorderStyle.THIN) |
|
|
|
CellUtil.setCellStyleProperty(lastCpiCell, "borderBottom", BorderStyle.DOUBLE) |
|
|
|
|
|
|
@@ -607,7 +612,7 @@ open class ReportService( |
|
|
|
val row9: Row = sheet.getRow(rowNum) |
|
|
|
val cell5 = row9.createCell(2) |
|
|
|
cell5.apply { |
|
|
|
cellFormula = "N${lastRowNum}" |
|
|
|
cellFormula = "M${lastRowNum}" |
|
|
|
cellStyle.dataFormat = accountingStyle |
|
|
|
} |
|
|
|
|
|
|
@@ -1801,26 +1806,22 @@ open class ReportService( |
|
|
|
|
|
|
|
open fun getProjectResourceOverconsumptionReport(args: Map<String, Any>): List<Map<String, Any>> { |
|
|
|
val sql = StringBuilder("WITH teamNormalConsumed AS (" |
|
|
|
+ " SELECT " |
|
|
|
+ " s.teamId, " |
|
|
|
+ " pt.project_id, " |
|
|
|
+ " SUM(tns.totalConsumed) AS totalConsumed, " |
|
|
|
+ " sum(tns.totalBudget) as totalBudget " |
|
|
|
+ " FROM ( " |
|
|
|
+ " SELECT " |
|
|
|
+ " t.staffId, " |
|
|
|
+ " sum(t.normalConsumed + COALESCE(t.otConsumed, 0)) as totalConsumed, " |
|
|
|
+ " t.projectTaskId AS taskId, " |
|
|
|
+ " sum(t.normalConsumed + COALESCE(t.otConsumed, 0)) * min(sal.hourlyRate) as totalBudget " |
|
|
|
+ " FROM timesheet t " |
|
|
|
+ " LEFT JOIN staff s ON t.staffId = s.id " |
|
|
|
+ " left join salary sal on sal.salaryPoint = s.salaryId " |
|
|
|
+ " GROUP BY t.staffId, t.projectTaskId " |
|
|
|
+ " ) AS tns " |
|
|
|
+ " INNER JOIN project_task pt ON tns.taskId = pt.id " |
|
|
|
+ " JOIN staff s ON tns.staffId = s.id " |
|
|
|
+ " JOIN team t ON s.teamId = t.id " |
|
|
|
+ " GROUP BY teamId, project_id " |
|
|
|
+ " SELECT" |
|
|
|
+ " tns.projectId," |
|
|
|
+ " SUM(tns.totalConsumed) AS totalConsumed, " |
|
|
|
+ " sum(tns.totalBudget) as totalBudget " |
|
|
|
+ " FROM ( " |
|
|
|
+ " SELECT" |
|
|
|
+ " t.staffId," |
|
|
|
+ " t.projectId AS projectId," |
|
|
|
+ " sum(t.normalConsumed + COALESCE(t.otConsumed, 0)) as totalConsumed, " |
|
|
|
+ " sum(t.normalConsumed + COALESCE(t.otConsumed, 0)) * min(sal.hourlyRate) as totalBudget " |
|
|
|
+ " FROM timesheet t" |
|
|
|
+ " LEFT JOIN staff s ON t.staffId = s.id " |
|
|
|
+ " left join salary sal on sal.salaryPoint = s.salaryId " |
|
|
|
+ " GROUP BY t.staffId, t.projectId" |
|
|
|
+ " ) AS tns" |
|
|
|
+ " GROUP BY projectId" |
|
|
|
+ " ) " |
|
|
|
+ " SELECT " |
|
|
|
+ " p.code, " |
|
|
|