} // prepare /// <summary> /// Perform Process. /// </summary> /// <returns>Message (clear text)</returns> protected override String DoIt() { if (m_C_ProjectLine_ID == 0) { throw new ArgumentException("No Project Line"); } MProjectLine projectLine = new MProjectLine(GetCtx(), m_C_ProjectLine_ID, Get_TrxName()); log.Info("doIt - " + projectLine); if (projectLine.GetM_Product_ID() == 0) { throw new ArgumentException("No Product"); } // MProject project = new MProject(GetCtx(), projectLine.GetC_Project_ID(), Get_TrxName()); if (project.GetM_PriceList_ID() == 0) { throw new ArgumentException("No PriceList"); } // Boolean isSOTrx = true; MProductPricing pp = new MProductPricing(projectLine.GetAD_Client_ID(), projectLine.GetAD_Org_ID(), projectLine.GetM_Product_ID(), project.GetC_BPartner_ID(), projectLine.GetPlannedQty(), isSOTrx); pp.SetM_PriceList_ID(project.GetM_PriceList_ID()); //vikas mantis Issue ( 0000517) pp.SetM_PriceList_Version_ID(project.GetM_PriceList_Version_ID()); //End pp.SetPriceDate(project.GetDateContract()); // projectLine.SetPlannedPrice(pp.GetPriceStd()); //projectLine.SetPlannedMarginAmt(pp.GetPriceStd().subtract(pp.GetPriceLimit())); projectLine.SetPlannedMarginAmt(Decimal.Subtract(pp.GetPriceStd(), pp.GetPriceLimit())); projectLine.Save(); // String retValue = Msg.GetElement(GetCtx(), "PriceList") + pp.GetPriceList() + " - " + Msg.GetElement(GetCtx(), "PriceStd") + pp.GetPriceStd() + " - " + Msg.GetElement(GetCtx(), "PriceLimit") + pp.GetPriceLimit(); return(retValue); } // doIt
} // doIt /// <summary> /// Get and validate Project /// </summary> /// <param name="ctx">context</param> /// <param name="C_Project_ID">id</param> /// <param name="trxName">transaction</param> /// <returns>valid project</returns> static protected MProject GetProject(Ctx ctx, int C_Project_ID, Trx trxName) { MProject fromProject = new MProject(ctx, C_Project_ID, trxName); if (fromProject.GetC_Project_ID() == 0) { throw new ArgumentException("Project not found C_Project_ID=" + C_Project_ID); } if (fromProject.GetM_PriceList_Version_ID() == 0) { throw new ArgumentException("Project has no Price List"); } if (fromProject.GetM_Warehouse_ID() == 0) { throw new ArgumentException("Project has no Warehouse"); } if (fromProject.GetC_BPartner_ID() == 0 || fromProject.GetC_BPartner_Location_ID() == 0) { throw new ArgumentException("Project has no Business Partner/Location"); } return(fromProject); } // getProject