update trease
This commit is contained in:
parent
43a2bb8443
commit
55e4b26911
@ -1806,4 +1806,48 @@ public class ReportingController {
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/trease-hasil"}, method = {RequestMethod.GET})
|
||||
public void handleLpTreaseHasil(
|
||||
@RequestParam("norec") String norec,
|
||||
@RequestParam(value = "format", required = false, defaultValue = "pdf") String format,
|
||||
@RequestParam(value = "mode", required = false, defaultValue = "download") String mode,
|
||||
HttpServletResponse response) throws Exception {
|
||||
|
||||
JasperPrint jasperPrint = null;
|
||||
try {
|
||||
// Generate report (common for both PDF/Excel)
|
||||
jasperPrint = this.reportingService.exportLpTreaseHasil(norec);
|
||||
|
||||
if ("excel".equalsIgnoreCase(format)) {
|
||||
// Handle Excel export
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=Trease_Hasil.xlsx");
|
||||
|
||||
JRXlsxExporter exporter = new JRXlsxExporter();
|
||||
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
|
||||
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(response.getOutputStream()));
|
||||
SimpleXlsxReportConfiguration config = new SimpleXlsxReportConfiguration();
|
||||
config.setOnePagePerSheet(false);
|
||||
config.setDetectCellType(true);
|
||||
config.setCollapseRowSpan(false);
|
||||
config.setRemoveEmptySpaceBetweenRows(true);
|
||||
config.setWhitePageBackground(false);
|
||||
exporter.setConfiguration(config);
|
||||
exporter.exportReport();
|
||||
|
||||
} else {
|
||||
// Handle PDF preview
|
||||
response.setContentType("application/pdf");
|
||||
response.setHeader("Content-Disposition", "inline; filename=Trease_Hasil.pdf");
|
||||
|
||||
JRPdfExporter exporter = new JRPdfExporter();
|
||||
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
|
||||
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(response.getOutputStream()));
|
||||
exporter.exportReport();
|
||||
}
|
||||
} finally {
|
||||
jasperPrint = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1442,4 +1442,18 @@ public class ReportingDao {
|
||||
return null;
|
||||
}
|
||||
|
||||
public JasperPrint exportLpTreaseHasil(String norec) {
|
||||
try (Connection conn = this.jdbcTemplate4.getDataSource().getConnection()) {
|
||||
String path = jasperDirPath + "trease_hasil.jrxml";
|
||||
JasperReport jasperReport = JasperCompileManager.compileReport(path);
|
||||
Map<String, Object> parameters = new HashMap<>();
|
||||
parameters.put("norec", norec);
|
||||
return JasperFillManager.fillReport(jasperReport, parameters, conn);
|
||||
} catch (Exception var15) {
|
||||
LOG.error("Exception at exportLpTreaseHasil");
|
||||
LOG.error(ReportingDao.class, var15);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -475,7 +475,7 @@ public class ReportingService {
|
||||
}
|
||||
|
||||
public JasperPrint exportLpPasienPulang(String tglAwal, String tglAkhir, Integer unitKerja, Integer idruangan, String printBy) {
|
||||
log.info("Starting exportLpPendapatanPoli with tglAwal: {}, tglAkhir: {}, unitKerja: {}, idruangan: {}, printBy: {}", tglAwal, tglAkhir, unitKerja, idruangan, printBy);
|
||||
log.info("Starting exportLpPasienPulang with tglAwal: {}, tglAkhir: {}, unitKerja: {}, idruangan: {}, printBy: {}", tglAwal, tglAkhir, unitKerja, idruangan, printBy);
|
||||
try {
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
Timestamp parse = new Timestamp(formatter.parse(tglAwal).getTime());
|
||||
@ -501,7 +501,7 @@ public class ReportingService {
|
||||
}
|
||||
|
||||
public JasperPrint exportLpPendapatanRuangan(String tglAwal, String tglAkhir, Integer idUnit, String printBy) {
|
||||
log.info("Starting exportLpPenjualanKaryawan with tglAwal: {}, tglAkhir: {}, idUnit: {}, printBy: {}", tglAwal, tglAkhir, idUnit, printBy);
|
||||
log.info("Starting exportLpPendapatanRuangan with tglAwal: {}, tglAkhir: {}, idUnit: {}, printBy: {}", tglAwal, tglAkhir, idUnit, printBy);
|
||||
try {
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
Timestamp parse = new Timestamp(formatter.parse(tglAwal).getTime());
|
||||
@ -513,4 +513,9 @@ public class ReportingService {
|
||||
}
|
||||
}
|
||||
|
||||
public JasperPrint exportLpTreaseHasil(String norec) {
|
||||
log.info("Starting exportLpTreaseHasil with norec: {}", norec);
|
||||
return this.reportingDao.exportLpTreaseHasil(norec);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user