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

Safe HaskellNone
LanguageHaskell2010

Hledger.Reports.MultiBalanceReport

Description

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

Synopsis

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.

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.

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.

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.