mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-09 21:22:26 +03:00
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
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user