hledger-0.4: A ledger-compatible text-based accounting tool.Source codeContentsIndex
Ledger.Ledger
Description
A Ledger stores, for efficiency, a RawLedger plus its tree of account names, and a map from account names to Accounts. It may also have had uninteresting Entrys and Transactions filtered out. It also stores the complete ledger file text for the ui command.
Synopsis
cacheLedger :: [String] -> RawLedger -> Ledger
groupTransactions :: [Transaction] -> (Tree AccountName, AccountName -> [Transaction], AccountName -> MixedAmount, AccountName -> MixedAmount)
calculateBalances :: Tree AccountName -> (AccountName -> [Transaction]) -> Tree (AccountName, (MixedAmount, MixedAmount))
transactionsByAccount :: [Transaction] -> Map AccountName [Transaction]
filtertxns :: [String] -> [Transaction] -> [Transaction]
accountnames :: Ledger -> [AccountName]
ledgerAccount :: Ledger -> AccountName -> Account
accounts :: Ledger -> [Account]
topAccounts :: Ledger -> [Account]
accountsMatching :: [String] -> Ledger -> [Account]
subAccounts :: Ledger -> Account -> [Account]
ledgerTransactions :: Ledger -> [Transaction]
ledgerAccountTree :: Int -> Ledger -> Tree Account
ledgerAccountTreeAt :: Ledger -> Account -> Maybe (Tree Account)
Documentation
cacheLedger :: [String] -> RawLedger -> LedgerSource
Convert a raw ledger to a more efficient cached type, described above.
groupTransactions :: [Transaction] -> (Tree AccountName, AccountName -> [Transaction], AccountName -> MixedAmount, AccountName -> MixedAmount)Source
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 summariseTransactionsInDateSpan.
calculateBalances :: Tree AccountName -> (AccountName -> [Transaction]) -> Tree (AccountName, (MixedAmount, MixedAmount))Source
Add subaccount-excluding and subaccount-including balances to a tree of account names somewhat efficiently, given a function that looks up transactions by account name.
transactionsByAccount :: [Transaction] -> Map AccountName [Transaction]Source
Convert a list of transactions to a map from account name to the list of all transactions in that account.
filtertxns :: [String] -> [Transaction] -> [Transaction]Source
accountnames :: Ledger -> [AccountName]Source
List a ledger's account names.
ledgerAccount :: Ledger -> AccountName -> AccountSource
Get the named account from a ledger.
accounts :: Ledger -> [Account]Source
List a ledger's accounts, in tree order
topAccounts :: Ledger -> [Account]Source
List a ledger's top-level accounts, in tree order
accountsMatching :: [String] -> Ledger -> [Account]Source
Accounts in ledger whose name matches the pattern, in tree order.
subAccounts :: Ledger -> Account -> [Account]Source
List a ledger account's immediate subaccounts
ledgerTransactions :: Ledger -> [Transaction]Source
List a ledger's transactions.
ledgerAccountTree :: Int -> Ledger -> Tree AccountSource
Get a ledger's tree of accounts to the specified depth.
ledgerAccountTreeAt :: Ledger -> Account -> Maybe (Tree Account)Source
Get a ledger's tree of accounts rooted at the specified account.
Produced by Haddock version 2.6.0