clarify meaning of balance report item's indent field

This commit is contained in:
Simon Michael 2011-06-14 21:28:21 +00:00
parent f7956d1ab7
commit 2e754b79a2
2 changed files with 7 additions and 7 deletions

View File

@ -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.

View File

@ -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.