mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-08 07:09:28 +03:00
fix: balance: Balance reports with --depth=0 should report on true
values, not zero everywhere. (#1761)
This commit is contained in:
parent
c11d19a893
commit
186995fc8b
@ -311,12 +311,11 @@ calculateReportMatrix rspec@ReportSpec{_rsReportOpts=ropts} j priceoracle startb
|
||||
-- Transpose to get each account's balance changes across all columns, then
|
||||
-- pad with zeros
|
||||
allchanges = ((<>zeros) <$> acctchanges) <> (zeros <$ startbals)
|
||||
acctchanges = dbg5 "acctchanges" . addElided $ transposeMap colacctchanges
|
||||
acctchanges = dbg5 "acctchanges" $ transposeMap colacctchanges
|
||||
colacctchanges = dbg5 "colacctchanges" $ map (second $ acctChangesFromPostings rspec) colps
|
||||
|
||||
avalue = acctApplyBoth . mixedAmountApplyValuationAfterSumFromOptsWith ropts j priceoracle
|
||||
acctApplyBoth f a = a{aibalance = f $ aibalance a, aebalance = f $ aebalance a}
|
||||
addElided = if queryDepth (_rsQuery rspec) == Just 0 then HM.insert "..." zeros else id
|
||||
historicalDate = minimumMay $ mapMaybe spanStart colspans
|
||||
zeros = M.fromList [(span, nullacct) | span <- colspans]
|
||||
colspans = map fst colps
|
||||
|
@ -8,20 +8,19 @@ hledger -f sample.journal balance --no-total --depth 1
|
||||
>>>=0
|
||||
|
||||
# 2. Depth 0 aggregates everything into one line
|
||||
hledger -f sample.journal balance --no-total --depth 0
|
||||
hledger -f sample.journal balance --no-total --depth 0 assets
|
||||
>>>
|
||||
0 ...
|
||||
$-1 ...
|
||||
>>>=0
|
||||
|
||||
# 3. Ditto in a multi-column balance report.
|
||||
hledger -f sample.journal balance -M -e 2008/2 --depth 0
|
||||
hledger -f sample.journal balance -M -e 2008/2 --depth 0 assets
|
||||
>>>
|
||||
Balance changes in 2008-01:
|
||||
|
||||
|| Jan
|
||||
=====++=====
|
||||
... || 0
|
||||
... || $1
|
||||
-----++-----
|
||||
|| 0
|
||||
|| $1
|
||||
>>>=0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user