hledger-lib-1.3: Core data types, parsers and functionality for the hledger accounting tools

Safe Haskell | None
Language | Haskell2010

Hledger.Data.Ledger

Contents

- Orphan instances

Description

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

Synopsis

- nullledger :: Ledger
- ledgerFromJournal :: Query -> Journal -> Ledger
- ledgerAccountNames :: Ledger -> [AccountName]
- ledgerAccount :: Ledger -> AccountName -> Maybe Account
- ledgerRootAccount :: Ledger -> Account
- ledgerTopAccounts :: Ledger -> [Account]
- ledgerLeafAccounts :: Ledger -> [Account]
- ledgerAccountsMatching :: [String] -> Ledger -> [Account]
- ledgerPostings :: Ledger -> [Posting]
- ledgerDateSpan :: Ledger -> DateSpan
- ledgerCommodities :: Ledger -> [CommoditySymbol]
- tests_ledgerFromJournal :: [Test]
- tests_Hledger_Data_Ledger :: Test

# Documentation

nullledger :: Ledger #

ledgerFromJournal :: Query -> Journal -> Ledger #

Filter a journal's transactions with the given query, then derive a ledger containing the chart of accounts and balances. If the query includes a depth limit, that will affect the ledger's journal but not the ledger's account tree.

ledgerAccountNames :: Ledger -> [AccountName] #

List a ledger's account names.

ledgerAccount :: Ledger -> AccountName -> Maybe Account #

Get the named account from a ledger.

ledgerRootAccount :: Ledger -> Account #

Get this ledger's root account, which is a dummy "root" account above all others. This should always be first in the account list, if somehow not this returns a null account.

ledgerTopAccounts :: Ledger -> [Account] #

List a ledger's top-level accounts (the ones below the root), in tree order.

ledgerLeafAccounts :: Ledger -> [Account] #

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

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

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

ledgerPostings :: Ledger -> [Posting] #

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

ledgerDateSpan :: Ledger -> DateSpan #

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

ledgerCommodities :: Ledger -> [CommoditySymbol] #

All commodities used in this ledger.

tests_ledgerFromJournal :: [Test] #

tests_Hledger_Data_Ledger :: Test #

# Orphan instances

Show Ledger # |
Methods showsPrec :: Int -> Ledger -> ShowS # show :: Ledger -> String # showList :: [Ledger] -> ShowS #