reg: csv: include txn index, rename total field (fixes #391)

This commit is contained in:
Simon Michael 2016-08-14 10:15:45 -07:00
parent 332a19ccd8
commit f864efdb07

View File

@ -67,13 +67,14 @@ register opts@CliOpts{reportopts_=ropts} j = do
postingsReportAsCsv :: PostingsReport -> CSV postingsReportAsCsv :: PostingsReport -> CSV
postingsReportAsCsv (_,is) = postingsReportAsCsv (_,is) =
["date","description","account","amount","running total or balance"] ["txnidx","date","description","account","amount","total"]
: :
map postingsReportItemAsCsvRecord is map postingsReportItemAsCsvRecord is
postingsReportItemAsCsvRecord :: PostingsReportItem -> Record postingsReportItemAsCsvRecord :: PostingsReportItem -> Record
postingsReportItemAsCsvRecord (_, _, _, p, b) = [date,desc,acct,amt,bal] postingsReportItemAsCsvRecord (_, _, _, p, b) = [idx,date,desc,acct,amt,bal]
where where
idx = show $ maybe 0 tindex $ ptransaction p
date = showDate $ postingDate p -- XXX csv should show date2 with --date2 date = showDate $ postingDate p -- XXX csv should show date2 with --date2
desc = T.unpack $ maybe "" tdescription $ ptransaction p desc = T.unpack $ maybe "" tdescription $ ptransaction p
acct = bracket $ T.unpack $ paccount p acct = bracket $ T.unpack $ paccount p