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

Safe HaskellNone



Whole-journal, account-centric, and per-commodity transactions reports, used by hledger-web.



type TransactionsReport = (String, [TransactionsReportItem])Source

A transactions report includes a list of transactions (posting-filtered and unfiltered variants), a running balance, and some other information helpful for rendering a register view (a flag indicating multiple other accounts and a display string describing them) with or without a notion of current account(s). Two kinds of report use this data structure, see journalTransactionsReport and accountTransactionsReport below for detais.

triDate :: (Transaction, t, t1, t2, t3, t4) -> DaySource

triBalance :: (t, t1, t2, t3, t4, t5) -> t5Source

triSimpleBalance :: (t, t1, t2, t3, t4, MixedAmount) -> [Char]Source

journalTransactionsReport :: ReportOpts -> Journal -> Query -> TransactionsReportSource

Select transactions from the whole journal. This is similar to a postingsReport except with transaction-based report items which are ordered most recent first. This is used by eg hledger-web's journal view.

accountTransactionsReport :: ReportOpts -> Journal -> Query -> Query -> TransactionsReportSource

Select transactions within one or more current accounts, and make a transactions report relative to those account(s). This means:

  1. it shows transactions from the point of view of the current account(s). The transaction amount is the amount posted to the current account(s). The other accounts' names are provided.
  2. With no transaction filtering in effect other than a start date, it shows the accurate historical running balance for the current account(s). Otherwise it shows a running total starting at 0.

This is used by eg hledger-web's account register view. Currently, reporting intervals are not supported, and report items are most recent first.

transactionsReportByCommodity :: TransactionsReport -> [TransactionsReport]Source

Split a transactions report whose items may involve several commodities, into one or more single-commodity transactions reports.