use of org.eevolution.process.ValuationEffectiveDate in project adempiere by adempiere.
the class CostResult method createTrxAndInventoryValuationReport.
void createTrxAndInventoryValuationReport() {
int AD_Process_ID = MProcess.getProcess_ID("Transaction Valuation", trxName);
ProcessInfo pi = new ProcessInfo("Transaction Valuation", AD_Process_ID);
MPInstance instance = new MPInstance(getCtx(), AD_Process_ID, 0);
instance.saveEx();
pi.setAD_PInstance_ID(instance.getAD_PInstance_ID());
pi.setAD_Client_ID(Env.getAD_Client_ID(getCtx()));
// Add Parameters
MPInstancePara para = new MPInstancePara(instance, 10);
para.setParameter(MCostDetail.COLUMNNAME_M_Product_ID, product.getM_Product_ID());
para.saveEx();
para = new MPInstancePara(instance, 20);
para.setParameter(MCostDetail.COLUMNNAME_M_CostType_ID, 50000);
para.saveEx();
para = new MPInstancePara(instance, 30);
para.setParameter(MCostDetail.COLUMNNAME_M_CostElement_ID, 100);
para.saveEx();
pi.setTransactionName(trxName);
//ReportCtl.startStandardReport(pi);
ReportEngine re = ReportEngine.get(getCtx(), pi);
File trxValuation = null;
trxValuation = re.getPDF();
AD_Process_ID = MProcess.getProcess_ID("Valuation Effective Date", trxName);
pi = new ProcessInfo("Valuation Effective Date", AD_Process_ID);
instance = new MPInstance(getCtx(), AD_Process_ID, 0);
instance.saveEx();
pi.setAD_PInstance_ID(instance.getAD_PInstance_ID());
pi.setAD_Client_ID(Env.getAD_Client_ID(getCtx()));
para = new MPInstancePara(instance, 10);
para.setParameter("DateValue", new Timestamp(System.currentTimeMillis()));
para.saveEx();
// Add Parameters
para = new MPInstancePara(instance, 20);
para.setParameter(MCostDetail.COLUMNNAME_M_Product_ID, product.getM_Product_ID());
para.saveEx();
para = new MPInstancePara(instance, 30);
para.setParameter(MCostDetail.COLUMNNAME_M_CostType_ID, 50000);
para.saveEx();
para = new MPInstancePara(instance, 40);
para.setParameter(MCostDetail.COLUMNNAME_M_CostElement_ID, 100);
para.saveEx();
ValuationEffectiveDate process = new ValuationEffectiveDate();
process.startProcess(getCtx(), pi, Trx.get(trxName, false));
pi.setTransactionName(trxName);
re = ReportEngine.get(getCtx(), pi);
File report = null;
report = re.getPDF();
EMail email = new EMail(getCtx(), "smtp.gmail.com", "victor.perez@e-evolution.com", "victor.perez@e-evolution.com", "Transaction and Inventory Valuation Report Test", "Transaction and Inventory Valuation " + new Timestamp(System.currentTimeMillis()));
email.addAttachment(trxValuation);
email.addAttachment(report);
email.createAuthenticator(Mail, MailPassword);
String msg = email.send();
System.out.println(msg);
}
Aggregations