This commit is contained in:
Simon Michael 2009-12-19 06:26:33 +00:00
parent 60bda57a26
commit 23e3c81acc
2 changed files with 16 additions and 17 deletions

View File

@ -71,7 +71,7 @@ instance Show Ledger where
(length $ accountnames l)
(showtree $ accountnametree l)
-- | Convert a raw ledger to a more efficient cached type, described above.
-- | Convert a journal to a more efficient cached ledger, described above.
cacheLedger :: [String] -> Journal -> Ledger
cacheLedger apats j = Ledger{journaltext="",journal=j,accountnametree=ant,accountmap=acctmap}
where
@ -79,11 +79,10 @@ cacheLedger apats j = Ledger{journaltext="",journal=j,accountnametree=ant,accoun
acctmap = Map.fromList [(a, mkacct a) | a <- flatten ant]
where mkacct a = Account a (psof a) (inclbalof a)
-- | Given a list of transactions, return an account name tree and three
-- query functions that fetch transactions, balance, and
-- subaccount-including balance by account name.
-- This is to factor out common logic from cacheLedger and
-- summarisePostingsInDateSpan.
-- | Given a list of postings, return an account name tree and three query
-- functions that fetch postings, balance, and subaccount-including
-- balance by account name. This factors out common logic from
-- cacheLedger and summarisePostingsInDateSpan.
groupPostings :: [Posting] -> (Tree AccountName,
(AccountName -> [Posting]),
(AccountName -> MixedAmount),

View File

@ -124,17 +124,6 @@ data Journal = Journal {
filereadtime :: ClockTime
} deriving (Eq)
-- | A generic, pure specification of how to filter raw ledger transactions.
data FilterSpec = FilterSpec {
datespan :: DateSpan -- ^ only include transactions in this date span
,cleared :: Maybe Bool -- ^ only include if cleared\/uncleared\/don't care
,real :: Bool -- ^ only include if real\/don't care
,costbasis :: Bool -- ^ convert all amounts to cost basis
,acctpats :: [String] -- ^ only include if matching these account patterns
,descpats :: [String] -- ^ only include if matching these description patterns
,whichdate :: WhichDate -- ^ which dates to use (transaction or effective)
}
data Account = Account {
aname :: AccountName,
apostings :: [Posting], -- ^ transactions in this account
@ -148,3 +137,14 @@ data Ledger = Ledger {
accountmap :: Map.Map AccountName Account
} deriving Typeable
-- | A generic, pure specification of how to filter transactions/postings.
data FilterSpec = FilterSpec {
datespan :: DateSpan -- ^ only include if in this date span
,cleared :: Maybe Bool -- ^ only include if cleared\/uncleared\/don't care
,real :: Bool -- ^ only include if real\/don't care
,costbasis :: Bool -- ^ convert all amounts to cost basis
,acctpats :: [String] -- ^ only include if matching these account patterns
,descpats :: [String] -- ^ only include if matching these description patterns
,whichdate :: WhichDate -- ^ which dates to use (actual or effective)
}