I am working on a simple invoicing and accounting applications, but I am totally lost on how to represent accounting-transactions(journal-entries) in a database. Using a separate debit and credit column in the database seems like one way, but most of the Open Source Accounting I have seen use a single amount column. This I assume simplifies the mathematics a lot. But then how do I convert debits, and credits to numerical values. Wikipedia Helped a little, but when i tried to cross check with an accounting system, it doesn't looks how it's done.
Here's the export from that accounting system:
Take a look at journal 326. While the sum of amount in this case = 0, the sum of credits isn't equal to sum of debits (Debiting 29 from Consulting & Accounting(E), Debiting 31.39 from AP(L), and crediting 2.39 to Sales Tax(L)).
However if I look at it as Debiting -31.39 from AP, It does. However I am not sure if we could credit/debit negative values.
Can someone explain how databases and accounting principles go together?