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

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

Instances

Instances details
Show ReportOpts Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Default ReportOpts Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

def :: ReportOpts #

data ReportSpec Source #

The result of successfully parsing a ReportOpts on a particular Day. Any ambiguous dates are completed and Queries are parsed, ensuring that there are no regular expression errors. Values here should be used in preference to re-deriving them from ReportOpts. If you change the query_ in ReportOpts, you should call reportOptsToSpec to regenerate the ReportSpec with the new Query.

Constructors

ReportSpec 

Fields

Instances

Instances details
Show ReportSpec Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Default ReportSpec Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

def :: ReportSpec #

data ReportType Source #

What is calculated and shown in each cell in a balance report.

Constructors

ChangeReport

The sum of posting amounts.

BudgetReport

The sum of posting amounts and the goal.

ValueChangeReport

The change of value of period-end historical values.

Instances

Instances details
Eq ReportType Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Show ReportType Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Default ReportType Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

def :: ReportType #

data BalanceType Source #

Which "accumulation method" is being shown in a balance report.

Constructors

PeriodChange

The accumulate change over a single period.

CumulativeChange

The accumulated change across multiple periods.

HistoricalBalance

The historical ending balance, including the effect of all postings before the report period. Unless altered by, a query, this is what you would see on a bank statement.

Instances

Instances details
Eq BalanceType Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Show BalanceType Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Default BalanceType Source # 
Instance details

Defined in Hledger.Reports.ReportOptions

Methods

def :: BalanceType #

data AccountListMode Source #

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

Constructors

ALFlat 
ALTree 

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

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

Generate a ReportOpts from raw command-line input, given a day. 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.

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, rsOpts, querystring_, etc.) are in sync.

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

Like updateReportSpec, but takes a ReportOpts-modifying function.

rawOptsToReportSpec :: RawOpts -> IO ReportSpec Source #

Generate a ReportSpec from RawOpts and the current date.

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.

whichDateFromOpts :: ReportOpts -> WhichDate Source #

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

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 -> DateSpan -> 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 the commodity symbol we're converting to, otherwise return Nothing. Used for example with historical reports with --value=end.

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.

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 Source #

The effective report span is the start and end dates specified by options or queries, or otherwise the earliest and latest transaction or posting dates in the journal. If no dates are specified by options/queries and the journal is empty, returns the null date span.

reportSpanBothDates :: Journal -> ReportSpec -> DateSpan Source #

Like reportSpan, but uses both primary and secondary dates when calculating the span.

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).