Saturday, 3 November 2018

Find Price Disc (Trade Agreements) in D365O

Previously in Ax 2012 if you have to find the Price disc for Trade agreement, you can use the code as listed in the below link:

https://robscode.onl/x-find-price-disc-trade-agreements-2/

But in D365O, there is slighter change as below:

In Ax 2012, the PriceDisc class can be initialized using new() as below:

priceDisc = new PriceDisc(ModuleInventPurchSales::Purch, _itemId, inventDimItem, unitId, systemDateGet(), _qty , _vendAccount);

But this new() is deprecated in D365O, so for this use the below code for initialization of PriceDisc class:

PriceDiscParameters parameters = PriceDiscParameters::construct(); parameters.parmModuleType(ModuleInventPurchSales::Purch); parameters.parmItemId(inventTable.ItemId); parameters.parmInventDim(inventDimItem); parameters.parmUnitID( unitId); parameters.parmPriceDiscDate(systemDateGet()); parameters.parmQty(50); parameters.parmAccountNum(vendTable.AccountNum); parameters.parmCurrencyCode(vendTable.Currency); priceDisc = PriceDisc::newFromPriceDiscParameters(parameters);

// From Trade agreement
if (priceDisc.findPrice(vendTable.PriceGroup)) { retPrice = priceDisc.price(); }
// From Item else if (priceDisc.findItemPrice()) { retPrice = priceDisc.price(); }


Best Regards
Pranav

2 comments:

  1. Hi Pranav, nice example. But price and discount is only half the total price. What about Markup? How do you find the markup for item/vendor?

    ReplyDelete

Insert/Update or remove the default dimension value in D365 FSCM via x++

Use below method to insert/update the dimension values, just pass the parameter values to the method and it will return the updated value: p...