I have two tables: Invoices and Payments. The first one contains Invoice_nr, Invoice_date, Due_date, Invoice_sum and the other has Invoice_nr, Payment_date, Payment_sum. I can count the open sum for any specific date var_date with a desired delay var_late:
What I need is to know how the debt changes over time. The previous table can give me the answer that for 12/01/31 I had the debt of 50 EUR which was late for less than 7 days but if i want to know the same number for 12/02/29 i need to enter 12/02/29 in the var_date. I want to have the table which shows me the debt for the end of every period.
Thanks in advance.