display virtual accounts with appropriate brackets in register report
This commit is contained in:
parent
c444b02349
commit
4f83326f14
@ -16,10 +16,15 @@ import Ledger.AccountName
|
|||||||
instance Show RawTransaction where show = showRawTransaction
|
instance Show RawTransaction where show = showRawTransaction
|
||||||
|
|
||||||
showRawTransaction :: RawTransaction -> String
|
showRawTransaction :: RawTransaction -> String
|
||||||
showRawTransaction t = (showaccountname $ taccount t) ++ " " ++ (showamount $ tamount t)
|
showRawTransaction (RawTransaction a amt _ ttype) =
|
||||||
|
showaccountname a ++ " " ++ (showamount amt)
|
||||||
where
|
where
|
||||||
showaccountname = printf "%-22s" . elideAccountName 22
|
showaccountname = printf "%-22s" . bracket . elideAccountName width
|
||||||
showamount = printf "%12s" . showAmountOrZero
|
showamount = printf "%12s" . showAmountOrZero
|
||||||
|
(bracket,width) = case ttype of
|
||||||
|
BalancedVirtualTransaction -> (\s -> "["++s++"]", 20)
|
||||||
|
VirtualTransaction -> (\s -> "("++s++")", 20)
|
||||||
|
otherwise -> (id,22)
|
||||||
|
|
||||||
isReal :: RawTransaction -> Bool
|
isReal :: RawTransaction -> Bool
|
||||||
isReal t = rttype t == RegularTransaction
|
isReal t = rttype t == RegularTransaction
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user