X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fhomebank;a=blobdiff_plain;f=src%2Fhb-import.h;fp=src%2Fhb-import.h;h=c5d1cdbf506f119b111aba72c0a6c84e6f46f601;hp=21bcc9d964e8a51015fed62e373fb4c682354fd1;hb=996fa4ab9f6b836001f8ad0eecbfd3821687fea7;hpb=27f6e3b112df235c8e9afc9911b1f6bce208a001 diff --git a/src/hb-import.h b/src/hb-import.h index 21bcc9d..c5d1cdb 100644 --- a/src/hb-import.h +++ b/src/hb-import.h @@ -1,5 +1,5 @@ /* HomeBank -- Free, easy, personal accounting for everyone. - * Copyright (C) 1995-2014 Maxime DOYEN + * Copyright (C) 1995-2016 Maxime DOYEN * * This file is part of HomeBank. * @@ -21,6 +21,100 @@ #define __HB_IMPORT_H__ +typedef struct _ImportContext ImportContext; +struct _ImportContext +{ + GList *trans_list; // trn storage + gint next_acc_key; //max key account when start + + gint datefmt; + const gchar *encoding; + + gint nb_src_acc, nb_new_acc; + gint cnt_new_ope; + gint cnt_new_pay; + gint cnt_new_cat; + gint cnt_err_date; + gint nb_duplicate; +}; + + +typedef struct _OfxContext OfxContext; +struct _OfxContext +{ + GList *trans_list; + Account *curr_acc; + gboolean curr_acc_isnew; + ImportContext *ictx; +}; + + +typedef struct _QifContext QifContext; +typedef struct _qif_split QIFSplit; +typedef struct _qif_tran QIF_Tran; + +#define QIF_UNKNOW_ACCOUNT_NAME "(unknown)" + +struct _QifContext +{ + GList *q_acc; + GList *q_cat; + GList *q_pay; + GList *q_tra; + + gboolean is_ccard; +}; + +struct _qif_split +{ + gchar *category; + gdouble amount; + gchar *memo; +}; + +struct _qif_tran +{ + gchar *account; + gchar *date; + gdouble amount; + gboolean reconciled; + gboolean cleared; + gchar *info; + gchar *payee; + gchar *memo; + gchar *category; + + gint nb_splits; + QIFSplit splits[TXN_MAX_SPLIT]; +}; + + +enum QIF_Type +{ + QIF_NONE, + QIF_HEADER, + QIF_ACCOUNT, + QIF_CATEGORY, + QIF_CLASS, + QIF_MEMORIZED, + QIF_TRANSACTION, + QIF_SECURITY, + QIF_PRICES +}; + + +GList *account_import_qif(gchar *filename, ImportContext *ictx); +gdouble hb_qif_parser_get_amount(gchar *string); + + + +Account *import_create_account(gchar *name, gchar *number); +GList *homebank_ofx_import(gchar *filename, ImportContext *ictx); + +gboolean hb_csv_row_valid(gchar **str_array, guint nbcolumns, gint *csvtype); +gchar **hb_csv_row_get(gchar *string, gchar *delimiter, gint max_tokens); + +GList *homebank_csv_import(gchar *filename, ImportContext *ictx); #endif