Skip to Content
author's profile photo Former Member
Former Member

Incoming Payments for previous date of invoices. Not today's one.

Hi Experts,

First of all, thanks for Rahul and Gordon for help this query.

About Below query, I can see all today's invoice with payment details, however, there are missing incoming payments which invoice didn't made today. I might need another query to see today's incoming payments which AR invoice made not today.

Could you guys help this?

Thanks

SELECT

T0.DocDate as 'Posting Date',

T0.DocNum as 'AR Invoice Number',

T0.CardName,

T0.DocDate as 'Payment Date',

T1.DocNum as 'Incoming Payment Number ',

T0.DocTotal as 'AR Invoice Total',

(T0.[DocTotal] - T0.[PaidToDate]) as 'AR Sum',

T1.TrsfrSum,

T1.CashSum,

T1.CheckSum,

T1.CreditSum,

T2.CheckNum as 'Cheque Number'

FROM OINV T0

LEFT JOIN ORCT T1 ON T0.ReceiptNum = T1.DocEntry

LEFT JOIN RCT1 T2 ON T1.DocNum = T2.DocNum

Left Join OSLP T3 ON T3.SlpCode= T0.SlpCode

WHERE DateDiff(D,T0.DocDate,GetDate()) = 0

UNION ALL

SELECT

T0.DocDate as 'Posting Date',

T0.DocNum as 'AR Invoice Number',

T0.CardName,

T0.DocDate as 'Payment Date',

T1.DocNum as 'Incoming Payment Number ',

T0.DocTotal * -1 as 'AR Invoice Total',

T0.PaidToDate * -1 as 'AR Sum',

T1.TrsfrSum,

T1.CashSum,

T1.CheckSum,

T1.CreditSum,

T2.CheckNum as 'Cheque Number'

FROM ORIN T0

LEFT JOIN ORCT T1 ON T0.ReceiptNum = T1.DocEntry

LEFT JOIN RCT1 T2 ON T1.DocNum = T2.DocNum

Left Join OSLP T3 ON T3.SlpCode= T0.SlpCode

WHERE DateDiff(D,T0.DocDate,GetDate()) = 0

ORDER BY T1.CreditSum, T1.CheckSum, T1.CashSum, T1.TrsfrSum, 'AR Sum'

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 22, 2011 at 03:48 AM

    Hi,

    You can replace

    WHERE DateDiff(D,T0.DocDate,GetDate()) = 0 with

    WHERE DateDiff(D,T1.DocDate,GetDate()) = 0

    Thanks,

    Gordon

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.