Safe Haskell | None |
---|---|
Language | Haskell2010 |
Hledger.Reports.ReportTypes
Description
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
- prrDepth :: Int
- 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
- prNegate :: Num b => PeriodicReport a b -> PeriodicReport a b
- prNormaliseSign :: Num b => NormalSign -> PeriodicReport a b -> PeriodicReport a b
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.
Constructors
PeriodicReport | |
Fields
|
Instances
(Show a, Show b) => Show (PeriodicReport a b) Source # | |
Defined in Hledger.Reports.ReportTypes Methods showsPrec :: Int -> PeriodicReport a b -> ShowS show :: PeriodicReport a b -> String showList :: [PeriodicReport a b] -> ShowS | |
Generic (PeriodicReport a b) Source # | |
Defined in Hledger.Reports.ReportTypes Associated Types type Rep (PeriodicReport a b) :: Type -> Type Methods from :: PeriodicReport a b -> Rep (PeriodicReport a b) x to :: Rep (PeriodicReport a b) x -> PeriodicReport a b | |
(ToJSON a, ToJSON b) => ToJSON (PeriodicReport a b) Source # | |
Defined in Hledger.Reports.ReportTypes Methods toJSON :: PeriodicReport a b -> Value Source # toEncoding :: PeriodicReport a b -> Encoding Source # toJSONList :: [PeriodicReport a b] -> Value Source # toEncodingList :: [PeriodicReport a b] -> Encoding Source # | |
type Rep (PeriodicReport a b) Source # | |
Defined in Hledger.Reports.ReportTypes type Rep (PeriodicReport a b) = D1 ('MetaData "PeriodicReport" "Hledger.Reports.ReportTypes" "hledger-lib-1.18.1-HAVTGFkSxUu9eSGTiEzewL" 'False) (C1 ('MetaCons "PeriodicReport" 'PrefixI 'True) (S1 ('MetaSel ('Just "prDates") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [DateSpan]) :*: (S1 ('MetaSel ('Just "prRows") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [PeriodicReportRow a b]) :*: S1 ('MetaSel ('Just "prTotals") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PeriodicReportRow () b))))) |
data PeriodicReportRow a b Source #
Constructors
PeriodicReportRow | |
Fields
|
Instances
(Show a, Show b) => Show (PeriodicReportRow a b) Source # | |
Defined in Hledger.Reports.ReportTypes Methods showsPrec :: Int -> PeriodicReportRow a b -> ShowS show :: PeriodicReportRow a b -> String showList :: [PeriodicReportRow a b] -> ShowS | |
Generic (PeriodicReportRow a b) Source # | |
Defined in Hledger.Reports.ReportTypes Associated Types type Rep (PeriodicReportRow a b) :: Type -> Type Methods from :: PeriodicReportRow a b -> Rep (PeriodicReportRow a b) x to :: Rep (PeriodicReportRow a b) x -> PeriodicReportRow a b | |
(ToJSON b, ToJSON a) => ToJSON (PeriodicReportRow a b) Source # | |
Defined in Hledger.Reports.ReportTypes Methods toJSON :: PeriodicReportRow a b -> Value Source # toEncoding :: PeriodicReportRow a b -> Encoding Source # toJSONList :: [PeriodicReportRow a b] -> Value Source # toEncodingList :: [PeriodicReportRow a b] -> Encoding Source # | |
type Rep (PeriodicReportRow a b) Source # | |
Defined in Hledger.Reports.ReportTypes type Rep (PeriodicReportRow a b) = D1 ('MetaData "PeriodicReportRow" "Hledger.Reports.ReportTypes" "hledger-lib-1.18.1-HAVTGFkSxUu9eSGTiEzewL" 'False) (C1 ('MetaCons "PeriodicReportRow" 'PrefixI 'True) ((S1 ('MetaSel ('Just "prrName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Just "prrDepth") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :*: (S1 ('MetaSel ('Just "prrAmounts") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [b]) :*: (S1 ('MetaSel ('Just "prrTotal") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 b) :*: S1 ('MetaSel ('Just "prrAverage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 b))))) |
type Percentage = Decimal Source #
Arguments
= MixedAmount | A change in balance during a certain period. |
Arguments
= MixedAmount | An ending balance as of some date. |
Arguments
= MixedAmount | The sum of |
Arguments
= MixedAmount | The average of |
periodicReportSpan :: PeriodicReport a b -> DateSpan Source #
Figure out the overall date span of a PeridicReport
prNegate :: Num b => PeriodicReport a b -> PeriodicReport a b Source #
Flip the sign of all amounts in a PeriodicReport.
prNormaliseSign :: Num b => NormalSign -> PeriodicReport a b -> PeriodicReport a b Source #
Given a PeriodicReport and its normal balance sign, if it is known to be normally negative, convert it to normally positive.