hledger-lib-0.26: Core data types, parsers and utilities for the hledger accounting tool.

Safe Haskell | None
Language | Haskell2010

Hledger.Reports.ReportOptions

Description

Options common to most hledger reports.

Synopsis

- data ReportOpts = ReportOpts {
  - begin_ :: Maybe Day
  - end_ :: Maybe Day
  - period_ :: Maybe (Interval, DateSpan)
  - cleared_ :: Bool
  - pending_ :: Bool
  - uncleared_ :: Bool
  - cost_ :: Bool
  - depth_ :: Maybe Int
  - display_ :: Maybe DisplayExp
  - date2_ :: Bool
  - empty_ :: Bool
  - no_elide_ :: Bool
  - real_ :: Bool
  - daily_ :: Bool
  - weekly_ :: Bool
  - monthly_ :: Bool
  - quarterly_ :: Bool
  - yearly_ :: Bool
  - format_ :: Maybe FormatStr
  - query_ :: String
  - average_ :: Bool
  - related_ :: Bool
  - balancetype_ :: BalanceType
  - accountlistmode_ :: AccountListMode
  - drop_ :: Int
  - row_total_ :: Bool
  - no_total_ :: Bool
  }
- data BalanceType
  - = PeriodBalance
  - | CumulativeBalance
  - | HistoricalBalance
- data AccountListMode
  - = ALDefault
  - | ALTree
  - | ALFlat
- type FormatStr = String
- defreportopts :: ReportOpts
- rawOptsToReportOpts :: RawOpts -> IO ReportOpts
- flat_ :: ReportOpts -> Bool
- tree_ :: ReportOpts -> Bool
- dateSpanFromOpts :: Day -> ReportOpts -> DateSpan
- intervalFromOpts :: ReportOpts -> Interval
- clearedValueFromOpts :: ReportOpts -> Maybe ClearedStatus
- whichDateFromOpts :: ReportOpts -> WhichDate
- journalSelectingAmountFromOpts :: ReportOpts -> Journal -> Journal
- queryFromOpts :: Day -> ReportOpts -> Query
- queryFromOptsOnly :: Day -> ReportOpts -> Query
- queryOptsFromOpts :: Day -> ReportOpts -> [QueryOpt]
- transactionDateFn :: ReportOpts -> Transaction -> Day
- postingDateFn :: ReportOpts -> Posting -> Day
- tests_Hledger_Reports_ReportOptions :: Test

# Documentation

data ReportOpts Source

Standard options for customising report filtering and output, corresponding to hledger's command-line options and query language arguments. Used in hledger-lib and above.

Constructors

ReportOpts |

Fields

begin_ :: Maybe Day
end_ :: Maybe Day
period_ :: Maybe (Interval, DateSpan)
cleared_ :: Bool
pending_ :: Bool
uncleared_ :: Bool
cost_ :: Bool
depth_ :: Maybe Int
display_ :: Maybe DisplayExp
date2_ :: Bool
empty_ :: Bool
no_elide_ :: Bool
real_ :: Bool
daily_ :: Bool
weekly_ :: Bool
monthly_ :: Bool
quarterly_ :: Bool
yearly_ :: Bool
format_ :: Maybe FormatStr
query_ :: String
average_ :: Bool
related_ :: Bool
balancetype_ :: BalanceType
accountlistmode_ :: AccountListMode
drop_ :: Int
row_total_ :: Bool
no_total_ :: Bool

Instances

Data ReportOpts Source |
Show ReportOpts Source |
Default ReportOpts Source |

data BalanceType Source

Which balance is being shown in a multi-column balance report.

Constructors

PeriodBalance | The change of balance in each period.
CumulativeBalance | The accumulated balance at each period's end, starting from zero at the report start date.
HistoricalBalance | The historical balance at each period's end, starting from the account balances at the report start date.

Instances

Eq BalanceType Source |
Data BalanceType Source |
Show BalanceType Source |
Default BalanceType Source |

data AccountListMode Source

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

Constructors

ALDefault |
ALTree |
ALFlat |

Instances

Eq AccountListMode Source |
Data AccountListMode Source |
Show AccountListMode Source |
Default AccountListMode Source |

type FormatStr = String Source

defreportopts :: ReportOpts Source

rawOptsToReportOpts :: RawOpts -> IO ReportOpts Source

flat_ :: ReportOpts -> Bool Source

tree_ :: ReportOpts -> Bool Source

Legacy-compatible convenience aliases for accountlistmode_.

dateSpanFromOpts :: Day -> ReportOpts -> DateSpan Source

Figure out the date span we should report on, based on any beginendperiod options provided. A period option will cause begin and end options to be ignored.

intervalFromOpts :: ReportOpts -> Interval Source

Figure out the reporting interval, if any, specified by the options. --period overrides --daily overrides --weekly overrides --monthly etc.

clearedValueFromOpts :: ReportOpts -> Maybe ClearedStatus Source

Get a maybe boolean representing the last cleared/uncleared option if any.

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 the cost basis amounts if specified by options.

queryFromOpts :: Day -> ReportOpts -> Query Source

Convert report options and arguments to a query.

queryFromOptsOnly :: Day -> ReportOpts -> Query Source

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

queryOptsFromOpts :: Day -> ReportOpts -> [QueryOpt] Source

Convert report options and arguments to query options.

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.

tests_Hledger_Reports_ReportOptions :: Test Source