average total for multicolumn bs/is/cf

This commit is contained in:
Justin Le 2017-03-26 01:40:34 -07:00
parent cd69f24fdd
commit f7f6d5f8e5

View File

@ -121,15 +121,21 @@ balanceviewReport BalanceView{..} CliOpts{reportopts_=ropts, rawopts_=raw} j = d
sumAmts = case amts of
a1:as -> foldl' (zipWith (+)) a1 as
[] -> []
totavg = totsum `divideMixedAmount`
fromIntegral (length sumAmts)
mergedTabl = case tabls of
t1:ts -> foldl' merging t1 ts
[] -> T.empty
totTabl | no_total_ ropts' = mergedTabl
| otherwise =
mergedTabl
+====+
row "Total"
(sumAmts ++ if row_total_ ropts' then [totsum] else [])
totTabl
| no_total_ ropts' || length bvqueries == 1 =
mergedTabl
| otherwise =
mergedTabl
+====+
row "Total"
(sumAmts ++ if row_total_ ropts' then [totsum] else []
++ if average_ ropts' then [totavg] else []
)
putStrLn bvtitle
putStrLn $ renderBalanceReportTable totTabl
where