imp:errors:unbalanced transaction: show more precise amounts (#2135)

Like we used to in 1.30, but better (show all available decimal digits,
unless they're infinite in which case show 8, show trailing zeros,
show commodity symbol with zero).
This commit is contained in:
Simon Michael 2024-02-29 12:32:23 -10:00
parent 3ec432bd53
commit 1ee0e80719

View File

@ -131,11 +131,17 @@ transactionCheckBalanced BalancingOpts{commodity_styles_} t = errs
rmsg
| rsumok = ""
| not rsignsok = "The real postings all have the same sign. Consider negating some of them."
| otherwise = "The real postings' sum should be 0 but is: " ++ showMixedAmountOneLineWithoutCost False rsumcost
| otherwise = "The real postings' sum should be 0 but is: " ++
(showMixedAmountWith oneLineNoCostFmt{displayCost=True, displayZeroCommodity=True} $
mixedAmountSetFullPrecisionUpTo Nothing $ mixedAmountSetFullPrecision
rsumcost)
bvmsg
| bvsumok = ""
| not bvsignsok = "The balanced virtual postings all have the same sign. Consider negating some of them."
| otherwise = "The balanced virtual postings' sum should be 0 but is: " ++ showMixedAmountOneLineWithoutCost False bvsumcost
| otherwise = "The balanced virtual postings' sum should be 0 but is: " ++
(showMixedAmountWith oneLineNoCostFmt{displayCost=True, displayZeroCommodity=True} $
mixedAmountSetFullPrecisionUpTo Nothing $ mixedAmountSetFullPrecision
bvsumcost)
-- | Legacy form of transactionCheckBalanced.
isTransactionBalanced :: BalancingOpts -> Transaction -> Bool