2008-10-03 06:04:15 +04:00
|
|
|
{-|
|
|
|
|
|
2009-04-04 00:55:49 +04:00
|
|
|
A compound data type for efficiency. An 'Account' stores
|
|
|
|
|
|
|
|
- an 'AccountName',
|
2009-04-05 02:38:36 +04:00
|
|
|
|
|
|
|
- all 'Transaction's (postings plus ledger transaction info) in the
|
2009-04-04 00:55:49 +04:00
|
|
|
account, excluding subaccounts
|
2009-04-05 02:38:36 +04:00
|
|
|
|
|
|
|
- a 'MixedAmount' representing the account balance, including subaccounts.
|
2008-10-03 06:04:15 +04:00
|
|
|
|
|
|
|
-}
|
|
|
|
|
2008-10-03 04:40:06 +04:00
|
|
|
module Ledger.Account
|
2007-02-15 05:08:18 +03:00
|
|
|
where
|
2008-10-03 04:05:16 +04:00
|
|
|
import Ledger.Utils
|
2008-10-03 04:12:59 +04:00
|
|
|
import Ledger.Types
|
2008-10-03 04:40:06 +04:00
|
|
|
import Ledger.Amount
|
2007-02-15 05:08:18 +03:00
|
|
|
|
|
|
|
|
2007-03-11 01:29:09 +03:00
|
|
|
instance Show Account where
|
2008-10-17 07:14:23 +04:00
|
|
|
show (Account a ts b) = printf "Account %s with %d txns and %s balance" a (length ts) (showMixedAmount b)
|
2007-03-11 01:29:09 +03:00
|
|
|
|
2008-10-18 04:52:49 +04:00
|
|
|
instance Eq Account where
|
|
|
|
(==) (Account n1 t1 b1) (Account n2 t2 b2) = n1 == n2 && t1 == t2 && b1 == b2
|
|
|
|
|
2008-11-22 20:21:49 +03:00
|
|
|
nullacct = Account "" [] nullmixedamt
|
2007-02-15 05:08:18 +03:00
|
|
|
|