]> Dogcows Code - chaz/homebank/blob - src/hb-import.h
import homebank-5.1.7
[chaz/homebank] / src / hb-import.h
1 /* HomeBank -- Free, easy, personal accounting for everyone.
2 * Copyright (C) 1995-2018 Maxime DOYEN
3 *
4 * This file is part of HomeBank.
5 *
6 * HomeBank is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * HomeBank is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef __HB_IMPORT_H__
21 #define __HB_IMPORT_H__
22
23
24 typedef struct _ImportContext ImportContext;
25 struct _ImportContext
26 {
27 GList *trans_list; // trn storage
28 gint next_acc_key; //max key account when start
29
30 gint datefmt;
31 const gchar *encoding;
32
33 gint nb_src_acc, nb_new_acc;
34 gint cnt_new_ope;
35 gint cnt_new_pay;
36 gint cnt_new_cat;
37 gint cnt_err_date;
38 gint nb_duplicate;
39 };
40
41
42 typedef struct _OfxContext OfxContext;
43 struct _OfxContext
44 {
45 GList *trans_list;
46 Account *curr_acc;
47 gboolean curr_acc_isnew;
48 ImportContext *ictx;
49 };
50
51
52 typedef struct _QifContext QifContext;
53 typedef struct _qif_split QIFSplit;
54 typedef struct _qif_tran QIF_Tran;
55
56 #define QIF_UNKNOW_ACCOUNT_NAME "(unknown)"
57
58 struct _QifContext
59 {
60 GList *q_acc;
61 GList *q_cat;
62 GList *q_pay;
63 GList *q_tra;
64
65 gboolean is_ccard;
66 };
67
68 struct _qif_split
69 {
70 gchar *category;
71 gdouble amount;
72 gchar *memo;
73 };
74
75 struct _qif_tran
76 {
77 gchar *account;
78 gchar *date;
79 gdouble amount;
80 gboolean reconciled;
81 gboolean cleared;
82 gchar *info;
83 gchar *payee;
84 gchar *memo;
85 gchar *category;
86
87 gint nb_splits;
88 QIFSplit splits[TXN_MAX_SPLIT];
89 };
90
91
92 enum QIF_Type
93 {
94 QIF_NONE,
95 QIF_HEADER,
96 QIF_ACCOUNT,
97 QIF_CATEGORY,
98 QIF_CLASS,
99 QIF_MEMORIZED,
100 QIF_TRANSACTION,
101 QIF_SECURITY,
102 QIF_PRICES
103 };
104
105
106 GList *account_import_qif(gchar *filename, ImportContext *ictx);
107 gdouble hb_qif_parser_get_amount(gchar *string);
108
109
110
111 Account *import_create_account(gchar *name, gchar *number);
112 GList *homebank_ofx_import(gchar *filename, ImportContext *ictx);
113
114 gboolean hb_csv_row_valid(gchar **str_array, guint nbcolumns, gint *csvtype);
115 gchar **hb_csv_row_get(gchar *string, gchar *delimiter, gint max_tokens);
116
117 GList *homebank_csv_import(gchar *filename, ImportContext *ictx);
118
119 #endif
120
This page took 0.033652 seconds and 4 git commands to generate.