Hola Johan
Intenté la Opción 1, hay datos pero no se agregó la columna para INV1.Text
La Opción 2 da error.
Opción 1
SELECT T0.[DocDate], T0.[DocNum], t0.NUMATCARD, T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription], T1.[Quantity], T1.UnitMsr,T1.[PriceBefDi], T1.[Price], T1.[LineTotal], T0.[DiscPrcnt],T0.[DocTotal], T2.[SlpName], T1.Text
INTO #INV
FROM OINV T0 INNER JOIN INV1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OSLP T2 ON T0.[SlpCode] = T2.[SlpCode]
WHERE T0.[CardCode] >='[%0]' AND T0.[CardCode] <= '[%1]'
AND T0.[DocDate] >=[%2] AND T0.[DocDate] <= [%3]
AND T2.[SlpName] >='[%4]' AND T2.[SlpName] <= '[%5]'
INSERT INTO #INV
SELECT T0.[DocDate], T0.[DocNum], T0.NUMATCARD, T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription], T1.[Quantity]*-1, T1.UnitMsr,T1.[PriceBefDi]*-1, T1.[Price]*-1, T1.[LineTotal]*-1, T0.[DiscPrcnt],T0.[DocTotal]*-1,T2.[SlpName], T1.Text FROM ORIN T0 INNER JOIN RIN1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OSLP T2 ON T0.[SlpCode] = T2.[SlpCode] WHERE T0.[CardCode] >='[%0]' AND T0.[CardCode] <= '[%1]'
AND T0.[DocDate] >=[%2] AND T0.[DocDate] <= [%3]
AND T2.[SlpName] >='[%4]' AND T2.[SlpName] <= '[%5]'
SELECT T10.[DocDate], T10.[ItemCode], T10.[Dscription], SUM(T10.[Quantity]) as 'Quantity', T10.UnitMsr, T10.[SlpName] FROM
#INV T10
group by T10.[DocDate], T10.[ItemCode], T10.[Dscription], T10.UnitMsr, T10.[SlpName]
Opción 2
SELECT T0.[DocDate], T0.[DocNum], t0.NUMATCARD, T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription], T1.[Quantity], T1.UnitMsr,T1.[PriceBefDi], T1.[Price], T1.[LineTotal], T0.[DiscPrcnt],T0.[DocTotal], T2.[SlpName], T1.Text
INTO #INV
FROM OINV T0 INNER JOIN INV1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OSLP T2 ON T0.[SlpCode] = T2.[SlpCode]
WHERE T0.[CardCode] >='[%0]' AND T0.[CardCode] <= '[%1]'
AND T0.[DocDate] >=[%2] AND T0.[DocDate] <= [%3]
AND T2.[SlpName] >='[%4]' AND T2.[SlpName] <= '[%5]'
INSERT INTO #INV
SELECT T0.[DocDate], T0.[DocNum], T0.NUMATCARD, T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription], T1.[Quantity]*-1, T1.UnitMsr,T1.[PriceBefDi]*-1, T1.[Price]*-1, T1.[LineTotal]*-1, T0.[DiscPrcnt],T0.[DocTotal]*-1,T2.[SlpName], T1.Text FROM ORIN T0 INNER JOIN RIN1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OSLP T2 ON T0.[SlpCode] = T2.[SlpCode] WHERE T0.[CardCode] >='[%0]' AND T0.[CardCode] <= '[%1]'
AND T0.[DocDate] >=[%2] AND T0.[DocDate] <= [%3]
AND T2.[SlpName] >='[%4]' AND T2.[SlpName] <= '[%5]'
SELECT T10.[DocDate], T10.[ItemCode], T10.[Dscription], SUM(T10.[Quantity]) as 'Quantity', T10.UnitMsr, T10.[SlpName], T10.Text FROM
#INV T10
group by T10.[DocDate], T10.[ItemCode], T10.[Dscription], T10.UnitMsr, T10.[SlpName], T10.Text