cli: Cli.Commands.Balance.multiBalanceReportHtmlRows: removed

export multiBalanceReportAsSpreadsheetParts for use in compoundBalanceReportAsHtml
This commit is contained in:
Henning Thielemann 2024-10-04 08:53:08 +02:00 committed by Simon Michael
parent 2a374668e4
commit 2fd2110f3d
2 changed files with 10 additions and 22 deletions

View File

@ -259,10 +259,10 @@ module Hledger.Cli.Commands.Balance (
,multiBalanceReportAsText
,multiBalanceReportAsCsv
,multiBalanceReportAsHtml
,multiBalanceReportHtmlRows
,multiBalanceReportAsTable
,multiBalanceReportTableAsText
,multiBalanceReportAsSpreadsheet
,multiBalanceReportAsSpreadsheetParts
,multiBalanceHasTotalsColumn
,addTotalBorders
,addRowSpanHeader
@ -307,7 +307,6 @@ import Hledger.Cli.Utils
import Hledger.Write.Csv (CSV, printCSV, printTSV)
import Hledger.Write.Ods (printFods)
import Hledger.Write.Html.Lucid (printHtml)
import qualified Hledger.Write.Html.Lucid as Html
import qualified Hledger.Write.Spreadsheet as Ods
@ -781,7 +780,8 @@ multiBalanceReportAsCsv opts@ReportOpts{..} report = maybeTranspose allRows
multiBalanceReportAsSpreadsheetParts False opts report
maybeTranspose = if transpose_ then transpose else id
-- Helper for CSV and ODS and HTML rendering.
-- | Render the Spreadsheet table rows (CSV, ODS, HTML) for a MultiBalanceReport.
-- Returns the heading row, 0 or more body rows, and the totals row if enabled.
multiBalanceReportAsSpreadsheetParts ::
Bool -> ReportOpts -> MultiBalanceReport ->
([Ods.Cell Ods.NumLines Text],
@ -829,22 +829,6 @@ multiBalanceReportAsHtml ropts mbr =
printHtml . map (map (fmap L.toHtml)) $
snd $ multiBalanceReportAsSpreadsheet ropts mbr
-- | Render the HTML table rows for a MultiBalanceReport.
-- Returns the heading row, 0 or more body rows, and the totals row if enabled.
multiBalanceReportHtmlRows :: ReportOpts -> MultiBalanceReport -> (Html (), [Html ()], [Html ()])
multiBalanceReportHtmlRows ropts mbr =
let
-- TODO: should the commodity_column be displayed as a subaccount in this case as well?
(headingsrow, bodyrows, mtotalsrows)
| transpose_ ropts = error' "Sorry, --transpose with HTML output is not yet supported" -- PARTIAL:
| otherwise = multiBalanceReportAsSpreadsheetParts True ropts mbr
formatRow = Html.formatRow . map (fmap L.toHtml)
in
(formatRow headingsrow
,map formatRow bodyrows
,map formatRow mtotalsrows
)
-- | Render the ODS table rows for a MultiBalanceReport.
-- Returns the heading row, 0 or more body rows, and the totals row if enabled.
multiBalanceReportAsSpreadsheet ::

View File

@ -365,11 +365,15 @@ compoundBalanceReportAsHtml ropts cbr =
subreportrows :: (T.Text, MultiBalanceReport, Bool) -> [Html ()]
subreportrows (subreporttitle, mbr, _increasestotal) =
let
(_,bodyrows,mtotalsrows) = multiBalanceReportHtmlRows ropts mbr
-- TODO: should the commodity_column be displayed as a subaccount in this case as well?
(_, bodyrows, mtotalsrows) =
multiBalanceReportAsSpreadsheetParts True ropts mbr
formatRow = Html.formatRow . map (fmap L.toHtml)
in
[tr_ $ th_ [colspanattr, leftattr, class_ "account"] $ toHtml subreporttitle]
++ bodyrows
++ mtotalsrows
++ map formatRow bodyrows
++ map formatRow mtotalsrows
++ [blankrow]
totalrows =