|
|
@@ -23,11 +23,22 @@ open class ReportService { |
|
|
|
private val DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy/MM/dd") |
|
|
|
private val FORMATTED_TODAY = LocalDate.now().format(DATE_FORMATTER) |
|
|
|
|
|
|
|
private val FINANCIAL_STATUS_REPORT = "templates/report/EX01_Financial Status Report.xlsx" |
|
|
|
private val PROJECT_CASH_FLOW_REPORT = "templates/report/EX02_Project Cash Flow Report.xlsx" |
|
|
|
private val MONTHLY_WORK_HOURS_ANALYSIS_REPORT = "templates/report/AR08_Monthly Work Hours Analysis Report.xlsx" |
|
|
|
private val SALART_LIST_TEMPLATE = "templates/report/Salary Template.xlsx" |
|
|
|
|
|
|
|
// ==============================|| GENERATE REPORT ||============================== // |
|
|
|
|
|
|
|
fun genFinancialStatusReport(): ByteArray { |
|
|
|
val workbook: Workbook = createFinancialStatusReport(FINANCIAL_STATUS_REPORT) |
|
|
|
|
|
|
|
val outputStream: ByteArrayOutputStream = ByteArrayOutputStream() |
|
|
|
workbook.write(outputStream) |
|
|
|
workbook.close() |
|
|
|
|
|
|
|
return outputStream.toByteArray() |
|
|
|
} |
|
|
|
@Throws(IOException::class) |
|
|
|
fun generateProjectCashFlowReport(project: Project, invoices: List<Invoice>, timesheets: List<Timesheet>): ByteArray { |
|
|
|
// Generate the Excel report with query results |
|
|
@@ -68,6 +79,18 @@ open class ReportService { |
|
|
|
} |
|
|
|
|
|
|
|
// ==============================|| CREATE REPORT ||============================== // |
|
|
|
|
|
|
|
// EX01 Financial Report |
|
|
|
private fun createFinancialStatusReport( |
|
|
|
templatePath: String, |
|
|
|
) : Workbook { |
|
|
|
val resource = ClassPathResource(templatePath) |
|
|
|
val templateInputStream = resource.inputStream |
|
|
|
val workbook: Workbook = XSSFWorkbook(templateInputStream) |
|
|
|
|
|
|
|
return workbook |
|
|
|
} |
|
|
|
|
|
|
|
@Throws(IOException::class) |
|
|
|
private fun createProjectCashFlowReport( |
|
|
|
project: Project, |
|
|
|