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

Safe Haskell | None
Language | Haskell2010

Hledger.Reports.BalanceReport

Contents

- Tests

Description

Balance report, used by the balance command.

Synopsis

- type BalanceReport = ([BalanceReportItem], MixedAmount)
- type BalanceReportItem = (AccountName, AccountName, Int, MixedAmount)
- balanceReport :: ReportOpts -> Query -> Journal -> BalanceReport
- balanceReportValue :: Journal -> Day -> BalanceReport -> BalanceReport
- mixedAmountValue :: Journal -> Day -> MixedAmount -> MixedAmount
- amountValue :: Journal -> Day -> Amount -> Amount
- flatShowsExclusiveBalance :: Bool
- tests_Hledger_Reports_BalanceReport :: Test

# Documentation

type BalanceReport = ([BalanceReportItem], MixedAmount) #

A simple single-column balance report. It has:

1. a list of items, one per account, each containing:

- the full account name
- the Ledger-style elided short account name (the leaf account name, prefixed by any boring parents immediately above); or with --flat, the full account name again
- the number of indentation steps for rendering a Ledger-style account tree, taking into account elided boring parents, --no-elide and --flat
- an amount

1. the total of all amounts

type BalanceReportItem = (AccountName, AccountName, Int, MixedAmount) #

balanceReport :: ReportOpts -> Query -> Journal -> BalanceReport #

Enabling this makes balance --flat --empty also show parent accounts without postings, in addition to those with postings and a zero balance. Disabling it shows only the latter. No longer supported, but leave this here for a bit. flatShowsPostinglessAccounts = True

Generate a simple balance report, containing the matched accounts and their balances (change of balance) during the specified period. This is like PeriodChangeReport with a single column (but more mature, eg this can do hierarchical display).

balanceReportValue :: Journal -> Day -> BalanceReport -> BalanceReport #

Convert all the amounts in a single-column balance report to their value on the given date in their default valuation commodities.

mixedAmountValue :: Journal -> Day -> MixedAmount -> MixedAmount #

amountValue :: Journal -> Day -> Amount -> Amount #

Find the market value of this amount on the given date, in it's default valuation commodity, based on recorded market prices. If no default valuation commodity can be found, the amount is left unchanged.

flatShowsExclusiveBalance :: Bool #

When true (the default), this makes balance --flat reports and their implementation clearer. Single/multi-col balance reports currently aren't all correct if this is false.

# Tests

tests_Hledger_Reports_BalanceReport :: Test #