Thread: accounting schema

accounting schema

From
"Medi Montaseri"
Date:
Hi,<br /><br />I am learning my way into Accounting and was wondering how Accounting applications are designed. perhaps
youcould point the way....<br /><br />On one hand, accountants talk about a sacret equation A = L + OE (Asset =
Libility+ Owner Equity) and then under each categories there are one or many account. On the other hand a DBA thinks in
termsof tables and relations. Instead of getting theoritical, allow me to setup an example<br /><br />Say you have have
constructionproject (like a room addition) or one of those flip this house deals<br /><br />Owner brings the land
(equity)of say worth $100K<br />Expenses begin to mount ( that is a minus against OE)<br /> Account Payble begins to
mount(that is a liability)<br />And one day you experience a sale <br /><br />As a DBA, (and keeping it simple) I am
thinkingI need a table for every account which migh look like<br /><br />id, description, credit, debit, validated,
created_on,created_by, modified_on, modified_by<br /><br />Is that pretty match it ?<br />Please let me know if you
haveseen some accounting or DB book that addresses this problem domain.<br /><br />Thanks<br />Medi<br /><br /> 

Re: accounting schema

From
Steve Midgley
Date:
At 05:09 PM 2/6/2008, pgsql-sql-owner@postgresql.org wrote:
>Date: Wed, 6 Feb 2008 17:08:54 -0800
>From: "Medi Montaseri" <montaseri@gmail.com>
>To: pgsql-sql@postgresql.org
>Subject: accounting schema
>Message-ID: 
><8078a1730802061708q17c72234xe61be822459a24a8@mail.gmail.com>
>
>Hi,
>
>I am learning my way into Accounting and was wondering how Accounting
>applications are designed. perhaps you could point the way....
>
>On one hand, accountants talk about a sacret equation A = L + OE 
>(Asset =
>Libility + Owner Equity) and then under each categories there are one 
>or
>many account. On the other hand a DBA thinks in terms of tables and
>relations. Instead of getting theoritical, allow me to setup an 
>example

Hi Medi,

You might read some source code and docs for open source accounting 
software and see "how it's done." Here's one example that might be 
interesting and simple enough to follow:

http://www.gnucash.org/

In general, I think there are many different accounting methods, so you 
have to get clear about which one you're using. "Double-entry" 
accounting is common. Cash vs. accrual posting methods matter (i.e. 
when does an expense or receivable "charge" against the assets 
balance?)

My most basic understanding is that in general you track assets as they 
come in, to an "Accounts Receivable" ledger (i.e. table) and 
liabilities to an "Accounts Payable" ledger. Then you reconcile these 
two "books" into a "General Ledger" table which gives you something 
like an audit trail of all activity (and a running balance). I'm sure 
Wikipedia will define these three terms and lots more with greater 
clarity.

But my (limited) experience with accounting schema is that they often 
involve these three tables (AR/AP/GL) at their core.

As you add bank accounts, complex investment instruments, depreciation 
etc, things get considerably more complex of course.

I'll readily admit my limited experience, and I'm sure others on this 
list have far better information. I hope this gets you started anyway.

Sincerely,

Steve



Re: accounting schema

