|
@@ -822,9 +822,12 @@ open class ReportService( |
|
|
it.staff.staffId == timesheet.staff?.staffId && it.date.year == timesheet.recordDate?.year && it.date.month == timesheet.recordDate?.month |
|
|
it.staff.staffId == timesheet.staff?.staffId && it.date.year == timesheet.recordDate?.year && it.date.month == timesheet.recordDate?.month |
|
|
}?.hourlyRate ?: 0.0) * ((timesheet.normalConsumed ?: 0.0) + (timesheet.otConsumed ?: 0.0)) |
|
|
}?.hourlyRate ?: 0.0) * ((timesheet.normalConsumed ?: 0.0) + (timesheet.otConsumed ?: 0.0)) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
val sumProjectExpense = projectExpenses.sumOf { it.amount?: 0.0 } |
|
|
|
|
|
|
|
|
sheet.getRow(rowIndex).apply { |
|
|
sheet.getRow(rowIndex).apply { |
|
|
createCell(1).apply { |
|
|
createCell(1).apply { |
|
|
setCellValue(actualExpenditure) |
|
|
|
|
|
|
|
|
setCellValue(actualExpenditure + sumProjectExpense) |
|
|
cellStyle.dataFormat = accountingStyle |
|
|
cellStyle.dataFormat = accountingStyle |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -899,8 +902,8 @@ open class ReportService( |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
println("grouped Project Expense") |
|
|
|
|
|
println(groupedProjectExpense) |
|
|
|
|
|
|
|
|
// println("grouped Project Expense") |
|
|
|
|
|
// println(groupedProjectExpense) |
|
|
// groupedTimesheets.entries.forEach { (key, value) -> |
|
|
// groupedTimesheets.entries.forEach { (key, value) -> |
|
|
// logger.info("key: $key") |
|
|
// logger.info("key: $key") |
|
|
// logger.info("value: " + value.sumOf { it }) |
|
|
// logger.info("value: " + value.sumOf { it }) |
|
@@ -932,18 +935,23 @@ open class ReportService( |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
createCell(2).apply { |
|
|
createCell(2).apply { |
|
|
setCellValue(invoice["paidAmount"] as Double? ?: 0.0) |
|
|
|
|
|
|
|
|
setCellValue(0.0) |
|
|
cellStyle.dataFormat = accountingStyle |
|
|
cellStyle.dataFormat = accountingStyle |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
createCell(3).apply { |
|
|
createCell(3).apply { |
|
|
|
|
|
setCellValue(invoice["paidAmount"] as Double? ?: 0.0) |
|
|
|
|
|
cellStyle.dataFormat = accountingStyle |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
createCell(4).apply { |
|
|
val lastRow = rowIndex - 1 |
|
|
val lastRow = rowIndex - 1 |
|
|
if (lastRow == 16) { |
|
|
if (lastRow == 16) { |
|
|
cellFormula = |
|
|
cellFormula = |
|
|
"C{currentRow}-B{currentRow}".replace("{currentRow}", rowIndex.toString()) |
|
|
"C{currentRow}-B{currentRow}".replace("{currentRow}", rowIndex.toString()) |
|
|
} else { |
|
|
} else { |
|
|
cellFormula = |
|
|
cellFormula = |
|
|
"IF(B{currentRow}>0,D{lastRow}-B{currentRow},D{lastRow}+C{currentRow})".replace( |
|
|
|
|
|
|
|
|
"IF(B{currentRow}>0,E{lastRow}-B{currentRow}-C{currentRow},E{lastRow}+D{currentRow}-C{currentRow})".replace( |
|
|
"{currentRow}", |
|
|
"{currentRow}", |
|
|
rowIndex.toString() |
|
|
rowIndex.toString() |
|
|
).replace("{lastRow}", lastRow.toString()) |
|
|
).replace("{lastRow}", lastRow.toString()) |
|
@@ -951,7 +959,7 @@ open class ReportService( |
|
|
cellStyle.dataFormat = accountingStyle |
|
|
cellStyle.dataFormat = accountingStyle |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
createCell(4)?.apply { |
|
|
|
|
|
|
|
|
createCell(5)?.apply { |
|
|
setCellValue( |
|
|
setCellValue( |
|
|
"Invoice Receipt: " + (invoice["invoiceNo"] as String? ?: "N/A").toString() |
|
|
"Invoice Receipt: " + (invoice["invoiceNo"] as String? ?: "N/A").toString() |
|
|
) |
|
|
) |
|
@@ -971,18 +979,23 @@ open class ReportService( |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
createCell(2).apply { |
|
|
createCell(2).apply { |
|
|
setCellValue(groupedInvoices[result]?.sumOf { it["paidAmount"] as Double } ?: 0.0) |
|
|
|
|
|
|
|
|
setCellValue(0.0) |
|
|
cellStyle.dataFormat = accountingStyle |
|
|
cellStyle.dataFormat = accountingStyle |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
createCell(3).apply { |
|
|
createCell(3).apply { |
|
|
|
|
|
setCellValue(groupedInvoices[result]?.sumOf { it["paidAmount"] as Double } ?: 0.0) |
|
|
|
|
|
cellStyle.dataFormat = accountingStyle |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
createCell(4).apply { |
|
|
val lastRow = rowIndex - 1 |
|
|
val lastRow = rowIndex - 1 |
|
|
if (lastRow == 16) { |
|
|
if (lastRow == 16) { |
|
|
cellFormula = |
|
|
cellFormula = |
|
|
"C{currentRow}-B{currentRow}".replace("{currentRow}", rowIndex.toString()) |
|
|
"C{currentRow}-B{currentRow}".replace("{currentRow}", rowIndex.toString()) |
|
|
} else { |
|
|
} else { |
|
|
cellFormula = |
|
|
cellFormula = |
|
|
"IF(B{currentRow}>0,D{lastRow}-B{currentRow},D{lastRow}+C{currentRow})".replace( |
|
|
|
|
|
|
|
|
"IF(B{currentRow}>0,E{lastRow}-B{currentRow}-C{currentRow},E{lastRow}+D{currentRow}-C{currentRow})".replace( |
|
|
"{currentRow}", |
|
|
"{currentRow}", |
|
|
rowIndex.toString() |
|
|
rowIndex.toString() |
|
|
).replace("{lastRow}", lastRow.toString()) |
|
|
).replace("{lastRow}", lastRow.toString()) |
|
@@ -990,7 +1003,7 @@ open class ReportService( |
|
|
cellStyle.dataFormat = accountingStyle |
|
|
cellStyle.dataFormat = accountingStyle |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
createCell(4)?.apply { |
|
|
|
|
|
|
|
|
createCell(5)?.apply { |
|
|
// setCellValue(invoice["description"].toString()) |
|
|
// setCellValue(invoice["description"].toString()) |
|
|
val invoiceNos = groupedInvoices[result]?.map { it["invoiceNo"] } |
|
|
val invoiceNos = groupedInvoices[result]?.map { it["invoiceNo"] } |
|
|
if (invoiceNos?.size != null && invoiceNos.size > 1) { |
|
|
if (invoiceNos?.size != null && invoiceNos.size > 1) { |
|
@@ -1023,12 +1036,17 @@ open class ReportService( |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
createCell(3).apply { |
|
|
createCell(3).apply { |
|
|
|
|
|
setCellValue(0.0) |
|
|
|
|
|
cellStyle.dataFormat = accountingStyle |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
createCell(4).apply { |
|
|
val lastRow = rowIndex - 1 |
|
|
val lastRow = rowIndex - 1 |
|
|
if (lastRow == 16) { |
|
|
if (lastRow == 16) { |
|
|
cellFormula = "C{currentRow}-B{currentRow}".replace("{currentRow}", rowIndex.toString()) |
|
|
cellFormula = "C{currentRow}-B{currentRow}".replace("{currentRow}", rowIndex.toString()) |
|
|
} else { |
|
|
} else { |
|
|
cellFormula = |
|
|
cellFormula = |
|
|
"IF(B{currentRow}>0,D{lastRow}-B{currentRow},D{lastRow}+C{currentRow})".replace( |
|
|
|
|
|
|
|
|
"IF(B{currentRow}>0,E{lastRow}-B{currentRow}-C{currentRow},E{lastRow}+D{currentRow}-C{currentRow})".replace( |
|
|
"{currentRow}", |
|
|
"{currentRow}", |
|
|
rowIndex.toString() |
|
|
rowIndex.toString() |
|
|
).replace("{lastRow}", lastRow.toString()) |
|
|
).replace("{lastRow}", lastRow.toString()) |
|
@@ -1036,12 +1054,13 @@ open class ReportService( |
|
|
cellStyle.dataFormat = accountingStyle |
|
|
cellStyle.dataFormat = accountingStyle |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
createCell(4).apply { |
|
|
|
|
|
|
|
|
createCell(5).apply { |
|
|
setCellValue("Manpower Expenditure") |
|
|
setCellValue("Manpower Expenditure") |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
conditionalFormattingNegative(sheet) |
|
|
conditionalFormattingNegative(sheet) |
|
|