Por favor, revisa a continuación y personaliza más si es relevante:
Select T0.slpCode AS 'Código de Empleado de Ventas',T4.SlpName AS 'Nombre de Empleado de Ventas',
ISNULL(Sum(T1.LineTotal),0) AS 'Ventas Totales',ISNULL(Sum(t2.LineTotal),0) AS 'Total de Notas de Crédito',
(ISNULL(Sum(T1.LineTotal),0) - ISNULL(Sum(t2.LineTotal),0)) AS 'Total de Ventas Netas'
from OINV T0
INNER JOIN INV1 T1 ON T0.[DocEntry] = T1.[DocEntry]
INNER JOIN OSLP T4 ON T4.SlpCode = T0.SlpCode
LEFT JOIN RIN1 T2 on T2.[BaseEntry] = T1.Docentry and T2.[BaseLine] = T1.[LineNum]
LEFT JOIN ORIN T3 ON T2.[DocEntry] = T3.[DocEntry]
GROUP BY T4.SlpName, T0.slpcode
ORDER BY T0.SlpCode
Atentamente,
Jitin