hledger-lib-1.21: A reusable library providing the core functionality of hledger
Safe HaskellNone
LanguageHaskell2010

Hledger.Reports.BudgetReport

Contents

Description

 
Synopsis

Documentation

type BudgetCell = (Maybe Change, Maybe BudgetGoal) Source #

A budget report tracks expected and actual changes per account and subperiod.

budgetReport :: ReportSpec -> Bool -> DateSpan -> Journal -> BudgetReport Source #

Calculate per-account, per-period budget (balance change) goals from all periodic transactions, calculate actual balance changes from the regular transactions, and compare these to get a BudgetReport. Unbudgeted accounts may be hidden or renamed (see journalWithBudgetAccountNames).

budgetReportAsTable :: ReportOpts -> BudgetReport -> Table Text Text (Maybe MixedAmount, Maybe MixedAmount) Source #

Build a Table from a multi-column balance report.

budgetReportAsText :: ReportOpts -> BudgetReport -> Text Source #

Render a budget report as plain text suitable for console output.

budgetReportAsCsv :: ReportOpts -> BudgetReport -> CSV Source #

Render a budget report as CSV. Like multiBalanceReportAsCsv, but includes alternating actual and budget amount columns.

Helpers

reportPeriodName :: BalanceType -> [DateSpan] -> DateSpan -> Text Source #

Make a name for the given period in a multiperiod report, given the type of balance being reported and the full set of report periods. This will be used as a column heading (or row heading, in a register summary report). We try to pick a useful name as follows:

  • ending-balance reports: the period's end date
  • balance change reports where the periods are months and all in the same year: the short month name in the current locale
  • all other balance change reports: a description of the datespan, abbreviated to compact form if possible (see showDateSpan).

combineBudgetAndActual :: ReportOpts -> Journal -> MultiBalanceReport -> MultiBalanceReport -> BudgetReport Source #

Combine a per-account-and-subperiod report of budget goals, and one of actual change amounts, into a budget performance report. The two reports should have the same report interval, but need not have exactly the same account rows or date columns. (Cells in the combined budget report can be missing a budget goal, an actual amount, or both.) The combined report will include:

  • consecutive subperiods at the same interval as the two reports, spanning the period of both reports
  • all accounts mentioned in either report, sorted by account code or account name or amount as appropriate.

Tests