print: show all decimal places in assertion/assignment amounts (#1465)

Overriding the commodity style, per https://hledger.org/hledger.html#commodity-display-style.
This commit is contained in:
Simon Michael 2021-02-03 18:11:44 -08:00
parent 74f288a01d
commit 201f967411
2 changed files with 17 additions and 1 deletions

View File

@ -981,7 +981,8 @@ journalApplyCommodityStyles j@Journal{jtxns=ts, jpricedirectives=pds} =
fixtransaction t@Transaction{tpostings=ps} = t{tpostings=map fixposting ps}
fixposting p = p{pamount=styleMixedAmount styles $ pamount p
,pbalanceassertion=fixbalanceassertion <$> pbalanceassertion p}
fixbalanceassertion ba = ba{baamount=styleAmount styles $ baamount ba}
-- balance assertion amounts are always displayed, eg by print, at full precision, per docs
fixbalanceassertion ba = ba{baamount=setFullPrecision $ styleAmount styles $ baamount ba}
fixpricedirective pd@PriceDirective{pdamount=a} = pd{pdamount=styleAmountExceptPrecision styles a}
-- | Get the canonical amount styles for this journal, whether (in order of precedence):

View File

@ -195,3 +195,18 @@ $ hledger -f - print
(b) 2.00 $
>=
# Balance assertion amounts are always displayed at their full precision,
# overriding commodity styles. (#1465)
<
commodity A 1.
2021-01-01
(a) 0.001A
(a) 1.122A = 1.123A
$ hledger -f - print
2021-01-01
(a) 0
(a) A 1 = A 1.123
>=