We currently have one table that stores information about what the customer owes us.
We also have a table stores what we owe the customer.
Every month the debits and credits that are within date scope are combined to create a bill.
The bill consists of two tables, Bill and BIllDetails
Each bill detail represents a credit or a debit. Each bill detail has an amount field.
The question is, in the bill details should all numbers be stored as positive, or should credits be stored as negative.
If all numbers are stored as positive we would use references in the details table to know what operation to preform when calculating the bill total.
If we store positives and negatives it seems not consistent with best accounting practices, but we could simply total the numbers.
What is the best practice here? References would be useful.
I don’t think there is a standard to dictate on this. IMHO, you’re getting kind of picky here. It isn’t going to make that big of a difference how you store it. If you want to get technical, having negative numbers will take up slightly more space in the database; but you’re only going to get the savings here if you take the time to mark the column as non-negative.
Personally; I would go with leaving both numbers positive b/c I’m guessing that is going to make it easier when you’re writing programs for report generation. So, if you’re producing a bill for the client; you might consider a debit as positive and a credit as negative; but for internal documents (like calculating profits/etc) you might want to flip that representation. Having them both be positive forces you to make the decision when you’re generating the report on if a number should be represented as positive or negative.