I've been doing research into the implementation of a double-entry accounting system (specifically using Django as a DB backend). What I am having difficulty understanding is the translation of a "Sub-ledger" and "General Ledger" from the accounting world into the database/software world.
In accounting, we might see something like:
Sales Sub-Journal:
---------------------------------------------------------------
Date Description Amount Acct Balance
---------------------------------------------------------------
Jan 1 Cust. A Sale 500.00 AR 500.00
Jan 15 Cust. B Sale 300.00 AR 800.00
General Journal:
---------------------------------------------------------------
Date Description Acct Debit Credit
---------------------------------------------------------------
Jan 15 Sales for Jan AR 800.00
Sales 800.00
Effectively, the sub-ledger is copied to the General Ledger with a single journal entry.
What I'm struggling to understand is the purpose of the Sub-ledger and General Ledger from a database perspective. Couldn't the above three entries be recorded in the DB with only two normal journal entries? This would remove the duplication of data (the $800 recorded in the sub-ledger and the $800 also recorded in the general journal entry)?
General Journal Entries:
---------------------------------------------------------------
Date Description Acct Debit Credit
---------------------------------------------------------------
Jan 1 Cust. A Sale AR 500.00
Sales 500.00
Jan 15 Cust. B Sale AR 300.00
Sales 300.00
I understand that in a paper system, a sub-ledger makes a lot of sense as you can see the detail of the sales transactions throughout a period (a day/week/month, whatever the interval is). Then the general ledger shows the "big picture" of your sales, accounts receivable, etc.
But in a relational database model, it seems the second example where everything is recorded through journal entries, and there are no sub-ledgers, would be far more optimal. You still log every transaction and if you need to see the detail of a specific vendor or customer (the sub-ledgers), you can simply provide a filter list of the journal entries.
Does that make sense? Am I missing something with the above?