Search in sources :

Example 1 with GenerateCostDetail

use of org.eevolution.process.GenerateCostDetail in project adempiere by adempiere.

the class CostResult method generateHistoryCost.

void generateHistoryCost() {
    int AD_Process_ID = MProcess.getProcess_ID("M_CostDetail Generate Cost Transaction", trxName);
    ProcessInfo pi = new ProcessInfo("Generate Cost Transaction", AD_Process_ID);
    MPInstance instance = new MPInstance(Env.getCtx(), AD_Process_ID, 0);
    instance.saveEx();
    pi.setAD_PInstance_ID(instance.getAD_PInstance_ID());
    pi.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx()));
    //	Add Parameters
    MPInstancePara para = new MPInstancePara(instance, 10);
    para.setParameter(MCostDetail.COLUMNNAME_C_AcctSchema_ID, Env.getContext(Env.getCtx(), "$C_AcctSchema_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();
    //Add Parameters
    para = new MPInstancePara(instance, 40);
    para.setParameter(MCostDetail.COLUMNNAME_M_Product_ID, product.getM_Product_ID());
    para.saveEx();
    para = new MPInstancePara(instance, 50);
    para.setParameter(MCostDetail.COLUMNNAME_DateAcct, Timestamp.valueOf("2000-01-01 00:00:00.0"));
    para.saveEx();
    GenerateCostDetail process = new GenerateCostDetail();
    process.startProcess(Env.getCtx(), pi, Trx.get(trxName, false));
}
Also used : MPInstancePara(org.compiere.model.MPInstancePara) MPInstance(org.compiere.model.MPInstance) GenerateCostDetail(org.eevolution.process.GenerateCostDetail) ProcessInfo(org.compiere.process.ProcessInfo)

Aggregations

MPInstance (org.compiere.model.MPInstance)1 MPInstancePara (org.compiere.model.MPInstancePara)1 ProcessInfo (org.compiere.process.ProcessInfo)1 GenerateCostDetail (org.eevolution.process.GenerateCostDetail)1