on 07-10-2014 5:56 AM
HI All,
We need to get the item cost of items on a particular date.
I have tested the following but it gives multiple results:
SELECT T0.ItemCode, Max(T0.Dscription) 'Item Name',T0.CalcPrice
FROM OINM T0
WHERE T0.DocDate = [%0]
GROUP BY T0.ItemCode, T0.Calcprice
I have checked the audit report too but it shows the current item cost.
is there a way to get the desired data?
Thanks,
Joseph
Hi Joseph,
What is your inventory revaluation method? It will be different to get the item cost by query depending on the method.
Thanks,
Gordon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I think you cannot get the item cost of an item on a particular date on the OITM table. it only shows the cost as of the current date. it also challenged me when i was doing the query. have you tried my query though? cause its working fine with me.
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Joseph,
Try this. I've been using this and giving me correct details.
SELECT
T3.WhsCode 'Whse Code', T3.WhsName 'Whse Name', T0.[ItemCode], T1.[ItemName],
sum(T0.[InQty] - T0.[OutQty]) 'OnHand', O2.CalcPrice/sum(T0.[InQty] - T0.[OutQty]) 'Cost'
FROM OINM T0
INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode
INNER JOIN OITB T2 ON T1.ItmsGrpCod = T2.ItmsGrpCod
INNER JOIN OWHS T3 ON T0.[Warehouse] = T3.WhsCode
INNER JOIN
(
SELECT DISTINCT o.Warehouse, o.ItemCode, o.Balance CalcPrice
FROM OINM O INNER JOIN
(
SELECT T0.[Warehouse] 'Whse', T0.[ItemCode] 'Code', MAX(T0.[CreateDate]) 'cDate' , MAX(T0.TransNum) '#'
FROM OINM T0 WHERE T0.[CreateDate] <= '[%1]'
GROUP BY T0.[Warehouse], T0.[ItemCode]
) O1 ON O.Warehouse = O1.Whse and O.ItemCode = O1.Code and O.CreateDate = O1.cDate and O.TransNum=O1.#
) O2 ON T0.Warehouse = O2.Warehouse and T0.[ItemCode] = O2.ItemCode
WHERE
T0.[CreateDate] <= '[%1]'
and T1.[ItemName] = '[%2]'
GROUP BY T3.WhsCode, T3.WhsName, T0.[ItemCode], T1.[ItemName], O2.CalcPrice
HAVING (sum(T0.[InQty] - T0.[OutQty]) <> 0)
ORDER BY T3.WhsCode, T0.[ItemCode]
you can also modify it to fit your needs.
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
How are you? Hope doing well.
Please clarify:
Are you looking for item cost or calculated price? If I run above query getting two rows of result with different items for particular date.
Thanks & Regards,
Nagarajn
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.