bal --budget: show end-date column headings when appropriate
bal --budget was always showing the period as column heading, as if for a change report. With --cumulative or --historical it should show the end date, like other balance reports. Cf https://hledger.org/hledger.html#multicolumn-balance-report.
This commit is contained in:
parent
0a9b05f3fd
commit
a89a4e1b42
@ -2,6 +2,7 @@
|
|||||||
-}
|
-}
|
||||||
|
|
||||||
{-# LANGUAGE CPP #-}
|
{-# LANGUAGE CPP #-}
|
||||||
|
{-# LANGUAGE NamedFieldPuns #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
{-# LANGUAGE RecordWildCards #-}
|
||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
@ -258,7 +259,7 @@ budgetReportAsText ropts@ReportOpts{..} budgetr =
|
|||||||
-- | Build a 'Table' from a multi-column balance report.
|
-- | Build a 'Table' from a multi-column balance report.
|
||||||
budgetReportAsTable :: ReportOpts -> BudgetReport -> Table String String (Maybe MixedAmount, Maybe MixedAmount)
|
budgetReportAsTable :: ReportOpts -> BudgetReport -> Table String String (Maybe MixedAmount, Maybe MixedAmount)
|
||||||
budgetReportAsTable
|
budgetReportAsTable
|
||||||
ropts
|
ropts@ReportOpts{balancetype_}
|
||||||
(PeriodicReport periods rows (PeriodicReportRow _ coltots grandtot grandavg)) =
|
(PeriodicReport periods rows (PeriodicReportRow _ coltots grandtot grandavg)) =
|
||||||
addtotalrow $
|
addtotalrow $
|
||||||
Table
|
Table
|
||||||
@ -266,9 +267,13 @@ budgetReportAsTable
|
|||||||
(T.Group NoLine $ map Header colheadings)
|
(T.Group NoLine $ map Header colheadings)
|
||||||
(map rowvals rows)
|
(map rowvals rows)
|
||||||
where
|
where
|
||||||
colheadings = map showDateSpanMonthAbbrev periods
|
colheadings = map mkheading periods
|
||||||
++ [" Total" | row_total_ ropts]
|
++ [" Total" | row_total_ ropts]
|
||||||
++ ["Average" | average_ ropts]
|
++ ["Average" | average_ ropts]
|
||||||
|
where
|
||||||
|
mkheading = case balancetype_ of
|
||||||
|
PeriodChange -> showDateSpanMonthAbbrev
|
||||||
|
_ -> maybe "" (showDate . prevday) . spanEnd
|
||||||
accts = map renderacct rows
|
accts = map renderacct rows
|
||||||
-- FIXME. Have to check explicitly for which to render here, since
|
-- FIXME. Have to check explicitly for which to render here, since
|
||||||
-- budgetReport sets accountlistmode to ALTree. Find a principled way to do
|
-- budgetReport sets accountlistmode to ALTree. Find a principled way to do
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user