Skip to Content
0
J S
Oct 13, 2020 at 02:18 PM

Cancelled Invoices

55 Views

Hi

I have below query & i dont want to include Cancelled Documents

SELECT T0.CardCode, T0.CardName,
(SUM(T1.Debit) - sum(T1.Credit)) 
FROM dbo.OCRD T0
LEFT JOIN dbo.JDT1 T1 ON T1.ShortName = T0.CardCode AND T1.TransType in ('13','14')
WHERE T0.CardType = 'C' 
Group By T0.CardCode, T0.CardName
having (SUM(T1.Debit) - sum(T1.Credit)) <> 0

Thanks