Sunday, March 4, 2018

Code for display method to find/stimulate the purchase price for an item and vendor



Code for display method to find/stimulate the purchase price for an item and vendor

PurchLine               purchLine;
InventDim               lInventDim;
UnitOfMeasureSymbol     unitId = 'PCS'; //Or get default purchase unit
ReqItemTable            reqItemTable; //To get approved vendor for item
;

//Create instance of Inventory dimension table
lInventDim.InventLocationId  = InventDim::find(_this.InventDimIdDefault).InventLocationId;
lInventDim.InventSiteId      = InventDim::find(_this.InventDimIdDefault).InventSiteId;
lInventDim = InventDim::findDim(lInventDim);

reqItemTable = ReqItemTable::find(_this.ItemId,lInventDim.InventDimId);

//Create an instance of purchLine table and set it to tmp
purchLine.setTmp();
purchLine.VendAccount   = reqItemTable.VendId;
purchLine.InventDimId   = lInventDim.inventDimId;
purchLine.PurchQty      = 1;
purchLine.PurchUnit     = unitId;
purchLine.ItemId        = _this.itemId;
purchLine.itemIdChanged();

return purchLine.PurchPrice;


Can be modified to display the sales price as well.

Cheers!

No comments:

Post a Comment