From
"Medi Montaseri"
Date:
Thanks Steve...<br />This is all well and good...I am getting it...but I need to chew on it more....gnucash was a good
one...didn'tthink of that....got to get passed all the GUI stuff...but...excellent ref...<br /><br />I suppose instead
ofAR and AP tables, I can just have one table called Entry (thanks Joe....) with an attribute indicating AR vs AP.<br
/><br/>I am also in favor of Double Entry and accrual posting....what do I know, I hear corporations do it this
way...<br/><br />I also like the "audit trail" built-in feature...actually this was something I was baffled about...I
wasoriginally thinking about editing capability, but what you are suggesting is that in practice, you don't change or
eraseanything...to make a correction, you debit and then credit (keeping the sum happy) and yet you have the audit
trail...verycool...I am liking this stuff...<br /><br />And finally you mentioned that bank accounts are tricky...can
youexpand on this please. After all I am under the impression that "bank accounts" are a corner stone of this whole
bookkeeping...I mean...bank accounts have debits and credits just like any account...eg interest earned is a credit and
bankfees are debits...what worries you about bank accounts...<br /><br />Thanks guys...this is very very nice <br /><br
/>Medi<br/><br /><div class="gmail_quote">On Feb 6, 2008 6:35 PM, Steve Midgley <<a
href="mailto:public@misuse.org">public@misuse.org</a>>wrote:<br /><blockquote class="gmail_quote"
style="border-left:1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> At 05:09 PM 2/6/2008,
<ahref="mailto:pgsql-sql-owner@postgresql.org">pgsql-sql-owner@postgresql.org</a> wrote:<br />>Date: Wed, 6 Feb 2008
17:08:54-0800<br />>From: "Medi Montaseri" <<a href="mailto:montaseri@gmail.com">montaseri@gmail.com</a>><br
/>>To: <a href="mailto:pgsql-sql@postgresql.org">pgsql-sql@postgresql.org</a><br />>Subject: accounting schema<br
/>>Message-ID:<br/>><<a
href="mailto:8078a1730802061708q17c72234xe61be822459a24a8@mail.gmail.com">8078a1730802061708q17c72234xe61be822459a24a8@mail.gmail.com</a>><br
/><divclass="Ih2E3d">><br />>Hi,<br />><br />>I am learning my way into Accounting and was wondering how
Accounting<br/>>applications are designed. perhaps you could point the way....<br />><br />>On one hand,
accountantstalk about a sacret equation A = L + OE<br /> >(Asset =<br />>Libility + Owner Equity) and then under
eachcategories there are one<br />>or<br />>many account. On the other hand a DBA thinks in terms of tables
and<br/>>relations. Instead of getting theoritical, allow me to setup an<br /> >example<br /><br /></div>Hi
Medi,<br/><br />You might read some source code and docs for open source accounting<br />software and see "how it's
done."Here's one example that might be<br />interesting and simple enough to follow:<br /><br /><a
href="http://www.gnucash.org/"target="_blank">http://www.gnucash.org/</a><br /><br />In general, I think there are many
differentaccounting methods, so you<br />have to get clear about which one you're using. "Double-entry"<br />
accountingis common. Cash vs. accrual posting methods matter (i.e.<br />when does an expense or receivable "charge"
againstthe assets<br />balance?)<br /><br />My most basic understanding is that in general you track assets as they<br
/>come in, to an "Accounts Receivable" ledger (i.e. table) and<br />liabilities to an "Accounts Payable" ledger. Then
youreconcile these<br />two "books" into a "General Ledger" table which gives you something<br /> like an audit trail
ofall activity (and a running balance). I'm sure<br />Wikipedia will define these three terms and lots more with
greater<br/>clarity.<br /><br />But my (limited) experience with accounting schema is that they often<br /> involve
thesethree tables (AR/AP/GL) at their core.<br /><br />As you add bank accounts, complex investment instruments,
depreciation<br/>etc, things get considerably more complex of course.<br /><br />I'll readily admit my limited
experience,and I'm sure others on this<br /> list have far better information. I hope this gets you started anyway.<br
/><br/>Sincerely,<br /><font color="#888888"><br />Steve<br /><br /></font></blockquote></div><br /> 

Re: accounting schema

From
Robert Edwards
Date:
Medi Montaseri wrote:
> Hi,
> 
> I am learning my way into Accounting and was wondering how Accounting 
> applications are designed. perhaps you could point the way....
> 
> On one hand, accountants talk about a sacret equation A = L + OE (Asset 
> = Libility + Owner Equity) and then under each categories there are one 
> or many account. On the other hand a DBA thinks in terms of tables and 
> relations. Instead of getting theoritical, allow me to setup an example
> 
> Say you have have construction project (like a room addition) or one of 
> those flip this house deals
> 
> Owner brings the land (equity) of say worth $100K
> Expenses begin to mount ( that is a minus against OE)
> Account Payble begins to mount (that is a liability)
> And one day you experience a sale
> 
> As a DBA, (and keeping it simple) I am thinking I need a table for every 
> account which migh look like
> 
> id, description, credit, debit, validated, created_on, created_by, 
> modified_on, modified_by
> 
> Is that pretty match it ?
> Please let me know if you have seen some accounting or DB book that 
> addresses this problem domain.
> 
> Thanks
> Medi
> 

