average total for multicolumn bs/is/cf
This commit is contained in:
parent
cd69f24fdd
commit
f7f6d5f8e5
@ -121,15 +121,21 @@ balanceviewReport BalanceView{..} CliOpts{reportopts_=ropts, rawopts_=raw} j = d
|
|||||||
sumAmts = case amts of
|
sumAmts = case amts of
|
||||||
a1:as -> foldl' (zipWith (+)) a1 as
|
a1:as -> foldl' (zipWith (+)) a1 as
|
||||||
[] -> []
|
[] -> []
|
||||||
|
totavg = totsum `divideMixedAmount`
|
||||||
|
fromIntegral (length sumAmts)
|
||||||
mergedTabl = case tabls of
|
mergedTabl = case tabls of
|
||||||
t1:ts -> foldl' merging t1 ts
|
t1:ts -> foldl' merging t1 ts
|
||||||
[] -> T.empty
|
[] -> T.empty
|
||||||
totTabl | no_total_ ropts' = mergedTabl
|
totTabl
|
||||||
| otherwise =
|
| no_total_ ropts' || length bvqueries == 1 =
|
||||||
mergedTabl
|
mergedTabl
|
||||||
+====+
|
| otherwise =
|
||||||
row "Total"
|
mergedTabl
|
||||||
(sumAmts ++ if row_total_ ropts' then [totsum] else [])
|
+====+
|
||||||
|
row "Total"
|
||||||
|
(sumAmts ++ if row_total_ ropts' then [totsum] else []
|
||||||
|
++ if average_ ropts' then [totavg] else []
|
||||||
|
)
|
||||||
putStrLn bvtitle
|
putStrLn bvtitle
|
||||||
putStrLn $ renderBalanceReportTable totTabl
|
putStrLn $ renderBalanceReportTable totTabl
|
||||||
where
|
where
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user