diff --git a/hledger-lib/Hledger/Write/Spreadsheet.hs b/hledger-lib/Hledger/Write/Spreadsheet.hs index 2cca67dfa..665bdca42 100644 --- a/hledger-lib/Hledger/Write/Spreadsheet.hs +++ b/hledger-lib/Hledger/Write/Spreadsheet.hs @@ -25,6 +25,7 @@ module Hledger.Write.Spreadsheet ( cellFromMixedAmount, cellsFromMixedAmount, cellFromAmount, + integerCell, ) where import qualified Hledger.Data.Amount as Amt @@ -251,3 +252,7 @@ amountType bopts amt = if Amt.displayCommodity bopts then amt else amt {acommodity = Text.empty} + + +integerCell :: (Lines border) => Integer -> Cell border Text +integerCell k = (defaultCell $ Text.pack $ show k) {cellType = TypeInteger} diff --git a/hledger/Hledger/Cli/Commands/Aregister.hs b/hledger/Hledger/Cli/Commands/Aregister.hs index 43fd7359c..7c5af567d 100644 --- a/hledger/Hledger/Cli/Commands/Aregister.hs +++ b/hledger/Hledger/Cli/Commands/Aregister.hs @@ -147,7 +147,7 @@ accountTransactionsReportItemAsRecord :: accountTransactionsReportItemAsRecord fmt wd reportq thisacctq (t@Transaction{tindex,tcode,tdescription}, _, _issplit, otheracctsstr, change, balance) - = [idx, + = [Spr.integerCell tindex, date, cell tcode, cell tdescription, @@ -156,7 +156,6 @@ accountTransactionsReportItemAsRecord amountCell balance] where cell = Spr.defaultCell - idx = (cell $ T.pack $ show tindex) {Spr.cellType = Spr.TypeInteger} date = (Spr.defaultCell $ showDate $ transactionRegisterDate wd reportq thisacctq t) diff --git a/hledger/Hledger/Cli/Commands/Print.hs b/hledger/Hledger/Cli/Commands/Print.hs index 896b2eadf..7e8c33d72 100644 --- a/hledger/Hledger/Cli/Commands/Print.hs +++ b/hledger/Hledger/Cli/Commands/Print.hs @@ -244,7 +244,7 @@ transactionToSpreadsheet fmt baseUrl query t = (postingToSpreadsheet fmt baseUrl query =<< tpostings t) where cell = Spr.defaultCell - idx = (cell $ T.pack $ show $ tindex t) {Spr.cellType = Spr.TypeInteger} + idx = Spr.integerCell $ tindex t description = cell $ tdescription t dateCell date = (Spr.defaultCell $ showDate date) {Spr.cellType = Spr.TypeDate} diff --git a/hledger/Hledger/Cli/Commands/Register.hs b/hledger/Hledger/Cli/Commands/Register.hs index 59b6bd009..825316f8c 100644 --- a/hledger/Hledger/Cli/Commands/Register.hs +++ b/hledger/Hledger/Cli/Commands/Register.hs @@ -138,7 +138,7 @@ postingsReportItemAsRecord :: AmountFormat -> Maybe Text -> [Text] -> PostingsReportItem -> [Spr.Cell border T.Text] postingsReportItemAsRecord fmt base query (_, _, _, p, b) = - [(cell idx) {Spr.cellType = Spr.TypeInteger}, + [idx, (dateCell base query (paccount p) date) {Spr.cellType = Spr.TypeDate}, cell code, cell desc, setAccountAnchor base query (paccount p) $ cell acct, @@ -146,7 +146,7 @@ postingsReportItemAsRecord fmt base query (_, _, _, p, b) = amountCell b] where cell = Spr.defaultCell - idx = T.pack . show . maybe 0 tindex $ ptransaction p + idx = Spr.integerCell . maybe 0 tindex $ ptransaction p date = postingDate p -- XXX csv should show date2 with --date2 code = maybe "" tcode $ ptransaction p desc = maybe "" tdescription $ ptransaction p