@@ -107,6 +107,7 @@ open class ReportService(
"code" to item.getValue("code"),
"code" to item.getValue("code"),
"description" to item.getValue("description"),
"description" to item.getValue("description"),
"client" to item.getValue("client"),
"client" to item.getValue("client"),
"subsidiary" to item.getValue("subsidiary"),
"teamLead" to item.getValue("teamLead"),
"teamLead" to item.getValue("teamLead"),
"planStart" to item.getValue("planStart"),
"planStart" to item.getValue("planStart"),
"planEnd" to item.getValue("planEnd"),
"planEnd" to item.getValue("planEnd"),
@@ -317,8 +318,9 @@ open class ReportService(
//Set Column 2, 3, 4 to auto width
//Set Column 2, 3, 4 to auto width
sheet.setColumnWidth(2, 20 * 256)
sheet.setColumnWidth(2, 20 * 256)
sheet.setColumnWidth(3, 45 * 256)
sheet.setColumnWidth(4, 15 * 256)
sheet.setColumnWidth(3, 20 * 256)
sheet.setColumnWidth(4, 45 * 256)
sheet.setColumnWidth(5, 15 * 256)
val boldFont = sheet.workbook.createFont()
val boldFont = sheet.workbook.createFont()
boldFont.bold = true
boldFont.bold = true
@@ -378,29 +380,35 @@ open class ReportService(
}
}
CellUtil.setAlignment(clientCell, HorizontalAlignment.CENTER)
CellUtil.setAlignment(clientCell, HorizontalAlignment.CENTER)
val teamLeadCell = row.createCell(3)
val subsidiaryCell = row.createCell(3)
subsidiaryCell.apply {
setCellValue(if (item["subsidiary"] != null) item.getValue("subsidiary").toString() else "N/A")
}
CellUtil.setAlignment(subsidiaryCell, HorizontalAlignment.CENTER)
val teamLeadCell = row.createCell(4)
teamLeadCell.setCellValue(if (item["teamLead"] != null) item.getValue("teamLead").toString() else "N/A")
teamLeadCell.setCellValue(if (item["teamLead"] != null) item.getValue("teamLead").toString() else "N/A")
val startDateCell = row.createCell(4)
val startDateCell = row.createCell(5 )
startDateCell.setCellValue(if (item["planStart"] != null) item.getValue("planStart").toString() else "N/A")
startDateCell.setCellValue(if (item["planStart"] != null) item.getValue("planStart").toString() else "N/A")
val endDateCell = row.createCell(5)
val endDateCell = row.createCell(6 )
endDateCell.setCellValue(if (item["planEnd"] != null) item.getValue("planEnd").toString() else "N/A")
endDateCell.setCellValue(if (item["planEnd"] != null) item.getValue("planEnd").toString() else "N/A")
val totalFeeCell = row.createCell(6 )
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
totalFeeCell.apply {
totalFeeCell.apply {
setCellValue(totalFee)
setCellValue(totalFee)
cellStyle.dataFormat = accountingStyle
cellStyle.dataFormat = accountingStyle
}
}
val budgetCell = row.createCell(7 )
val budgetCell = row.createCell(8 )
budgetCell.apply {
budgetCell.apply {
cellFormula = "G${rowNum} * 80%"
cellFormula = "G${rowNum} * 80%"
cellStyle.dataFormat = accountingStyle
cellStyle.dataFormat = accountingStyle
}
}
val cumExpenditureCell = row.createCell(8 )
val cumExpenditureCell = row.createCell(9 )
val normalConsumed = item["normalConsumed"]?.let { it as BigDecimal } ?: BigDecimal(0)
val normalConsumed = item["normalConsumed"]?.let { it as BigDecimal } ?: BigDecimal(0)
val otConsumed = item["otConsumed"]?.let { it as BigDecimal } ?: BigDecimal(0)
val otConsumed = item["otConsumed"]?.let { it as BigDecimal } ?: BigDecimal(0)
val cumExpenditure = normalConsumed.add(otConsumed)
val cumExpenditure = normalConsumed.add(otConsumed)
@@ -409,21 +417,21 @@ open class ReportService(
cellStyle.dataFormat = accountingStyle
cellStyle.dataFormat = accountingStyle
}
}
val budgetVCell = row.createCell(9 )
val budgetVCell = row.createCell(10 )
budgetVCell.apply {
budgetVCell.apply {
cellFormula = "H${rowNum} - I${rowNum}"
cellFormula = "H${rowNum} - I${rowNum}"
cellStyle = boldFontCellStyle
cellStyle = boldFontCellStyle
cellStyle.dataFormat = accountingStyle
cellStyle.dataFormat = accountingStyle
}
}
val issuedCell = row.createCell(10 )
val issuedCell = row.createCell(11 )
val issuedAmount = item["issuedAmount"]?.let { it as BigDecimal } ?: BigDecimal(0)
val issuedAmount = item["issuedAmount"]?.let { it as BigDecimal } ?: BigDecimal(0)
issuedCell.apply {
issuedCell.apply {
setCellValue(issuedAmount.toDouble())
setCellValue(issuedAmount.toDouble())
cellStyle.dataFormat = accountingStyle
cellStyle.dataFormat = accountingStyle
}
}
val uninvoiceCell = row.createCell(11 )
val uninvoiceCell = row.createCell(12 )
uninvoiceCell.apply {
uninvoiceCell.apply {
cellFormula =
cellFormula =
" IF(H${rowNum}<=I${rowNum}, H${rowNum}-K${rowNum}, IF(AND(H${rowNum}>I${rowNum}, I${rowNum}<K${rowNum}), 0, IF(AND(H${rowNum}>I${rowNum}, I${rowNum}>=K${rowNum}), I${rowNum}-K${rowNum}, 0))) "
" IF(H${rowNum}<=I${rowNum}, H${rowNum}-K${rowNum}, IF(AND(H${rowNum}>I${rowNum}, I${rowNum}<K${rowNum}), 0, IF(AND(H${rowNum}>I${rowNum}, I${rowNum}>=K${rowNum}), I${rowNum}-K${rowNum}, 0))) "
@@ -431,19 +439,19 @@ open class ReportService(
cellStyle.dataFormat = accountingStyle
cellStyle.dataFormat = accountingStyle
}
}
val cpiCell = row.createCell(12 )
val cpiCell = row.createCell(13 )
cpiCell.apply {
cpiCell.apply {
cellFormula = "IF(K${rowNum} = 0, 0, K${rowNum}/I${rowNum})"
cellFormula = "IF(K${rowNum} = 0, 0, K${rowNum}/I${rowNum})"
}
}
val receivedAmountCell = row.createCell(13 )
val receivedAmountCell = row.createCell(14 )
val paidAmount = item["paidAmount"]?.let { it as BigDecimal } ?: BigDecimal(0)
val paidAmount = item["paidAmount"]?.let { it as BigDecimal } ?: BigDecimal(0)
receivedAmountCell.apply {
receivedAmountCell.apply {
setCellValue(paidAmount.toDouble())
setCellValue(paidAmount.toDouble())
cellStyle.dataFormat = accountingStyle
cellStyle.dataFormat = accountingStyle
}
}
val unsettledAmountCell = row.createCell(14 )
val unsettledAmountCell = row.createCell(15 )
unsettledAmountCell.apply {
unsettledAmountCell.apply {
cellFormula = "K${rowNum}-N${rowNum}"
cellFormula = "K${rowNum}-N${rowNum}"
cellStyle = boldFontCellStyle
cellStyle = boldFontCellStyle
@@ -454,13 +462,13 @@ open class ReportService(
val lastRowNum = rowNum + 1
val lastRowNum = rowNum + 1
val row: Row = sheet.createRow(rowNum)
val row: Row = sheet.createRow(rowNum)
for (i in 0..4 ) {
for (i in 0..5 ) {
val cell = row.createCell(i)
val cell = row.createCell(i)
CellUtil.setCellStyleProperty(cell, "borderTop", BorderStyle.THIN)
CellUtil.setCellStyleProperty(cell, "borderTop", BorderStyle.THIN)
CellUtil.setCellStyleProperty(cell, "borderBottom", BorderStyle.DOUBLE)
CellUtil.setCellStyleProperty(cell, "borderBottom", BorderStyle.DOUBLE)
}
}
val subTotalCell = row.createCell(5 )
val subTotalCell = row.createCell(6 )
subTotalCell.apply {
subTotalCell.apply {
setCellValue("Sub-total:")
setCellValue("Sub-total:")
}
}
@@ -468,71 +476,71 @@ open class ReportService(
CellUtil.setCellStyleProperty(subTotalCell, "borderBottom", BorderStyle.DOUBLE)
CellUtil.setCellStyleProperty(subTotalCell, "borderBottom", BorderStyle.DOUBLE)
val sumTotalFeeCell = row.createCell(6 )
val sumTotalFeeCell = row.createCell(7 )
sumTotalFeeCell.apply {
sumTotalFeeCell.apply {
cellFormula = "SUM(G15:G ${rowNum})"
cellFormula = "SUM(H15:H ${rowNum})"
cellStyle.dataFormat = accountingStyle
cellStyle.dataFormat = accountingStyle
}
}
CellUtil.setCellStyleProperty(sumTotalFeeCell, "borderTop", BorderStyle.THIN)
CellUtil.setCellStyleProperty(sumTotalFeeCell, "borderTop", BorderStyle.THIN)
CellUtil.setCellStyleProperty(sumTotalFeeCell, "borderBottom", BorderStyle.DOUBLE)
CellUtil.setCellStyleProperty(sumTotalFeeCell, "borderBottom", BorderStyle.DOUBLE)
val sumBudgetCell = row.createCell(7 )
val sumBudgetCell = row.createCell(8 )
sumBudgetCell.apply {
sumBudgetCell.apply {
cellFormula = "SUM(H15:H ${rowNum})"
cellFormula = "SUM(I15:I ${rowNum})"
cellStyle.dataFormat = accountingStyle
cellStyle.dataFormat = accountingStyle
}
}
CellUtil.setCellStyleProperty(sumBudgetCell, "borderTop", BorderStyle.THIN)
CellUtil.setCellStyleProperty(sumBudgetCell, "borderTop", BorderStyle.THIN)
CellUtil.setCellStyleProperty(sumBudgetCell, "borderBottom", BorderStyle.DOUBLE)
CellUtil.setCellStyleProperty(sumBudgetCell, "borderBottom", BorderStyle.DOUBLE)
val sumCumExpenditureCell = row.createCell(8 )
val sumCumExpenditureCell = row.createCell(9 )
sumCumExpenditureCell.apply {
sumCumExpenditureCell.apply {
cellFormula = "SUM(I15:I ${rowNum})"
cellFormula = "SUM(J15:J ${rowNum})"
cellStyle.dataFormat = accountingStyle
cellStyle.dataFormat = accountingStyle
}
}
CellUtil.setCellStyleProperty(sumCumExpenditureCell, "borderTop", BorderStyle.THIN)
CellUtil.setCellStyleProperty(sumCumExpenditureCell, "borderTop", BorderStyle.THIN)
CellUtil.setCellStyleProperty(sumCumExpenditureCell, "borderBottom", BorderStyle.DOUBLE)
CellUtil.setCellStyleProperty(sumCumExpenditureCell, "borderBottom", BorderStyle.DOUBLE)
val sumBudgetVCell = row.createCell(9 )
val sumBudgetVCell = row.createCell(10 )
sumBudgetVCell.apply {
sumBudgetVCell.apply {
cellFormula = "SUM(J15:J ${rowNum})"
cellFormula = "SUM(K15:K ${rowNum})"
cellStyle = boldFontCellStyle
cellStyle = boldFontCellStyle
cellStyle.dataFormat = accountingStyle
cellStyle.dataFormat = accountingStyle
}
}
CellUtil.setCellStyleProperty(sumBudgetVCell, "borderTop", BorderStyle.THIN)
CellUtil.setCellStyleProperty(sumBudgetVCell, "borderTop", BorderStyle.THIN)
CellUtil.setCellStyleProperty(sumBudgetVCell, "borderBottom", BorderStyle.DOUBLE)
CellUtil.setCellStyleProperty(sumBudgetVCell, "borderBottom", BorderStyle.DOUBLE)
val sumIInvoiceCell = row.createCell(10 )
val sumIInvoiceCell = row.createCell(11 )
sumIInvoiceCell.apply {
sumIInvoiceCell.apply {
cellFormula = "SUM(K15:K ${rowNum})"
cellFormula = "SUM(L15:L ${rowNum})"
cellStyle.dataFormat = accountingStyle
cellStyle.dataFormat = accountingStyle
}
}
CellUtil.setCellStyleProperty(sumIInvoiceCell, "borderTop", BorderStyle.THIN)
CellUtil.setCellStyleProperty(sumIInvoiceCell, "borderTop", BorderStyle.THIN)
CellUtil.setCellStyleProperty(sumIInvoiceCell, "borderBottom", BorderStyle.DOUBLE)
CellUtil.setCellStyleProperty(sumIInvoiceCell, "borderBottom", BorderStyle.DOUBLE)
val sumUInvoiceCell = row.createCell(11 )
val sumUInvoiceCell = row.createCell(12 )
sumUInvoiceCell.apply {
sumUInvoiceCell.apply {
cellFormula = "SUM(L15:L ${rowNum})"
cellFormula = "SUM(M15:M ${rowNum})"
cellStyle = boldFontCellStyle
cellStyle = boldFontCellStyle
cellStyle.dataFormat = accountingStyle
cellStyle.dataFormat = accountingStyle
}
}
CellUtil.setCellStyleProperty(sumUInvoiceCell, "borderTop", BorderStyle.THIN)
CellUtil.setCellStyleProperty(sumUInvoiceCell, "borderTop", BorderStyle.THIN)
CellUtil.setCellStyleProperty(sumUInvoiceCell, "borderBottom", BorderStyle.DOUBLE)
CellUtil.setCellStyleProperty(sumUInvoiceCell, "borderBottom", BorderStyle.DOUBLE)
val lastCpiCell = row.createCell(12 )
val lastCpiCell = row.createCell(13 )
CellUtil.setCellStyleProperty(lastCpiCell, "borderTop", BorderStyle.THIN)
CellUtil.setCellStyleProperty(lastCpiCell, "borderTop", BorderStyle.THIN)
CellUtil.setCellStyleProperty(lastCpiCell, "borderBottom", BorderStyle.DOUBLE)
CellUtil.setCellStyleProperty(lastCpiCell, "borderBottom", BorderStyle.DOUBLE)
val sumRAmountCell = row.createCell(13 )
val sumRAmountCell = row.createCell(14 )
sumRAmountCell.apply {
sumRAmountCell.apply {
cellFormula = "SUM(N15:N ${rowNum})"
cellFormula = "SUM(O15:O ${rowNum})"
cellStyle.dataFormat = accountingStyle
cellStyle.dataFormat = accountingStyle
}
}
CellUtil.setCellStyleProperty(sumRAmountCell, "borderTop", BorderStyle.THIN)
CellUtil.setCellStyleProperty(sumRAmountCell, "borderTop", BorderStyle.THIN)
CellUtil.setCellStyleProperty(sumRAmountCell, "borderBottom", BorderStyle.DOUBLE)
CellUtil.setCellStyleProperty(sumRAmountCell, "borderBottom", BorderStyle.DOUBLE)
val sumUnSettleCell = row.createCell(14 )
val sumUnSettleCell = row.createCell(15 )
sumUnSettleCell.apply {
sumUnSettleCell.apply {
cellFormula = "SUM(O15:O ${rowNum})"
cellFormula = "SUM(P15:P ${rowNum})"
cellStyle = boldFontCellStyle
cellStyle = boldFontCellStyle
cellStyle.dataFormat = accountingStyle
cellStyle.dataFormat = accountingStyle
}
}
@@ -552,7 +560,7 @@ open class ReportService(
row2Cell.setCellValue("All")
row2Cell.setCellValue("All")
} else {
} else {
row2Cell.apply {
row2Cell.apply {
cellFormula = "D 15"
cellFormula = "E 15"
}
}
}
}
@@ -565,7 +573,7 @@ open class ReportService(
val row5: Row = sheet.getRow(rowNum)
val row5: Row = sheet.getRow(rowNum)
val cell1 = row5.createCell(2)
val cell1 = row5.createCell(2)
cell1.apply {
cell1.apply {
cellFormula = "H ${lastRowNum}"
cellFormula = "I ${lastRowNum}"
cellStyle.dataFormat = accountingStyle
cellStyle.dataFormat = accountingStyle
}
}
@@ -573,7 +581,7 @@ open class ReportService(
val row6: Row = sheet.getRow(rowNum)
val row6: Row = sheet.getRow(rowNum)
val cell2 = row6.createCell(2)
val cell2 = row6.createCell(2)
cell2.apply {
cell2.apply {
cellFormula = "I ${lastRowNum}"
cellFormula = "J ${lastRowNum}"
cellStyle.dataFormat = accountingStyle
cellStyle.dataFormat = accountingStyle
}
}
@@ -581,7 +589,7 @@ open class ReportService(
val row7: Row = sheet.getRow(rowNum)
val row7: Row = sheet.getRow(rowNum)
val cell3 = row7.createCell(2)
val cell3 = row7.createCell(2)
cell3.apply {
cell3.apply {
cellFormula = "J ${lastRowNum}"
cellFormula = "K ${lastRowNum}"
cellStyle.dataFormat = accountingStyle
cellStyle.dataFormat = accountingStyle
}
}
@@ -589,7 +597,7 @@ open class ReportService(
val row8: Row = sheet.getRow(rowNum)
val row8: Row = sheet.getRow(rowNum)
val cell4 = row8.createCell(2)
val cell4 = row8.createCell(2)
cell4.apply {
cell4.apply {
cellFormula = "K ${lastRowNum}"
cellFormula = "L ${lastRowNum}"
cellStyle.dataFormat = accountingStyle
cellStyle.dataFormat = accountingStyle
}
}
@@ -597,7 +605,7 @@ open class ReportService(
val row9: Row = sheet.getRow(rowNum)
val row9: Row = sheet.getRow(rowNum)
val cell5 = row9.createCell(2)
val cell5 = row9.createCell(2)
cell5.apply {
cell5.apply {
cellFormula = "L ${lastRowNum}"
cellFormula = "N ${lastRowNum}"
cellStyle.dataFormat = accountingStyle
cellStyle.dataFormat = accountingStyle
}
}
@@ -605,7 +613,7 @@ open class ReportService(
val row10: Row = sheet.getRow(rowNum)
val row10: Row = sheet.getRow(rowNum)
val cell6 = row10.createCell(2)
val cell6 = row10.createCell(2)
cell6.apply {
cell6.apply {
cellFormula = "N ${lastRowNum}"
cellFormula = "O ${lastRowNum}"
cellStyle.dataFormat = accountingStyle
cellStyle.dataFormat = accountingStyle
}
}
@@ -613,7 +621,7 @@ open class ReportService(
val row11: Row = sheet.getRow(rowNum)
val row11: Row = sheet.getRow(rowNum)
val cell7 = row11.createCell(2)
val cell7 = row11.createCell(2)
cell7.apply {
cell7.apply {
cellFormula = "O ${lastRowNum}"
cellFormula = "P ${lastRowNum}"
cellStyle.dataFormat = accountingStyle
cellStyle.dataFormat = accountingStyle
}
}
@@ -1664,12 +1672,14 @@ open class ReportService(
+ " left join project p on p.code = i.projectCode"
+ " left join project p on p.code = i.projectCode"
+ " group by p.code"
+ " group by p.code"
+ " )"
+ " )"
+ " select p.code, p.description, c.name as client, 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(cte_ts.normalConsumed, 0) as normalConsumed, IFNULL(cte_ts.otConsumed, 0) as otConsumed,"
+ " 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_ts.hourlyRate, 0) as hourlyRate, IFNULL(cte_i.sumIssuedAmount, 0) as sumIssuedAmount, IFNULL(cte_i.sumPaidAmount, 0) as sumPaidAmount"
+ " from project p"
+ " from project p"
+ " left join cte_timesheet cte_ts on p.code = cte_ts.code"
+ " left join cte_timesheet cte_ts on p.code = cte_ts.code"
+ " left join customer c on c.id = p.customerId"
+ " left join customer c on c.id = p.customerId"
+ " left join customer_subsidiary cs on cs.id = p.customerSubsidiaryId"
+ " left join subsidiary s2 on s2.id = cs.subsidiaryId "
+ " left join tsmsdb.team t on t.teamLead = p.teamLead"
+ " left join tsmsdb.team t on t.teamLead = p.teamLead"
+ " left join cte_invoice cte_i on cte_i.code = p.code"
+ " left join cte_invoice cte_i on cte_i.code = p.code"
+ " where p.status = \'On-going\'"
+ " where p.status = \'On-going\'"
@@ -1877,7 +1887,7 @@ open class ReportService(
+ " left join project p on p.code = i.projectCode"
+ " left join project p on p.code = i.projectCode"
+ " group by p.code"
+ " group by p.code"
+ " )"
+ " )"
+ " select p.code, p.description, c.name as client, concat(t.code, \" - \", t.name) as teamLead,"
+ " select p.code, p.description, c.name as client, IFNULL(s2.name, \"N/A\") as subsidiary, concat(t.code, \" - \", t.name) as teamLead,"
+ " IFNULL(cte_ts.normalConsumed, 0) as normalConsumed, IFNULL(cte_ts.otConsumed, 0) as otConsumed, DATE_FORMAT(cte_ts.recordDate, '%Y-%m') as recordDate, "
+ " IFNULL(cte_ts.normalConsumed, 0) as normalConsumed, IFNULL(cte_ts.otConsumed, 0) as otConsumed, DATE_FORMAT(cte_ts.recordDate, '%Y-%m') as recordDate, "
+ " IFNULL(cte_ts.salaryPoint, 0) as salaryPoint, "
+ " IFNULL(cte_ts.salaryPoint, 0) as salaryPoint, "
+ " IFNULL(cte_ts.hourlyRate, 0) as hourlyRate, IFNULL(cte_i.sumIssuedAmount, 0) as sumIssuedAmount, IFNULL(cte_i.sumPaidAmount, 0) as sumPaidAmount,"
+ " IFNULL(cte_ts.hourlyRate, 0) as hourlyRate, IFNULL(cte_i.sumIssuedAmount, 0) as sumIssuedAmount, IFNULL(cte_i.sumPaidAmount, 0) as sumPaidAmount,"
@@ -1890,6 +1900,8 @@ open class ReportService(
+ " left join staff s on s.id = cte_ts.staffId"
+ " left join staff s on s.id = cte_ts.staffId"
+ " left join grade g on g.id = s.gradeId"
+ " left join grade g on g.id = s.gradeId"
+ " left join team t2 on t2.id = s.teamId"
+ " left join team t2 on t2.id = s.teamId"
+ " left join customer_subsidiary cs on cs.id = p.customerSubsidiaryId "
+ " left join subsidiary s2 on s2.id = cs.subsidiaryId "
+ " where p.deleted = false"
+ " where p.deleted = false"
+ " and (DATE_FORMAT(cte_ts.recordDate, \'%Y-%m\') >= :startMonth and DATE_FORMAT(cte_ts.recordDate, \'%Y-%m\') <= :endMonth)"
+ " and (DATE_FORMAT(cte_ts.recordDate, \'%Y-%m\') >= :startMonth and DATE_FORMAT(cte_ts.recordDate, \'%Y-%m\') <= :endMonth)"
+ " and p.id = :projectId"
+ " and p.id = :projectId"
@@ -1941,6 +1953,9 @@ open class ReportService(
if (info["code"] == item["code"] && "paidAmount" !in info) {
if (info["code"] == item["code"] && "paidAmount" !in info) {
info["paidAmount"] = item.getValue("sumPaidAmount")
info["paidAmount"] = item.getValue("sumPaidAmount")
}
}
if (info["code"] == item["code"] && "subsidiary" !in info) {
info["subsidiary"] = item.getValue("subsidiary")
}
if (info["description"] != item.getValue("description")) {
if (info["description"] != item.getValue("description")) {
info["description"] = item.getValue("description")
info["description"] = item.getValue("description")
}
}
@@ -2040,6 +2055,7 @@ open class ReportService(
val accountingStyle = workbook.createDataFormat().getFormat("_(* #,##0.00_);_(* (#,##0.00);_(* \"-\"??_);_(@_)")
val accountingStyle = workbook.createDataFormat().getFormat("_(* #,##0.00_);_(* (#,##0.00);_(* \"-\"??_);_(@_)")
val monthFormat = DateTimeFormatter.ofPattern("MMM yyyy", Locale.ENGLISH)
val startDate = YearMonth.parse(startMonth, DateTimeFormatter.ofPattern("yyyy-MM"))
val startDate = YearMonth.parse(startMonth, DateTimeFormatter.ofPattern("yyyy-MM"))
val convertStartMonth = YearMonth.of(startDate.year, startDate.month)
val convertStartMonth = YearMonth.of(startDate.year, startDate.month)
val endDate = YearMonth.parse(endMonth, DateTimeFormatter.ofPattern("yyyy-MM"))
val endDate = YearMonth.parse(endMonth, DateTimeFormatter.ofPattern("yyyy-MM"))
@@ -2050,15 +2066,13 @@ open class ReportService(
while (!currentDate.isAfter(endDate)) {
while (!currentDate.isAfter(endDate)) {
monthRange.add(
monthRange.add(
mapOf(
mapOf(
"display" to currentDate.month.name.substring(0, 3 ),
"display" to YearMonth.of(currentDate.year, currentDate.month).format(monthFormat ),
"date" to currentDate
"date" to currentDate
)
)
)
)
currentDate = currentDate.plusMonths(1)
currentDate = currentDate.plusMonths(1)
}
}
val monthFormat = DateTimeFormatter.ofPattern("MMM yyyy", Locale.ENGLISH)
val info: Map<String, Any> = manhoursSpent.first() { it.containsKey("info") }["info"] as Map<String, Any>
val info: Map<String, Any> = manhoursSpent.first() { it.containsKey("info") }["info"] as Map<String, Any>
val staffInfoList: List<Map<String, Any>> =
val staffInfoList: List<Map<String, Any>> =
manhoursSpent.first() { it.containsKey("staffInfoList") }["staffInfoList"] as List<Map<String, Any>>
manhoursSpent.first() { it.containsKey("staffInfoList") }["staffInfoList"] as List<Map<String, Any>>
@@ -2129,7 +2143,12 @@ open class ReportService(
rowNum = 6
rowNum = 6
val row6: Row = sheet.getRow(rowNum)
val row6: Row = sheet.getRow(rowNum)
val row6Cell = row6.getCell(1)
val row6Cell = row6.getCell(1)
row6Cell.setCellValue(info.getValue("client").toString())
val clientSubsidiary = if(info.getValue("subsidiary").toString() != "N/A"){
info.getValue("subsidiary").toString()
}else{
info.getValue("client").toString()
}
row6Cell.setCellValue(clientSubsidiary)
rowNum = 9
rowNum = 9
val row9: Row = sheet.getRow(rowNum)
val row9: Row = sheet.getRow(rowNum)