Tuesday, January 28, 2014

Find Sales price from Trade agreement on a Sales Quotation through code

PriceDisc_Price       priceDisc_Price;
SalesPrice                salesPriceAgreement, salesPriceItem;
SalesQuotationLine  salesQuotationLine;  

priceDisc_Price = SalesPurchLine::priceDisc_PriceCache(salesQuotationLine);
salesPriceItem = InventTableModule::find(salesQuotationLine.ItemId, ModuleInventPurchSales::Sales).Price;
salesPriceAgreement = priceDisc_Price.price();

// Check if a trade agreement exists
 if (salesQuotationLine.SalesPurchLine::priceAgreementExists(salesQuotationLine.inventDim()))
 {
         // Your code   
         salesQuotationLine.SalesPrice = salesPriceAgreement;
  }
  else
        salesQuotationLine.SalesPrice = salesPriceItem ;

That's all!

No comments:

Post a Comment