GnuCash 2.4.99
Data Structures | Files | Defines | Typedefs | Enumerations | Functions
Tools

Data Structures

struct  _bi_import_stats
struct  GncPluginbi_import
struct  GncPluginbi_importClass
struct  _customer_import_stats
struct  GncPlugincustomer_import
struct  GncPlugincustomer_importClass

Files

file  dialog-bi-import-gui.h
 

GUI handling for bi-import plugin.


file  dialog-bi-import.h
 

core import functions for invoice import plugin


file  gnc-plugin-bi-import.h
 

Plugin registration of the bi-import module.


file  gnc-plugin-customer_import.h
 

Plugin registration of the customer_import module.


Defines

#define GNC_TYPE_PLUGIN_BI_IMPORT   (gnc_plugin_bi_import_get_type())
#define GNC_PLUGIN_BI_IMPORT(obj)   (G_TYPE_CHECK_INSTANCE_CAST((obj), GNC_TYPE_PLUGIN_BI_IMPORT, GncPluginbi_import))
#define GNC_PLUGIN_BI_IMPORT_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST((klass), GNC_TYPE_PLUGIN_BI_IMPORT, GncPluginbi_importClass))
#define GNC_IS_PLUGIN_BI_IMPORT(obj)   (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNC_TYPE_PLUGIN_BI_IMPORT))
#define GNC_IS_PLUGIN_BI_IMPORT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE((klass), GNC_TYPE_PLUGIN_BI_IMPORT))
#define GNC_PLUGIN_BI_IMPORT_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj), GNC_TYPE_PLUGIN_BI_IMPORT, GncPluginbi_importClass))
#define GNC_PLUGIN_BI_IMPORT_NAME   "gnc-plugin-bi_import"
#define GNC_TYPE_PLUGIN_customer_import   (gnc_plugin_customer_import_get_type())
#define GNC_PLUGIN_customer_import(obj)   (G_TYPE_CHECK_INSTANCE_CAST((obj), GNC_TYPE_PLUGIN_customer_import, GncPlugincustomer_import))
#define GNC_PLUGIN_customer_import_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST((klass), GNC_TYPE_PLUGIN_customer_import, GncPlugincustomer_importClass))
#define GNC_IS_PLUGIN_customer_import(obj)   (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNC_TYPE_PLUGIN_customer_import))
#define GNC_IS_PLUGIN_customer_import_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE((klass), GNC_TYPE_PLUGIN_customer_import))
#define GNC_PLUGIN_customer_import_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj), GNC_TYPE_PLUGIN_customer_import, GncPlugincustomer_importClass))
#define GNC_PLUGIN_customer_import_NAME   "gnc-plugin-customer_import"

Typedefs

typedef typedefG_BEGIN_DECLS
struct _bi_import_gui 
BillImportGui
typedef enum _bi_import_result bi_import_result
typedef struct _bi_import_stats bi_import_stats
typedef typedefG_BEGIN_DECLS
struct _customer_import_gui 
CustomerImportGui
typedef enum
_customer_import_result 
customer_import_result
typedef struct
_customer_import_stats 
customer_import_stats

Enumerations

enum  bi_import_model_columns {
  ID, DATE_OPENED, OWNER_ID, BILLING_ID,
  NOTES, DATE, DESC, ACTION,
  ACCOUNT, QUANTITY, PRICE, DISC_TYPE,
  DISC_HOW, DISCOUNT, TAXABLE, TAXINCLUDED,
  TAX_TABLE, DATE_POSTED, DUE_DATE, ACCOUNT_POSTED,
  MEMO_POSTED, ACCU_SPLITS, N_COLUMNS
}
enum  _bi_import_result { RESULT_OK, RESULT_OPEN_FAILED, RESULT_ERROR_IN_REGEXP }
enum  customer_import_model_columns {
  CI_ID, CI_COMPANY, CI_NAME, CI_ADDR1,
  CI_ADDR2, CI_ADDR3, CI_ADDR4, CI_PHONE,
  CI_FAX, CI_EMAIL, CI_NOTES, CI_SHIPNAME,
  CI_SHIPADDR1, CI_SHIPADDR2, CI_SHIPADDR3, CI_SHIPADDR4,
  CI_SHIPPHONE, CI_SHIPFAX, CI_SHIPEMAIL, CI_N_COLUMNS
}
enum  _customer_import_result { CI_RESULT_OK, CI_RESULT_OPEN_FAILED, CI_RESULT_ERROR_IN_REGEXP }

