From b379c973ebd76b518c3e39cf6f3a6a731635463f Mon Sep 17 00:00:00 2001 From: Elaine Tan Date: Thu, 20 Feb 2014 18:54:37 +0800 Subject: [PATCH] IDEMPIERE-1765 Support print format jasper process in WPayPrint --- .../adempiere/webui/apps/form/WPayPrint.java | 41 ++++++++++++++++--- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPayPrint.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPayPrint.java index 567a58f341..f724551c7b 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPayPrint.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPayPrint.java @@ -52,7 +52,10 @@ import org.compiere.model.MLookup; import org.compiere.model.MLookupFactory; import org.compiere.model.MPaySelectionCheck; import org.compiere.model.MPaymentBatch; +import org.compiere.print.MPrintFormat; import org.compiere.print.ReportEngine; +import org.compiere.process.ProcessInfo; +import org.compiere.process.ServerProcessCtl; import org.compiere.util.DB; import org.compiere.util.DisplayType; import org.compiere.util.Env; @@ -428,9 +431,22 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene ReportEngine re = ReportEngine.get(Env.getCtx(), ReportEngine.CHECK, check.get_ID()); try { - File file = File.createTempFile("WPayPrint", null); - re.getPDF(file); - pdfList.add(file); + MPrintFormat format = re.getPrintFormat(); + if (format.getJasperProcess_ID() > 0) + { + ProcessInfo pi = new ProcessInfo("", format.getJasperProcess_ID()); + pi.setRecord_ID(check.get_ID()); + pi.setIsBatch(true); + + ServerProcessCtl.process(pi, null); + pdfList.add(pi.getPDFReport()); + } + else + { + File file = File.createTempFile("WPayPrint", null); + re.getPDF(file); + pdfList.add(file); + } } catch (Exception e) { @@ -479,9 +495,22 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene ReportEngine re = ReportEngine.get(Env.getCtx(), ReportEngine.REMITTANCE, check.get_ID()); try { - File file = File.createTempFile("WPayPrint", null); - re.getPDF(file); - pdfList.add(file); + MPrintFormat format = re.getPrintFormat(); + if (format.getJasperProcess_ID() > 0) + { + ProcessInfo pi = new ProcessInfo("", format.getJasperProcess_ID()); + pi.setRecord_ID(check.get_ID()); + pi.setIsBatch(true); + + ServerProcessCtl.process(pi, null); + pdfList.add(pi.getPDFReport()); + } + else + { + File file = File.createTempFile("WPayPrint", null); + re.getPDF(file); + pdfList.add(file); + } } catch (Exception e) {