My home-grown system uses three key tables: account, transaction and
split.

The split joins a transaction to an account and an amount. All the
splits for a single transaction must sum to zero (checked by a PL/pgSQL
function triggered on insert, update and delete on the split table).
For example, my pay is a single transaction with typically 8 splits
reflecting what my pay-master does with my pay (tax, superannuation,
health contrib, etc.)

I also have other tables for managing reconciliations - each split has
a reconciliation ID that indicates if/when that split was reconciled.
Once reconciled, the split becomes, effectively, immutable (by the same
PL/pgSQL function).

Transactions contain date, description, who etc. (all from the top of
my head - I should check what I really did many years ago).

Most of the rest of it is then just mapping the accounts to the various
ledgers and bank accounts etc.

This model is very simple, for very simple people like me.

Cheers,

Bob Edwards.


Re: accounting schema

From
Steve Midgley
Date:
At 06:54 PM 2/6/2008, Medi Montaseri wrote:
>Thanks Steve...
>
>And finally you mentioned that bank accounts are tricky...can you 
>expand on this please. After all I am under the impression that "bank 
>accounts" are a corner stone of this whole book keeping...I 
>mean...bank accounts have debits and credits just like any 
>account...eg interest earned is a credit and bank fees are 
>debits...what worries you about bank accounts...
>
>Thanks guys...this is very very nice
>
>Medi

Hi Medi,

We may be well off-topic for Pgsql but it is a modeling issue so I'll 
reply on-list..

Consider this scenario: You want to track your AP/AR accounts by 
"business unit" - so you have a Marketing account, Sales account, 
Engineering account, etc. But let's say you want to keep all the money 
for all the "units" in only two bank accounts depending on which region 
the expenses will be paid out from (to reduce processing fees). So you 
might pay for things accrued by Engineering and Marketing on the West 
Coast from one bank account and Engineering and Marketing expenses on 
the East Coast from the other (a US-centric example).

So the bank accounts where cash is actually deposited/withdrawn is 
different from where the money is received or spent from a "logical" 
perspective in the AR/AP ledgers.

This is a simple example and real-world issues become truly horrendous. 
(For example, try to account for investment instruments like long term 
property holdings with lines of credit against the real estate).

I've always thought that if DBA's existed when Accounting was invented, 
things would look very, very different. :)

Good luck,

Steve



Re: accounting schema

From
John Hasler
Date:
Look at LedgerSMB at <www.ledgersmb.org>.  It uses Postgresql.
-- 
John Hasler 
john@dhh.gt.org
Elmwood, WI USA


Re: accounting schema

From
"Tony Wasson"
Date:
On Feb 6, 2008 6:08 PM, Medi Montaseri <montaseri@gmail.com> wrote:
> I am learning my way into Accounting and was wondering how Accounting
> applications are designed. perhaps you could point the way....

<SNIP>
> As a DBA, (and keeping it simple) I am thinking I need a table for every
> account which migh look like
>
> id, description, credit, debit, validated, created_on, created_by,
> modified_on, modified_by
>
> Is that pretty match it ?
> Please let me know if you have seen some accounting or DB book that
> addresses this problem domain.

Another codebase to look at is http://www.sql-ledger.org/. It uses postgresql.

Regards,
Tony


Re: accounting schema

From
johnf
Date:
On Wednesday 06 February 2008 06:54:36 pm Medi Montaseri wrote:
> I suppose instead of AR and AP tables, I can just have one table called
> Entry (thanks Joe....) with an attribute indicating AR vs AP.

I recommend you not do have only one table for transaction.  AR and AP are 
different animals and each can get very complex quickly.   Adding a field 
that only applies to AP and not AR is a very simple example of what goes 
wrong.

-- 
John Fabiani