Skip to Content
0
Dec 21, 2022 at 02:33 PM

Production Order Components item costs Query

32 Views

Hi All

Please help to correct this Production Item Components costs Query as it is not showing components items for recent Production Orders though it is showing correct items components in older Production Orders.

select T2.DocNum as [Production Order],

T2.PostDate as [Date],

T2.ItemCode as [FG], T2.CmpltQty as [CompletedQty],

T1.Price as [Unit Cost], -sum(T0.TransValue),

T0.ItemCode as [Material],

T3.ItemName as [Description],

T0.OutQty as [IssueQty],

T0.CalcPrice as [Unit Cost],

(T0.OutQty * T0.CalcPrice) as [Total],

T2.Comments as [Remarks]

From OINM T0 inner join IGN1 T1

on T0.CreatedBy = T1.DocEntry

Inner Join OWOR T2

On T1.BaseEntry = T2.DocEntry

Inner Join OITM T3

On T0.ItemCode = T3.ItemCode

Where T2.[ItemCode] = [%0]

and T2.PostDate >= [%1]

and T2.PostDate <= [%2]

and T0.TransType = 59

--and T0.OutQty > 0

GROUP BY T2.DocNum, T2.PostDate, T2.ItemCode, T2.CmpltQty, T1.Price, T0.ItemCode, T3.ItemName, T0.OutQty, T0.CalcPrice, T2.Comments