GET TRADE AGREEMENT PURCHASE line discount x++ CODE D365
WITH THE BELOW CODE YOU CAN GET THE CURRENT TRADE AGREEMENT line discount OF A GIVEN PURCHASE ORDER LINE IN D365.
public static price findPurchLineDisc(Purchline _purchline, VendAccount _vendAccount, InventDimId _inventDimId)
{
InventTable inventTable = InventTable::find(_purchline.ItemId);
VendTable vendTable = VendTable::find(_vendAccount);
InventDim inventDimItem = InventDim::find(_inventDimId);
UnitOfMeasureSymbol unitId = inventTable.inventTableModuleInvent().UnitId;
PriceDisc_LineDisc priceDisc_LineDisc;
priceDisc_LineDisc = PriceDisc_LineDisc::construct();
priceDisc_LineDisc.parmModuleType(ModuleInventPurchSales::Purch);
priceDisc_LineDisc.parmItemId(inventTable.ItemId);
priceDisc_LineDisc.parmInventDim(inventDimItem);
priceDisc_LineDisc.parmUnitID(unitId);
priceDisc_LineDisc.parmDiscDate(DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone()));
priceDisc_LineDisc.parmQty(1);
priceDisc_LineDisc.parmAccountNum(vendTable.AccountNum);
priceDisc_LineDisc.parmItemLineDiscCode(_purchline.itemLineDisc());
priceDisc_LineDisc.parmCurrencyCode(Ledger::accountingCurrency(CompanyInfo::current()));
return priceDisc_LineDisc.discPct();
}
No comments:
Post a Comment