diff --git a/hledger-web/Handler/RegisterR.hs b/hledger-web/Handler/RegisterR.hs index a98fad91625..5d21f1aecef 100644 --- a/hledger-web/Handler/RegisterR.hs +++ b/hledger-web/Handler/RegisterR.hs @@ -42,10 +42,22 @@ getRegisterR = do if filtering then ", filtered" else "" - maincontent = - registerReportHtml opts vd $ - accountTransactionsReport (reportopts_ $ cliopts_ opts) j m $ - fromMaybe Any $ inAccountQuery qopts + (chartQuery, depth) = + case (,) <$> inAccount qopts <*> inAccountQuery qopts of + Nothing -> (Any, 0) + Just ((an, _), aq) -> (aq, accountNameLevel an) + transRep = + accountTransactionsReport + (reportopts_ $ cliopts_ opts) + j + m + chartQuery + ballRep = + balanceReport + ((reportopts_ $ cliopts_ opts) {accountlistmode_=ALFlat}) + (And [chartQuery, Depth $ depth + 1, m]) + j + maincontent = registerReportHtml opts vd transRep ballRep hledgerLayout vd "register" @@ -60,12 +72,16 @@ postRegisterR = postAddForm -- Generate html for an account register, including a balance chart and transaction list. registerReportHtml :: - WebOpts -> ViewData -> TransactionsReport -> HtmlUrl AppRoute -registerReportHtml opts vd r = + WebOpts + -> ViewData + -> TransactionsReport + -> BalanceReport + -> HtmlUrl AppRoute +registerReportHtml opts vd r br = [hamlet|
^{registerChartHtml $ transactionsReportByCommodity r} - ^{registerPieChartHtml} + ^{registerPieChartHtml br} ^{registerItemsHtml opts vd r} |] @@ -216,8 +232,8 @@ registerChartHtml percommoditytxnreports then " " else c -registerPieChartHtml :: HtmlUrl AppRoute -registerPieChartHtml = +registerPieChartHtml :: BalanceReport -> HtmlUrl AppRoute +registerPieChartHtml (bris, _) = do [hamlet|