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

Safe Haskell | None
Language | Haskell2010

Hledger.Reports.BudgetReport

Description

Synopsis

- type BudgetGoal = Change
- type BudgetTotal = Total
- type BudgetAverage = Average
- type BudgetCell = (Maybe Change, Maybe BudgetGoal)
- type BudgetReport = PeriodicReport BudgetCell
- type BudgetReportRow = PeriodicReportRow BudgetCell
- budgetReport :: ReportOpts -> Bool -> Bool -> DateSpan -> Day -> Journal -> BudgetReport
- sortBudgetReport :: ReportOpts -> Journal -> BudgetReport -> BudgetReport
- budgetJournal :: Bool -> ReportOpts -> DateSpan -> Journal -> Journal
- budgetRollUp :: [AccountName] -> Bool -> Journal -> Journal
- combineBudgetAndActual :: MultiBalanceReport -> MultiBalanceReport -> BudgetReport
- budgetReportSpan :: BudgetReport -> DateSpan
- budgetReportAsText :: ReportOpts -> BudgetReport -> String
- budgetReportAsTable :: ReportOpts -> BudgetReport -> Table String String (Maybe MixedAmount, Maybe MixedAmount)
- maybeAccountNameDrop :: ReportOpts -> AccountName -> AccountName
- tests_BudgetReport :: Test ()

# 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 BudgetReport = PeriodicReport BudgetCell Source #

type BudgetReportRow = PeriodicReportRow BudgetCell Source #

budgetReport :: ReportOpts -> Bool -> 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).

sortBudgetReport :: ReportOpts -> Journal -> BudgetReport -> BudgetReport Source #

Sort a budget report's rows according to options.

budgetJournal :: Bool -> ReportOpts -> DateSpan -> Journal -> Journal Source #

Use all periodic transactions in the journal to generate budget transactions in the specified report period. Budget transactions are similar to forecast transactions except their purpose is to set goal amounts (of change) per account and period.

budgetRollUp :: [AccountName] -> Bool -> Journal -> Journal Source #

Adjust a journal's account names for budget reporting, in two ways:

1. accounts with no budget goal anywhere in their ancestry are moved under the "unbudgeted" top level account.
2. subaccounts with no budget goal are merged with their closest parent account with a budget goal, so that only budgeted accounts are shown. This can be disabled by --show-unbudgeted.

combineBudgetAndActual :: 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.

budgetReportSpan :: BudgetReport -> DateSpan Source #

Figure out the overall period of a BudgetReport.

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

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

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

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

maybeAccountNameDrop :: ReportOpts -> AccountName -> AccountName Source #

Drop leading components of accounts names as specified by --drop, but only in --flat mode.

tests_BudgetReport :: Test () Source #