cli: Commands.Register.postingsReportItemAsRecord: format transaction index as integer

lib: Write.Spreadsheet.Type: new TypeInteger
This commit is contained in:
Henning Thielemann 2024-10-17 18:46:51 +02:00 committed by Simon Michael
parent b23753f5ae
commit 96e0500ea7
3 changed files with 13 additions and 1 deletions

View File

@ -69,6 +69,9 @@ printFods encoding tables =
" <number:text>-</number:text>" :
" <number:day number:style='long'/>" :
" </number:date-style>" :
" <number:number-style style:name='integer'>" :
" <number:number number:min-integer-digits='1'/>" :
" </number:number-style>" :
customStyles ++
"</office:styles>" :
[]
@ -139,6 +142,7 @@ dataStyleFromType :: Type -> DataStyle
dataStyleFromType typ =
case typ of
TypeString -> DataString
TypeInteger -> DataInteger
TypeDate -> DataDate
TypeAmount amt -> DataAmount (acommodity amt) (asprecision $ astyle amt)
TypeMixedAmount -> DataMixedAmount
@ -234,6 +238,7 @@ borderStyle border =
data DataStyle =
DataString
| DataInteger
| DataDate
| DataAmount CommoditySymbol AmountPrecision
| DataMixedAmount
@ -299,6 +304,10 @@ formatCell cell =
valueType =
case cellType cell of
TypeInteger ->
printf
"office:value-type='float' office:value='%s'"
(cellContent cell)
TypeAmount amt ->
printf
"office:value-type='float' office:value='%s'"
@ -343,6 +352,8 @@ styleNames cstyle border dataStyle =
case dataStyle of
DataDate ->
(printf "%s-%s-date" cstyleName bordName, Just "iso-date")
DataInteger ->
(printf "%s-%s-integer" cstyleName bordName, Just "integer")
DataAmount comm prec ->
let name = numberStyleName (comm, prec) in
(printf "%s-%s-%s" cstyleName bordName name,

View File

@ -40,6 +40,7 @@ import Prelude hiding (span)
data Type =
TypeString
| TypeInteger
| TypeAmount !Amount
| TypeMixedAmount
| TypeDate

View File

@ -127,7 +127,7 @@ postingsReportItemAsRecord ::
(Spr.Lines border) =>
AmountFormat -> PostingsReportItem -> [Spr.Cell border T.Text]
postingsReportItemAsRecord fmt (_, _, _, p, b) =
[cell idx,
[(cell idx) {Spr.cellType = Spr.TypeInteger},
(cell date) {Spr.cellType = Spr.TypeDate},
cell code, cell desc, cell acct,
amountCell (pamount p),