hledger-lib-1.52.1: A library providing the core functionality of hledger

Safe Haskell | None
Language | GHC2021

Hledger.Reports.AccountTransactionsReport

Contents

- Orphan instances

Description

An account-centric transactions report.

Synopsis

- type AccountTransactionsReport = [AccountTransactionsReportItem]
- type AccountTransactionsReportItem = (Transaction, Transaction, Bool, [AccountName], MixedAmount, MixedAmount)
- accountTransactionsReport :: ReportSpec -> Journal -> Query -> AccountTransactionsReport
- accountTransactionsReportItems :: Query -> Query -> MixedAmount -> (MixedAmount -> MixedAmount) -> (AccountName -> Maybe AccountType) -> [(Day, Transaction)] -> [AccountTransactionsReportItem]
- transactionRegisterDate :: WhichDate -> Query -> Query -> Transaction -> Day
- triOrigTransaction :: (a, b, c, d, e, f) -> a
- triDate :: (a, Transaction, c, d, e, f) -> Day
- triAmount :: (a, b, c, d, e, f) -> e
- triBalance :: (a, b, c, d, e, f) -> f
- triCommodityAmount :: CommoditySymbol -> (a, b, c, d, MixedAmount, f) -> MixedAmount
- triCommodityBalance :: CommoditySymbol -> (a, b, c, d, e, MixedAmount) -> MixedAmount
- accountTransactionsReportByCommodity :: AccountTransactionsReport -> [(CommoditySymbol, AccountTransactionsReport)]
- tests_AccountTransactionsReport :: TestTree

# Documentation

type AccountTransactionsReport = [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 register view, and hledger's aregister report, 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": the earliest of the transaction date and any other posting dates of postings to the current account (matched by the report query).
- 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.

type AccountTransactionsReportItem = (Transaction, Transaction, Bool, [AccountName], MixedAmount, MixedAmount) Source #

accountTransactionsReport :: ReportSpec -> Journal -> Query -> AccountTransactionsReport Source #

accountTransactionsReportItems :: Query -> Query -> MixedAmount -> (MixedAmount -> MixedAmount) -> (AccountName -> Maybe AccountType) -> [(Day, Transaction)] -> [AccountTransactionsReportItem] Source #

Generate transactions report items from a list of transactions, using the provided user-specified report query, a query specifying which account to use as the focus, a starting balance, and a sign-setting function. Each transaction is accompanied by the date that should be shown for it in the report. This is not necessarily the transaction date - see transactionRegisterDate.

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

What date should be shown for a transaction in an account register report ? This will be in context of a particular account (the "this account" query) and any additional report query. It could be:

- if postings are matched by both thisacctq and reportq, the earliest of those matched postings' dates (or their secondary dates if --date2 was used)
- the transaction date, or its secondary date if --date2 was used.

triOrigTransaction :: (a, b, c, d, e, f) -> a Source #

triDate :: (a, Transaction, c, d, e, f) -> Day Source #

triAmount :: (a, b, c, d, e, f) -> e Source #

triBalance :: (a, b, c, d, e, f) -> f Source #

triCommodityAmount :: CommoditySymbol -> (a, b, c, d, MixedAmount, f) -> MixedAmount Source #

triCommodityBalance :: CommoditySymbol -> (a, b, c, d, e, MixedAmount) -> MixedAmount Source #

accountTransactionsReportByCommodity :: AccountTransactionsReport -> [(CommoditySymbol, AccountTransactionsReport)] Source #

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

tests_AccountTransactionsReport :: TestTree Source #

# Orphan instances

HasAmounts AccountTransactionsReportItem Source # |
Instance details Methods styleAmounts :: Map CommoditySymbol AmountStyle -> AccountTransactionsReportItem -> AccountTransactionsReportItem Source #