lib: fix balance --budget in the presence of --value

This commit is contained in:
Dmitry Astapov 2018-09-22 22:27:53 +01:00 committed by Simon Michael
parent ef5e7511c2
commit 8c79d6529d
2 changed files with 29 additions and 3 deletions

View File

@ -400,9 +400,7 @@ canonicaliseAmount styles a@Amount{acommodity=c, astyle=s} = a{astyle=s'}
amountValue :: Journal -> Day -> Amount -> Amount
amountValue j d a =
case commodityValue j d (acommodity a) of
Just v -> v{aquantity=aquantity v * aquantity a
,aprice=aprice a
}
Just v -> v{aquantity=aquantity v * aquantity a}
Nothing -> a
-- This is here not in Commodity.hs to use the Amount Show instance above for debugging.

View File

@ -316,3 +316,31 @@ Budget performance in 2018/01/01:
# TODO
# 15. respect --sort-amount
# 16. respect --value
<
P 2018/01/26 SHARE €10
2018/05/17 Dividend
revenue:dividend €-10
assets:pension €10
2018/05/17 Buy
assets:pension:shares 1 SHARE @ €10
assets:pension €-10
~ monthly from 2018/06 to 2018/07
assets:pension €1
assets:bank
$ hledger -f - bal -M --budget --cumulative --forecast --value
Budget performance in 2018/05/01-2018/06/30:
|| May Jun
================++====================================================
<unbudgeted> || €-10 €-10
assets:bank || 0 €-1 [ 100% of €-1]
assets:pension || €10 €11 [1100% of €1]
----------------++----------------------------------------------------
|| 0 0 [ 0]