|
|
@@ -103,10 +103,11 @@ open class ReportService( |
|
|
|
fun generateProjectCashFlowReport( |
|
|
|
project: Project, |
|
|
|
invoices: List<Invoice>, |
|
|
|
timesheets: List<Timesheet> |
|
|
|
timesheets: List<Timesheet>, |
|
|
|
dateType: String |
|
|
|
): ByteArray { |
|
|
|
// Generate the Excel report with query results |
|
|
|
val workbook: Workbook = createProjectCashFlowReport(project, invoices, timesheets, PROJECT_CASH_FLOW_REPORT) |
|
|
|
val workbook: Workbook = createProjectCashFlowReport(project, invoices, timesheets, dateType, PROJECT_CASH_FLOW_REPORT) |
|
|
|
|
|
|
|
// Write the workbook to a ByteArrayOutputStream |
|
|
|
val outputStream: ByteArrayOutputStream = ByteArrayOutputStream() |
|
|
@@ -487,6 +488,7 @@ open class ReportService( |
|
|
|
project: Project, |
|
|
|
invoices: List<Invoice>, |
|
|
|
timesheets: List<Timesheet>, |
|
|
|
dateType: String, |
|
|
|
templatePath: String, |
|
|
|
): Workbook { |
|
|
|
// please create a new function for each report template |
|
|
@@ -572,7 +574,7 @@ open class ReportService( |
|
|
|
rowIndex = 15 |
|
|
|
|
|
|
|
|
|
|
|
val dateFormatter = DateTimeFormatter.ofPattern("MMM YYYY") |
|
|
|
val dateFormatter = if (dateType == "Date") DateTimeFormatter.ofPattern("yyyy/MM/dd") else DateTimeFormatter.ofPattern("MMM YYYY") |
|
|
|
val combinedResults = |
|
|
|
(invoices.map { it.receiptDate } + timesheets.map { it.recordDate }).filterNotNull().sortedBy { it } |
|
|
|
.map { it.format(dateFormatter) }.distinct() |
|
|
|