mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-28 04:46:31 +03:00
cli: Cli.Commands.Balance.multiBalanceReportAsSpreadsheetParts: parameter ishtml::Bool -> fmt::AmountFormat
arguments machineFmt, oneLineNoCostFmt are more descriptive than False, True
This commit is contained in:
parent
2fd2110f3d
commit
2122444c4b
@ -777,17 +777,17 @@ multiBalanceReportAsCsv opts@ReportOpts{..} report = maybeTranspose allRows
|
|||||||
_ -> rows ++ totals
|
_ -> rows ++ totals
|
||||||
rows = header:body
|
rows = header:body
|
||||||
(header, body, totals) =
|
(header, body, totals) =
|
||||||
multiBalanceReportAsSpreadsheetParts False opts report
|
multiBalanceReportAsSpreadsheetParts machineFmt opts report
|
||||||
maybeTranspose = if transpose_ then transpose else id
|
maybeTranspose = if transpose_ then transpose else id
|
||||||
|
|
||||||
-- | Render the Spreadsheet table rows (CSV, ODS, HTML) for a MultiBalanceReport.
|
-- | 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.
|
-- Returns the heading row, 0 or more body rows, and the totals row if enabled.
|
||||||
multiBalanceReportAsSpreadsheetParts ::
|
multiBalanceReportAsSpreadsheetParts ::
|
||||||
Bool -> ReportOpts -> MultiBalanceReport ->
|
AmountFormat -> ReportOpts -> MultiBalanceReport ->
|
||||||
([Ods.Cell Ods.NumLines Text],
|
([Ods.Cell Ods.NumLines Text],
|
||||||
[[Ods.Cell Ods.NumLines Text]],
|
[[Ods.Cell Ods.NumLines Text]],
|
||||||
[[Ods.Cell Ods.NumLines Text]])
|
[[Ods.Cell Ods.NumLines Text]])
|
||||||
multiBalanceReportAsSpreadsheetParts ishtml opts@ReportOpts{..} (PeriodicReport colspans items tr) =
|
multiBalanceReportAsSpreadsheetParts fmt opts@ReportOpts{..} (PeriodicReport colspans items tr) =
|
||||||
(headers, concatMap fullRowAsTexts items, addTotalBorders totalrows)
|
(headers, concatMap fullRowAsTexts items, addTotalBorders totalrows)
|
||||||
where
|
where
|
||||||
accountCell label =
|
accountCell label =
|
||||||
@ -818,9 +818,8 @@ multiBalanceReportAsSpreadsheetParts ishtml opts@ReportOpts{..} (PeriodicReport
|
|||||||
else addRowSpanHeader (accountCell totalRowHeadingSpreadsheet) $
|
else addRowSpanHeader (accountCell totalRowHeadingSpreadsheet) $
|
||||||
rowAsText Total simpleDateSpanCell tr
|
rowAsText Total simpleDateSpanCell tr
|
||||||
rowAsText rc dsCell =
|
rowAsText rc dsCell =
|
||||||
let fmt = if ishtml then oneLineNoCostFmt else machineFmt
|
map (map (fmap wbToText)) .
|
||||||
in map (map (fmap wbToText)) .
|
multiBalanceRowAsCellBuilders fmt opts colspans rc dsCell
|
||||||
multiBalanceRowAsCellBuilders fmt opts colspans rc dsCell
|
|
||||||
|
|
||||||
|
|
||||||
-- | Render a multi-column balance report as HTML.
|
-- | Render a multi-column balance report as HTML.
|
||||||
@ -835,7 +834,8 @@ multiBalanceReportAsSpreadsheet ::
|
|||||||
ReportOpts -> MultiBalanceReport ->
|
ReportOpts -> MultiBalanceReport ->
|
||||||
((Maybe Int, Maybe Int), [[Ods.Cell Ods.NumLines Text]])
|
((Maybe Int, Maybe Int), [[Ods.Cell Ods.NumLines Text]])
|
||||||
multiBalanceReportAsSpreadsheet ropts mbr =
|
multiBalanceReportAsSpreadsheet ropts mbr =
|
||||||
let (header,body,total) = multiBalanceReportAsSpreadsheetParts True ropts mbr
|
let (header,body,total) =
|
||||||
|
multiBalanceReportAsSpreadsheetParts oneLineNoCostFmt ropts mbr
|
||||||
in (if transpose_ ropts then swap *** Ods.transpose else id) $
|
in (if transpose_ ropts then swap *** Ods.transpose else id) $
|
||||||
((Just 1, case layout_ ropts of LayoutWide _ -> Just 1; _ -> Nothing),
|
((Just 1, case layout_ ropts of LayoutWide _ -> Just 1; _ -> Nothing),
|
||||||
header : body ++ total)
|
header : body ++ total)
|
||||||
|
@ -367,7 +367,7 @@ compoundBalanceReportAsHtml ropts cbr =
|
|||||||
let
|
let
|
||||||
-- TODO: should the commodity_column be displayed as a subaccount in this case as well?
|
-- TODO: should the commodity_column be displayed as a subaccount in this case as well?
|
||||||
(_, bodyrows, mtotalsrows) =
|
(_, bodyrows, mtotalsrows) =
|
||||||
multiBalanceReportAsSpreadsheetParts True ropts mbr
|
multiBalanceReportAsSpreadsheetParts oneLineNoCostFmt ropts mbr
|
||||||
formatRow = Html.formatRow . map (fmap L.toHtml)
|
formatRow = Html.formatRow . map (fmap L.toHtml)
|
||||||
|
|
||||||
in
|
in
|
||||||
|
Loading…
Reference in New Issue
Block a user