balance: fix partially-visible totals row

With --no-total in a periodic (non-cumulative, non-historical) balance
report, hide the totals row completely, as in the other modes.
This commit is contained in:
Simon Michael 2014-12-27 16:44:03 -08:00
parent 6da4942633
commit 95ced2da80
2 changed files with 12 additions and 17 deletions

View File

@ -422,16 +422,12 @@ periodBalanceReportAsText opts r@(MultiBalanceReport (colspans, items, (coltotal
unlines $ unlines $
([printf "Balance changes in %s:" (showDateSpan $ multiBalanceReportSpan r)] ++) $ ([printf "Balance changes in %s:" (showDateSpan $ multiBalanceReportSpan r)] ++) $
trimborder $ lines $ trimborder $ lines $
render render id (" "++) showMixedAmountOneLineWithoutPrice $
id addtotalrow $
(" "++) Table
showMixedAmountOneLineWithoutPrice (T.Group NoLine $ map (Header . padright acctswidth) accts)
$ Table (T.Group NoLine $ map Header colheadings)
(T.Group NoLine $ map (Header . padright acctswidth) accts) (map rowvals items')
(T.Group NoLine $ map Header colheadings)
(map rowvals items')
+----+
totalrow
where where
trimborder = ("":) . (++[""]) . drop 1 . init . map (drop 1 . init) trimborder = ("":) . (++[""]) . drop 1 . init . map (drop 1 . init)
colheadings = map showDateSpan colspans colheadings = map showDateSpan colspans
@ -447,11 +443,12 @@ periodBalanceReportAsText opts r@(MultiBalanceReport (colspans, items, (coltotal
rowvals (_,as,rowtot,rowavg) = as rowvals (_,as,rowtot,rowavg) = as
++ (if row_total_ opts then [rowtot] else []) ++ (if row_total_ opts then [rowtot] else [])
++ (if average_ opts then [rowavg] else []) ++ (if average_ opts then [rowavg] else [])
totalrow | no_total_ opts = row "" [] addtotalrow | no_total_ opts = id
| otherwise = row "" $ | otherwise = (+----+ (row "" $
coltotals coltotals
++ (if row_total_ opts then [tot] else []) ++ (if row_total_ opts then [tot] else [])
++ (if average_ opts then [avg] else []) ++ (if average_ opts then [avg] else [])
))
-- | Render a multi-column cumulative balance report as plain text suitable for console output. -- | Render a multi-column cumulative balance report as plain text suitable for console output.
cumulativeBalanceReportAsText :: ReportOpts -> MultiBalanceReport -> String cumulativeBalanceReportAsText :: ReportOpts -> MultiBalanceReport -> String

View File

@ -21,8 +21,6 @@ Balance changes in 2013q1:
assets || 0 1 0 assets || 0 1 0
assets:cash || 0 1 0 assets:cash || 0 1 0
assets:checking || 0 0 1 assets:checking || 0 0 1
-----------------++----------------------------
||
>>>=0 >>>=0