imp: lib: Hledger.Data.Amount: showMixedAmountOneLine now shows costs

This commit is contained in:
Simon Michael 2022-10-01 18:33:29 -10:00
parent de5a97600c
commit 3a4f23df95
2 changed files with 4 additions and 4 deletions

View File

@ -781,11 +781,11 @@ mixedAmountUnstyled = mapMixedAmountUnsafe amountUnstyled
showMixedAmount :: MixedAmount -> String showMixedAmount :: MixedAmount -> String
showMixedAmount = wbUnpack . showMixedAmountB noColour showMixedAmount = wbUnpack . showMixedAmountB noColour
-- | Get the one-line string representation of a mixed amount. -- | Get the one-line string representation of a mixed amount (also showing any costs).
-- --
-- > showMixedAmountOneLine = wbUnpack . showMixedAmountB oneLine -- > showMixedAmountOneLine = wbUnpack . showMixedAmountB oneLine
showMixedAmountOneLine :: MixedAmount -> String showMixedAmountOneLine :: MixedAmount -> String
showMixedAmountOneLine = wbUnpack . showMixedAmountB oneLine showMixedAmountOneLine = wbUnpack . showMixedAmountB oneLine{displayPrice=True}
-- | Like showMixedAmount, but zero amounts are shown with their -- | Like showMixedAmount, but zero amounts are shown with their
-- commodity if they have one. -- commodity if they have one.

View File

@ -118,11 +118,11 @@ transactionCheckBalanced BalancingOpts{commodity_styles_} t = errs
rmsg rmsg
| rsumok = "" | rsumok = ""
| not rsignsok = "The real postings all have the same sign. Consider negating some of them." | 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: " ++ showMixedAmountOneLine rsumcost | otherwise = "The real postings' sum should be 0 but is: " ++ showMixedAmountOneLineWithoutPrice False rsumcost
bvmsg bvmsg
| bvsumok = "" | bvsumok = ""
| not bvsignsok = "The balanced virtual postings all have the same sign. Consider negating some of them." | 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: " ++ showMixedAmountOneLine bvsumcost | otherwise = "The balanced virtual postings' sum should be 0 but is: " ++ showMixedAmountOneLineWithoutPrice False bvsumcost
-- | Legacy form of transactionCheckBalanced. -- | Legacy form of transactionCheckBalanced.
isTransactionBalanced :: BalancingOpts -> Transaction -> Bool isTransactionBalanced :: BalancingOpts -> Transaction -> Bool