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;
@ -427,11 +430,24 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
// ReportCtrl will check BankAccountDoc for PrintFormat // ReportCtrl will check BankAccountDoc for PrintFormat
ReportEngine re = ReportEngine.get(Env.getCtx(), ReportEngine.CHECK, check.get_ID()); ReportEngine re = ReportEngine.get(Env.getCtx(), ReportEngine.CHECK, check.get_ID());
try try
{
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); File file = File.createTempFile("WPayPrint", null);
re.getPDF(file); re.getPDF(file);
pdfList.add(file); pdfList.add(file);
} }
}
catch (Exception e) catch (Exception e)
{ {
log.log(Level.SEVERE, e.getLocalizedMessage(), e); log.log(Level.SEVERE, e.getLocalizedMessage(), e);
@ -478,11 +494,24 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene
MPaySelectionCheck check = m_checks[i]; MPaySelectionCheck check = m_checks[i];
ReportEngine re = ReportEngine.get(Env.getCtx(), ReportEngine.REMITTANCE, check.get_ID()); ReportEngine re = ReportEngine.get(Env.getCtx(), ReportEngine.REMITTANCE, check.get_ID());
try try
{
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); File file = File.createTempFile("WPayPrint", null);
re.getPDF(file); re.getPDF(file);
pdfList.add(file); pdfList.add(file);
} }
}
catch (Exception e) catch (Exception e)
{ {
log.log(Level.SEVERE, e.getLocalizedMessage(), e); log.log(Level.SEVERE, e.getLocalizedMessage(), e);