Subject Re: [firebird-support] How to know the months received?
Author W O
Hello Mark

There is an invoice for each specific payment, but it was not necesary to
write those details in my example.

Thank you very much for your answer.

Walter.



I would advise you to rethink your design. You would be better of to
> attribute (link) a payment to one or more specific invoices at the time of
> payment. It would also be possible to keep a balance for a customer: item
> billed or invoiced decreases the balance, payment received increases the
> balance. In general a customer will have a negative or zero balance, unless
> he pays in advance. If negative, the last invoice(s) upto the negative
> balance are considered unpaid, if positive it simply means the customer has
> credit for any future purchases or bills.
>
> As Set already explained, this is too complex and involves too much
> heuristics to solve in SQL if you only store 'months received'.
>
> Mark
>
>
>


[Non-text portions of this message have been removed]