SELECT T0.[DocNum], T1.[Project], T2.[PrjName], T1.[CogsOcrCod] as Region, T1.[CogsOcrCo2] as Branch,T1.[WhsCode], T1.[Dscription],T1.[LineStatus],T1.[Quantity], T1.[OpenQty],T0.[DocCur], T1.[Price], T0.[U_OrderStatus], T3.[DocNum],T3.[cardname],T3.[DocStatus] FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OPRJ T2 ON T1.Project = T2.PrjCode,OPOR T3 INNER JOIN POR1 T4 ON T3.DocEntry = T4.DocEntry
WHERE T4.BaseRef = T0.DocNum and T0.[DocStatus] = 'O'
i have this query it is working fine but there is problem. that is it is showing only that sale order wich purchase order is posted my client want all sale order if his purchase order is poted or not