RE: costPrice in SalesLine is updated after Stock Recalculation/Closure ?
Hi Everybody and sorry for the delay !
So if I understand, to extract the right FIFO Cost by Transaction/Item, I can not base my queries on CostPrice Field (on SalesLine Table) and I have to work on InventTrans Table. My query is this one :
Correct me if i'm wrong :)
SELECT
INVENTTRANSORIGIN.REFERENCEID, ReferenceCategory, InventTrans.itemid,
SUM(CASE WHEN STATUSRECEIPT = 2 THEN InventTrans.CostAmountPhysical InventTrans.CostAmountAdjustment WHEN STATUSRECEIPT = 1 THEN InventTrans.CostAmountPosted InventTrans.CostAmountAdjustment
WHEN STATUSISSUE = 2 THEN InventTrans.CostAmountPhysical InventTrans.CostAmountAdjustment WHEN STATUSISSUE = 1 THEN InventTrans.CostAmountPosted InventTrans.CostAmountAdjustment ELSE 0 END) / IIF(ISNULL(sum(InventTrans.qty), 0) = 0, 1, sum(InventTrans.qty)) as FIFO_10
,
SUM(InventTrans.Qty) as Qty
FROM InventTrans WITH (NOLOCK)
JOIN INVENTTRANSORIGIN WITH (NOLOCK) ON INVENTTRANSORIGIN.recid = InventTrans.INVENTTRANSORIGIN AND INVENTTRANSORIGIN.DATAAREAID = 'XXXX'
WHERE InventTrans.StatusIssue IN (0, 1, 2) AND InventTrans.StatusReceipt IN (0, 1, 2) AND InventTrans.DataAreaId = 'XXXX'
AND InventTrans.DATEFINANCIAL between '01/10/2019' AND '31/10/2019'
GROUP BY INVENTTRANSORIGIN.REFERENCEID, ReferenceCategory,InventTrans.itemid
PS: How can check on AX the Cost Price by transaction (so I can check if me query is correct) ?Is there a form or a report do do such check ?
Thanks.