IDEMPIERE-335 - Send Jasper Report email

(transplanted from 5f33b56d79d04e5bba96d938c65e650e4516001a)
This commit is contained in:
Hesham S. Ahmed 2012-07-10 13:29:45 +03:00
parent fc14420374
commit 00f842dd67
4 changed files with 72 additions and 2 deletions

View File

@ -26,9 +26,12 @@ import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException; import org.adempiere.exceptions.AdempiereException;
import org.compiere.print.MPrintFormat;
import org.compiere.print.ReportEngine; import org.compiere.print.ReportEngine;
import org.compiere.process.DocAction; import org.compiere.process.DocAction;
import org.compiere.process.DocumentEngine; import org.compiere.process.DocumentEngine;
import org.compiere.process.ProcessInfo;
import org.compiere.process.ServerProcessCtl;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -616,6 +619,21 @@ public class MInOut extends X_M_InOut implements DocAction
ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.SHIPMENT, getM_InOut_ID(), get_TrxName()); ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.SHIPMENT, getM_InOut_ID(), get_TrxName());
if (re == null) if (re == null)
return null; return null;
MPrintFormat format = re.getPrintFormat();
// We have a Jasper Print Format
// ==============================
if(format.getJasperProcess_ID() > 0)
{
ProcessInfo pi = new ProcessInfo ("", format.getJasperProcess_ID());
pi.setRecord_ID ( getC_Order_ID() );
pi.setIsBatch(true);
ServerProcessCtl.process(null, pi, null);
return pi.getPDFReport();
}
// Standard Print Format (Non-Jasper)
// ==================================
return re.getPDF(file); return re.getPDF(file);
} // createPDF } // createPDF

View File

@ -30,9 +30,12 @@ import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException; import org.adempiere.exceptions.AdempiereException;
import org.adempiere.exceptions.BPartnerNoAddressException; import org.adempiere.exceptions.BPartnerNoAddressException;
import org.adempiere.exceptions.DBException; import org.adempiere.exceptions.DBException;
import org.compiere.print.MPrintFormat;
import org.compiere.print.ReportEngine; import org.compiere.print.ReportEngine;
import org.compiere.process.DocAction; import org.compiere.process.DocAction;
import org.compiere.process.DocumentEngine; import org.compiere.process.DocumentEngine;
import org.compiere.process.ProcessInfo;
import org.compiere.process.ServerProcessCtl;
import org.compiere.util.CCache; import org.compiere.util.CCache;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
@ -1272,6 +1275,21 @@ public class MInvoice extends X_C_Invoice implements DocAction
ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.INVOICE, getC_Invoice_ID(), get_TrxName()); ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.INVOICE, getC_Invoice_ID(), get_TrxName());
if (re == null) if (re == null)
return null; return null;
MPrintFormat format = re.getPrintFormat();
// We have a Jasper Print Format
// ==============================
if(format.getJasperProcess_ID() > 0)
{
ProcessInfo pi = new ProcessInfo ("", format.getJasperProcess_ID());
pi.setRecord_ID ( getC_Order_ID() );
pi.setIsBatch(true);
ServerProcessCtl.process(null, pi, null);
return pi.getPDFReport();
}
// Standard Print Format (Non-Jasper)
// ==================================
return re.getPDF(file); return re.getPDF(file);
} // createPDF } // createPDF

View File

@ -30,15 +30,16 @@ import java.util.Vector;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import javax.mail.internet.AddressException;
import org.adempiere.exceptions.AdempiereException; import org.adempiere.exceptions.AdempiereException;
import org.adempiere.exceptions.BPartnerNoBillToAddressException; import org.adempiere.exceptions.BPartnerNoBillToAddressException;
import org.adempiere.exceptions.BPartnerNoShipToAddressException; import org.adempiere.exceptions.BPartnerNoShipToAddressException;
import org.adempiere.exceptions.FillMandatoryException; import org.adempiere.exceptions.FillMandatoryException;
import org.compiere.print.MPrintFormat;
import org.compiere.print.ReportEngine; import org.compiere.print.ReportEngine;
import org.compiere.process.DocAction; import org.compiere.process.DocAction;
import org.compiere.process.DocumentEngine; import org.compiere.process.DocumentEngine;
import org.compiere.process.ProcessInfo;
import org.compiere.process.ServerProcessCtl;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
@ -618,6 +619,21 @@ public class MOrder extends X_C_Order implements DocAction
ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.ORDER, getC_Order_ID(), get_TrxName()); ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.ORDER, getC_Order_ID(), get_TrxName());
if (re == null) if (re == null)
return null; return null;
MPrintFormat format = re.getPrintFormat();
// We have a Jasper Print Format
// ==============================
if(format.getJasperProcess_ID() > 0)
{
ProcessInfo pi = new ProcessInfo ("", format.getJasperProcess_ID());
pi.setRecord_ID ( getC_Order_ID() );
pi.setIsBatch(true);
ServerProcessCtl.process(null, pi, null);
return pi.getPDFReport();
}
// Standard Print Format (Non-Jasper)
// ==================================
return re.getPDF(file); return re.getPDF(file);
} // createPDF } // createPDF

View File

@ -25,7 +25,10 @@ import java.util.ArrayList;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
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.EMail; import org.compiere.util.EMail;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -286,6 +289,21 @@ public class MRfQResponse extends X_C_RfQResponse
ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.RFQ, getC_RfQResponse_ID()); ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.RFQ, getC_RfQResponse_ID());
if (re == null) if (re == null)
return null; return null;
MPrintFormat format = re.getPrintFormat();
// We have a Jasper Print Format
// ==============================
if(format.getJasperProcess_ID() > 0)
{
ProcessInfo pi = new ProcessInfo ("", format.getJasperProcess_ID());
pi.setRecord_ID ( getC_Order_ID() );
pi.setIsBatch(true);
ServerProcessCtl.process(null, pi, null);
return pi.getPDFReport();
}
// Standard Print Format (Non-Jasper)
// ==================================
return re.getPDF(file); return re.getPDF(file);
} // getPDF } // getPDF