Safe Haskell | None |
---|---|
Language | Haskell2010 |
New common report types, used by the BudgetReport for now, perhaps all reports later.
Synopsis
- data PeriodicReport a b = PeriodicReport {
- prDates :: [DateSpan]
- prRows :: [PeriodicReportRow a b]
- prTotals :: PeriodicReportRow () b
- data PeriodicReportRow a b = PeriodicReportRow {
- prrName :: a
- prrAmounts :: [b]
- prrTotal :: b
- prrAverage :: b
- type Percentage = Decimal
- type Change = MixedAmount
- type Balance = MixedAmount
- type Total = MixedAmount
- type Average = MixedAmount
- periodicReportSpan :: PeriodicReport a b -> DateSpan
- prMapName :: (a -> b) -> PeriodicReport a c -> PeriodicReport b c
- prMapMaybeName :: (a -> Maybe b) -> PeriodicReport a c -> PeriodicReport b c
- data CompoundPeriodicReport a b = CompoundPeriodicReport {
- cbrTitle :: Text
- cbrDates :: [DateSpan]
- cbrSubreports :: [(Text, PeriodicReport a b, Bool)]
- cbrTotals :: PeriodicReportRow () b
- data CBCSubreportSpec a = CBCSubreportSpec {}
- data DisplayName = DisplayName {}
- flatDisplayName :: AccountName -> DisplayName
- treeDisplayName :: AccountName -> DisplayName
- prrFullName :: PeriodicReportRow DisplayName a -> AccountName
- prrDisplayName :: PeriodicReportRow DisplayName a -> AccountName
- prrDepth :: PeriodicReportRow DisplayName a -> Int
Documentation
data PeriodicReport a b Source #
A periodic report is a generic tabular report, where each row corresponds to some label (usually an account name) and each column to a date period. The column periods are usually consecutive subperiods formed by splitting the overall report period by some report interval (daily, weekly, etc.). It has:
- a list of each column's period (date span)
- a list of rows, each containing:
- an account label
- the account's depth
- A list of amounts, one for each column. Depending on the value type,
these can represent balance changes, ending balances, budget
performance, etc. (for example, see
BalanceType
and Hledger.Cli.Commands.Balance). - the total of the row's amounts for a periodic report, or zero for cumulative/historical reports (since summing end balances generally doesn't make sense).
- the average of the row's amounts
- the column totals, and the overall grand total (or zero for cumulative/historical reports) and grand average.
PeriodicReport | |
|
Instances
data PeriodicReportRow a b Source #
PeriodicReportRow | |
|
Instances
type Percentage = Decimal Source #
= MixedAmount | A change in balance during a certain period. |
= MixedAmount | An ending balance as of some date. |
= MixedAmount | The sum of |
periodicReportSpan :: PeriodicReport a b -> DateSpan Source #
Figure out the overall date span of a PeriodicReport
prMapName :: (a -> b) -> PeriodicReport a c -> PeriodicReport b c Source #
Map a function over the row names.
prMapMaybeName :: (a -> Maybe b) -> PeriodicReport a c -> PeriodicReport b c Source #
Map a function over the row names, possibly discarding some.
data CompoundPeriodicReport a b Source #
A compound balance report has:
- an overall title
- the period (date span) of each column
- one or more named, normal-positive multi balance reports, with columns corresponding to the above, and a flag indicating whether they increased or decreased the overall totals
- a list of overall totals for each column, and their grand total and average
It is used in compound balance report commands like balancesheet, cashflow and incomestatement.
CompoundPeriodicReport | |
|
Instances
data CBCSubreportSpec a Source #
Description of one subreport within a compound balance report. Part of a CompoundBalanceCommandSpec, but also used in hledger-lib.
CBCSubreportSpec | |
|
data DisplayName Source #
A full name, display name, and depth for an account.
Instances
Eq DisplayName Source # | |
Defined in Hledger.Reports.ReportTypes (==) :: DisplayName -> DisplayName -> Bool # (/=) :: DisplayName -> DisplayName -> Bool # | |
Ord DisplayName Source # | |
Defined in Hledger.Reports.ReportTypes compare :: DisplayName -> DisplayName -> Ordering # (<) :: DisplayName -> DisplayName -> Bool # (<=) :: DisplayName -> DisplayName -> Bool # (>) :: DisplayName -> DisplayName -> Bool # (>=) :: DisplayName -> DisplayName -> Bool # max :: DisplayName -> DisplayName -> DisplayName # min :: DisplayName -> DisplayName -> DisplayName # | |
Show DisplayName Source # | |
Defined in Hledger.Reports.ReportTypes showsPrec :: Int -> DisplayName -> ShowS # show :: DisplayName -> String # showList :: [DisplayName] -> ShowS # | |
ToJSON DisplayName Source # | |
Defined in Hledger.Reports.ReportTypes toJSON :: DisplayName -> Value # toEncoding :: DisplayName -> Encoding # toJSONList :: [DisplayName] -> Value # toEncodingList :: [DisplayName] -> Encoding # |
flatDisplayName :: AccountName -> DisplayName Source #
Construct a flat display name, where the full name is also displayed at depth 1
treeDisplayName :: AccountName -> DisplayName Source #
Construct a tree display name, where only the leaf is displayed at its given depth
prrFullName :: PeriodicReportRow DisplayName a -> AccountName Source #
Get the full, canonical, name of a PeriodicReportRow tagged by a DisplayName.
prrDisplayName :: PeriodicReportRow DisplayName a -> AccountName Source #
Get the display name of a PeriodicReportRow tagged by a DisplayName.
prrDepth :: PeriodicReportRow DisplayName a -> Int Source #
Get the display depth of a PeriodicReportRow tagged by a DisplayName.