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(); }
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
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?
ReplyDeleteNice Article, Thanks for your Great Information....
ReplyDeleteDevOps Training
DevOps Online Training
DevOps Training in Hyderabad
DevOps Training in Ameerpet