cancel
Showing results for 
Search instead for 
Did you mean: 

last invoice & last payment in month

Former Member
0 Kudos

good morning all the experts,

hallow all, I have a query like this:

SELECT

T0.[CardCode]as 'Customer Code', T0.[CardName]as 'Customer Name', T1.[PymntGroup]as 'T.O.P',

T2.[DocDate]as 'Invoice Date', T2.[DocNum] as 'Invoice Doc', T2.[DocDueDate] as 'Invoice Due Date',

T2.[DocTotal] as 'Tot Invoice', T3.[DocNum] as'Payment Doc', T3.[DocDueDate] as 'Payment Due date' ,

T3.[DocDate] as 'Payment Date', T3.[DocTotal] as 'Tot payment'

FROM

OCRD T0 INNER JOIN OCTG T1 ON T0.GroupNum = T1.GroupNum INNER JOIN

OINV T2 ON T0.CardCode = T2.CardCode INNER JOIN

ORCT T3 ON T2.ReceiptNum = T3.DocEntry

WHERE

T2.[DocDate] >=[%0]and

T2.[DocDate] <=[%1]and

T0.[CardName] =[%2]

if anyone can help me to display like this:

1. final invoice to customer A in one month

2. A customer shows the last payment in one month

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Your query combined all invoices and payment tables. In this case, you may only get either last invoice or payment date. There is no way to get both unless it is the same.

Thanks,

Gordon

Former Member
0 Kudos

Morning all Expert,

gordun hi, thanks for your answer to my question,

I think this could be obtained proved impossible to combine both

thx