hledger-lib-1.21: 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

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.

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

Convert this journal's postings' amounts to cost using their transaction prices, if specified by options (-B/--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. The boolean argument flags whether primary and secondary dates are considered equivalently.

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

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