diff --git a/hledger-web/Handlers.hs b/hledger-web/Handlers.hs index 7aca9874d..802c54237 100644 --- a/hledger-web/Handlers.hs +++ b/hledger-web/Handlers.hs @@ -131,11 +131,11 @@ balanceReportAsHtml _ vd@VD{here=here,q=q,m=m,j=j} (items,total) = $(Settings.ha filtering = not $ null q inaccts = filter (m `matchesInAccount`) $ journalAccountNames j itemAsHtml :: ViewData -> BalanceReportItem -> Hamlet AppRoute - itemAsHtml VD{here=here,q=q} (acct, adisplay, adepth, abal) = $(Settings.hamletFile "balancereportitem") + itemAsHtml VD{here=here,q=q} (acct, adisplay, aindent, abal) = $(Settings.hamletFile "balancereportitem") where - depthclass = "depth"++show adepth + depthclass = "depth"++show aindent inclass = if acct `elem` inaccts then "inacct" else "notinacct" :: String - indent = preEscapedString $ concat $ replicate (2 * adepth) " " + indent = preEscapedString $ concat $ replicate (2 * aindent) " " accturl = (here, [("q", pack $ accountUrl acct)]) -- | Render a journal report as HTML. diff --git a/hledger/Hledger/Cli/Balance.hs b/hledger/Hledger/Cli/Balance.hs index 9a2ea71ca..654fa81e1 100644 --- a/hledger/Hledger/Cli/Balance.hs +++ b/hledger/Hledger/Cli/Balance.hs @@ -124,7 +124,7 @@ type BalanceReport = ([BalanceReportItem] -- line items, one per account type BalanceReportItem = (AccountName -- full account name ,AccountName -- account name elided for display: the leaf name, -- prefixed by any boring parents immediately above - ,Int -- account depth within this report, excludes boring parents + ,Int -- how many steps to indent this account (0-based account depth excluding boring parents) ,MixedAmount) -- account balance, includes subs unless --flat is present -- | Print a balance report. @@ -148,12 +148,12 @@ balanceReportAsText opts (items,total) = -- | Render one balance report line item as plain text. balanceReportItemAsText :: [Opt] -> BalanceReportItem -> String -balanceReportItemAsText opts (a, adisplay, adepth, abal) = concatTopPadded [amt, " ", name] +balanceReportItemAsText opts (a, adisplay, aindent, abal) = concatTopPadded [amt, " ", name] where amt = padleft 20 $ showMixedAmountWithoutPrice abal name | Flat `elem` opts = accountNameDrop (dropFromOpts opts) a - | otherwise = depthspacer ++ adisplay - depthspacer = replicate (indentperlevel * adepth) ' ' + | otherwise = indentspacer ++ adisplay + indentspacer = replicate (indentperlevel * aindent) ' ' indentperlevel = 2 -- | Get a balance report with the specified options for this journal.