dev: clarify showAmountsCostB
This commit is contained in:
parent
ca55c2f0f8
commit
e2ed2b3b6d
@ -84,7 +84,7 @@ module Hledger.Data.Amount (
|
|||||||
csvDisplay,
|
csvDisplay,
|
||||||
showAmountB,
|
showAmountB,
|
||||||
showAmount,
|
showAmount,
|
||||||
showAmountCostB,
|
showAmountsCostB,
|
||||||
cshowAmount,
|
cshowAmount,
|
||||||
showAmountWithZeroCommodity,
|
showAmountWithZeroCommodity,
|
||||||
showAmountDebug,
|
showAmountDebug,
|
||||||
@ -617,8 +617,9 @@ withDecimalPoint = flip setAmountDecimalPoint
|
|||||||
|
|
||||||
-- Amount rendering
|
-- Amount rendering
|
||||||
|
|
||||||
showAmountCostB :: Amount -> WideBuilder
|
-- Show an amount's cost as @ UNITCOST or @@ TOTALCOST (builder version).
|
||||||
showAmountCostB amt = case acost amt of
|
showAmountsCostB :: Amount -> WideBuilder
|
||||||
|
showAmountsCostB amt = case acost amt of
|
||||||
Nothing -> mempty
|
Nothing -> mempty
|
||||||
Just (UnitCost pa) -> WideBuilder (TB.fromString " @ ") 3 <> showAmountB noColour{displayZeroCommodity=True} pa
|
Just (UnitCost pa) -> WideBuilder (TB.fromString " @ ") 3 <> showAmountB noColour{displayZeroCommodity=True} pa
|
||||||
Just (TotalCost pa) -> WideBuilder (TB.fromString " @@ ") 4 <> showAmountB noColour{displayZeroCommodity=True} (sign pa)
|
Just (TotalCost pa) -> WideBuilder (TB.fromString " @@ ") 4 <> showAmountB noColour{displayZeroCommodity=True} (sign pa)
|
||||||
@ -667,7 +668,7 @@ showAmountB
|
|||||||
| amountLooksZero a && not displayZeroCommodity = (WideBuilder (TB.singleton '0') 1, "")
|
| amountLooksZero a && not displayZeroCommodity = (WideBuilder (TB.singleton '0') 1, "")
|
||||||
| otherwise = (quantity, quoteCommoditySymbolIfNeeded $ acommodity a)
|
| otherwise = (quantity, quoteCommoditySymbolIfNeeded $ acommodity a)
|
||||||
space = if not (T.null comm) && ascommodityspaced style then WideBuilder (TB.singleton ' ') 1 else mempty
|
space = if not (T.null comm) && ascommodityspaced style then WideBuilder (TB.singleton ' ') 1 else mempty
|
||||||
cost = if displayCost then showAmountCostB a else mempty
|
cost = if displayCost then showAmountsCostB a else mempty
|
||||||
|
|
||||||
-- | Colour version. For a negative amount, adds ANSI codes to change the colour,
|
-- | Colour version. For a negative amount, adds ANSI codes to change the colour,
|
||||||
-- currently to hard-coded red.
|
-- currently to hard-coded red.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user