hledger-lib-1.20.4: 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 BalanceType Source #

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

Constructors

PeriodChange

The change of balance in each 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=cost|then|end|now|DATE[,COMM]

Constructors

AtCost (Maybe CommoditySymbol)

convert to cost commodity using transaction prices, then optionally to given commodity using market prices at posting date

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

AtDefault (Maybe CommoditySymbol)

works like AtNow in single period reports, like AtEnd in multiperiod reports

Instances

Instances details
Eq ValuationType Source # 
Instance details

Defined in Hledger.Data.Valuation

Show ValuationType Source # 
Instance details

Defined in Hledger.Data.Valuation

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

changingValuation :: ReportOpts -> Bool Source #

Whether the market price for postings might change when reported in different report periods.

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.

journalSelectingAmountFromOpts :: ReportOpts -> Journal -> Journal Source #

Convert this journal's postings' amounts to cost using their transaction prices, if specified by options (-B/--value=cost). Maybe soon superseded by newer valuation code.

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.

forecastPeriodFromRawOpts :: Day -> RawOpts -> Maybe DateSpan Source #

get period expression from --forecast option

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.