/// <summary>
        /// Get Limit Price if exists
        /// </summary>
        /// <returns>limit</returns>
        public Decimal GetLimitPrice()
        {
            Decimal limitPrice = GetPlannedPrice();

            if (GetM_Product_ID() == 0)
            {
                return(limitPrice);
            }
            if (GetProject() == null)
            {
                return(limitPrice);
            }
            bool            isSOTrx = true;
            MProduct        prd     = new MProduct(GetCtx(), GetM_Product_ID(), null);
            MProductPricing pp      = new MProductPricing(GetAD_Client_ID(), GetAD_Org_ID(),
                                                          GetM_Product_ID(), _parent.GetC_BPartner_ID(), GetPlannedQty(), isSOTrx);

            pp.SetM_PriceList_ID(_parent.GetM_PriceList_ID());
            pp.SetM_PriceList_Version_ID(_parent.GetM_PriceList_Version_ID());

            // Get Price according to Attribute set instance if selected on Project line
            if (Get_ColumnIndex("M_AttributeSetInstance_ID") >= 0)
            {
                pp.SetM_AttributeSetInstance_ID(GetM_AttributeSetInstance_ID());
            }

            pp.SetC_UOM_ID(prd.GetC_UOM_ID());
            if (pp.CalculatePrice())
            {
                limitPrice = pp.GetPriceLimit();
            }
            return(limitPrice);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get Limit Price if exists
        /// </summary>
        /// <returns>limit</returns>
        public Decimal GetLimitPrice()
        {
            Decimal limitPrice = GetPlannedPrice();

            if (GetM_Product_ID() == 0)
            {
                return(limitPrice);
            }
            if (GetProject() == null)
            {
                return(limitPrice);
            }
            bool            isSOTrx = true;
            MProduct        prd     = new MProduct(GetCtx(), GetM_Product_ID(), null);
            MProductPricing pp      = new MProductPricing(GetAD_Client_ID(), GetAD_Org_ID(),
                                                          GetM_Product_ID(), _parent.GetC_BPartner_ID(), GetPlannedQty(), isSOTrx);

            pp.SetM_PriceList_ID(_parent.GetM_PriceList_ID());
            pp.SetM_PriceList_Version_ID(_parent.GetM_PriceList_Version_ID());
            pp.SetC_UOM_ID(prd.GetC_UOM_ID());
            if (pp.CalculatePrice())
            {
                limitPrice = pp.GetPriceLimit();
            }
            return(limitPrice);
        }