hledger-lib-1.19.1: A reusable library providing the core functionality of hledger

Safe Haskell | None
Language | Haskell2010

Hledger.Reports.BudgetReport

Contents

- Helpers
- Tests

Description

Synopsis

- type BudgetGoal = Change
- type BudgetTotal = Total
- type BudgetAverage = Average
- type BudgetCell = (Maybe Change, Maybe BudgetGoal)
- type BudgetReportRow = PeriodicReportRow DisplayName BudgetCell
- type BudgetReport = PeriodicReport DisplayName BudgetCell
- budgetReport :: ReportOpts -> Bool -> DateSpan -> Day -> Journal -> BudgetReport
- budgetReportAsTable :: ReportOpts -> BudgetReport -> Table String String (Maybe MixedAmount, Maybe MixedAmount)
- budgetReportAsText :: ReportOpts -> BudgetReport -> String
- reportPeriodName :: BalanceType -> [DateSpan] -> DateSpan -> String
- tests_BudgetReport :: TestTree

# Documentation

type BudgetGoal = Change Source #

type BudgetTotal = Total Source #

type BudgetAverage = Average Source #

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

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

type BudgetReportRow = PeriodicReportRow DisplayName BudgetCell Source #

type BudgetReport = PeriodicReport DisplayName BudgetCell Source #

budgetReport :: ReportOpts -> Bool -> DateSpan -> Day -> Journal -> BudgetReport Source #

Calculate budget goals from all periodic transactions, actual balance changes from the regular transactions, and compare these to get a `BudgetReport`. Unbudgeted accounts may be hidden or renamed (see budgetRollup).

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

Build a `Table` from a multi-column balance report.

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

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

# Helpers

reportPeriodName :: BalanceType -> [DateSpan] -> DateSpan -> String 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).

# Tests

tests_BudgetReport :: TestTree Source #