cli: Commands.Cli.Balance.rawTableContent: helper function for extracting CSV from Spreadsheet cells
This commit is contained in:
parent
df9531a6b7
commit
2fcf793221
@ -440,7 +440,7 @@ totalRowHeadingBudgetCsv = "Total:"
|
|||||||
-- | Render a single-column balance report as CSV.
|
-- | Render a single-column balance report as CSV.
|
||||||
balanceReportAsCsv :: ReportOpts -> BalanceReport -> CSV
|
balanceReportAsCsv :: ReportOpts -> BalanceReport -> CSV
|
||||||
balanceReportAsCsv opts =
|
balanceReportAsCsv opts =
|
||||||
map (map Ods.cellContent) . balanceReportAsSpreadsheet opts
|
rawTableContent . balanceReportAsSpreadsheet opts
|
||||||
|
|
||||||
-- | Render a single-column balance report as plain text.
|
-- | Render a single-column balance report as plain text.
|
||||||
balanceReportAsText :: ReportOpts -> BalanceReport -> TB.Builder
|
balanceReportAsText :: ReportOpts -> BalanceReport -> TB.Builder
|
||||||
@ -571,6 +571,10 @@ addTotalBorders =
|
|||||||
Ods.cellBorder = Ods.noBorder {Ods.borderTop = border}}))
|
Ods.cellBorder = Ods.noBorder {Ods.borderTop = border}}))
|
||||||
(Ods.DoubleLine : repeat Ods.NoLine)
|
(Ods.DoubleLine : repeat Ods.NoLine)
|
||||||
|
|
||||||
|
rawTableContent :: [[Ods.Cell border text]] -> [[text]]
|
||||||
|
rawTableContent = map (map Ods.cellContent)
|
||||||
|
|
||||||
|
|
||||||
-- | Render a single-column balance report as FODS.
|
-- | Render a single-column balance report as FODS.
|
||||||
balanceReportAsSpreadsheet ::
|
balanceReportAsSpreadsheet ::
|
||||||
ReportOpts -> BalanceReport -> [[Ods.Cell Ods.NumLines Text]]
|
ReportOpts -> BalanceReport -> [[Ods.Cell Ods.NumLines Text]]
|
||||||
@ -651,7 +655,7 @@ multiBalanceReportAsCsv opts@ReportOpts{..} report = maybeTranspose allRows
|
|||||||
-- Helper for CSV (and HTML) rendering.
|
-- Helper for CSV (and HTML) rendering.
|
||||||
multiBalanceReportAsCsvHelper :: Bool -> ReportOpts -> MultiBalanceReport -> (CSV, CSV)
|
multiBalanceReportAsCsvHelper :: Bool -> ReportOpts -> MultiBalanceReport -> (CSV, CSV)
|
||||||
multiBalanceReportAsCsvHelper ishtml opts =
|
multiBalanceReportAsCsvHelper ishtml opts =
|
||||||
(map (map Ods.cellContent) *** map (map Ods.cellContent)) .
|
(rawTableContent *** rawTableContent) .
|
||||||
multiBalanceReportAsSpreadsheetHelper ishtml opts
|
multiBalanceReportAsSpreadsheetHelper ishtml opts
|
||||||
|
|
||||||
-- Helper for CSV and ODS and HTML rendering.
|
-- Helper for CSV and ODS and HTML rendering.
|
||||||
@ -909,7 +913,7 @@ multiBalanceReportAsTable opts@ReportOpts{summary_only_, average_, row_total_, b
|
|||||||
|
|
||||||
multiBalanceRowAsTextBuilders :: AmountFormat -> ReportOpts -> [DateSpan] -> PeriodicReportRow a MixedAmount -> [[WideBuilder]]
|
multiBalanceRowAsTextBuilders :: AmountFormat -> ReportOpts -> [DateSpan] -> PeriodicReportRow a MixedAmount -> [[WideBuilder]]
|
||||||
multiBalanceRowAsTextBuilders bopts ropts colspans row =
|
multiBalanceRowAsTextBuilders bopts ropts colspans row =
|
||||||
map (map Ods.cellContent) $
|
rawTableContent $
|
||||||
multiBalanceRowAsCellBuilders bopts ropts colspans row
|
multiBalanceRowAsCellBuilders bopts ropts colspans row
|
||||||
|
|
||||||
multiBalanceRowAsCellBuilders ::
|
multiBalanceRowAsCellBuilders ::
|
||||||
@ -1218,7 +1222,7 @@ budgetReportAsTable ReportOpts{..} (PeriodicReport spans items totrow) =
|
|||||||
-- but includes alternating actual and budget amount columns.
|
-- but includes alternating actual and budget amount columns.
|
||||||
budgetReportAsCsv :: ReportOpts -> BudgetReport -> [[Text]]
|
budgetReportAsCsv :: ReportOpts -> BudgetReport -> [[Text]]
|
||||||
budgetReportAsCsv ropts report
|
budgetReportAsCsv ropts report
|
||||||
= map (map Ods.cellContent) $
|
= rawTableContent $
|
||||||
budgetReportAsSpreadsheet ropts report
|
budgetReportAsSpreadsheet ropts report
|
||||||
|
|
||||||
budgetReportAsSpreadsheet ::
|
budgetReportAsSpreadsheet ::
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user