开发者

is Payment table needed when you have an invoice table like this?

开发者 https://www.devze.com 2022-12-25 05:00 出处:网络
this is my invoice table: Invoice Table: invoice_id creation_date due_date payment_date status enum(\'not paid\',\'paid\',\'expired\')

this is my invoice table:

Invoice Table: invoice_id creation_date due_date payment_date status enum('not paid','paid','expired') user_id total_price

I wonder if it's Useful to have a payment table in order to record user payments for invoices.

payment table can be like this: payment_id payment_date invoic开发者_StackOverflow中文版e_id price_paid status enum('successful', 'not successful')


If you want to allow more than one payment for an invoices, then yes a payment table would be useful.

It's also a good idea to keep your database normalized as much as possible.


Yes. Sometimes they might not pay in full or overpay, or pay in multiple transactions. Having the separate table allows you to keep track of this.

With just one table, all you can see is the original amount and the amount remaining to be paid, but not the history of payments.


Could a payment span multiple invoices?

Could an invoice be payed via multiple payments?

My guess is you will need a payment table and probably an account table and some sort of transaction table as well.


Many accounting applications have invoice_header, invoice_line, account_ledger, ledger_application and account tables.

The account_ledger table typically contains the items on the customer/vendor accounts. These items could be invoices, payments, or whatever.

The ledger_application table holds the information on the many-to-many relationship between payments and invoices.

The invoice_header table contains all information associated with an invoice which does not belong in the account_ledger table.

The invoice_line table has the data pertaining to the individual items/quantities/amounts on the invoice.

The account table stores data about the customer/vendor such as address, contact info, etc.

0

精彩评论

暂无评论...
验证码 换一张
取 消