From f864efdb0779cd3648d3042bc53724a3ac7f1857 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sun, 14 Aug 2016 10:15:45 -0700 Subject: [PATCH] reg: csv: include txn index, rename total field (fixes #391) --- hledger/Hledger/Cli/Register.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hledger/Hledger/Cli/Register.hs b/hledger/Hledger/Cli/Register.hs index aef711f8d..28b8e4470 100644 --- a/hledger/Hledger/Cli/Register.hs +++ b/hledger/Hledger/Cli/Register.hs @@ -67,13 +67,14 @@ register opts@CliOpts{reportopts_=ropts} j = do postingsReportAsCsv :: PostingsReport -> CSV postingsReportAsCsv (_,is) = - ["date","description","account","amount","running total or balance"] + ["txnidx","date","description","account","amount","total"] : map postingsReportItemAsCsvRecord is postingsReportItemAsCsvRecord :: PostingsReportItem -> Record -postingsReportItemAsCsvRecord (_, _, _, p, b) = [date,desc,acct,amt,bal] +postingsReportItemAsCsvRecord (_, _, _, p, b) = [idx,date,desc,acct,amt,bal] where + idx = show $ maybe 0 tindex $ ptransaction p date = showDate $ postingDate p -- XXX csv should show date2 with --date2 desc = T.unpack $ maybe "" tdescription $ ptransaction p acct = bracket $ T.unpack $ paccount p