title: Accounting System design & databases
body: <p>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. <a href="http://en.wikipedia.org/wiki/Double-entry_bookkeeping_system#Examples_of_debits_and_credits" rel="nofollow noreferrer">Wikipedia Helped a little</a>, but when i tried to cross check with an accounting system, it doesn't looks how it's done.</p>
  
  <p><a href="http://sites.google.com/site/abhishiv/Home/transactions.pdf" rel="nofollow noreferrer">Here's the export</a> from that accounting system:</p>
  
  <p>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 &amp; Accounting(E), Debiting 31.39 from AP(L), and crediting 2.39 to Sales Tax(L)).</p>
  
  <p>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.</p>
  
  <p>Can someone explain how databases and accounting principles go together?</p>