Functions

BillImportGui * gnc_plugin_bi_import_showGUI (void)
bi_import_result gnc_bi_import_read_file (const gchar *filename, const gchar *parser_regexp, GtkListStore *store, guint max_rows, bi_import_stats *stats)
void gnc_bi_import_fix_bis (GtkListStore *store, guint *fixed, guint *deleted, GString *info, gchar *type)
 try to fix some common errors in the csv representation of invoices corrects the date format corrects ambigous values in multi line invoices ensures customer exists if quantity is unset, set to 1 if price is unset, delete row
void gnc_bi_import_create_bis (GtkListStore *store, QofBook *book, guint *n_invoices_created, guint *n_invoices_updated, gchar *type, gchar *open_mode)
GType gnc_plugin_bi_import_get_type (void)
GncPlugingnc_plugin_bi_import_new (void)
void gnc_plugin_bi_import_create_plugin (void)
CustomerImportGui * gnc_plugin_customer_import_showGUI (void)
customer_import_result gnc_customer_import_read_file (const gchar *filename, const gchar *parser_regexp, GtkListStore *store, guint max_rows, customer_import_stats *stats)
void gnc_customer_import_fix_customers (GtkListStore *store, guint *fixed, guint *deleted, gchar *type)
void gnc_customer_import_create_customers (GtkListStore *store, QofBook *book, guint *n_customers_created, guint *n_customers_updated, gchar *type)
GType gnc_plugin_customer_import_get_type (void)
GncPlugingnc_plugin_customer_import_new (void)
void gnc_plugin_customer_import_create_plugin (void)

Function Documentation

void gnc_plugin_bi_import_create_plugin ( void  )

Create a new GncPluginbi_import object and register it.

GType gnc_plugin_bi_import_get_type ( void  )
Returns:
The glib runtime type of an bi_import plugin page
GncPlugin* gnc_plugin_bi_import_new ( void  )
Returns:
A new GncPluginbi_import object

Definition at line 69 of file gnc-plugin-bi-import.c.

{
    return GNC_PLUGIN (g_object_new (GNC_TYPE_PLUGIN_BI_IMPORT, (gchar*) NULL));
}
BillImportGui* gnc_plugin_bi_import_showGUI ( void  )

File chooser

Definition at line 82 of file dialog-bi-import-gui.c.

{
    BillImportGui *gui;
    GtkBuilder *builder;
    GList *glist;
    GtkTreeIter iter;
    GtkCellRenderer *renderer;
    GtkTreeViewColumn *column;

    // if window exists already, activate it
    glist = gnc_find_gui_components ("dialog-bi-import-gui", NULL, NULL);
    if (glist)
    {
        // window found
        gui = g_list_nth_data (glist, 0);
        g_list_free (glist);
        gtk_window_present (GTK_WINDOW(gui->dialog));
        return gui;
    }

    // create new window
    gui = g_new0 (BillImportGui, 1);
    gui->type = "BILL"; // Set default type to match gui.  really shouldn't be here TODO change me
    gui->open_mode = "ALL";

    builder = gtk_builder_new();
    gnc_builder_add_from_file (builder, "dialog-bi-import-gui.glade", "bi-import Dialog");
    gui->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "bi-import Dialog"));
    gui->tree_view = GTK_WIDGET(gtk_builder_get_object (builder, "treeview1"));
    gui->entryFilename = GTK_WIDGET(gtk_builder_get_object (builder, "entryFilename"));

    gui->book = gnc_get_current_book();

    gui->regexp = g_string_new ( "^(?<id>[^;]*);(?<date_opened>[^;]*);(?<owner_id>[^;]*);(?<billing_id>[^;]*);?(?<notes>[^;]*);?(?<date>[^;]*);?(?<desc>[^;]*);?(?<action>[^;]*);?(?<account>[^;]*);?(?<quantity>[^;]*);?(?<price>[^;]*);?(?<disc_type>[^;]*);?(?<disc_how>[^;]*);?(?<discount>[^;]*);?(?<taxable>[^;]*);?(?<taxincluded>[^;]*);?(?<tax_table>[^;]*);(?<date_posted>[^;]*);(?<due_date>[^;]*);(?<account_posted>[^;]*);(?<memo_posted>[^;]*);(?<accu_splits>[^;]*)$");

    // create model and bind to view
    gui->store = gtk_list_store_new (N_COLUMNS,
                                     G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, // invoice settings
                                     G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, // entry settings
                                     G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); // autopost settings
    gtk_tree_view_set_model( GTK_TREE_VIEW(gui->tree_view), GTK_TREE_MODEL(gui->store) );
