hledger-lib-0.18: Core data types, parsers and utilities for the hledger accounting tool.

Safe HaskellSafe-Infered



A Ledger is derived from a Journal by applying a filter specification to select Transactions and Postings of interest. It contains the filtered journal and knows the resulting chart of accounts, account balances, and postings in each account.



journalToLedger :: Query -> Journal -> LedgerSource

Filter a journal's transactions as specified, and then process them to derive a ledger containing all balances, the chart of accounts, canonicalised commodities etc.

ledgerAccountNames :: Ledger -> [AccountName]Source

List a ledger's account names.

ledgerAccount :: Ledger -> AccountName -> AccountSource

Get the named account from a ledger.

ledgerAccounts :: Ledger -> [Account]Source

List a ledger's accounts, in tree order

ledgerTopAccounts :: Ledger -> [Account]Source

List a ledger's top-level accounts, in tree order

ledgerLeafAccounts :: Ledger -> [Account]Source

List a ledger's bottom-level (subaccount-less) accounts, in tree order

ledgerAccountsMatching :: [String] -> Ledger -> [Account]Source

Accounts in ledger whose name matches the pattern, in tree order.

ledgerSubAccounts :: Ledger -> Account -> [Account]Source

List a ledger account's immediate subaccounts

ledgerPostings :: Ledger -> [Posting]Source

List a ledger's postings, in the order parsed.

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.

ledgerDateSpan :: Ledger -> DateSpanSource

The (fully specified) date span containing all the ledger's (filtered) transactions, or DateSpan Nothing Nothing if there are none.

ledgerCommodities :: Ledger -> Map String CommoditySource

All commodities used in this ledger, as a map keyed by symbol.