Skip to Content
0
Mar 07, 2015 at 02:24 PM

Exclude A/P Credit Memo from this Query

19 Views

Hello All,

i am trying to figure out to exclude A/P Invoice that it was already Credit Memo with my existing Query

SELECT
max(T0.DocDate) as 'Date',
max(T1.CardName) as 'Vendor Name',
max(T0.Address) as 'Vendor Address',
count(T0.DocNum) as 'No. of Invoices',
max(T1.LicTradNum) as 'TIN No.',
sum(T0.BaseAmnt) as 'Base Amount',
sum(T0.VatSum) as 'Input Tax',
max(T1.ECVatGroup ) as 'TaxCode',
max(T2.WTCode) as 'WtaxCode'
FROM OPCH T0  INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode 
left join PCH5 T2 on T0.DocEntry = T2.AbsEntry
WHERE T0.DocDate BETWEEN '[%0]' and '[%1]' and T0.VatSum <> 0 
GROUP BY T1.CardCode

Please help mew revise my Query.

this is connected with my previous question but i cannot figure out how to incorporate PCH1.TargetEntry

Please Help.

Thank You.

Fidel