Search code examples
database-designaccounting

Designing table to store the transaction entry in a double entry accounting database


I try to develope a small accounting system using codeigniter.
Case I: The database have 2 tables: tbl_transaction and tbl_journal to record daily transactions.
ie, in tbl_journal the date, amount, narration of the transaction will be stored and the tbl_transaction contains the journal_id, account, amountaccounts involved in each transaction, which means there will be 2 entries in tbl_transaction, one entry showing positive amount & other showing negative amount with the debit/credit account name.
Case II: The database with single table tbl_journal to store the transaction information. ie, tbl_journal with fields for date, amount, debit account, credit account, narration.
Which of these would be good? Or what could be the better design? Somebody please help me..


Solution

  • The first is better. In accounting you get cases where one Credit entry is matched by multiple debit entries, and vice versa. Your second option wouldn't cover that.