From 984da9c5042a4252b93967e6fec31e4e059586c2 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 25 Nov 2009 12:21:38 +0000 Subject: [PATCH] balance, register: don't show amount prices any more, like c++ ledger Note print still shows all amount prices, unlike ledger (and supports -B); it looks useful. --- Commands/Balance.hs | 8 ++++---- Commands/Register.hs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Commands/Balance.hs b/Commands/Balance.hs index f0789d172..b890ed22d 100644 --- a/Commands/Balance.hs +++ b/Commands/Balance.hs @@ -123,7 +123,7 @@ showBalanceReport opts _ l = acctsstr ++ totalstr accttree = ledgerAccountTree (depthFromOpts opts) l totalstr | NoTotal `elem` opts = "" | not (Empty `elem` opts) && isZeroMixedAmount total = "" - | otherwise = printf "--------------------\n%s\n" $ padleft 20 $ showMixedAmount total + | otherwise = printf "--------------------\n%s\n" $ padleft 20 $ showMixedAmountWithoutPrice total where total = sum $ map abalance $ ledgerTopAccounts l @@ -131,11 +131,11 @@ showBalanceReport opts _ l = acctsstr ++ totalstr showInterestingAccount :: Ledger -> [AccountName] -> AccountName -> String showInterestingAccount l interestingaccts a = concatTopPadded [amt, " ", depthspacer ++ partialname] where - amt = padleft 20 $ showMixedAmount $ abalance $ ledgerAccount l a - -- the depth spacer (indent) is two spaces for each interesting parent + amt = padleft 20 $ showMixedAmountWithoutPrice $ abalance $ ledgerAccount l a parents = parentAccountNames a interestingparents = filter (`elem` interestingaccts) parents - depthspacer = replicate (2 * length interestingparents) ' ' + depthspacer = replicate (indentperlevel * length interestingparents) ' ' + indentperlevel = 2 -- the partial name is the account's leaf name, prefixed by the -- names of any boring parents immediately above partialname = accountNameFromComponents $ reverse (map accountLeafName ps) ++ [accountLeafName a] diff --git a/Commands/Register.hs b/Commands/Register.hs index c5cc75d57..3b3bd0147 100644 --- a/Commands/Register.hs +++ b/Commands/Register.hs @@ -109,7 +109,7 @@ showtxn omitdesc t b = concatBottomPadded [entrydesc ++ p ++ " ", bal] ++ "\n" entrydesc = if omitdesc then replicate 32 ' ' else printf "%s %s " date desc date = showDate da desc = printf "%-20s" $ elideRight 20 de :: String - p = showPosting $ Posting s a amt "" tt - bal = padleft 12 (showMixedAmountOrZero b) + p = showPostingWithoutPrice $ Posting s a amt "" tt + bal = padleft 12 (showMixedAmountOrZeroWithoutPrice b) Transaction{tstatus=s,tdate=da,tdescription=de,taccount=a,tamount=amt,ttype=tt} = t