Safe Haskell | None |
---|---|
Language | Haskell2010 |
Multi-column balance reports, used by the balance command.
Synopsis
- newtype MultiBalanceReport = MultiBalanceReport ([DateSpan], [MultiBalanceReportRow], MultiBalanceReportTotals)
- type MultiBalanceReportRow = (AccountName, AccountName, Int, [MixedAmount], MixedAmount, MixedAmount)
- multiBalanceReport :: ReportOpts -> Query -> Journal -> MultiBalanceReport
- multiBalanceReportWith :: ReportOpts -> Query -> Journal -> PriceOracle -> MultiBalanceReport
- balanceReportFromMultiBalanceReport :: ReportOpts -> Query -> Journal -> BalanceReport
- mbrNegate :: MultiBalanceReport -> MultiBalanceReport
- mbrNormaliseSign :: NormalSign -> MultiBalanceReport -> MultiBalanceReport
- multiBalanceReportSpan :: MultiBalanceReport -> DateSpan
- tableAsText :: ReportOpts -> (a -> String) -> Table String String a -> String
- tests_MultiBalanceReport :: TestTree
Documentation
newtype MultiBalanceReport Source #
A multi balance report is a balance report with multiple columns, corresponding to consecutive subperiods within the overall report period. It has:
- a list of each column's period (date span)
- a list of rows, each containing:
- the full account name
- the leaf account name
- the account's depth
- A list of amounts, one for each column. The meaning of the
amounts depends on the type of multi balance report, of which
there are three: periodic, cumulative and historical (see
BalanceType
and Hledger.Cli.Commands.Balance). - the total of the row's amounts for a periodic report, or zero for cumulative/historical reports (since summing end balances generally doesn't make sense).
- the average of the row's amounts
- the column totals, and the overall grand total (or zero for cumulative/historical reports) and grand average.
MultiBalanceReport ([DateSpan], [MultiBalanceReportRow], MultiBalanceReportTotals) |
Instances
Show MultiBalanceReport Source # | |
Defined in Hledger.Reports.MultiBalanceReport showsPrec :: Int -> MultiBalanceReport -> ShowS # show :: MultiBalanceReport -> String # showList :: [MultiBalanceReport] -> ShowS # | |
Generic MultiBalanceReport Source # | |
Defined in Hledger.Reports.MultiBalanceReport type Rep MultiBalanceReport :: Type -> Type # from :: MultiBalanceReport -> Rep MultiBalanceReport x # to :: Rep MultiBalanceReport x -> MultiBalanceReport # | |
NFData MultiBalanceReport Source # | |
Defined in Hledger.Reports.MultiBalanceReport rnf :: MultiBalanceReport -> () # | |
type Rep MultiBalanceReport Source # | |
Defined in Hledger.Reports.MultiBalanceReport |
type MultiBalanceReportRow = (AccountName, AccountName, Int, [MixedAmount], MixedAmount, MixedAmount) Source #
multiBalanceReport :: ReportOpts -> Query -> 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. Does not support tree-mode boring parent eliding. 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 multiBalanceReport') by the bscfis commands.
multiBalanceReportWith :: ReportOpts -> Query -> Journal -> PriceOracle -> MultiBalanceReport Source #
A helper for multiBalanceReport. This one takes 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.
balanceReportFromMultiBalanceReport :: ReportOpts -> Query -> Journal -> BalanceReport Source #
Generates a simple non-columnar BalanceReport, but using multiBalanceReport, in order to support --historical. Does not support tree-mode boring parent eliding. If the normalbalance_ option is set, it adjusts the sorting and sign of amounts (see ReportOpts and CompoundBalanceCommand).
mbrNegate :: MultiBalanceReport -> MultiBalanceReport Source #
Flip the sign of all amounts in a MultiBalanceReport.
mbrNormaliseSign :: NormalSign -> MultiBalanceReport -> MultiBalanceReport Source #
Given a MultiBalanceReport and its normal balance sign, if it is known to be normally negative, convert it to normally positive.
multiBalanceReportSpan :: MultiBalanceReport -> DateSpan Source #
Figure out the overall date span of a multicolumn balance report.
tableAsText :: ReportOpts -> (a -> String) -> Table String String a -> String Source #