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

Safe HaskellNone



Here are several variants of a transactions report. Transactions reports are like a postings report, but more transaction-oriented, and (in the account-centric variant) relative to a some base account. They are 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.

type AccountTransactionsReport = (String, [AccountTransactionsReportItem]) Source #

An account transactions report represents transactions affecting a particular account (or possibly several accounts, but we don't use that). It is used eg by hledger-ui's and hledger-web's account register view, where we want to show one row per transaction, in the context of the current account. Report items consist of:

  • the transaction, unmodified
  • the transaction as seen in the context of the current account and query, which means:
  • the transaction date is set to the "transaction context date", which can be different from the transaction's general date: if postings to the current account (and matched by the report query) have their own dates, it's the earliest of these dates.
  • the transaction's postings are filtered, excluding any which are not matched by the report query
  • a text description of the other account(s) posted to/from
  • a flag indicating whether there's more than one other account involved
  • the total increase/decrease to the current account
  • the report transactions' running total after this transaction; or if historical balance is requested (-H), the historical running total. The historical running total includes transactions from before the report start date if one is specified, filtered by the report query. The historical running total may or may not be the account's historical running balance, depending on the report query.

Items are sorted by transaction register date (the earliest date the transaction posts to the current account), most recent first. Reporting intervals are currently ignored.

triOrigTransaction :: (t5, t4, t3, t2, t1, t) -> t5 Source #

triDate :: (t4, Transaction, t3, t2, t1, t) -> Day Source #

triAmount :: (t4, t3, t2, t1, t5, t) -> t5 Source #

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

journalTransactionsReport :: ReportOpts -> Journal -> Query -> TransactionsReport Source #

Select transactions from the whole journal. This is similar to a "postingsReport" except with transaction-based report items which are ordered most recent first. XXX Or an EntriesReport - use that instead ? This is used by hledger-web's journal view.

transactionsReportByCommodity :: TransactionsReport -> [(CommoditySymbol, TransactionsReport)] Source #

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

transactionRegisterDate :: Query -> Query -> Transaction -> Day Source #

What is the transaction's date in the context of a particular account (specified with a query) and report query, as in an account register ? It's normally the transaction's general date, but if any posting(s) matched by the report query and affecting the matched account(s) have their own earlier dates, it's the earliest of these dates. Secondary transaction/posting dates are ignored.