Exemplo n.º 1
0
        }       //	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