I have a method for a display field which does the following;
return InventSum::find(_salesLine.ItemId, InventDim::_salesLine.InventDimId).AvailPhysical();
This gives me the on-hand Available Physical for the line site/warehouse/location.
I need to see the total available for just the site/warehouse. I think I need to search inventDim by Item/Warehouse to get my inventdimid, but I cannot find the method so I am suspicious that this is incorrect.
Can anyone help?
My working solution...
InventDimParm invDimParm;
InventDim warehouseInvDim;
InventDim salesLineInventDim;
;
salesLineInventDim = _salesLine.inventDim();
warehouseInvDim.InventSiteId = salesLineInventDim.InventSiteId;
warehouseInvDim.InventLocationId = salesLineInventDim.InventLocationId;
warehouseInvDim = InventDim::findOrCreate(warehouseInvDim);
invDimParm.initFromInventDim(InventDim::find(warehouseInvDim.inventDimId));
return InventSum::findSum(_salesLine.ItemId,warehouseInvDim,invDimParm).availOrdered();
I know this is for availOrdered() but it works exactly the same for availPhysical()