|
|
|
@@ -269,8 +269,6 @@ class ReportController( |
|
|
|
@RequestParam(required = false) lastOutDateEnd: String? |
|
|
|
): ResponseEntity<ByteArray> { |
|
|
|
val parameters = mutableMapOf<String, Any>() |
|
|
|
|
|
|
|
// Set report header parameters |
|
|
|
parameters["stockCategory"] = stockCategory ?: "All" |
|
|
|
parameters["itemNo"] = itemCode ?: "All" |
|
|
|
parameters["reportDate"] = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
|
|
|
@@ -282,7 +280,7 @@ class ReportController( |
|
|
|
parameters["lastInDateEnd"] = lastInDateEnd ?: "" |
|
|
|
parameters["lastOutDateStart"] = lastOutDateStart ?: "" |
|
|
|
parameters["lastOutDateEnd"] = lastOutDateEnd ?: "" |
|
|
|
|
|
|
|
|
|
|
|
val dbData = reportService.searchStockBalanceReport( |
|
|
|
stockCategory, |
|
|
|
itemCode, |
|
|
|
@@ -294,20 +292,20 @@ class ReportController( |
|
|
|
lastOutDateStart, |
|
|
|
lastOutDateEnd |
|
|
|
) |
|
|
|
|
|
|
|
val pdfBytes = reportService.createPdfResponse( |
|
|
|
"/jasper/StockBalanceReport.jrxml", |
|
|
|
parameters, |
|
|
|
|
|
|
|
val excelBytes = reportService.createExcelResponse( |
|
|
|
"/jasper/StockBalanceReport.jrxml", |
|
|
|
parameters, |
|
|
|
dbData |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
val headers = HttpHeaders().apply { |
|
|
|
contentType = MediaType.APPLICATION_PDF |
|
|
|
setContentDispositionFormData("attachment", "StockBalanceReport.pdf") |
|
|
|
set("filename", "StockBalanceReport.pdf") |
|
|
|
contentType = MediaType.parseMediaType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") |
|
|
|
setContentDispositionFormData("attachment", "StockBalanceReport.xlsx") |
|
|
|
set("filename", "StockBalanceReport.xlsx") |
|
|
|
} |
|
|
|
|
|
|
|
return ResponseEntity(pdfBytes, headers, HttpStatus.OK) |
|
|
|
|
|
|
|
return ResponseEntity(excelBytes, headers, HttpStatus.OK) |
|
|
|
} |
|
|
|
|
|
|
|
} |