How to implement a partially paid invoice in the database structure?
Write a small piece for work IE (STS 6%) in it.
We need to implement the functionality of the billing.
To create an instance of the account to fill it positions is not difficult.
But when I started to write, I remembered that the account is more than 2 status: "paid/not paid".
It is not clear how to store a partially paid invoice, status, and amount.
In connection with this question, if someone is already implemented, how?
To make a table of payments
payments: id, date, invoice_id, sum
It will reflect the payment on the account
The status of the account to or dynamically in the request, comparing the invoiced amount with the amount of payment for it, or calculate at the checkout and put in the chart of accounts. not_payed, payed_partially, payed_fully