I got this query, Customer undeposited checks from my previous post and revise a little of it. However, the query seemed is not filtering incoming payments already deposited, incoming payments cancelled and Incoming Payment with 'Account type'. Please help.
select T2.CheckKey, T0.Canceled, T0.Docnum as 'Payment no.',T0.docdate as 'Posting date',T0.cardcode as 'Customer Code',T0.cardname as 'Customer Name',
T2.CheckDate as 'Check Date', T2.CheckNum as 'Check Number', T2.Bankcode as 'Bank', T2.Checksum as 'Check Amount'
from orct T0
inner join rct1 T1 on T0.docentry=T1.docnum
inner join ochh T2 on T2.CheckKey=T1.CheckAbs
WHERE T2.CheckDate between [%0] and [%1] and t0.DocType = 'C' and T0.Canceled= 'y' AND T0.Series = '51' or T0.Series = '12' or T0.Series = '63' or T0.Series = '52' AND T2.CheckKey Not In (SELECT CheckKey FROM DPS1) order by T2.CheckDate