fix: balcmds: don't repeat "total" and "Net:" headers in HTML output
This commit is contained in:
parent
1a242c1264
commit
9788a06223
@ -580,7 +580,8 @@ multiBalanceReportAsCsvHelper ishtml opts@ReportOpts{..} (PeriodicReport colspan
|
|||||||
where showName = accountNameDrop drop_ . prrFullName
|
where showName = accountNameDrop drop_ . prrFullName
|
||||||
totalrows
|
totalrows
|
||||||
| no_total_ = mempty
|
| no_total_ = mempty
|
||||||
| otherwise = map ("total" :) $ rowAsText opts colspans tr
|
| ishtml = zipWith (:) ("total":repeat "") $ rowAsText opts colspans tr
|
||||||
|
| otherwise = map ("total" :) $ rowAsText opts colspans tr
|
||||||
rowAsText = if ishtml then multiBalanceRowAsHtmlText else multiBalanceRowAsCsvText
|
rowAsText = if ishtml then multiBalanceRowAsHtmlText else multiBalanceRowAsCsvText
|
||||||
|
|
||||||
-- | Render a multi-column balance report as HTML.
|
-- | Render a multi-column balance report as HTML.
|
||||||
|
|||||||
@ -29,6 +29,7 @@ import Hledger
|
|||||||
import Hledger.Cli.Commands.Balance
|
import Hledger.Cli.Commands.Balance
|
||||||
import Hledger.Cli.CliOptions
|
import Hledger.Cli.CliOptions
|
||||||
import Hledger.Cli.Utils (unsupportedOutputFormatError, writeOutputLazyText)
|
import Hledger.Cli.Utils (unsupportedOutputFormatError, writeOutputLazyText)
|
||||||
|
import Data.Function ((&))
|
||||||
|
|
||||||
-- | Description of a compound balance report command,
|
-- | Description of a compound balance report command,
|
||||||
-- from which we generate the command's cmdargs mode and IO action.
|
-- from which we generate the command's cmdargs mode and IO action.
|
||||||
@ -337,8 +338,13 @@ compoundBalanceReportAsHtml ropts cbr =
|
|||||||
++ mtotalsrows
|
++ mtotalsrows
|
||||||
++ [blankrow]
|
++ [blankrow]
|
||||||
|
|
||||||
totalrows | no_total_ ropts || length subreports == 1 = []
|
totalrows =
|
||||||
| otherwise = multiBalanceReportHtmlFootRow ropts <$> (("Net:" :) <$> multiBalanceRowAsCsvText ropts colspans totalrow)
|
if no_total_ ropts || length subreports == 1 then []
|
||||||
|
else
|
||||||
|
multiBalanceRowAsCsvText ropts colspans totalrow -- make a table of rendered lines of the report totals row
|
||||||
|
& zipWith (:) ("Net:":repeat "") -- insert a headings column, with Net: on the first line only
|
||||||
|
& map (multiBalanceReportHtmlFootRow ropts) -- convert to a list of HTML totals rows
|
||||||
|
|
||||||
in do
|
in do
|
||||||
style_ (T.unlines [""
|
style_ (T.unlines [""
|
||||||
,"td { padding:0 0.5em; }"
|
,"td { padding:0 0.5em; }"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user