hledger-lib
Safe HaskellNone
LanguageGHC2021

Hledger.Reports.ReportOptions

Description

Options common to most hledger reports.

Synopsis

Documentation

data ReportOpts Source #

Standard options for customising report filtering and output. Most of these correspond to standard hledger command-line options or query arguments, but not all. Some are used only by certain commands, as noted below.

Constructors

ReportOpts 

Fields

  • period_ :: Period
     
  • interval_ :: Interval
     
  • statuses_ :: [Status]

    Zero, one, or two statuses to be matched

  • conversionop_ :: Maybe ConversionOp

    Which operation should we apply to conversion transactions?

  • value_ :: Maybe ValuationType

    What value should amounts be converted to ?

  • infer_prices_ :: Bool

    Infer market prices from transactions ?

  • depth_ :: DepthSpec
    • -depth: clip the report to this depth (overall, or per account), removing deeper accounts and summing their amounts into their parents. Reports read it from their query, where queryFromFlags puts it.
  • fold_depth_ :: Maybe Int

    Unlike the CLI, where a depth limit (depth_) clips the tree before its rows are laid out, in hledger-web's tree mode a depth limit only sets the depth at which accounts are folded by default; the user can still open or close individual accounts to show more or less depth. So there the rows are laid out for the whole tree, and some are hidden. But folding can only hide whole rows; a boring parent account squashed into its subaccount's row, like "assets:bank", could not easily be folded to depth 1. So fold_depth_ holds a folding UI's default fold depth, and we take care not to squash accounts across this depth. Eg with fold depth 1, instead of "assets:bank", we'll display "assets" and "bank" on separate rows. (It's like no_elide_, but at this depth only.) Note, hledger-web's balance reports and sidebar fold in this way, but not its holdings report, where clipping merges positions by commodity, which folding can't show; so it does depth-clipping, like the CLI holdings report.

  • no_elide_ :: Bool
    • -no-elide: in tree mode, don't ever squash boring parent accounts into their subaccount's row; in list mode, with -E, also show parent accounts.
  • date2_ :: Bool
     
  • empty_ :: Bool
     
  • full_names_ :: Bool
     
  • real_ :: Bool
     
  • format_ :: StringFormat
     
  • balance_base_url_ :: Maybe Text
     
  • pretty_ :: Bool
     
  • querystring_ :: [Text]
     
  • average_ :: Bool
     
  • related_ :: Bool
     
  • sortspec_ :: SortSpec
     
  • txn_dates_ :: Bool
     
  • balancecalc_ :: BalanceCalculation

    What to calculate in balance report cells

  • balanceaccum_ :: BalanceAccumulation

    How to accumulate balance report values over time

  • budgetpat_ :: Maybe Text

    A case-insensitive description substring to select periodic transactions for budget reports. (Not a regexp, nor a full hledger query, for now.)

  • accountlistmode_ :: AccountListMode
     
  • drop_ :: Int
     
  • declared_ :: Bool

    Include accounts declared but not yet posted to ?

  • row_total_ :: Bool
     
  • no_total_ :: Bool
     
  • summary_only_ :: Bool
     
  • show_costs_ :: Bool

    Show costs for reports which normally don't show them ?

  • sort_amount_ :: Bool
     
  • percent_ :: Bool
     
  • invert_ :: Bool

    Flip all amount signs in reports ?

  • normalbalance_ :: Maybe NormalSign

    This can be set when running balance reports on a set of accounts with the same normal balance type (eg all assets, or all incomes). - It helps --sort-amount know how to sort negative numbers (eg in the income section of an income statement) - It helps compound balance report commands (is, bs etc.) do sign normalisation, converting normally negative subreports to normally positive for a more conventional display.

  • color_ :: Bool

    Whether to use ANSI color codes in text output. Influenced by the --color/colour flag (cf CliOptions), whether stdout is an interactive terminal, and the value of TERM and existence of NO_COLOR environment variables.

  • transpose_ :: Bool
     
  • layout_ :: Layout
     
  • period_titles_ :: PeriodTitles
     
  • title_ :: Maybe Text

    Explicit --title value if given (possibly empty to suppress); otherwise Nothing, in which case each report falls back to its own default heading. Resolved via effectiveTitle.

  • subreport_titles_ :: Maybe Text

    Explicit --subreport-titles value, a |-separated list of subreport titles to use in compound reports. An empty string means "suppress all default subreport titles".

  • translations_ :: Translations

    Translations for the report's structural text (titles, headings, month names), selected by --lang. English by default.

Instances

Instances details
Default ReportOpts Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

def :: ReportOpts

Show ReportOpts Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

showsPrec :: Int -> ReportOpts -> ShowS

show :: ReportOpts -> String

showList :: [ReportOpts] -> ShowS

HasReportOpts ReportOpts Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

reportOpts :: ReportableLens' ReportOpts ReportOpts Source #

period :: ReportableLens' ReportOpts Period Source #

statuses :: ReportableLens' ReportOpts [Status] Source #

depth :: ReportableLens' ReportOpts DepthSpec Source #

date2 :: ReportableLens' ReportOpts Bool Source #

real :: ReportableLens' ReportOpts Bool Source #

querystring :: ReportableLens' ReportOpts [Text] Source #

HasReportOptsNoUpdate ReportOpts Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

reportOptsNoUpdate :: Lens' ReportOpts ReportOpts Source #

accountlistmode :: Lens' ReportOpts AccountListMode Source #

average :: Lens' ReportOpts Bool Source #

balance_base_url :: Lens' ReportOpts (Maybe Text) Source #

balanceaccum :: Lens' ReportOpts BalanceAccumulation Source #

balancecalc :: Lens' ReportOpts BalanceCalculation Source #

budgetpat :: Lens' ReportOpts (Maybe Text) Source #

color__ :: Lens' ReportOpts Bool Source #

conversionop :: Lens' ReportOpts (Maybe ConversionOp) Source #

date2NoUpdate :: Lens' ReportOpts Bool Source #

declared :: Lens' ReportOpts Bool Source #

depthNoUpdate :: Lens' ReportOpts DepthSpec Source #

drop__ :: Lens' ReportOpts Int Source #

empty__ :: Lens' ReportOpts Bool Source #

fold_depth :: Lens' ReportOpts (Maybe Int) Source #

format :: Lens' ReportOpts StringFormat Source #

full_names :: Lens' ReportOpts Bool Source #

infer_prices :: Lens' ReportOpts Bool Source #

interval :: Lens' ReportOpts Interval Source #

invert :: Lens' ReportOpts Bool Source #

layout :: Lens' ReportOpts Layout Source #

no_elide :: Lens' ReportOpts Bool Source #

no_total :: Lens' ReportOpts Bool Source #

normalbalance :: Lens' ReportOpts (Maybe NormalSign) Source #

percent :: Lens' ReportOpts Bool Source #

periodNoUpdate :: Lens' ReportOpts Period Source #

period_titles :: Lens' ReportOpts PeriodTitles Source #

pretty :: Lens' ReportOpts Bool Source #

querystringNoUpdate :: Lens' ReportOpts [Text] Source #

realNoUpdate :: Lens' ReportOpts Bool Source #

related :: Lens' ReportOpts Bool Source #

row_total :: Lens' ReportOpts Bool Source #

show_costs :: Lens' ReportOpts Bool Source #

sort_amount :: Lens' ReportOpts Bool Source #

sortspec :: Lens' ReportOpts SortSpec Source #

statusesNoUpdate :: Lens' ReportOpts [Status] Source #

subreport_titles :: Lens' ReportOpts (Maybe Text) Source #

summary_only :: Lens' ReportOpts Bool Source #

title__ :: Lens' ReportOpts (Maybe Text) Source #

translations :: Lens' ReportOpts Translations Source #

transpose__ :: Lens' ReportOpts Bool Source #

txn_dates :: Lens' ReportOpts Bool Source #

value :: Lens' ReportOpts (Maybe ValuationType) Source #

class HasReportOptsNoUpdate c where Source #

Lenses for ReportOpts.

Minimal complete definition

reportOptsNoUpdate

Methods

reportOptsNoUpdate :: Lens' c ReportOpts Source #

accountlistmode :: Lens' c AccountListMode Source #

average :: Lens' c Bool Source #

balance_base_url :: Lens' c (Maybe Text) Source #

balanceaccum :: Lens' c BalanceAccumulation Source #

balancecalc :: Lens' c BalanceCalculation Source #

budgetpat :: Lens' c (Maybe Text) Source #

color__ :: Lens' c Bool Source #

conversionop :: Lens' c (Maybe ConversionOp) Source #

date2NoUpdate :: Lens' c Bool Source #

declared :: Lens' c Bool Source #

depthNoUpdate :: Lens' c DepthSpec Source #

drop__ :: Lens' c Int Source #

empty__ :: Lens' c Bool Source #

fold_depth :: Lens' c (Maybe Int) Source #

format :: Lens' c StringFormat Source #

full_names :: Lens' c Bool Source #

infer_prices :: Lens' c Bool Source #

interval :: Lens' c Interval Source #

invert :: Lens' c Bool Source #

layout :: Lens' c Layout Source #

no_elide :: Lens' c Bool Source #

no_total :: Lens' c Bool Source #

normalbalance :: Lens' c (Maybe NormalSign) Source #

percent :: Lens' c Bool Source #

periodNoUpdate :: Lens' c Period Source #

period_titles :: Lens' c PeriodTitles Source #

pretty :: Lens' c Bool Source #

querystringNoUpdate :: Lens' c [Text] Source #

realNoUpdate :: Lens' c Bool Source #

related :: Lens' c Bool Source #

row_total :: Lens' c Bool Source #

show_costs :: Lens' c Bool Source #

sort_amount :: Lens' c Bool Source #

sortspec :: Lens' c SortSpec Source #

statusesNoUpdate :: Lens' c [Status] Source #

subreport_titles :: Lens' c (Maybe Text) Source #

summary_only :: Lens' c Bool Source #

title__ :: Lens' c (Maybe Text) Source #

translations :: Lens' c Translations Source #

transpose__ :: Lens' c Bool Source #

txn_dates :: Lens' c Bool Source #

value :: Lens' c (Maybe ValuationType) Source #

Instances

Instances details
HasReportOptsNoUpdate ReportOpts Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

reportOptsNoUpdate :: Lens' ReportOpts ReportOpts Source #

accountlistmode :: Lens' ReportOpts AccountListMode Source #

average :: Lens' ReportOpts Bool Source #

balance_base_url :: Lens' ReportOpts (Maybe Text) Source #

balanceaccum :: Lens' ReportOpts BalanceAccumulation Source #

balancecalc :: Lens' ReportOpts BalanceCalculation Source #

budgetpat :: Lens' ReportOpts (Maybe Text) Source #

color__ :: Lens' ReportOpts Bool Source #

conversionop :: Lens' ReportOpts (Maybe ConversionOp) Source #

date2NoUpdate :: Lens' ReportOpts Bool Source #

declared :: Lens' ReportOpts Bool Source #

depthNoUpdate :: Lens' ReportOpts DepthSpec Source #

drop__ :: Lens' ReportOpts Int Source #

empty__ :: Lens' ReportOpts Bool Source #

fold_depth :: Lens' ReportOpts (Maybe Int) Source #

format :: Lens' ReportOpts StringFormat Source #

full_names :: Lens' ReportOpts Bool Source #

infer_prices :: Lens' ReportOpts Bool Source #

interval :: Lens' ReportOpts Interval Source #

invert :: Lens' ReportOpts Bool Source #

layout :: Lens' ReportOpts Layout Source #

no_elide :: Lens' ReportOpts Bool Source #

no_total :: Lens' ReportOpts Bool Source #

normalbalance :: Lens' ReportOpts (Maybe NormalSign) Source #

percent :: Lens' ReportOpts Bool Source #

periodNoUpdate :: Lens' ReportOpts Period Source #

period_titles :: Lens' ReportOpts PeriodTitles Source #

pretty :: Lens' ReportOpts Bool Source #

querystringNoUpdate :: Lens' ReportOpts [Text] Source #

realNoUpdate :: Lens' ReportOpts Bool Source #

related :: Lens' ReportOpts Bool Source #

row_total :: Lens' ReportOpts Bool Source #

show_costs :: Lens' ReportOpts Bool Source #

sort_amount :: Lens' ReportOpts Bool Source #

sortspec :: Lens' ReportOpts SortSpec Source #

statusesNoUpdate :: Lens' ReportOpts [Status] Source #

subreport_titles :: Lens' ReportOpts (Maybe Text) Source #

summary_only :: Lens' ReportOpts Bool Source #

title__ :: Lens' ReportOpts (Maybe Text) Source #

translations :: Lens' ReportOpts Translations Source #

transpose__ :: Lens' ReportOpts Bool Source #

txn_dates :: Lens' ReportOpts Bool Source #

value :: Lens' ReportOpts (Maybe ValuationType) Source #

HasReportOptsNoUpdate ReportSpec Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

reportOptsNoUpdate :: Lens' ReportSpec ReportOpts Source #

accountlistmode :: Lens' ReportSpec AccountListMode Source #

average :: Lens' ReportSpec Bool Source #

balance_base_url :: Lens' ReportSpec (Maybe Text) Source #

balanceaccum :: Lens' ReportSpec BalanceAccumulation Source #

balancecalc :: Lens' ReportSpec BalanceCalculation Source #

budgetpat :: Lens' ReportSpec (Maybe Text) Source #

color__ :: Lens' ReportSpec Bool Source #

conversionop :: Lens' ReportSpec (Maybe ConversionOp) Source #

date2NoUpdate :: Lens' ReportSpec Bool Source #

declared :: Lens' ReportSpec Bool Source #

depthNoUpdate :: Lens' ReportSpec DepthSpec Source #

drop__ :: Lens' ReportSpec Int Source #

empty__ :: Lens' ReportSpec Bool Source #

fold_depth :: Lens' ReportSpec (Maybe Int) Source #

format :: Lens' ReportSpec StringFormat Source #

full_names :: Lens' ReportSpec Bool Source #

infer_prices :: Lens' ReportSpec Bool Source #

interval :: Lens' ReportSpec Interval Source #

invert :: Lens' ReportSpec Bool Source #

layout :: Lens' ReportSpec Layout Source #

no_elide :: Lens' ReportSpec Bool Source #

no_total :: Lens' ReportSpec Bool Source #

normalbalance :: Lens' ReportSpec (Maybe NormalSign) Source #

percent :: Lens' ReportSpec Bool Source #

periodNoUpdate :: Lens' ReportSpec Period Source #

period_titles :: Lens' ReportSpec PeriodTitles Source #

pretty :: Lens' ReportSpec Bool Source #

querystringNoUpdate :: Lens' ReportSpec [Text] Source #

realNoUpdate :: Lens' ReportSpec Bool Source #

related :: Lens' ReportSpec Bool Source #

row_total :: Lens' ReportSpec Bool Source #

show_costs :: Lens' ReportSpec Bool Source #

sort_amount :: Lens' ReportSpec Bool Source #

sortspec :: Lens' ReportSpec SortSpec Source #

statusesNoUpdate :: Lens' ReportSpec [Status] Source #

subreport_titles :: Lens' ReportSpec (Maybe Text) Source #

summary_only :: Lens' ReportSpec Bool Source #

title__ :: Lens' ReportSpec (Maybe Text) Source #

translations :: Lens' ReportSpec Translations Source #

transpose__ :: Lens' ReportSpec Bool Source #

txn_dates :: Lens' ReportSpec Bool Source #

value :: Lens' ReportSpec (Maybe ValuationType) Source #

class HasReportOptsNoUpdate a => HasReportOpts a where Source #

Special lenses for ReportOpts which also update the Query and QueryOpts in ReportSpec. Note that these are not true lenses, as they have a further restriction on the functor. This will work as a normal lens for all common uses, but since they don't obey the lens laws for some fancy cases, they may fail in some exotic circumstances.

Note that setEither/overEither should only be necessary with querystring and reportOpts: the other lenses should never fail.

Examples:

>>> import Lens.Micro (set)
>>> _rsQuery <$> setEither querystring ["assets"] defreportspec
Right (Acct (RegexpCI "assets"))
>>> _rsQuery <$> setEither querystring ["(assets"] defreportspec
Left "This regular expression is invalid or unsupported, please correct it: (assets"
>>> _rsQuery $ set querystring ["assets"] defreportspec
Acct (RegexpCI "assets")
>>> _rsQuery $ set period (MonthPeriod 2021 08) defreportspec
Date DateSpan 2021-08

XXX testing error output isn't working since adding color to it: > import System.Environment > setEnv NO_COLOR "1" >> return (_rsQuery $ set querystring ["(assets"] defreportspec) *** Exception: Error: Updating ReportSpec failed: try using overEither instead of over or setEither instead of set

Minimal complete definition

Nothing

Methods

reportOpts :: ReportableLens' a ReportOpts Source #

period :: ReportableLens' a Period Source #

statuses :: ReportableLens' a [Status] Source #

depth :: ReportableLens' a DepthSpec Source #

date2 :: ReportableLens' a Bool Source #

real :: ReportableLens' a Bool Source #

querystring :: ReportableLens' a [Text] Source #

Instances

Instances details
HasReportOpts ReportOpts Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

reportOpts :: ReportableLens' ReportOpts ReportOpts Source #

period :: ReportableLens' ReportOpts Period Source #

statuses :: ReportableLens' ReportOpts [Status] Source #

depth :: ReportableLens' ReportOpts DepthSpec Source #

date2 :: ReportableLens' ReportOpts Bool Source #

real :: ReportableLens' ReportOpts Bool Source #

querystring :: ReportableLens' ReportOpts [Text] Source #

HasReportOpts ReportSpec Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

reportOpts :: ReportableLens' ReportSpec ReportOpts Source #

period :: ReportableLens' ReportSpec Period Source #

statuses :: ReportableLens' ReportSpec [Status] Source #

depth :: ReportableLens' ReportSpec DepthSpec Source #

date2 :: ReportableLens' ReportSpec Bool Source #

real :: ReportableLens' ReportSpec Bool Source #

querystring :: ReportableLens' ReportSpec [Text] Source #

data ReportSpec Source #

A fully-determined set of report parameters (report options with all partial values made total, eg the begin and end dates are known, avoiding date/regex errors; plus the reporting date), and the query successfully calculated from them.

If you change the report options or date in one of these, you should use reportOptsToSpec to regenerate the whole thing, avoiding inconsistency.

Constructors

ReportSpec 

Fields

  • _rsReportOpts :: ReportOpts

    The underlying ReportOpts used to generate this ReportSpec

  • _rsDay :: Day

    The Day this ReportSpec is generated for

  • _rsQuery :: Query

    The generated Query for the given day, except for any change:/balance: terms

  • _rsRowQuery :: Query

    The query's change: and balance: terms, which reports test against their rows' (or entries') summed amounts, after aggregating; Any if there are none. See querySplitRowTerms.

  • _rsQueryOpts :: [QueryOpt]

    A list of QueryOpts for the given day

Instances

Instances details
Default ReportSpec Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

def :: ReportSpec

Show ReportSpec Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

showsPrec :: Int -> ReportSpec -> ShowS

show :: ReportSpec -> String

showList :: [ReportSpec] -> ShowS

HasReportOpts ReportSpec Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

reportOpts :: ReportableLens' ReportSpec ReportOpts Source #

period :: ReportableLens' ReportSpec Period Source #

statuses :: ReportableLens' ReportSpec [Status] Source #

depth :: ReportableLens' ReportSpec DepthSpec Source #

date2 :: ReportableLens' ReportSpec Bool Source #

real :: ReportableLens' ReportSpec Bool Source #

querystring :: ReportableLens' ReportSpec [Text] Source #

HasReportOptsNoUpdate ReportSpec Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

reportOptsNoUpdate :: Lens' ReportSpec ReportOpts Source #

accountlistmode :: Lens' ReportSpec AccountListMode Source #

average :: Lens' ReportSpec Bool Source #

balance_base_url :: Lens' ReportSpec (Maybe Text) Source #

balanceaccum :: Lens' ReportSpec BalanceAccumulation Source #

balancecalc :: Lens' ReportSpec BalanceCalculation Source #

budgetpat :: Lens' ReportSpec (Maybe Text) Source #

color__ :: Lens' ReportSpec Bool Source #

conversionop :: Lens' ReportSpec (Maybe ConversionOp) Source #

date2NoUpdate :: Lens' ReportSpec Bool Source #

declared :: Lens' ReportSpec Bool Source #

depthNoUpdate :: Lens' ReportSpec DepthSpec Source #

drop__ :: Lens' ReportSpec Int Source #

empty__ :: Lens' ReportSpec Bool Source #

fold_depth :: Lens' ReportSpec (Maybe Int) Source #

format :: Lens' ReportSpec StringFormat Source #

full_names :: Lens' ReportSpec Bool Source #

infer_prices :: Lens' ReportSpec Bool Source #

interval :: Lens' ReportSpec Interval Source #

invert :: Lens' ReportSpec Bool Source #

layout :: Lens' ReportSpec Layout Source #

no_elide :: Lens' ReportSpec Bool Source #

no_total :: Lens' ReportSpec Bool Source #

normalbalance :: Lens' ReportSpec (Maybe NormalSign) Source #

percent :: Lens' ReportSpec Bool Source #

periodNoUpdate :: Lens' ReportSpec Period Source #

period_titles :: Lens' ReportSpec PeriodTitles Source #

pretty :: Lens' ReportSpec Bool Source #

querystringNoUpdate :: Lens' ReportSpec [Text] Source #

realNoUpdate :: Lens' ReportSpec Bool Source #

related :: Lens' ReportSpec Bool Source #

row_total :: Lens' ReportSpec Bool Source #

show_costs :: Lens' ReportSpec Bool Source #

sort_amount :: Lens' ReportSpec Bool Source #

sortspec :: Lens' ReportSpec SortSpec Source #

statusesNoUpdate :: Lens' ReportSpec [Status] Source #

subreport_titles :: Lens' ReportSpec (Maybe Text) Source #

summary_only :: Lens' ReportSpec Bool Source #

title__ :: Lens' ReportSpec (Maybe Text) Source #

translations :: Lens' ReportSpec Translations Source #

transpose__ :: Lens' ReportSpec Bool Source #

txn_dates :: Lens' ReportSpec Bool Source #

value :: Lens' ReportSpec (Maybe ValuationType) Source #

HasReportSpec ReportSpec Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

class HasReportSpec c where Source #

Minimal complete definition

reportSpec

Methods

reportSpec :: Lens' c ReportSpec Source #

rsDay :: Lens' c Day Source #

rsQuery :: Lens' c Query Source #

rsQueryOpts :: Lens' c [QueryOpt] Source #

rsReportOpts :: Lens' c ReportOpts Source #

rsRowQuery :: Lens' c Query Source #

data SortField Source #

Constructors

AbsAmount' Bool 
Account' Bool 
Amount' Bool 
Date' Bool 
Description' Bool 

Instances

Instances details
Eq SortField Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

(==) :: SortField -> SortField -> Bool

(/=) :: SortField -> SortField -> Bool

Show SortField Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

showsPrec :: Int -> SortField -> ShowS

show :: SortField -> String

showList :: [SortField] -> ShowS

overEither :: ((a -> Either e b) -> s -> Either e t) -> (a -> b) -> s -> Either e t Source #

Apply a function over a lens, but report on failure.

setEither :: ((a -> Either e b) -> s -> Either e t) -> b -> s -> Either e t Source #

Set a field using a lens, but report on failure.

data BalanceCalculation Source #

What to calculate for each cell in a balance report. "Balance report types -> Calculation type" in the hledger manual.

Constructors

CalcChange

Sum of posting amounts in the period.

CalcBudget

Sum of posting amounts and the goal for the period.

CalcValueChange

Change from previous period's historical end value to this period's historical end value.

CalcGain

Change from previous period's gain, i.e. valuation minus cost basis.

CalcPostingsCount

Number of postings in the period.

CalcTransactionsCount

Number of transactions in the period (exact only for a single account row, eg at depth 0).

Instances

Instances details
Default BalanceCalculation Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Eq BalanceCalculation Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Show BalanceCalculation Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

showsPrec :: Int -> BalanceCalculation -> ShowS

show :: BalanceCalculation -> String

showList :: [BalanceCalculation] -> ShowS

balanceCalcIsCount :: BalanceCalculation -> Bool Source #

Does this calculation count postings or transactions, rather than summing amounts ?

data BalanceAccumulation Source #

How to accumulate calculated values across periods (columns) in a balance report. "Balance report types -> Accumulation type" in the hledger manual.

Constructors

PerPeriod

No accumulation. Eg, shows the change of balance in each period.

Cumulative

Accumulate changes across periods, starting from zero at report start.

Historical

Accumulate changes across periods, including any from before report start. Eg, shows the historical end balance of each period.

Instances

Instances details
Default BalanceAccumulation Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Eq BalanceAccumulation Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Show BalanceAccumulation Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

showsPrec :: Int -> BalanceAccumulation -> ShowS

show :: BalanceAccumulation -> String

showList :: [BalanceAccumulation] -> ShowS

data AccountListMode Source #

Should accounts be displayed: in the command's default style, hierarchically, or as a flat list ?

Constructors

ALFlat 
ALTree 

Instances

Instances details
Default AccountListMode Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Eq AccountListMode Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Show AccountListMode Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

showsPrec :: Int -> AccountListMode -> ShowS

show :: AccountListMode -> String

showList :: [AccountListMode] -> ShowS

data ValuationType Source #

What kind of value conversion should be done on amounts ? CLI: --value=then|end|now|DATE[,COMM]

Constructors

AtThen (Maybe CommoditySymbol)

convert to default or given valuation commodity, using market prices at each posting's date

AtEnd (Maybe CommoditySymbol)

convert to default or given valuation commodity, using market prices at period end(s)

AtNow (Maybe CommoditySymbol)

convert to default or given valuation commodity, using current market prices

AtDate Day (Maybe CommoditySymbol)

convert to default or given valuation commodity, using market prices on some date

Instances

Instances details
Eq ValuationType Source # 
Instance details

Defined in Hledger.Data.Valuation

Show ValuationType Source # 
Instance details

Defined in Hledger.Data.Valuation

Methods

showsPrec :: Int -> ValuationType -> ShowS

show :: ValuationType -> String

showList :: [ValuationType] -> ShowS

data Layout Source #

Instances

Instances details
Eq Layout Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

(==) :: Layout -> Layout -> Bool

(/=) :: Layout -> Layout -> Bool

Show Layout Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

showsPrec :: Int -> Layout -> ShowS

show :: Layout -> String

showList :: [Layout] -> ShowS

data PeriodTitles Source #

How to render period column headings in periodic reports.

Constructors

PTCompact 
PTDates 

Instances

Instances details
Default PeriodTitles Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

def :: PeriodTitles

Eq PeriodTitles Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

(==) :: PeriodTitles -> PeriodTitles -> Bool

(/=) :: PeriodTitles -> PeriodTitles -> Bool

Show PeriodTitles Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

showsPrec :: Int -> PeriodTitles -> ShowS

show :: PeriodTitles -> String

showList :: [PeriodTitles] -> ShowS

effectiveTitle :: ReportOpts -> Text -> Text Source #

Resolve the effective report heading: if --title was given on the command line, use that value (which may be empty to suppress the heading); otherwise return the supplied per-report default.

rawOptsToReportOpts :: Day -> Bool -> RawOpts -> ReportOpts Source #

Generate a ReportOpts from raw command-line input, given a day and whether to use ANSI colour/styles in standard output. This will fail with a usage error if it is passed - an invalid --format argument, - an invalid --value argument, - if --valuechange is called with a valuation type other than -V/--value=end. - an invalid --pretty argument,

setDefaultConversionOp :: ConversionOp -> ReportSpec -> ReportSpec Source #

Set the default ConversionOp.

reportOptsToSpec :: Day -> ReportOpts -> Either String ReportSpec Source #

Generate a ReportSpec from a set of ReportOpts on a given day.

updateReportSpec :: ReportOpts -> ReportSpec -> Either String ReportSpec Source #

Update the ReportOpts and the fields derived from it in a ReportSpec, or return an error message if there is a problem such as missing or unparseable options data. This is the safe way to change a ReportSpec, ensuring that all fields (_rsQuery, _rsReportOpts, querystring_, etc.) are in sync.

updateReportSpecWith :: (ReportOpts -> ReportOpts) -> ReportSpec -> Either String ReportSpec Source #

Like updateReportSpec, but takes a ReportOpts-modifying function.

rawOptsToReportSpec :: Day -> Bool -> RawOpts -> Either String ReportSpec Source #

Generate a ReportSpec from RawOpts and a provided day, or return an error string if there are regular expression errors.

tree_ :: ReportOpts -> Bool Source #

Legacy-compatible convenience aliases for accountlistmode_.

reportOptsToggleStatus :: Status -> ReportOpts -> ReportOpts Source #

Add/remove this status from the status list. Used by hledger-ui.

simplifyStatuses :: Ord a => [a] -> [a] Source #

Reduce a list of statuses to just one of each status, and if all statuses are present return the empty list.

whichDate :: ReportOpts -> WhichDate Source #

Report which date we will report on based on --date2.

journalValueAndFilterPostings :: ReportSpec -> Journal -> Journal Source #

Convert a Journal's amounts to cost and/or to value (see journalApplyValuationFromOpts), and filter by the ReportSpec Query.

We make sure to first filter by amt: and cur: terms, then value the Journal, then filter by the remaining terms.

journalApplyValuationFromOpts :: ReportSpec -> Journal -> Journal Source #

Convert this journal's postings' amounts to cost and/or to value, if specified by options (-B--cost-V-X--value etc.). Strip prices if not needed. This should be the main stop for performing costing and valuation. The exception is whenever you need to perform valuation _after_ summing up amounts, as in a historical balance report with --value=end. valuationAfterSum will check for this condition.

journalApplyValuationFromOptsWith :: ReportSpec -> Journal -> PriceOracle -> Journal Source #

Like journalApplyValuationFromOpts, but takes PriceOracle as an argument.

mixedAmountApplyValuationAfterSumFromOptsWith :: ReportOpts -> Journal -> PriceOracle -> Day -> MixedAmount -> MixedAmount Source #

Select the Account valuation functions required for performing valuation after summing amounts. Used in MultiBalanceReport to value historical and similar reports.

valuationAfterSum :: ReportOpts -> Maybe (Maybe CommoditySymbol) Source #

If the ReportOpts specify that we are performing valuation after summing amounts, return Just of the commodity symbol we're converting to, Just Nothing for the default, and otherwise return Nothing. Used for example with historical reports with --value=end.

requiresHistorical :: ReportOpts -> Bool Source #

If the ReportOpts specify that we will need to consider historical postings, either because this is a historical report, or because the valuation strategy requires historical amounts.

intervalFromRawOpts :: RawOpts -> Interval Source #

Get the report interval, if any, specified by the last of -p/--period, -D--daily, -W--weekly, -M/--monthly etc. options. An interval from --period counts only if it is explicitly defined.

intervalFromQueryOpts :: [QueryOpt] -> Maybe Interval Source #

Get the last interval specified in query opts, if any. date: queries can specify a reporting interval.

queryFromFlags :: ReportOpts -> Query Source #

Convert report options to a query, ignoring any non-flag command line arguments.

transactionDateFn :: ReportOpts -> Transaction -> Day Source #

Select the Transaction date accessor based on --date2.

postingDateFn :: ReportOpts -> Posting -> Day Source #

Select the Posting date accessor based on --date2.

reportSpan :: Journal -> ReportSpec -> (DateSpan, Maybe DayPartition) Source #

The effective report span is the start and end dates requested by options or queries. If the start date is unspecified, the earliest transaction or posting date is used. If the end date is unspecified, the latest transaction or posting date (or non-future market price date, when doing an end value report) is used. If none of these things are present, the null date span is returned. The report sub-periods caused by a report interval, if any, are also returned.

reportSpanBothDates :: Journal -> ReportSpec -> (DateSpan, Maybe DayPartition) Source #

Like reportSpan, but considers both primary and secondary dates, not just one or the other.

reportSpanLazy :: Journal -> ReportSpec -> (DateSpan, [DateSpan]) Source #

Like reportSpan, but returns the report periods as a lazily generated list of DateSpans rather than a DayPartition, so that a report which traverses them once uses constant memory however many periods there are (#1683). The list is a single unbounded span if there are no periods, like maybeDayPartitionToDateSpans.

reportSpanBothDatesLazy :: Journal -> ReportSpec -> (DateSpan, [DateSpan]) Source #

Like reportSpanLazy, but considers both primary and secondary dates. Used by the postings report.

reportPeriodName :: ReportOpts -> [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, translated according to --lang
  • all other balance change reports: a description of the datespan, abbreviated to compact form if possible (see showDateSpan).