#define CREATE_COLUMN(description,column_id) \
  renderer = gtk_cell_renderer_text_new (); \
  column = gtk_tree_view_column_new_with_attributes (description, renderer, "text", column_id, NULL); \
  gtk_tree_view_column_set_resizable (column, TRUE); \
  gtk_tree_view_append_column (GTK_TREE_VIEW (gui->tree_view), column);
    CREATE_COLUMN ("id", ID);
    CREATE_COLUMN ("date__opened", DATE_OPENED);
    CREATE_COLUMN ("owner__id", OWNER_ID);
    CREATE_COLUMN ("billing__id", BILLING_ID);
    CREATE_COLUMN ("notes", NOTES);

    CREATE_COLUMN ("date", DATE);
    CREATE_COLUMN ("desc", DESC);
    CREATE_COLUMN ("action", ACTION);
    CREATE_COLUMN ("account", ACCOUNT);
    CREATE_COLUMN ("quantity", QUANTITY);
    CREATE_COLUMN ("price", PRICE);
    CREATE_COLUMN ("disc__type", DISC_TYPE);
    CREATE_COLUMN ("disc__how", DISC_HOW);
    CREATE_COLUMN ("discount", DISCOUNT);
    CREATE_COLUMN ("taxable", TAXABLE);
    CREATE_COLUMN ("taxincluded", TAXINCLUDED);
    CREATE_COLUMN ("tax__table", TAX_TABLE);

    CREATE_COLUMN ("date__posted", DATE_POSTED);
    CREATE_COLUMN ("due__date", DUE_DATE);
    CREATE_COLUMN ("account__posted", ACCOUNT_POSTED);
    CREATE_COLUMN ("memo__posted", MEMO_POSTED);
    CREATE_COLUMN ("accu__splits", ACCU_SPLITS);

    gui->component_id = gnc_register_gui_component ("dialog-bi-import-gui",
                        NULL,
                        gnc_bi_import_gui_close_handler,
                        gui);

    /* Setup signals */
    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, gui);

    gtk_widget_show_all ( gui->dialog );

    g_object_unref(G_OBJECT(builder));

    return gui;
}
void gnc_plugin_customer_import_create_plugin ( void  )

Create a new GncPlugincustomer_import object and register it.

GType gnc_plugin_customer_import_get_type ( void  )
Returns:
The glib runtime type of an customer_import plugin page
GncPlugin* gnc_plugin_customer_import_new ( void  )
Returns:
A new GncPlugincustomer_import object

Definition at line 69 of file gnc-plugin-customer_import.c.

{
    return GNC_PLUGIN (g_object_new (GNC_TYPE_PLUGIN_customer_import, (gchar*) NULL));
}
CustomerImportGui* gnc_plugin_customer_import_showGUI ( void  )

File chooser

Definition at line 78 of file dialog-customer-import-gui.c.

