display real dispBal()
{
InventSum _InventSum;
PurchReqLine _PurchReqLine;
ItemId tmpItemId;
InventDimId tmpInventDimId;
;
select _PurchReqLine
where (_PurchReqLine.PurchReqId == VendReqTrans.PurchReqId
&& _PurchReqLine.LineNum == VendReqTrans.LineNum);
tmpInventDimId = _PurchReqLine.InventDimId;
tmpItemId = _PurchReqLine.ItemId;
select SUM(AvailPhysical) FROM _InventSum
where _InventSum.ItemId == tmpItemId
&& _InventSum.InventDimId == tmpInventDimId;
return _InventSum.AvailPhysical;
}
------------------------
display real dispMin()
{
real ret;
PurchReqLine _PurchReqLine;
InventDim _InventDim;
ReqItemTable _ReqItemTable;
InventDimId tmpInvendDimId;
ItemId tmpItemId;
;
select _PurchReqLine
where (_PurchReqLine.PurchReqId == VendReqTRans.PurchReqId
&& _PurchReqLine.LineNum == VendReqTRans.LineNum)
join _InventDim
where _InventDim.inventDimId == _PurchReqLine.InventDimId;
tmpInvendDimId = _InventDim.inventDimId;
tmpItemId = _PurchReqLine.ItemId;
select _ReqItemTable
where _ReqItemTable.ItemId == tmpItemId
&& _ReqItemTable.CovInventDimId == tmpInvendDimId;
ret = _ReqItemTable.MinInventOnhand;
return ret;
}
--------------------
display real dispMax()
{
real ret;
PurchReqLine _PurchReqLine;
InventDim _InventDim;
ReqItemTable _ReqItemTable;
InventDimId tmpInvendDimId;
ItemId tmpItemId;
;
select _PurchReqLine
where (_PurchReqLine.PurchReqId == VendReqTRans.PurchReqId
&& _PurchReqLine.LineNum == VendReqTRans.LineNum)
join _InventDim
where _InventDim.inventDimId == _PurchReqLine.InventDimId;
tmpInvendDimId = _InventDim.inventDimId;
tmpItemId = _PurchReqLine.ItemId;
select _ReqItemTable
where _ReqItemTable.ItemId == tmpItemId
&& _ReqItemTable.CovInventDimId == tmpInvendDimId;
ret = _ReqItemTable.MaxInventOnhand;
return ret;
}
ใช้คลาส InventOnhand ดึง Onhand ต่างๆ
ตอบลบ--------------------------------
static void findingOnhandInfo(Args _args)
{
// ItemId itemId;
InventDim inventDim;
InventDimParm inventDimParm;
InventOnhand inventOnhand = new InventOnhand(); // Manipulate Classssssss !
;
// itemId = "XT0002";
InventDim.InventLocationId = "XBP"; // Specific InventDim
inventDimParm.initFromInventDim(inventDim);
inventOnhand.parmInventDim(inventDim);
inventOnhand.parmInventDimParm(inventDimParm);
// inventOnhand.parmItemId(itemId);
inventOnhand.parmItemId("XT0002");
info(strfmt("Available Physical: %1",inventOnhand.availPhysical()));
info(strfmt("Available Ordered: %1",inventOnhand.availOrdered()));
info(strfmt("Reservation: %1",inventOnhand.availFinancial()));
}
ใช้คลาส InventSumDateDim ดึง Onhand ณ วันที่ ใดวันที่หนึ่ง (หรือจะเป็นช่วง)
ตอบลบ---------------------------------------------
static void findingOnhandByDate(Args _args)
{
ItemId itemId;
InventDim inventDim;
InventDimParm inventDimParm;
InventSumDateDim inventSumDateDim;
;
itemId = "XT0002";
inventDim.InventLocationId = "XBP"; // 09/02/2012 = -5, 21/02/2012 = -4
// inventDim.InventLocationId = "FGBP"; // 05/08/2011 = -4
inventDimParm.initFromInventDim(inventDim);
// Manipulate Classssssss !
inventSumDateDim = InventSumDateDim::newParameters(mkdate(09,02,2012),
itemId,
inventDim,
inventDimParm);
info(strfmt("PostedQTY: %1",inventSumDateDim.postedQty()));
info(strfmt("Deducted Qty: %1",inventSumDateDim.deductedQty()));
info(strfmt("ReceivedQTY: %1",inventSumDateDim.receivedQty()));
// try to findingOnhandByDateRange
}
display real ordered()
ตอบลบ{
InventSum inventSum;
InventDim inventDim;
;
SELECT sum(ordered) FROM inventSum
WHERE inventSum.ItemId == SWAN_Reorderpoint_1.ItemId
JOIN inventDim
WHERE inventDim.inventDimId == inventSum.InventDimId
&& inventDim.InventLocationId == f_InventLocationId;
return inventSum.Ordered;
}