GnuCash c935c2f+
Loading...
Searching...
No Matches
Functions
csv-transactions-export.h File Reference

CSV Export Transactions. More...

#include "assistant-csv-export.h"

Go to the source code of this file.

Functions

void csv_transactions_export (CsvExportInfo *info)
 The csv_transactions_export() will let the user export the transactions to a delimited file.
 

Detailed Description

CSV Export Transactions.

Author
Copyright (c) 2012 Robert Fewell

Definition in file csv-transactions-export.h.

Function Documentation

◆ csv_transactions_export()

void csv_transactions_export ( CsvExportInfo info)

The csv_transactions_export() will let the user export the transactions to a delimited file.

Definition at line 341 of file csv-transactions-export.cpp.

342{
343 ENTER("");
344 DEBUG("File name is : %s", info->file_name);
345
346 StringVec headers;
347 bool num_action = qof_book_use_split_action_for_num_field (gnc_get_current_book());
348
349 /* Header string */
350 if (info->simple_layout)
351 {
352 /* Translators: The following symbols will build the header
353 line of exported CSV files: */
354 headers = {
355 _("Date"),
356 _("Account Name"),
357 (num_action ? _("Transaction Number") : _("Number")),
358 _("Description"),
359 _("Full Category Path"),
360 _("Reconcile"),
361 _("Amount With Sym"),
362 _("Amount Num."),
363 _("Value With Sym"),
364 _("Value Num."),
365 _("Rate/Price"),
366 };
367 }
368 else
369 headers = {
370 _("Date"),
371 _("Transaction ID"),
372 (num_action ? _("Transaction Number") : _("Number")),
373 _("Description"),
374 _("Notes"),
375 _("Commodity/Currency"),
376 _("Void Reason"),
377 (num_action ? _("Number/Action") : _("Action")),
378 _("Memo"),
379 _("Full Account Name"),
380 _("Account Name"),
381 _("Amount With Sym"),
382 _("Amount Num."),
383 _("Value With Sym"),
384 _("Value Num."),
385 _("Reconcile"),
386 _("Reconcile Date"),
387 _("Rate/Price"),
388 };
389
390 /* Write header line */
391 auto ss{gnc_open_filestream(info->file_name)};
392 info->failed = !gnc_csv_add_line (ss, headers, info->use_quotes, info->separator_str);
393
394 /* Go through list of accounts */
395 TransSet trans_set;
396
397 switch (info->export_type)
398 {
399 case XML_EXPORT_TRANS:
400 for (auto ptr = info->csva.account_list; !ss.fail() && ptr; ptr = g_list_next(ptr))
401 account_splits (info, GNC_ACCOUNT(ptr->data), ss, trans_set);
402 break;
403 case XML_EXPORT_REGISTER:
404 export_query_splits (info, false, ss, trans_set);
405 break;
406 default:
407 PERR ("unknown export_type %d", info->export_type);
408 }
409
410 info->failed = ss.fail();
411 LEAVE("");
412}
gboolean qof_book_use_split_action_for_num_field(const QofBook *book)
Returns TRUE if this book uses split action field as the 'Num' field, FALSE if it uses transaction nu...
#define DEBUG(format, args...)
Print a debugging message.
Definition qoflog.h:264
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition qoflog.h:282
#define PERR(format, args...)
Log a serious error.
Definition qoflog.h:244
#define ENTER(format, args...)
Print a function entry debugging message.
Definition qoflog.h:272