GnuCash  4.13-177-g21dd8aa057+
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 typedef struct _transactioninfo GNCImportTransInfo;
35 typedef struct _selected_match_info GNCImportSelectedMatchInfo;
36 typedef struct _matchinfo
37 {
38  Transaction * trans;
39  Split * split;
40  /*GNC_match_probability probability;*/
41  gint probability;
42  gboolean update_proposed;
44 
45 typedef enum _action
46 {
47  GNCImport_SKIP,
48  GNCImport_ADD,
49  GNCImport_CLEAR,
50  GNCImport_UPDATE,
51  GNCImport_LAST_ACTION,
52  GNCImport_INVALID_ACTION
53 } GNCImportAction;
54 
55 /************************************************************************
56  ************************************************************************/
59 
67 gboolean gnc_import_exists_online_id (Transaction *trans, GHashTable* acct_id_hash);
68 
83 void split_find_match (GNCImportTransInfo * trans_info,
84  Split * split,
85  gint display_threshold,
86  gint date_threshold,
87  gint date_not_threshold,
88  double fuzzy_amount_difference);
89 
99 void
100 gnc_import_TransInfo_init_matches (GNCImportTransInfo *trans_info,
101  GNCImportSettings *settings);
102 
120 gboolean
122  GNCImportTransInfo *trans_info);
123 
137 GdkPixbuf* gen_probability_pixbuf (gint score,
138  GNCImportSettings *settings,
139  GtkWidget * widget);
140 
144 /************************************************************************
145  * Getter/Setter Functions for the Data Types.
146  ************************************************************************/
147 
150 
162 GNCImportTransInfo *
163 gnc_import_TransInfo_new (Transaction *trans, GncImportMatchMap *matchmap);
164 
166 void gnc_import_TransInfo_delete (GNCImportTransInfo *info);
167 
169 GList *gnc_import_TransInfo_get_match_list (const GNCImportTransInfo *info);
170 
172 void gnc_import_TransInfo_set_match_list (GNCImportTransInfo *info, GList* match_list);
173 
175 Transaction *gnc_import_TransInfo_get_trans (const GNCImportTransInfo *info);
176 
178 gboolean gnc_import_TransInfo_is_balanced (const GNCImportTransInfo *info);
179 
181 Split *gnc_import_TransInfo_get_fsplit (const GNCImportTransInfo *info);
182 
185 gnc_import_TransInfo_get_selected_match (const GNCImportTransInfo *info);
186 
191 void
192 gnc_import_TransInfo_set_selected_match_info (GNCImportTransInfo *info,
193  GNCImportMatchInfo *match,
194  gboolean selected_manually);
195 
197 gboolean
198 gnc_import_TransInfo_get_match_selected_manually (const GNCImportTransInfo *info);
199 
201 GNCImportAction
202 gnc_import_TransInfo_get_action (const GNCImportTransInfo *info);
203 
205 void
206 gnc_import_TransInfo_set_action (GNCImportTransInfo *info,
207  GNCImportAction action);
208 
210 Account *
211 gnc_import_TransInfo_get_destacc (const GNCImportTransInfo *info);
212 
217 void
218 gnc_import_TransInfo_set_destacc (GNCImportTransInfo *info,
219  Account *acc,
220  gboolean selected_manually);
221 
223 gboolean
224 gnc_import_TransInfo_refresh_destacc (GNCImportTransInfo *transaction_info,
225  GncImportMatchMap *matchmap);
226 
228 gboolean
229 gnc_import_TransInfo_get_destacc_selected_manually (const GNCImportTransInfo *info);
230 
231 
233 guint32
234 gnc_import_TransInfo_get_ref_id (const GNCImportTransInfo *info);
235 
237 void
238 gnc_import_TransInfo_set_ref_id (GNCImportTransInfo *info,
239  guint32 ref_id);
240 
242 void
243 gnc_import_TransInfo_set_append_text (GNCImportTransInfo *info,
244  gboolean append_text);
245 
252 Split *
254 
255 
258 gint
262 #endif
263 
GNCImportTransInfo * gnc_import_TransInfo_new(Transaction *trans, GncImportMatchMap *matchmap)
Create a new object of GNCImportTransInfo here.
void gnc_import_TransInfo_set_selected_match_info(GNCImportTransInfo *info, GNCImportMatchInfo *match, gboolean selected_manually)
Sets the currently selected match in this TransInfo.
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.
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_delete(GNCImportTransInfo *info)
Destructor.
void gnc_import_TransInfo_set_ref_id(GNCImportTransInfo *info, guint32 ref_id)
Set the reference id for this TransInfo.
Split * gnc_import_TransInfo_get_fsplit(const GNCImportTransInfo *info)
Returns the first split of the transaction of this TransInfo.
Transaction * gnc_import_TransInfo_get_trans(const GNCImportTransInfo *info)
Returns the transaction of 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).
Import preference handling.
guint32 gnc_import_TransInfo_get_ref_id(const GNCImportTransInfo *info)
Returns the reference id for this TransInfo.
void gnc_import_TransInfo_init_matches(GNCImportTransInfo *trans_info, GNCImportSettings *settings)
Iterates through all splits of the originating account of trans_info.
GNCImportAction gnc_import_TransInfo_get_action(const GNCImportTransInfo *info)
Returns the currently selected action for this TransInfo.
Split * gnc_import_MatchInfo_get_split(const GNCImportMatchInfo *info)
Get the split ('this-side split') of this MatchInfo.
gint gnc_import_MatchInfo_get_probability(const GNCImportMatchInfo *info)
Get the probability (confidence level) of this MatchInfo.
gboolean gnc_import_process_trans_item(GncImportMatchMap *matchmap, GNCImportTransInfo *trans_info)
/brief – Processes one match according to its selected action.
void gnc_import_TransInfo_set_action(GNCImportTransInfo *info, GNCImportAction action)
Set the action for this TransInfo.
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.
gboolean gnc_import_TransInfo_refresh_destacc(GNCImportTransInfo *transaction_info, GncImportMatchMap *matchmap)
Try to automatch a given transaction to a destination account.
void gnc_import_TransInfo_set_append_text(GNCImportTransInfo *info, gboolean append_text)
Set the append_text for this TransInfo.
void gnc_import_TransInfo_set_match_list(GNCImportTransInfo *info, GList *match_list)
Assigns the 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.
Account * gnc_import_TransInfo_get_destacc(const GNCImportTransInfo *info)
Returns the 'other account' of this transaction.
GList * gnc_import_TransInfo_get_match_list(const GNCImportTransInfo *info)
Returns the stored list of possible matches.
GNCImportMatchInfo * gnc_import_TransInfo_get_selected_match(const GNCImportTransInfo *info)
Returns the currently selected match in this TransInfo.
API for Transactions and Splits (journal entries)
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...