/// <summary> /// Set Product - Callout /// </summary> /// <param name="oldM_Product_ID">old value</param> /// <param name="newM_Product_ID">new value</param> /// <param name="windowNo">window</param> //@UICallout public void SetM_Product_ID(String oldM_Product_ID, String newM_Product_ID, int windowNo) { if (newM_Product_ID == null || newM_Product_ID.Length == 0) { return; } int M_Product_ID = int.Parse(newM_Product_ID); base.SetM_Product_ID(M_Product_ID); if (M_Product_ID == 0) { return; } // int M_PriceList_Version_ID = GetCtx().GetContextAsInt(windowNo, "M_PriceList_Version_ID"); if (M_PriceList_Version_ID == 0) { return; } int C_BPartner_ID = GetCtx().GetContextAsInt(windowNo, "C_BPartner_ID"); Decimal Qty = GetPlannedQty(); bool IsSOTrx = true; MProductPricing pp = new MProductPricing(GetAD_Client_ID(), GetAD_Org_ID(), M_Product_ID, C_BPartner_ID, Qty, IsSOTrx); pp.SetM_PriceList_Version_ID(M_PriceList_Version_ID); DateTime?date = GetPlannedDate(); if (date == null) { date = new DateTime(GetCtx().GetContextAsTime(windowNo, "DateContract")); } pp.SetPriceDate(date); // Decimal PriceList = pp.GetPriceList(); SetPriceList(PriceList); Decimal plannedPrice = pp.GetPriceStd(); SetPlannedPrice(plannedPrice); Decimal Discount = pp.GetDiscount(); SetDiscount(Discount); // Decimal plannedAmt = pp.GetLineAmt(GetCurPrecision()); SetPlannedAmt(plannedAmt); // //p_changeVO.setContext(GetCtx(), windowNo, "StdPrecision", pp.GetPrecision()); log.Fine("PlannedQty=" + Qty + " * PlannedPrice=" + plannedPrice + " -> PlannedAmt=" + plannedAmt); }