cli: Commands.Balance.headerCell: do not automatically add a bottom border anymore

addHeaderBorders: do it explicitly
This commit is contained in:
Henning Thielemann 2024-10-12 13:26:06 +02:00 committed by Simon Michael
parent dce24ea08f
commit b8570c2aa0

View File

@ -587,15 +587,8 @@ renderComponent topaligned oneline opts (acctname, dep, total) (FormatField ljus
} }
headerCell :: Text -> Ods.Cell Ods.NumLines Text headerCell :: (Ods.Lines borders) => Text -> Ods.Cell borders Text
headerCell text = headerCell text = (Ods.defaultCell text) {Ods.cellStyle = Ods.Head}
let deflt = Ods.defaultCell text
in
deflt {
Ods.cellStyle = Ods.Head,
Ods.cellBorder =
(Ods.cellBorder deflt) {Ods.borderBottom = Ods.DoubleLine}
}
registerQueryUrl :: [Text] -> Text registerQueryUrl :: [Text] -> Text
registerQueryUrl query = registerQueryUrl query =
@ -637,13 +630,18 @@ replaceDate :: Text -> [Text] -> [Text]
replaceDate prd query = "date:"<>prd : removeDates query replaceDate prd query = "date:"<>prd : removeDates query
headerDateSpanCell :: headerDateSpanCell ::
Maybe Text -> [Text] -> DateSpan -> Ods.Cell Ods.NumLines Text Maybe Text -> [Text] -> DateSpan -> Ods.Cell () Text
headerDateSpanCell base query spn = headerDateSpanCell base query spn =
let prd = showDateSpan spn in let prd = showDateSpan spn in
(headerCell prd) { (headerCell prd) {
Ods.cellAnchor = composeAnchor base $ replaceDate prd query Ods.cellAnchor = composeAnchor base $ replaceDate prd query
} }
addHeaderBorders :: [Ods.Cell () text] -> [Ods.Cell Ods.NumLines text]
addHeaderBorders =
map (\c -> c {Ods.cellBorder =
Ods.noBorder {Ods.borderBottom = Ods.DoubleLine}})
simpleDateSpanCell :: DateSpan -> Ods.Cell Ods.NumLines Text simpleDateSpanCell :: DateSpan -> Ods.Cell Ods.NumLines Text
simpleDateSpanCell = Ods.defaultCell . showDateSpan simpleDateSpanCell = Ods.defaultCell . showDateSpan
@ -701,7 +699,7 @@ balanceReportAsSpreadsheet opts (items, total) =
where where
cell = Ods.defaultCell cell = Ods.defaultCell
headers = headers =
map headerCell $ addHeaderBorders $ map headerCell $
"account" : case layout_ opts of "account" : case layout_ opts of
LayoutBare -> ["commodity", "balance"] LayoutBare -> ["commodity", "balance"]
_ -> ["balance"] _ -> ["balance"]
@ -794,6 +792,7 @@ multiBalanceReportAsSpreadsheetParts fmt opts@ReportOpts{..} (PeriodicReport col
(Ods.defaultCell label) {Ods.cellClass = Ods.Class "account"} (Ods.defaultCell label) {Ods.cellClass = Ods.Class "account"}
hCell cls label = (headerCell label) {Ods.cellClass = Ods.Class cls} hCell cls label = (headerCell label) {Ods.cellClass = Ods.Class cls}
headers = headers =
addHeaderBorders $
hCell "account" "account" : hCell "account" "account" :
case layout_ of case layout_ of
LayoutTidy -> LayoutTidy ->
@ -1259,7 +1258,7 @@ budgetReportAsSpreadsheet
= (if transpose_ then Ods.transpose else id) $ = (if transpose_ then Ods.transpose else id) $
-- heading row -- heading row
(map headerCell $ (addHeaderBorders $ map headerCell $
"Account" : "Account" :
["Commodity" | layout_ == LayoutBare ] ["Commodity" | layout_ == LayoutBare ]
++ concatMap (\spn -> [showDateSpan spn, "budget"]) colspans ++ concatMap (\spn -> [showDateSpan spn, "budget"]) colspans