I am using this query to show Production Order Variances. There is one key part that is missing that I cannot figure out how to add the Actual Additional Cost from the summary tab to this query. Is there a way to add this field to this query?
SELECT DISTINCT T0.DocNum, T0.PlannedQty, T0.CmpltQty, T1.Dscription, T0.PostDate, (T1.StockPrice*T0.CmpltQty) as 'Actual Product Cost', -sum(T2.TransValue) as 'Actual Component Cost', SUM(T2.TransValue) 'Total Variance',
(T1.StockPrice*T0.CmpltQty) +sum(T2.TransValue) as Difference
FROM OWOR T0
LEFT JOIN IGN1 T1 ON T0.DocNum=T1.BaseRef
INNER JOIN OINM T2 ON T0.DocEntry=T2.AppObjAbs AND OutQTY>0
WHERE T0.PostDate >=[%0\] AND T0.PostDate <=[%1\]
GROUP BY T0.DocNum, T0.PlannedQty, T0.CmpltQty, T1.Dscription, T0.PostDate, (T1.StockPrice*T0.CmpltQty)
Thanks for the help,