{
    CustomerImportGui *gui;
    //gktbuilderXML *xml;
    GtkBuilder *builder;
    GList *glist;
    GtkTreeIter iter;
    GtkCellRenderer *renderer;
    GtkTreeViewColumn *column;

    // if window exists already, activate it
    glist = gnc_find_gui_components ("dialog-customer_import_gui", NULL, NULL);
    if (glist)
    {
        // window found
        gui = g_list_nth_data (glist, 0);
        g_list_free (glist);
        gtk_window_present (GTK_WINDOW(gui->dialog));
        return gui;
    }

    // create new window
    gui = g_new0 (CustomerImportGui, 1);

    builder = gtk_builder_new();
    gnc_builder_add_from_file (builder, "dialog-customer-import-gui.glade", "customer_import Dialog");
    gui->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "customer_import Dialog"));
    gui->tree_view = GTK_WIDGET(gtk_builder_get_object (builder, "treeview1"));
    gui->entryFilename = GTK_WIDGET(gtk_builder_get_object (builder, "entryFilename"));
    gui->type = "CUSTOMER"; // Set a default type to import

    gui->regexp = g_string_new ( "^(?<id>[^;]+);(?<company>[^;]*);(?<name>[^;]+);(?<addr1>[^;]+);?(?<addr2>[^;]*);?(?<addr3>[^;]*);?(?<addr4>[^;]*);?(?<phone>[^;]*);?(?<fax>[^;]*);?(?<email>[^;]*);?(?<shipname>[^;]*);?(?<shipaddr1>[^;]*);?(?<shipaddr2>[^;]*);?(?<shipaddr3>[^;]*);?(?<shipaddr4>[^;]*);?(?<shipphone>[^;]*);?(?<shipfax>[^;]*);?(?<shipemail>[^;]*)");
    gui->book = gnc_get_current_book();

    // create model and bind to view
    gui->store = gtk_list_store_new (CI_N_COLUMNS,
                                     G_TYPE_STRING, G_TYPE_STRING,
                                     G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
                                     G_TYPE_STRING,
                                     G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
    gtk_tree_view_set_model( GTK_TREE_VIEW(gui->tree_view), GTK_TREE_MODEL(gui->store) );
#define CREATE_COLUMN(description,column_id) \
  renderer = gtk_cell_renderer_text_new (); \
  column = gtk_tree_view_column_new_with_attributes (description, renderer, "text", column_id, NULL); \
  gtk_tree_view_column_set_resizable (column, TRUE); \
  gtk_tree_view_append_column (GTK_TREE_VIEW (gui->tree_view), column);
    CREATE_COLUMN ("id", CI_ID);
    CREATE_COLUMN ("company", CI_COMPANY);
    CREATE_COLUMN ("name", CI_NAME);
    CREATE_COLUMN ("addr1", CI_ADDR1);
    CREATE_COLUMN ("addr2", CI_ADDR2);
    CREATE_COLUMN ("addr3", CI_ADDR3);
    CREATE_COLUMN ("addr4", CI_ADDR4);
    CREATE_COLUMN ("phone", CI_PHONE);
    CREATE_COLUMN ("fax", CI_FAX);
    CREATE_COLUMN ("email", CI_EMAIL);
    CREATE_COLUMN ("notes", CI_NOTES);
    CREATE_COLUMN ("shipname", CI_SHIPNAME);
    CREATE_COLUMN ("shipaddr1", CI_SHIPADDR1);
    CREATE_COLUMN ("shipaddr2", CI_SHIPADDR2);
    CREATE_COLUMN ("shipaddr3", CI_SHIPADDR3);
    CREATE_COLUMN ("shipaddr4", CI_SHIPADDR4);
    CREATE_COLUMN ("shipphone", CI_SHIPPHONE);
    CREATE_COLUMN ("shipfax", CI_SHIPFAX);
    CREATE_COLUMN ("shipemail", CI_SHIPEMAIL);

    gui->component_id = gnc_register_gui_component ("dialog-customer_import_gui",
                        NULL,
                        gnc_customer_import_gui_close_handler,
                        gui);

    /* Setup signals */
    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, gui);
    gtk_widget_show_all ( gui->dialog );
    return gui;
}
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines