Page 1 of 1

Simple Billing System

Posted: Sat Apr 04, 2009 5:59 am
by MatthewHiggins
I'm working on a really simple billing system as part of a personal project.

At the moment, there is a MySQL table which includes the specific items which need paying for, then another table which lists payments, the idea being that the 'invoice' for the item is paid, and it is listed as paid, and large items are paid for in installments, so there can be more than one record in the payments table for one each item being paid for.

This works fine, installments are totalled and taken from the invoiced cost, when this reaches zero, everything is marked as complete.

Simple.

I would like to develop this a little, and allow two invoices to be paid in one transaction. At the moment, when this is done, for example, one cheque for two invoices, I enter them as separate transactions, however I am looking at automating it, and integrating it with a credit card processor, so I think my only option is for each customer to have an "account" which things are charged to and is 'topped up' with cash, cheque or credit card online.

How can I do this, with my current PHP/MySQL setup?

Re: Simple Billing System

Posted: Sat Apr 04, 2009 5:30 pm
by califdon
Absolutely everything in database design starts with defining the entities you need to represent. What you described sounds to me like at least 3 entities:

An invoice
A payment against an invoice
A line item on a payment

With a table for each entity, you can identify one or more line items on a payment with an invoice. You can identify all payment line items for a particular invoice. And of course you can identify all line items that make up a payment.