IDEMPIERE-1765 Support print format jasper process in WPayPrint

This commit is contained in:
Elaine Tan 2014-02-20 18:54:37 +08:00
parent 6361c17201
commit b379c973eb
1 changed files with 35 additions and 6 deletions

View File

@ -52,7 +52,10 @@ import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory; import org.compiere.model.MLookupFactory;
import org.compiere.model.MPaySelectionCheck; import org.compiere.model.MPaySelectionCheck;
import org.compiere.model.MPaymentBatch; import org.compiere.model.MPaymentBatch;
import org.compiere.print.MPrintFormat;
import org.compiere.print.ReportEngine; import org.compiere.print.ReportEngine;
import org.compiere.process.ProcessInfo;
import org.compiere.process.ServerProcessCtl;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
import org.compiere.util.Env; 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()); ReportEngine re = ReportEngine.get(Env.getCtx(), ReportEngine.CHECK, check.get_ID());
try try
{ {
File file = File.createTempFile("WPayPrint", null); MPrintFormat format = re.getPrintFormat();
re.getPDF(file); if (format.getJasperProcess_ID() > 0)
pdfList.add(file); {
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) 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()); ReportEngine re = ReportEngine.get(Env.getCtx(), ReportEngine.REMITTANCE, check.get_ID());
try try
{ {
File file = File.createTempFile("WPayPrint", null); MPrintFormat format = re.getPrintFormat();
re.getPDF(file); if (format.getJasperProcess_ID() > 0)
pdfList.add(file); {
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) catch (Exception e)
{ {