|
|
@@ -125,10 +125,11 @@ open class ReportService { |
|
|
|
|
|
|
|
rowIndex = 10 |
|
|
|
val actualIncome = invoices.sumOf { invoice -> invoice.paidAmount!! } |
|
|
|
val actualExpenditure = timesheets.sumOf { timesheet -> timesheet.staff!!.salary.hourlyRate.toDouble() * ((timesheet.normalConsumed ?: 0.0) + (timesheet.otConsumed ?: 0.0)) } |
|
|
|
sheet.getRow(rowIndex).apply { |
|
|
|
getCell(1).apply { |
|
|
|
// TODO: Replace by actual expenditure |
|
|
|
// setCellValue(actualIncome * 0.8) |
|
|
|
setCellValue(actualExpenditure) |
|
|
|
cellStyle.dataFormat = accountingStyle |
|
|
|
} |
|
|
|
|
|
|
@@ -153,7 +154,6 @@ open class ReportService { |
|
|
|
} |
|
|
|
|
|
|
|
// TODO: Add expenditure |
|
|
|
// formula =IF(B17>0,D16-B17,D16+C17) |
|
|
|
rowIndex = 15 |
|
|
|
val combinedResults = (invoices.map { it.receiptDate } + timesheets.map { it.recordDate }).filterNotNull().sortedBy { it } |
|
|
|
|
|
|
@@ -188,18 +188,6 @@ open class ReportService { |
|
|
|
} |
|
|
|
cellStyle.dataFormat = accountingStyle |
|
|
|
} |
|
|
|
getCell(3).apply { |
|
|
|
val lastRow = rowIndex - 1 |
|
|
|
if (lastRow == 15) { |
|
|
|
cellFormula = "C{currentRow}".replace("{currentRow}", rowIndex.toString()) |
|
|
|
} else { |
|
|
|
cellFormula = "IF(B{currentRow}>0,D{lastRow}-B{currentRow},D{lastRow}+C{currentRow})".replace( |
|
|
|
"{currentRow}", |
|
|
|
rowIndex.toString() |
|
|
|
).replace("{lastRow}", lastRow.toString()) |
|
|
|
} |
|
|
|
cellStyle.dataFormat = accountingStyle |
|
|
|
} |
|
|
|
|
|
|
|
getCell(4).apply { |
|
|
|
setCellValue(invoice.milestonePayment!!.description!!) |
|
|
|