display virtual accounts with appropriate brackets in register report

This commit is contained in:
Simon Michael 2008-10-16 06:12:40 +00:00
parent c444b02349
commit 4f83326f14

View File

@ -16,10 +16,15 @@ import Ledger.AccountName
instance Show RawTransaction where show = showRawTransaction
showRawTransaction :: RawTransaction -> String
showRawTransaction t = (showaccountname $ taccount t) ++ " " ++ (showamount $ tamount t)
showRawTransaction (RawTransaction a amt _ ttype) =
showaccountname a ++ " " ++ (showamount amt)
where
showaccountname = printf "%-22s" . elideAccountName 22
showaccountname = printf "%-22s" . bracket . elideAccountName width
showamount = printf "%12s" . showAmountOrZero
(bracket,width) = case ttype of
BalancedVirtualTransaction -> (\s -> "["++s++"]", 20)
VirtualTransaction -> (\s -> "("++s++")", 20)
otherwise -> (id,22)
isReal :: RawTransaction -> Bool
isReal t = rttype t == RegularTransaction