วันศุกร์ที่ 25 พฤษภาคม พ.ศ. 2555
ทำ sub ซ้อน
static void Job7(Args _args)
{
SWAN_SumPostedMovement _SWAN_SumPostedMovement;
InventTrans _InventTrans;
InventDim _InventDim;
InventJournalTrans _InventJournalTrans;
int i;
str 30 _Department[];
;
delete_from _SWAN_SumPostedMovement;
i = 0;
WHILE SELECT Dimension[1]
FROM _InventJournalTrans
GROUP BY _InventJournalTrans.Dimension[1]
JOIN _InventDim
WHERE _InventDim.inventDimId == _InventJournalTrans.inventDimId
{
i++;
_Department[i] = _InventJournalTrans.Dimension[1];
}
print "Start..";
pause;
for (i = i; i >=1 ;i--)
{
While Select ItemId
FROM _InventJournalTrans
GROUP BY _InventJournalTrans.ItemId
WHERE _InventJournalTrans.Dimension[1] == _Department[i]
JOIN _InventDim
WHERE _InventDim.inventDimId == _InventJournalTrans.InventDimId
{
_SWAN_SumPostedMovement.DepartmentId[1] = _Department[i];
_SWAN_SumPostedMovement.ItemId = _InventJournalTrans.ItemId;
_SWAN_SumPostedMovement.insert();
}
}
print "Finished !";
pause;
}
+=========================================================+
display str department()
{
InventJournalTrans _InventJournalTrans;
;
select _InventJournalTrans
where _InventJournalTrans.JournalId == InventTrans.TransRefId;
return _InventJournalTrans.Dimension[1];
}
+============================================================+
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น