From 4f83326f14a790ca48cc992e0dc41fbcf6126333 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 16 Oct 2008 06:12:40 +0000 Subject: [PATCH] display virtual accounts with appropriate brackets in register report --- Ledger/RawTransaction.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Ledger/RawTransaction.hs b/Ledger/RawTransaction.hs index 1e6eafbdc..863263ed3 100644 --- a/Ledger/RawTransaction.hs +++ b/Ledger/RawTransaction.hs @@ -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