Hi Gaurav
I tried it but i am getting an (SWEI) error?
The below is what I have done...
SELECT
T0.[DueDate] as 'Build Date',
T0.[DocNum] as 'Prod Ord',
T0.[U_CustName] as 'Sales Partner',
T0.[PlannedQty] as 'Qty',
T0.[ItemCode] as 'Product No',
T2.[ItemName] as 'Product Description',
(select SUM(S1.[PlannedQty]) from WOR1 S1 where S1.DocEntry = T1.DocEntry and S1.ItemCode = 'LABOUR' GROUP BY S1.DocEntry) as 'Time',
T0.[Comments] as 'Remarks',
T3.[ItmsGrpNam] as 'Item Group',
case when T0.[Status] = 'P' then 'Planned'
when T0.[Status] = 'R' then 'Released'
when T0.[Status] = 'L' then 'Closed'
when T0.[Status] = 'C' then 'Cancelled' end as 'Prod Status',
T4.[ReqDate] as 'Required Date',
T5.[ShipDate] as 'Despatch Date',
T5.[LineTotal] as 'Row Value'
FROM
OWOR T0
INNER JOIN WOR1 T1 ON T0.[DocEntry] = T1.[DocEntry]
INNER JOIN OITM T2 ON T0.ItemCode = T2.ItemCode
INNER JOIN OITB T3 ON T2.[ItmsGrpCod] = T3.[ItmsGrpCod]
LEFT JOIN ORDR T4 ON T4.[DocNum] = T0.[OriginNum]
LEFT JOIN RDR1 T5 ON T5.DocEntry = T4.DocEntry AND T5.ItemCode=T0.ItemCode and T5.[U_Prod_Order_No] = T0.[DocNum]
WHERE
T1.[ItemCode] <> 'SUNDRY LABOUR' and t1.docentry NOT IN ( select t1.docentry from wor1 t1 where t1.itemcode = 'SUNDRY LABOUR') and
T1.[ItemCode] <> 'OUTSOURCED' and t1.docentry NOT IN ( select t1.docentry from wor1 t1 where t1.itemcode = 'OUTSOURCED') and
T0.[DueDate] between [%0] and [%1] and
T0.[Status] not in ( 'C')
GROUP BY
T0.[DocNum], T0.[DueDate], T0.[U_CustName], T0.[PlannedQty], T0.[ItemCode], T2.[ItemName], T1.[PlannedQty], T0.[Comments], T3.[ItmsGrpNam], T0.[Status], T4.[ReqDate], T5.[ShipDate],
T5.[LineTotal],T1.DocEntry
ORDER BY
T0.[DueDate], T0.[DocNum]
Thanks and Regards
Rahul