GnuCash c935c2f+
Loading...
Searching...
No Matches
import-backend.h
Go to the documentation of this file.
1/********************************************************************\
2 * This program is free software; you can redistribute it and/or *
3 * modify it under the terms of the GNU General Public License as *
4 * published by the Free Software Foundation; either version 2 of *
5 * the License, or (at your option) any later version. *
6 * *
7 * This program is distributed in the hope that it will be useful, *
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
10 * GNU General Public License for more details. *
11 * *
12 * You should have received a copy of the GNU General Public License*
13 * along with this program; if not, contact: *
14 * *
15 * Free Software Foundation Voice: +1-617-542-5942 *
16 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
17 * Boston, MA 02110-1301, USA gnu@gnu.org *
18\********************************************************************/
28#ifndef IMPORT_BACKEND_H
29#define IMPORT_BACKEND_H
30
31#include "Transaction.h"
32#include "import-settings.h"
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38typedef struct _transactioninfo GNCImportTransInfo;
39typedef struct _selected_match_info GNCImportSelectedMatchInfo;
40typedef struct _matchinfo
41{
42 Transaction * trans;
43 Split * split;
44 /*GNC_match_probability probability;*/
45 gint probability;
46 gboolean update_proposed;
48
49typedef struct _lsplitinfo
50{
51 gnc_numeric price;
52 const char *action;
53 const char *memo;
54 gnc_numeric amount;
55 Account *account;
56 char rec_state;
57 time64 rec_date;
59
60typedef enum _action
61{
62 GNCImport_SKIP,
63 GNCImport_ADD,
64 GNCImport_CLEAR,
65 GNCImport_UPDATE,
66 GNCImport_LAST_ACTION,
67 GNCImport_INVALID_ACTION
68} GNCImportAction;
69
70/************************************************************************
71 ************************************************************************/
74
82gboolean gnc_import_exists_online_id (Transaction *trans, GHashTable* acct_id_hash);
83
98void split_find_match (GNCImportTransInfo * trans_info,
99 Split * split,
100 gint display_threshold,
101 gint date_threshold,
102 gint date_not_threshold,
103 double fuzzy_amount_difference);
104
114void
115gnc_import_TransInfo_init_matches (GNCImportTransInfo *trans_info,
116 GNCImportSettings *settings);
117
135gboolean
137 GNCImportTransInfo *trans_info);
138
152GdkPixbuf* gen_probability_pixbuf (gint score,
153 GNCImportSettings *settings,
154 GtkWidget * widget);
155
159/************************************************************************
160 * Getter/Setter Functions for the Data Types.
161 ************************************************************************/
162
165
177GNCImportTransInfo* gnc_import_TransInfo_new(Transaction* trans, Account* base_acc);
178
180void gnc_import_TransInfo_delete (GNCImportTransInfo *info);
181
183GList *gnc_import_TransInfo_get_match_list (const GNCImportTransInfo *info);
184
186void gnc_import_TransInfo_remove_top_match (GNCImportTransInfo *info);
187
189Transaction *gnc_import_TransInfo_get_trans (const GNCImportTransInfo *info);
190
192gboolean gnc_import_TransInfo_is_balanced (const GNCImportTransInfo *info);
193
195Split *gnc_import_TransInfo_get_fsplit (const GNCImportTransInfo *info);
196
199gnc_import_TransInfo_get_selected_match (const GNCImportTransInfo *info);
200
205void
206gnc_import_TransInfo_set_selected_match_info (GNCImportTransInfo *info,
207 GNCImportMatchInfo *match,
208 gboolean selected_manually);
209
211gboolean
212gnc_import_TransInfo_get_match_selected_manually (const GNCImportTransInfo *info);
213
215GNCImportAction
216gnc_import_TransInfo_get_action (const GNCImportTransInfo *info);
217
219void
220gnc_import_TransInfo_set_action (GNCImportTransInfo *info,
221 GNCImportAction action);
222
224Account *
225gnc_import_TransInfo_get_destacc (const GNCImportTransInfo *info);
226
231void
232gnc_import_TransInfo_set_destacc (GNCImportTransInfo *info,
233 Account *acc,
234 gboolean selected_manually);
235
237gboolean
238gnc_import_TransInfo_get_destacc_selected_manually (const GNCImportTransInfo *info);
239
240
242guint32
243gnc_import_TransInfo_get_ref_id (const GNCImportTransInfo *info);
244
246void
247gnc_import_TransInfo_set_ref_id (GNCImportTransInfo *info,
248 guint32 ref_id);
249
251gnc_numeric
252gnc_import_TransInfo_get_price (const GNCImportTransInfo *info);
253
255void
256gnc_import_TransInfo_set_price (GNCImportTransInfo *info,
257 gnc_numeric lprice);
258
260gnc_numeric
261gnc_import_TransInfo_get_dest_amount (const GNCImportTransInfo *info);
262
264gnc_numeric
265gnc_import_TransInfo_get_dest_value (const GNCImportTransInfo *info);
266
268void
269gnc_import_TransInfo_set_last_split_info (GNCImportTransInfo *info,
270 GNCImportLastSplitInfo *lsplit);
271
273void
274gnc_import_TransInfo_set_append_text (GNCImportTransInfo *info,
275 gboolean append_text);
276
283Split *
285
286
289gint
293#ifdef __cplusplus
294}
295#endif
296
297#endif
API for Transactions and Splits (journal entries)
gint64 time64
Most systems that are currently maintained, including Microsoft Windows, BSD-derived Unixes and Linux...
Definition gnc-date.h:87
void gnc_import_TransInfo_remove_top_match(GNCImportTransInfo *info)
Remove the first match in the list of possible matches
void gnc_import_TransInfo_delete(GNCImportTransInfo *info)
Destructor.
GList * gnc_import_TransInfo_get_match_list(const GNCImportTransInfo *info)
Returns the stored list of possible matches.
gboolean gnc_import_TransInfo_get_match_selected_manually(const GNCImportTransInfo *info)
Returns if the currently selected match was selected by the user.
gboolean gnc_import_process_trans_item(Account *base_acc, GNCImportTransInfo *trans_info)
/brief – Processes one match according to its selected action.
gboolean gnc_import_exists_online_id(Transaction *trans, GHashTable *acct_id_hash)
Checks whether the given transaction's online_id already exists in its parent account.
gnc_numeric gnc_import_TransInfo_get_dest_amount(const GNCImportTransInfo *info)
Returns the destination split amount for this TransInfo.
Split * gnc_import_TransInfo_get_fsplit(const GNCImportTransInfo *info)
Returns the first split of the transaction of this TransInfo.
void gnc_import_TransInfo_set_append_text(GNCImportTransInfo *info, gboolean append_text)
Set the append_text for this TransInfo.
guint32 gnc_import_TransInfo_get_ref_id(const GNCImportTransInfo *info)
Returns the reference id for this TransInfo.
void gnc_import_TransInfo_set_destacc(GNCImportTransInfo *info, Account *acc, gboolean selected_manually)
Set the 'other account' of this transaction (used for auto-balance if needed).
void gnc_import_TransInfo_set_last_split_info(GNCImportTransInfo *info, GNCImportLastSplitInfo *lsplit)
Sets additional parameters to be used to generate the closing split.
GNCImportAction gnc_import_TransInfo_get_action(const GNCImportTransInfo *info)
Returns the currently selected action for this TransInfo.
gnc_numeric gnc_import_TransInfo_get_dest_value(const GNCImportTransInfo *info)
Returns the destination split value for this TransInfo.
Transaction * gnc_import_TransInfo_get_trans(const GNCImportTransInfo *info)
Returns the transaction of this TransInfo.
GNCImportTransInfo * gnc_import_TransInfo_new(Transaction *trans, Account *base_acc)
Create a new object of GNCImportTransInfo here.
GdkPixbuf * gen_probability_pixbuf(gint score_original, GNCImportSettings *settings, GtkWidget *widget)
This function generates a new pixmap representing a match score.
void gnc_import_TransInfo_init_matches(GNCImportTransInfo *trans_info, GNCImportSettings *settings)
Iterates through all splits of trans_info's originating account match list.
void gnc_import_TransInfo_set_price(GNCImportTransInfo *info, gnc_numeric lprice)
Set the exchange rate for this TransInfo.
void gnc_import_TransInfo_set_action(GNCImportTransInfo *info, GNCImportAction action)
Set the action for this TransInfo.
Account * gnc_import_TransInfo_get_destacc(const GNCImportTransInfo *info)
Returns the 'other account' of this transaction.
gboolean gnc_import_TransInfo_is_balanced(const GNCImportTransInfo *info)
Returns if the transaction stored in the TransInfo is currently balanced.
gboolean gnc_import_TransInfo_get_destacc_selected_manually(const GNCImportTransInfo *info)
Returns if the currently selected destination account for auto-matching was selected by the user.
gnc_numeric gnc_import_TransInfo_get_price(const GNCImportTransInfo *info)
Returns the exchange rate for this TransInfo.
void gnc_import_TransInfo_set_ref_id(GNCImportTransInfo *info, guint32 ref_id)
Set the reference id for this TransInfo.
void gnc_import_TransInfo_set_selected_match_info(GNCImportTransInfo *info, GNCImportMatchInfo *match, gboolean selected_manually)
Sets the currently selected match in this TransInfo.
gint gnc_import_MatchInfo_get_probability(const GNCImportMatchInfo *info)
Get the probability (confidence level) of this MatchInfo.
Split * gnc_import_MatchInfo_get_split(const GNCImportMatchInfo *info)
Get the split ('this-side split') of this MatchInfo.
void split_find_match(GNCImportTransInfo *trans_info, Split *split, gint display_threshold, gint date_threshold, gint date_not_threshold, double fuzzy_amount_difference)
The transaction matching heuristics are here.
GNCImportMatchInfo * gnc_import_TransInfo_get_selected_match(const GNCImportTransInfo *info)
Returns the currently selected match in this TransInfo.
Import preference handling.
STRUCTS.