hledger-lib-1.19.1: A reusable library providing the core functionality of hledger

Safe Haskell | None
Language | Haskell2010

Hledger.Reports.MultiBalanceReport

Description

Multi-column balance reports, used by the balance command.

Synopsis

- type MultiBalanceReport = PeriodicReport DisplayName MixedAmount
- type MultiBalanceReportRow = PeriodicReportRow DisplayName MixedAmount
- multiBalanceReport :: Day -> ReportOpts -> Journal -> MultiBalanceReport
- multiBalanceReportWith :: ReportOpts -> Query -> Journal -> PriceOracle -> MultiBalanceReport
- type CompoundBalanceReport = CompoundPeriodicReport DisplayName MixedAmount
- compoundBalanceReport :: Day -> ReportOpts -> Journal -> [CBCSubreportSpec] -> CompoundBalanceReport
- compoundBalanceReportWith :: ReportOpts -> Query -> Journal -> PriceOracle -> [CBCSubreportSpec] -> CompoundBalanceReport
- tableAsText :: ReportOpts -> (a -> String) -> Table String String a -> String
- sortRows :: ReportOpts -> Journal -> [MultiBalanceReportRow] -> [MultiBalanceReportRow]
- sortRowsLike :: [AccountName] -> [PeriodicReportRow DisplayName b] -> [PeriodicReportRow DisplayName b]
- tests_MultiBalanceReport :: TestTree

# Documentation

type MultiBalanceReport = PeriodicReport DisplayName MixedAmount Source #

A multi balance report is a kind of periodic report, where the amounts correspond to balance changes or ending balances in a given period. It has:

1. a list of each column's period (date span)
2. a list of rows, each containing:

- the full account name, display name, and display depth
- A list of amounts, one for each column.
- the total of the row's amounts for a periodic report
- the average of the row's amounts

1. the column totals, and the overall grand total (or zero for cumulative/historical reports) and grand average.

type MultiBalanceReportRow = PeriodicReportRow DisplayName MixedAmount Source #

multiBalanceReport :: Day -> ReportOpts -> Journal -> MultiBalanceReport Source #

Generate a multicolumn balance report for the matched accounts, showing the change of balance, accumulated balance, or historical balance in each of the specified periods. If the normalbalance_ option is set, it adjusts the sorting and sign of amounts (see ReportOpts and CompoundBalanceCommand). hledger's most powerful and useful report, used by the balance command (in multiperiod mode) and (via compoundBalanceReport) by the bscfis commands.

multiBalanceReportWith :: ReportOpts -> Query -> Journal -> PriceOracle -> MultiBalanceReport Source #

A helper for multiBalanceReport. This one takes an explicit Query instead of deriving one from ReportOpts, and an extra argument, a PriceOracle to be used for looking up market prices. Commands which run multiple reports (bs etc.) can generate the price oracle just once for efficiency, passing it to each report by calling this function directly.

type CompoundBalanceReport = CompoundPeriodicReport DisplayName MixedAmount Source #

compoundBalanceReport :: Day -> ReportOpts -> Journal -> [CBCSubreportSpec] -> CompoundBalanceReport Source #

Generate a compound balance report from a list of CBCSubreportSpec. This shares postings between the subreports.

compoundBalanceReportWith :: ReportOpts -> Query -> Journal -> PriceOracle -> [CBCSubreportSpec] -> CompoundBalanceReport Source #

A helper for compoundBalanceReport, similar to multiBalanceReportWith.

tableAsText :: ReportOpts -> (a -> String) -> Table String String a -> String Source #

sortRows :: ReportOpts -> Journal -> [MultiBalanceReportRow] -> [MultiBalanceReportRow] Source #

Sort the rows by amount or by account declaration order.

sortRowsLike :: [AccountName] -> [PeriodicReportRow DisplayName b] -> [PeriodicReportRow DisplayName b] Source #

A sorting helper: sort a list of things (eg report rows) keyed by account name to match the provided ordering of those same account names.

tests_MultiBalanceReport :: TestTree Source #