How do you handle debits and credits

103 views
Skip to first unread message

Gordon L

unread,
May 20, 2014, 12:16:15 PM5/20/14
to plutu...@googlegroups.com
I was glancing at Github. Wondering how do you handle DR and CR. It seems the actual entries happen in the plutus_amounts table, but I didn't see any field for debits and credits. 

Accounts Receivable is a Debit Balance account. For example, if a customer pays, 
DR Bank $100
CR Accounts Receivable $100

Do you simply record the entry in amounts table with -ve sign? Thanks!




mbulat

unread,
May 20, 2014, 12:30:30 PM5/20/14
to plutu...@googlegroups.com
The Amount class is subclassed as CreditAmount and DebitAmount. The amounts table then has a 'type' field which Rails uses for Single Table Inheritance. 

So your above example would create an entry with a 'DebitAmount' type, and another entry with a 'CreditAmount' type in the table, both with positive amounts. The model code then handles adding or subtracting appropriately based on DR or CR.  

Gordon L

unread,
May 20, 2014, 1:09:03 PM5/20/14
to plutu...@googlegroups.com
Thanks. Got it. 
So from a database perspective, amount.type is either DebitAmount or CreditAmount. I misunderstood before, I thought the type field in amount table was referring to something like Payment, Bill, Withdrawal, etc. 
Reply all
Reply to author
Forward
0 new messages