I'm working on a project that has to have accounting-like features. It will generate statements and record payments and charges against each account.
It will store all information in a database.
Is there a preferred way to store a charge or a credit? The easy way is charges are simply a + dollar value applied to the account, and a payment is a negative amount. A sum of all charges/payments is the customer balance.
Another possibility is charges are payments are stored with no + or - value but with a flag indicating what has happened, and another way that would resemble more of a ledger book woud be to store charges and payments in separate fields. It was also suggested that a computed value of the customer balance be externall calculated and reinserted into a field in the database to allow for error checking, in the case a row or transaction is somehow lost or deleted.
What are some methods used for doing this?