cli: Cli.Commands.Balance.multiBalanceReportHtmlRows: removed
export multiBalanceReportAsSpreadsheetParts for use in compoundBalanceReportAsHtml
This commit is contained in:
parent
2a374668e4
commit
2fd2110f3d
@ -259,10 +259,10 @@ module Hledger.Cli.Commands.Balance (
|
|||||||
,multiBalanceReportAsText
|
,multiBalanceReportAsText
|
||||||
,multiBalanceReportAsCsv
|
,multiBalanceReportAsCsv
|
||||||
,multiBalanceReportAsHtml
|
,multiBalanceReportAsHtml
|
||||||
,multiBalanceReportHtmlRows
|
|
||||||
,multiBalanceReportAsTable
|
,multiBalanceReportAsTable
|
||||||
,multiBalanceReportTableAsText
|
,multiBalanceReportTableAsText
|
||||||
,multiBalanceReportAsSpreadsheet
|
,multiBalanceReportAsSpreadsheet
|
||||||
|
,multiBalanceReportAsSpreadsheetParts
|
||||||
,multiBalanceHasTotalsColumn
|
,multiBalanceHasTotalsColumn
|
||||||
,addTotalBorders
|
,addTotalBorders
|
||||||
,addRowSpanHeader
|
,addRowSpanHeader
|
||||||
@ -307,7 +307,6 @@ import Hledger.Cli.Utils
|
|||||||
import Hledger.Write.Csv (CSV, printCSV, printTSV)
|
import Hledger.Write.Csv (CSV, printCSV, printTSV)
|
||||||
import Hledger.Write.Ods (printFods)
|
import Hledger.Write.Ods (printFods)
|
||||||
import Hledger.Write.Html.Lucid (printHtml)
|
import Hledger.Write.Html.Lucid (printHtml)
|
||||||
import qualified Hledger.Write.Html.Lucid as Html
|
|
||||||
import qualified Hledger.Write.Spreadsheet as Ods
|
import qualified Hledger.Write.Spreadsheet as Ods
|
||||||
|
|
||||||
|
|
||||||
@ -781,7 +780,8 @@ multiBalanceReportAsCsv opts@ReportOpts{..} report = maybeTranspose allRows
|
|||||||
multiBalanceReportAsSpreadsheetParts False opts report
|
multiBalanceReportAsSpreadsheetParts False opts report
|
||||||
maybeTranspose = if transpose_ then transpose else id
|
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 ::
|
multiBalanceReportAsSpreadsheetParts ::
|
||||||
Bool -> ReportOpts -> MultiBalanceReport ->
|
Bool -> ReportOpts -> MultiBalanceReport ->
|
||||||
([Ods.Cell Ods.NumLines Text],
|
([Ods.Cell Ods.NumLines Text],
|
||||||
@ -829,22 +829,6 @@ multiBalanceReportAsHtml ropts mbr =
|
|||||||
printHtml . map (map (fmap L.toHtml)) $
|
printHtml . map (map (fmap L.toHtml)) $
|
||||||
snd $ multiBalanceReportAsSpreadsheet ropts mbr
|
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.
|
-- | Render the ODS table rows for a MultiBalanceReport.
|
||||||
-- Returns the heading row, 0 or more body rows, and the totals row if enabled.
|
-- Returns the heading row, 0 or more body rows, and the totals row if enabled.
|
||||||
multiBalanceReportAsSpreadsheet ::
|
multiBalanceReportAsSpreadsheet ::
|
||||||
|
|||||||
@ -365,11 +365,15 @@ compoundBalanceReportAsHtml ropts cbr =
|
|||||||
subreportrows :: (T.Text, MultiBalanceReport, Bool) -> [Html ()]
|
subreportrows :: (T.Text, MultiBalanceReport, Bool) -> [Html ()]
|
||||||
subreportrows (subreporttitle, mbr, _increasestotal) =
|
subreportrows (subreporttitle, mbr, _increasestotal) =
|
||||||
let
|
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
|
in
|
||||||
[tr_ $ th_ [colspanattr, leftattr, class_ "account"] $ toHtml subreporttitle]
|
[tr_ $ th_ [colspanattr, leftattr, class_ "account"] $ toHtml subreporttitle]
|
||||||
++ bodyrows
|
++ map formatRow bodyrows
|
||||||
++ mtotalsrows
|
++ map formatRow mtotalsrows
|
||||||
++ [blankrow]
|
++ [blankrow]
|
||||||
|
|
||||||
totalrows =
|
totalrows =
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user