Release Bukti Layanan Farmasi

This commit is contained in:
Kals1um 2025-01-03 16:09:58 +07:00
parent 1e2edb31ee
commit 19844ed0c7
3 changed files with 44 additions and 0 deletions

View File

@ -325,5 +325,13 @@ public class ReportingController {
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@RequestMapping(value = {"/bukti-layanan-farmasi/{norec}"}, method = {RequestMethod.GET})
public void exportPdfBuktiLayanan(@PathVariable("norec") String norec,
@RequestParam(value = "jenisbukti", required = false) String jenisbukti,
ModelAndView mv, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService.exportPdfBuktiLayanan(norec, jenisbukti);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
}

View File

@ -522,4 +522,32 @@ public class ReportingDao {
return null;
}
public JasperPrint exportPdfBuktiLayanan(String norec) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = jasperDirPath + "bukti_layanan.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("norec", norec);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var17) {
LOG.error("Exception at exportPdfBuktiLayanan");
LOG.error(ReportingDao.class, var17);
}
return null;
}
public JasperPrint exportPdfBuktiNoLayanFarmasi(String norec) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = jasperDirPath + "bukti_nonlayanan_farmasi.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("norec", norec);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var17) {
LOG.error("Exception at exportPdfBuktiNoLayanFarmasi");
LOG.error(ReportingDao.class, var17);
}
return null;
}
}

View File

@ -147,4 +147,12 @@ public class ReportingService {
return this.reportingDao.exportPdfSppb(norec);
}
public JasperPrint exportPdfBuktiLayanan(String norec, String jenisbukti) {
if (Objects.equals(jenisbukti, "NONLAYANAN")){
return this.reportingDao.exportPdfBuktiNoLayanFarmasi(norec);
} else {
return this.reportingDao.exportPdfBuktiLayanan(norec);
}
}
}