Showing posts with label Trade Agreement Purchase price. Show all posts
Showing posts with label Trade Agreement Purchase price. Show all posts

Sunday, 28 June 2020

Trade Agreement Purchase price in D365 AX 2012 code

Trade Agreement Purchase price in D365 AX 2012 code :

You can use the below code to find the current trade aggrement price of a given item for a Purchase order.

public static Price findPurchasePrice(ItemId _itemId, VendAccount _vendAccount, InventDimId _inventDimId, Qty _qty) { PriceDisc priceDisc; InventTable inventTable = InventTable::find(_itemId); VendTable vendTable = VendTable::find(_vendAccount); //InventDim inventDimItem = inventTable.inventItemInventSetup().inventDim(); InventDim inventDimItem = InventDim::find(_inventDimId); UnitOfMeasureSymbol unitId = inventTable.inventTableModuleInvent().UnitId; Price retPrice; priceDisc = new PriceDisc(ModuleInventPurchSales::Purch, _itemId, inventDimItem, unitId, systemDateGet(), _qty , _vendAccount); if (priceDisc.findPrice(_vendTable.PriceGroup)) retPrice = priceDisc.price(); else if (priceDisc.findItemPrice()) retPrice = priceDisc.price(); return retPrice; }

FOR SALES REPLACE PURCH WITH SALES AND VENDOR WITH CUSTOMER.....

thanks,
Vikas Mehta.

Blog Post 6: Bonus – Building Your First Custom Copilot Plugin in X++

Blog Post 6: Bonus – Building Your First Custom Copilot Plugin in X++  Introduction In our previous posts, we explored what Copilot can do o...