mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-25 19:31:44 +03:00
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
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user