GnuCash  5.6-150-g038405b370+
dialog-bi-import.h
Go to the documentation of this file.
1 /*
2  * dialog-bi-import.h -- Invoice Importer core functions
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of
7  * the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, contact:
16  *
17  * Free Software Foundation Voice: +1-617-542-5942
18  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
19  * Boston, MA 02110-1301, USA gnu@gnu.org
20  */
21 
32 #ifndef GNC_PLUGIN_BI_IMPORT_H
33 #define GNC_PLUGIN_BI_IMPORT_H
34 
35 #include <glib.h>
36 #include <gtk/gtk.h>
37 
38 G_BEGIN_DECLS
39 
40 // model
41 enum bi_import_model_columns
42 {
43  ID, DATE_OPENED, OWNER_ID, BILLING_ID, NOTES, // invoice settings
44  DATE, DESC, ACTION, ACCOUNT, QUANTITY, PRICE, DISC_TYPE, DISC_HOW, DISCOUNT, TAXABLE, TAXINCLUDED, TAX_TABLE, // entry settings
45  DATE_POSTED, DUE_DATE, ACCOUNT_POSTED, MEMO_POSTED, ACCU_SPLITS, // autopost settings
46  N_COLUMNS
47 };
48 
49 enum _bi_import_result
50 {
51  RESULT_OK,
52  RESULT_OPEN_FAILED,
53  RESULT_ERROR_IN_REGEXP,
54 };
55 typedef enum _bi_import_result bi_import_result;
56 
58 {
59  int n_imported, n_ignored;
60  GString *ignored_lines;
61 };
62 typedef struct _bi_import_stats bi_import_stats;
63 
64 
65 bi_import_result
66 gnc_bi_import_read_file (const gchar *filename, const gchar *parser_regexp, GtkListStore *store, guint max_rows, bi_import_stats *stats);
67 
68 void
69 gnc_bi_import_fix_bis (GtkListStore *store, guint *fixed, guint *deleted, GString *info, gchar *type);
70 
71 void
72 gnc_bi_import_create_bis (GtkListStore *store, QofBook *book, guint *n_invoices_created,
73  guint *n_invoices_updated, guint *n_rows_ignored, gchar *type, gchar *open_mode, GString * info,
74  GtkWindow *parent);
75 
76 
77 G_END_DECLS
78 
79 #endif /* GNC_PLUGIN_BI_IMPORT_H */
80 
void gnc_bi_import_fix_bis(GtkListStore *store, guint *fixed, guint *deleted, GString *info, gchar *type)
Adjusts and validates invoice import data.
bi_import_result gnc_bi_import_read_file(const gchar *filename, const gchar *parser_regexp, GtkListStore *store, guint max_rows, bi_import_stats *stats)
Imports a csv file with invoice data into a GtkListStore.
void gnc_bi_import_create_bis(GtkListStore *store, QofBook *book, guint *n_invoices_created, guint *n_invoices_updated, guint *n_rows_ignored, gchar *type, gchar *open_mode, GString *info, GtkWindow *parent)
Creates and updates invoices from validated import data.