Display Real GetCostAmt32()
{
real ret;
InventTrans _InventTrans;
InventJournalTrans
_InventJournalTrans;
InventDim _InventDim;
InventTable _InventTable;
Date FromDate,ToDate;
InventJournalTable
_InventJournalTable;
;
FromDate =
str2date("01/11/"+ int2str(_Year), 123);
ToDate =
endMth(FromDate);
select
SUM(CostAmountAdjustment) from _InventTrans
where (_InventTrans.DateFinancial >= FromDate
&& _InventTrans.DateFinancial <= Todate)
join _InventJournalTrans
where _InventJournalTrans.InventTransId ==
_InventTrans.InventTransId
&& _InventJournalTrans.Dimension[1] ==
SWAN_SumPostedMovement_CostAmt_1.Department // Department
join _InventTable
where _InventTable.ItemId
==_InventJournalTrans.ItemId
&& _InventTable.ItemGroupId ==
SWAN_SumPostedMovement_CostAmt_1.ItemGroupId
join _InventDim
where
(_Inventdim.inventDimId == _InventJournalTrans.InventDimId)
&&
_InventDim.InventLocationId == P_InventLocationId ; // P_InventLocationId
ret =
_InventTrans.CostAmountAdjustment;
adjCostNov = ret;
return ret;
}
display real costAmount()
ตอบลบ{
real ret = 0.00;
InventTable _InventTable;
VendInvoiceTrans vendInvoiceTrans;
;
Select _InventTable
Where _InventTable.ItemId == InventTrans.ItemId
&& _InventTable.ItemId Like "s*";
if(_InventTable.RecId)
{
// while loop for last record to get last price of invoiced purchase
WHILE SELECT PurchPrice FROM vendInvoiceTrans
WHERE vendInvoiceTrans.ItemId == InventTrans.ItemId
{
ret = vendInvoiceTrans.PurchPrice;
}
// if have not history about puchasing
if(!vendInvoiceTrans.PurchPrice)
{
ret = (InventTrans.CostAmountPhysical+InventTrans.CostAmountAdjustment);
}
}
else
{
ret = 0.00;
}
return ret;
}
/*
Display real lastestPurInvPrice()
{
VendInvoiceTrans vendInvoiceTrans;
InventTrans inventTrans;
real ret;
;
// while loop for last record to get last price of invoiced purchase
WHILE SELECT PurchPrice FROM vendInvoiceTrans
WHERE vendInvoiceTrans.ItemId == InventSumDateTrans.ItemId
{
ret = vendInvoiceTrans.PurchPrice;
}
// if item have not purched(invoiced) then get cost price
if(!ret)
{
SELECT firstonly inventTrans
WHERE inventTrans.ItemId == InventSumDateTrans.ItemId;
ret = inventTrans.CostAmountPhysical;
}
return ret;
}
*/