clarify meaning of balance report item's indent field
This commit is contained in:
parent
f7956d1ab7
commit
2e754b79a2
@ -131,11 +131,11 @@ balanceReportAsHtml _ vd@VD{here=here,q=q,m=m,j=j} (items,total) = $(Settings.ha
|
|||||||
filtering = not $ null q
|
filtering = not $ null q
|
||||||
inaccts = filter (m `matchesInAccount`) $ journalAccountNames j
|
inaccts = filter (m `matchesInAccount`) $ journalAccountNames j
|
||||||
itemAsHtml :: ViewData -> BalanceReportItem -> Hamlet AppRoute
|
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
|
where
|
||||||
depthclass = "depth"++show adepth
|
depthclass = "depth"++show aindent
|
||||||
inclass = if acct `elem` inaccts then "inacct" else "notinacct" :: String
|
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)])
|
accturl = (here, [("q", pack $ accountUrl acct)])
|
||||||
|
|
||||||
-- | Render a journal report as HTML.
|
-- | Render a journal report as HTML.
|
||||||
|
|||||||
@ -124,7 +124,7 @@ type BalanceReport = ([BalanceReportItem] -- line items, one per account
|
|||||||
type BalanceReportItem = (AccountName -- full account name
|
type BalanceReportItem = (AccountName -- full account name
|
||||||
,AccountName -- account name elided for display: the leaf name,
|
,AccountName -- account name elided for display: the leaf name,
|
||||||
-- prefixed by any boring parents immediately above
|
-- 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
|
,MixedAmount) -- account balance, includes subs unless --flat is present
|
||||||
|
|
||||||
-- | Print a balance report.
|
-- | Print a balance report.
|
||||||
@ -148,12 +148,12 @@ balanceReportAsText opts (items,total) =
|
|||||||
|
|
||||||
-- | Render one balance report line item as plain text.
|
-- | Render one balance report line item as plain text.
|
||||||
balanceReportItemAsText :: [Opt] -> BalanceReportItem -> String
|
balanceReportItemAsText :: [Opt] -> BalanceReportItem -> String
|
||||||
balanceReportItemAsText opts (a, adisplay, adepth, abal) = concatTopPadded [amt, " ", name]
|
balanceReportItemAsText opts (a, adisplay, aindent, abal) = concatTopPadded [amt, " ", name]
|
||||||
where
|
where
|
||||||
amt = padleft 20 $ showMixedAmountWithoutPrice abal
|
amt = padleft 20 $ showMixedAmountWithoutPrice abal
|
||||||
name | Flat `elem` opts = accountNameDrop (dropFromOpts opts) a
|
name | Flat `elem` opts = accountNameDrop (dropFromOpts opts) a
|
||||||
| otherwise = depthspacer ++ adisplay
|
| otherwise = indentspacer ++ adisplay
|
||||||
depthspacer = replicate (indentperlevel * adepth) ' '
|
indentspacer = replicate (indentperlevel * aindent) ' '
|
||||||
indentperlevel = 2
|
indentperlevel = 2
|
||||||
|
|
||||||
-- | Get a balance report with the specified options for this journal.
|
-- | Get a balance report with the specified options for this journal.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user