| @@ -25,9 +25,11 @@ open class TaskTemplate : IdEntity<Long>() { | |||||
| @JsonManagedReference | @JsonManagedReference | ||||
| @OneToMany(mappedBy = "taskTemplate", cascade = [CascadeType.ALL], orphanRemoval = true) | @OneToMany(mappedBy = "taskTemplate", cascade = [CascadeType.ALL], orphanRemoval = true) | ||||
| @OrderBy | |||||
| open var gradeAllocations: MutableSet<TaskTemplateGradeAllocation> = mutableSetOf() | open var gradeAllocations: MutableSet<TaskTemplateGradeAllocation> = mutableSetOf() | ||||
| @JsonManagedReference | @JsonManagedReference | ||||
| @OneToMany(mappedBy = "taskTemplate", cascade = [CascadeType.ALL], orphanRemoval = true) | @OneToMany(mappedBy = "taskTemplate", cascade = [CascadeType.ALL], orphanRemoval = true) | ||||
| @OrderBy | |||||
| open var groupAllocations: MutableSet<TaskTemplateGroupAllocation> = mutableSetOf() | open var groupAllocations: MutableSet<TaskTemplateGroupAllocation> = mutableSetOf() | ||||
| } | } | ||||
| @@ -125,10 +125,11 @@ open class ReportService { | |||||
| rowIndex = 10 | rowIndex = 10 | ||||
| val actualIncome = invoices.sumOf { invoice -> invoice.paidAmount!! } | 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 { | sheet.getRow(rowIndex).apply { | ||||
| getCell(1).apply { | getCell(1).apply { | ||||
| // TODO: Replace by actual expenditure | // TODO: Replace by actual expenditure | ||||
| // setCellValue(actualIncome * 0.8) | |||||
| setCellValue(actualExpenditure) | |||||
| cellStyle.dataFormat = accountingStyle | cellStyle.dataFormat = accountingStyle | ||||
| } | } | ||||
| @@ -153,7 +154,6 @@ open class ReportService { | |||||
| } | } | ||||
| // TODO: Add expenditure | // TODO: Add expenditure | ||||
| // formula =IF(B17>0,D16-B17,D16+C17) | |||||
| rowIndex = 15 | rowIndex = 15 | ||||
| val combinedResults = (invoices.map { it.receiptDate } + timesheets.map { it.recordDate }).filterNotNull().sortedBy { it } | val combinedResults = (invoices.map { it.receiptDate } + timesheets.map { it.recordDate }).filterNotNull().sortedBy { it } | ||||
| @@ -188,18 +188,6 @@ open class ReportService { | |||||
| } | } | ||||
| cellStyle.dataFormat = accountingStyle | 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 { | getCell(4).apply { | ||||
| setCellValue(invoice.milestonePayment!!.description!!) | setCellValue(invoice.milestonePayment!!.description!!) | ||||
| @@ -2,10 +2,7 @@ package com.ffii.tsms.modules.timesheet.entity; | |||||
| import com.ffii.core.support.AbstractRepository | import com.ffii.core.support.AbstractRepository | ||||
| import com.ffii.tsms.modules.data.entity.Staff | import com.ffii.tsms.modules.data.entity.Staff | ||||
| import com.ffii.tsms.modules.data.entity.projections.StaffSearchInfo | |||||
| import com.ffii.tsms.modules.project.entity.Project | import com.ffii.tsms.modules.project.entity.Project | ||||
| import com.ffii.tsms.modules.project.entity.StaffAllocation | |||||
| import com.ffii.tsms.modules.timesheet.entity.projections.MonthlyHours | |||||
| import com.ffii.tsms.modules.timesheet.entity.projections.TimesheetHours | import com.ffii.tsms.modules.timesheet.entity.projections.TimesheetHours | ||||
| import com.ffii.tsms.modules.project.entity.ProjectTask | import com.ffii.tsms.modules.project.entity.ProjectTask | ||||
| import org.springframework.data.jpa.repository.Query | import org.springframework.data.jpa.repository.Query | ||||