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.

No comments:

Post a Comment

AZURE INTERVIEW QUESTIONS AND ANSWERS

AZURE INTERVIEW QUESTIONS AND ANSWERES 2021 2. What is cloud computing? Explanation:  It is the use of servers on the internet to “store...