Skip to Content
0
Jan 12, 2021 at 04:56 PM

Query add Sales Orders and Deliveries

30 Views

With this existing query how to add Sales Order and Delivery so that I can add the Sales Order DocNum and the Delivery DocNum

SELECT T0.[DocDate],T0.[CardName] AS 'Customer', sum(case when T0.[DocEntry]=T1.[DocEntry] then (isnull(T1.[Quantity],0)) else 0 End) as 'CARS' ,T0.[DocNum] AS 'Invoice #' , T0.[BPLname] AS 'Branch' , T3.[SLPname] AS 'Sales Mgr' FROM OINV T0 INNER JOIN INV1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OBPL T2 ON T0.[BPLid]=T2.[BPLid] LEFT OUTER JOIN OSLP T3 ON T0.[SlpCode]=T3.[SlpCode] WHERE T0.[U_DCTY] ='C' AND (T0.[DocDate] >= [%0] and T0.[DocDate] <=[%1]) AND T1.[ItemCode] >= 'A%' and T1.[ItemCode] <= 'V%' AND T0.[CANCELED]='N' GROUP BY T0.[DocDate], T0.[DocNum], T0.[CardName], T1.[Quantity], T0.[BPLname], T3.[SlpName]