on 2020 Apr 30 7:09 PM
Hi Team,
I need to make a query for a list of all the invoices(paid/unpaid both) along with the incoming payment, CM, or external reconciliation. I am able to get list of all invoices with incoming payment. But I need to add the CM adjustment or any external reconciliation.
SELECT t0.docentry, t0.cardcode as CardCode,t3.CardName,t4.GroupName,T0.DOCNUM AS InvoiceNo,T0.DOCDATE AS InvoiceDate,T0.DOCTOTAL AS InvoiceTotal, t0.DocDueDate,T2.DOCDATE AS IncPayDate, T1.SumApplied as Paid, (t0.doctotal)-(select sum(q.SumApplied) from rct2 q inner join oinv w on q.docentry = w.docentry where q.DocEntry = t1.DocEntry and q.DocNum <= t2.docnum) as Pending, T2.DOCNUM IncPayNo, t5.DocTotal FROM OINV T0 LEFT JOIN RCT2 T1 ON T0.DOCENTRY=T1.DOCENTRY AND T0.OBJTYPE=T1.INVTYPE LEFT JOIN ORCT T2 ON T2.DOCNUM=T1.DOCNUM inner join ocrd t3 on t3.CardCode=t0.CardCode inner join ocrg t4 on t4.GroupCode=t3.GroupCode where ( T0.[DocDate] >= '2019-01-01') and ( T0.[DocDate] <= '2019-12-12' ) and t0.docnum='2019008007' order by t0.docdate
Can anyone please help on this....?
User | Count |
---|---|
113 | |
8 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.