Update Cetakan Permintaan Makanan

This commit is contained in:
akbarga 2024-08-08 13:26:48 +07:00
parent 31248cacb4
commit 19c485f717
3 changed files with 53 additions and 4 deletions

View File

@ -239,9 +239,10 @@ public class ReportingController {
public void exportPermintaanMakanan(@RequestParam("idRu") int idRu,
@RequestParam("tglAwal") String tglAwal,
@RequestParam("tglAkhir") String tglAkhir,
@RequestParam("tglLayanan") String tglLayanan,
@RequestParam(value = "jenisDiet", required = false, defaultValue = "") String jenisDiet, ModelAndView mv,
HttpServletRequest req, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService.printPdfPermintaanMakanan(idRu, tglAwal, tglAkhir, jenisDiet);
JasperPrint jasperPrint = this.reportingService.printPdfPermintaanMakanan(idRu, tglAwal, tglAkhir, jenisDiet, tglLayanan);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@ -287,4 +288,14 @@ public class ReportingController {
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@RequestMapping(value = {"/lap-amprahan-tindakan"}, method = {RequestMethod.GET})
public void exportAmprahanTindakan(@RequestParam("idRu") int idRu,
@RequestParam("tglAwal") String tglAwal,
@RequestParam("tglAkhir") String tglAkhir, ModelAndView mv,
HttpServletRequest req, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService.printPdfAmprahanTindakan(idRu, tglAwal, tglAkhir);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
}

View File

@ -21,6 +21,7 @@ import javax.print.attribute.standard.MediaSizeName;
import javax.print.attribute.standard.OrientationRequested;
import javax.print.attribute.standard.PrinterName;
import java.sql.Connection;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@ -287,7 +288,7 @@ public class ReportingDao {
return null;
}
public JasperPrint exportPdfPermintaanMakanan(int idRu, String tglAwal, String tglAkhir, String jenisDiet) {
public JasperPrint exportPdfPermintaanMakanan(int idRu, String tglAwal, String tglAkhir, String jenisDiet, String tglLayanan) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = jasperDirPath + "pl_permintaan_makan.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
@ -296,6 +297,7 @@ public class ReportingDao {
parameters.put("tglAwal", tglAwal);
parameters.put("tglAkhir", tglAkhir);
parameters.put("jenisDiet", jenisDiet);
parameters.put("tglLayanan", tglLayanan);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var17) {
LOG.error("Exception at exportPdfPermintaanMakanan");
@ -375,4 +377,20 @@ public class ReportingDao {
}
return null;
}
public JasperPrint exportPdfAmprahanTindakan(int idRu, Date tglAwal, Date tglAkhir) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = jasperDirPath + "laporan_tindakanAmp.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("idRu", idRu);
parameters.put("tglAwal", tglAwal);
parameters.put("tglAkhir", tglAkhir);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var17) {
LOG.error("Exception at exportPdfAmprahanTindakan");
LOG.error(ReportingDao.class, var17);
}
return null;
}
}

View File

@ -3,11 +3,18 @@ package com.reporting.service;
import com.reporting.dao.ReportingDao;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperPrint;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
@Service
public class ReportingService {
private static final Logger log = LoggerFactory.getLogger(ReportingService.class);
@Autowired
private ReportingDao reportingDao;
@ -76,8 +83,8 @@ public class ReportingService {
return this.reportingDao.exportPdfRekapPenjaminByRanap(tglAwal, tglAkhir, idDept, kelompokPasien);
}
public JasperPrint printPdfPermintaanMakanan(int idRu, String tglAwal, String tglAkhir, String jenisDiet) {
return this.reportingDao.exportPdfPermintaanMakanan(idRu, tglAwal, tglAkhir, jenisDiet);
public JasperPrint printPdfPermintaanMakanan(int idRu, String tglAwal, String tglAkhir, String jenisDiet, String tglLayanan) {
return this.reportingDao.exportPdfPermintaanMakanan(idRu, tglAwal, tglAkhir, jenisDiet, tglLayanan);
}
public JasperPrint printPdfRekapMakanan(int idRu, String tglAwal, String tglAkhir) {
@ -99,4 +106,17 @@ public class ReportingService {
public JasperPrint exportPdfSummaryList(String nocm) {
return this.reportingDao.exportPdfSummaryList(nocm);
}
public JasperPrint printPdfAmprahanTindakan(int idRu, String tglAwal, String tglAkhir) {
try {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date parse = formatter.parse(tglAwal);
Date parse2 = formatter.parse(tglAkhir);
return this.reportingDao.exportPdfAmprahanTindakan(idRu, parse, parse2);
} catch (ParseException e) {
log.error(e.getMessage());
return null;
}
}
}