[grisbi-cvs] grisbi/src accueil.c, 1.224, 1.225 affichage.c, 1.171, 1.172 balance_estimate_data.c, 1.16, 1.17 balance_estimate_data.h, 1.10, 1.11 balance_estimate_future.c, 1.4, 1.5 balance_estimate_future.h, 1.3, 1.4 balance_estimate_hist.c, 1.19, 1.20 balance_estimate_tab.c, 1.57, 1.58 balance_estimate_tab.h, 1.11, 1.12 gsb_data_payment.c, 1.17, 1.18 gsb_data_scheduled.c, 1.31, 1.32 gsb_data_scheduled.h, 1.18, 1.19 gsb_file_config.c, 1.94, 1.95 gsb_file_load.c, 1.214, 1.215 gsb_file_save.c, 1.160, 1.161 gsb_file_save.h, 1.7, 1.8 gsb_form.c, 1.154, 1.155 gsb_form_scheduler.c, 1.40, 1.41 menu.c, 1.150, 1.151 traitement_variables.c, 1.191, 1.192
Pierre Biava
pbiava at users.sourceforge.net
Sun Mar 28 16:40:31 CEST 2010
- Previous message: [grisbi-cvs] grisbi/po cs.po, 1.103, 1.104 da.po, 1.109, 1.110 de.po, 1.183, 1.184 el.po, 1.73, 1.74 eo.po, 1.66, 1.67 es.po, 1.182, 1.183 fa.po, 1.96, 1.97 fr.po, 1.242, 1.243 grisbi.pot, 1.144, 1.145 he.po, 1.102, 1.103 it.po, 1.102, 1.103 nl.po, 1.101, 1.102 pl.po, 1.107, 1.108 pt_BR.po, 1.104, 1.105 ro.po, 1.103, 1.104 ru.po, 1.101, 1.102 zh_CN.po, 1.97, 1.98
- Next message: [grisbi-cvs] grisbi/src gsb_data_scheduled.c,1.32,1.33
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/grisbi/grisbi/src
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv26947/src
Modified Files:
accueil.c affichage.c balance_estimate_data.c
balance_estimate_data.h balance_estimate_future.c
balance_estimate_future.h balance_estimate_hist.c
balance_estimate_tab.c balance_estimate_tab.h
gsb_data_payment.c gsb_data_scheduled.c gsb_data_scheduled.h
gsb_file_config.c gsb_file_load.c gsb_file_save.c
gsb_file_save.h gsb_form.c gsb_form_scheduler.c menu.c
traitement_variables.c
Log Message:
Fixed minor bugs and added the entry of data in the futur for the module budgetary
Index: affichage.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/affichage.c,v
retrieving revision 1.171
retrieving revision 1.172
diff -u -d -r1.171 -r1.172
--- affichage.c 8 Mar 2010 21:30:00 -0000 1.171
+++ affichage.c 28 Mar 2010 14:40:28 -0000 1.172
@@ -83,6 +83,8 @@
extern GdkColor calendar_entry_color;
extern GdkColor couleur_bet_division;
extern GdkColor couleur_fond[2];
+extern GdkColor couleur_bet_future;
+extern GdkColor default_couleur_bet_future;
extern GdkColor couleur_grise;
extern GdkColor couleur_jour;
extern GdkColor couleur_selection;
@@ -794,6 +796,7 @@
{ N_("Archive color"), &archive_background_color, &default_archive_background_color},
{ N_("Background of invalid date entry"), &calendar_entry_color, &default_calendar_entry_color },
{ N_("Background of bet division"), &couleur_bet_division, &default_couleur_bet_division },
+ { N_("Background of bet futur"), &couleur_bet_future, &default_couleur_bet_future },
{ NULL, 0, 0},
};
Index: gsb_file_save.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_save.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- gsb_file_save.h 23 May 2009 19:25:10 -0000 1.7
+++ gsb_file_save.h 28 Mar 2010 14:40:29 -0000 1.8
@@ -24,6 +24,7 @@
gboolean gsb_file_save_save_file ( const gchar *filename,
gboolean compress,
gint archive_number );
+const gchar *my_safe_null_str ( const gchar *string );
/* END_DECLARATION */
#endif
Index: balance_estimate_future.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_future.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- balance_estimate_future.h 23 Mar 2010 22:15:21 -0000 1.3
+++ balance_estimate_future.h 28 Mar 2010 14:40:28 -0000 1.4
@@ -8,11 +8,7 @@
/* START_DECLARATION */
-gboolean bet_future_configure_form_to_future ( void );
-gboolean bet_future_configure_form_to_transaction ( void );
-GtkWidget * bet_future_create_page ( void );
-gboolean bet_future_new_line_dialog ( GtkWidget *tree_view,
- GtkTreeModel *tab_model,
+gboolean bet_future_new_line_dialog ( GtkTreeModel *tab_model,
gchar *str_date );
/* END_DECLARATION */
Index: gsb_data_scheduled.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_scheduled.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- gsb_data_scheduled.c 23 Mar 2010 22:15:21 -0000 1.31
+++ gsb_data_scheduled.c 28 Mar 2010 14:40:28 -0000 1.32
@@ -39,7 +39,51 @@
/*END_INCLUDE*/
+/**
+ * \struct
+ * Describe a scheduled
+ */
+typedef struct
+{
+ /** @name general stuff */
+ gint scheduled_number;
+ gint account_number;
+ gsb_real scheduled_amount;
+ gint party_number;
+ gchar *notes;
+ gshort automatic_scheduled; /**< 0=manual, 1=automatic (scheduled scheduled) */
+ guint financial_year_number;
+
+ /** @name dates of the scheduled */
+ GDate *date;
+
+ /** @name currency stuff */
+ gint currency_number;
+
+ /** @name category stuff */
+ gint category_number;
+ gint sub_category_number;
+ gint budgetary_number;
+ gint sub_budgetary_number;
+ gint account_number_transfer; /**< -1 for a scheduled neither categ, neither transfer, neither split */
+ gint split_of_scheduled; /**< 1 if it's a split of scheduled */
+ gint mother_scheduled_number; /**< for a split, the mother's scheduled number */
+
+ /** @name method of payment */
+ gint method_of_payment_number;
+ gchar *method_of_payment_content;
+ gint contra_method_of_payment_number;
+
+ /** @name specific stuff for scheduled transactions */
+ gint frequency; /**< 0=once, 1=week, 2=month, 3=year, 4=perso */
+ gint user_interval; /**< 0=days, 1=monthes, 2=years */
+ gint user_entry;
+ GDate *limit_date;
+} struct_scheduled;
+
+
/*START_STATIC*/
+static void _gsb_data_scheduled_free ( struct_scheduled *scheduled);
static void gsb_data_scheduled_delete_all_scheduled ();
static gint gsb_data_scheduled_get_last_number (void);
static gint gsb_data_scheduled_get_last_white_number (void);
@@ -1526,7 +1570,7 @@
/**
* This internal function is called to free memory used by a struct_scheduled structure.
*/
-void gsb_data_scheduled_free ( struct_scheduled *scheduled)
+static void _gsb_data_scheduled_free ( struct_scheduled *scheduled )
{
if ( ! scheduled )
return;
@@ -1578,7 +1622,7 @@
{
scheduled_list = g_slist_remove ( scheduled_list,
scheduled_child );
- gsb_data_scheduled_free ( scheduled_child );
+ _gsb_data_scheduled_free ( scheduled_child );
}
list_tmp = list_tmp -> next;
}
@@ -1587,7 +1631,7 @@
scheduled_list = g_slist_remove ( scheduled_list,
scheduled );
- gsb_data_scheduled_free (scheduled);
+ _gsb_data_scheduled_free ( scheduled );
return TRUE;
}
@@ -1696,3 +1740,8 @@
}
return -1;
}
+
+
+/* Local Variables: */
+/* c-basic-offset: 4 */
+/* End: */
Index: balance_estimate_data.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_data.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- balance_estimate_data.h 13 Mar 2010 21:06:58 -0000 1.10
+++ balance_estimate_data.h 28 Mar 2010 14:40:28 -0000 1.11
@@ -4,6 +4,7 @@
#include <gtk/gtk.h>
/* START_INCLUDE_H */
+#include "./gsb_data_scheduled.h"
#include "./gsb_real.h"
/* END_INCLUDE_H */
@@ -11,7 +12,7 @@
typedef struct _bet_range SBR;
typedef struct _historical SH;
typedef struct _hist_div struct_hist_div;
-
+typedef struct _future_data struct_futur_data;
struct _bet_range
{
@@ -42,11 +43,43 @@
};
+struct _future_data
+{
+ gint number;
+ gint account_number;
+ GDate *date;
+ gsb_real amount;
+ guint fyear_number;
+ gint payment_number;
+ gint party_number;
+ gint category_number;
+ gint sub_category_number;
+ gint budgetary_number;
+ gint sub_budgetary_number;
+ gchar *notes;
+
+ gint frequency; /* 0=once, 1=week, 2=month, 5=year, 6=perso */
+ gint user_interval; /* 0=days, 1= week 2=month, 3=years */
+ gint user_entry;
+ GDate *limit_date;
+ gint mother_row; /* if frequency > 0 */
+};
+
+
/* START_DECLARATION */
-gboolean bet_data_add_div_hist ( gint account_nb,
+GHashTable *bet_data_future_get_list ( void );
+gboolean bet_data_future_add_lines ( struct_futur_data *sfd );
+GDate *bet_data_futur_get_next_date ( struct_futur_data *scheduled,
+ const GDate *date );
+gboolean bet_data_future_remove_line ( gint account_number, gint number );
+gboolean bet_data_future_remove_lines ( gint account_number,
+ gint number,
+ gint mother_row );
+gboolean bet_data_future_set_lines_from_file ( struct_futur_data *scheduled );
+gboolean bet_data_hist_add_div ( gint account_nb,
gint div_number,
gint sub_div_nb );
-gsb_real bet_data_get_div_amount ( gint account_nb, gint div_number, gint sub_div_nb );
+gsb_real bet_data_hist_get_div_amount ( gint account_nb, gint div_number, gint sub_div_nb );
gint bet_data_get_div_children ( gint account_nb, gint div_number );
gboolean bet_data_get_div_edited ( gint account_nb, gint div_number, gint sub_div_nb );
gchar *bet_data_get_div_name (gint div_num,
@@ -76,12 +109,13 @@
gboolean bet_data_set_div_ptr ( gint type_div );
void bet_data_set_maj ( gboolean maj );
void bet_data_synchronise_hist_div_list ( GHashTable *list_div );
-SBR *initialise_struct_bet_range ( void );
-SH *initialise_struct_historical ( void );
-struct_hist_div *initialise_struct_hist_div ( void );
-void free_struct_bet_range ( SBR *sbr );
-void free_struct_historical ( SH *sh );
-
+struct_futur_data *struct_initialise_bet_future ( void );
+SBR *struct_initialise_bet_range ( void );
+SH *struct_initialise_bet_historical ( void );
+struct_hist_div *struct_initialise_hist_div ( void );
+void struct_free_bet_range ( SBR *sbr );
+void struct_free_bet_historical ( SH *sh );
+void struct_free_bet_future ( struct_futur_data *sfd );
/* END_DECLARATION */
Index: traitement_variables.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/traitement_variables.c,v
retrieving revision 1.191
retrieving revision 1.192
diff -u -d -r1.191 -r1.192
--- traitement_variables.c 13 Mar 2010 21:06:58 -0000 1.191
+++ traitement_variables.c 28 Mar 2010 14:40:29 -0000 1.192
@@ -130,7 +130,9 @@
GdkColor couleur_jaune;
GdkColor couleur_bet_division;
GdkColor default_couleur_bet_division;
-
+GdkColor couleur_bet_future;
+GdkColor default_couleur_bet_future;
+
GSList *liste_labels_titres_colonnes_liste_ope = NULL;
gchar *nom_fichier_comptes = NULL;
@@ -506,15 +508,22 @@
couleur_jaune.pixel = 1;
/* colors of the background bet divisions */
- couleur_bet_division.red =64550;
- couleur_bet_division.green =65535;
+ couleur_bet_division.red = 64550;
+ couleur_bet_division.green = 65535;
couleur_bet_division.blue = 33466;
- default_couleur_bet_division.red =64550;
- default_couleur_bet_division.green =65535;
+ default_couleur_bet_division.red = 64550;
+ default_couleur_bet_division.green = 65535;
default_couleur_bet_division.blue = 33466;
-
+ /* colors of the background bet future data */
+ couleur_bet_future.red = 31829;
+ couleur_bet_future.green = 51015;
+ couleur_bet_future.blue = 35908;
+
+ default_couleur_bet_future.red = 31829;
+ default_couleur_bet_future.green = 51015;
+ default_couleur_bet_future.blue = 35908;
}
/*****************************************************************************************************/
Index: gsb_file_save.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_save.c,v
retrieving revision 1.160
retrieving revision 1.161
diff -u -d -r1.160 -r1.161
--- gsb_file_save.c 16 Mar 2010 11:48:43 -0000 1.160
+++ gsb_file_save.c 28 Mar 2010 14:40:29 -0000 1.161
@@ -133,7 +133,6 @@
gulong *length_calculated,
gchar **file_content,
gint archive_number );
-static const gchar *my_safe_null_str ( const gchar *string );
/*END_STATIC*/
@@ -146,6 +145,7 @@
extern GdkColor calendar_entry_color;
extern GdkColor couleur_bet_division;
extern GdkColor couleur_fond[2];
+extern GdkColor couleur_bet_future;
extern GdkColor couleur_grise;
extern GdkColor couleur_jour;
extern GdkColor couleur_selection;
@@ -799,7 +799,11 @@
"\t\tCalendar_entry_blue=\"%d\"\n"
"\t\tCouleur_bet_division_red=\"%d\"\n"
"\t\tCouleur_bet_division_green=\"%d\"\n"
- "\t\tCouleur_bet_division_blue=\"%d\" />\n",
+ "\t\tCouleur_bet_division_blue=\"%d\"\n"
+ "\t\tCouleur_bet_future_red=\"%d\"\n"
+ "\t\tCouleur_bet_future_green=\"%d\"\n"
+ "\t\tCouleur_bet_future_blue=\"%d\" />\n",
+
couleur_fond[0].red,
couleur_fond[0].green,
couleur_fond[0].blue,
@@ -832,7 +836,10 @@
calendar_entry_color.blue,
couleur_bet_division.red,
couleur_bet_division.green,
- couleur_bet_division.blue );
+ couleur_bet_division.blue,
+ couleur_bet_future.red,
+ couleur_bet_future.green,
+ couleur_bet_future.blue );
/* append the new string to the file content
* and return the new iterator */
Index: gsb_form.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form.c,v
retrieving revision 1.154
retrieving revision 1.155
diff -u -d -r1.154 -r1.155
--- gsb_form.c 23 Mar 2010 22:15:21 -0000 1.154
+++ gsb_form.c 28 Mar 2010 14:40:29 -0000 1.155
@@ -1533,7 +1533,6 @@
/* string will be filled only if the field is empty */
string = NULL;
- devel_debug_int (element_number);
switch ( element_number )
{
case TRANSACTION_FORM_PARTY :
@@ -2190,7 +2189,6 @@
case GDK_KP_Add:
case GDK_plus:
case GDK_equal: /* This should make all our US users happy */
-
/* increase the check of 1 */
if (element_number == TRANSACTION_FORM_CHEQUE)
{
@@ -2202,7 +2200,6 @@
case GDK_KP_Subtract:
case GDK_minus:
-
/* decrease the check of 1 */
if (element_number == TRANSACTION_FORM_CHEQUE)
{
@@ -2213,6 +2210,72 @@
break;
}
+ if ( element_number == TRANSACTION_FORM_TYPE )
+ {
+ gint payment_number;
+
+ switch ( ev -> keyval )
+ {
+ case GDK_c:
+ case GDK_C:
+ payment_number = gsb_data_payment_get_number_by_name ( _("Credit card"),
+ account_number );
+ if ( payment_number )
+ gsb_payment_method_set_combobox_history ( widget, payment_number );
+
+ return TRUE;
+ break;
+ case GDK_d:
+ case GDK_D:
+ payment_number = gsb_data_payment_get_number_by_name ( _("Direct deposit"),
+ account_number );
+ if ( payment_number )
+ gsb_payment_method_set_combobox_history ( widget, payment_number );
+
+ return TRUE;
+ break;
+ case GDK_h:
+ case GDK_H:
+ payment_number = gsb_data_payment_get_number_by_name ( _("Check"),
+ account_number );
+ if ( payment_number )
+ gsb_payment_method_set_combobox_history ( widget, payment_number );
+
+ return TRUE;
+ break;
+ case GDK_l:
+ case GDK_L:
+ payment_number = gsb_data_payment_get_number_by_name ( _("Cash withdrawal"),
+ account_number );
+ if ( payment_number )
+ gsb_payment_method_set_combobox_history ( widget, payment_number );
+
+ return TRUE;
+ break;
+
+ case GDK_p:
+ case GDK_P:
+ payment_number = gsb_data_payment_get_number_by_name ( _("Direct debit"),
+ account_number );
+ if ( payment_number )
+ gsb_payment_method_set_combobox_history ( widget, payment_number );
+
+ return TRUE;
+ break;
+ case GDK_t:
+ case GDK_T:
+ case GDK_v:
+ case GDK_V:
+ payment_number = gsb_data_payment_get_number_by_name ( _("Transfert"),
+ account_number );
+ if ( payment_number )
+ gsb_payment_method_set_combobox_history ( widget, payment_number );
+
+ return TRUE;
+ break;
+ }
+ }
+
return FALSE;
}
Index: gsb_data_scheduled.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_scheduled.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- gsb_data_scheduled.h 23 Mar 2010 22:15:21 -0000 1.18
+++ gsb_data_scheduled.h 28 Mar 2010 14:40:28 -0000 1.19
@@ -6,52 +6,7 @@
#include "./gsb_real.h"
/* END_INCLUDE_H */
-
-/**
- * \struct
- * Describe a scheduled
- */
-typedef struct
-{
- /** @name general stuff */
- gint scheduled_number;
- gint account_number;
- gsb_real scheduled_amount;
- gint party_number;
- gchar *notes;
- gshort automatic_scheduled; /**< 0=manual, 1=automatic (scheduled scheduled) */
- guint financial_year_number;
-
- /** @name dates of the scheduled */
- GDate *date;
-
- /** @name currency stuff */
- gint currency_number;
-
- /** @name category stuff */
- gint category_number;
- gint sub_category_number;
- gint budgetary_number;
- gint sub_budgetary_number;
- gint account_number_transfer; /**< -1 for a scheduled neither categ, neither transfer, neither split */
- gint split_of_scheduled; /**< 1 if it's a split of scheduled */
- gint mother_scheduled_number; /**< for a split, the mother's scheduled number */
-
- /** @name method of payment */
- gint method_of_payment_number;
- gchar *method_of_payment_content;
- gint contra_method_of_payment_number;
-
- /** @name specific stuff for scheduled transactions */
- gint frequency; /**< 0=once, 1=week, 2=month, 3=year, 4=perso */
- gint user_interval; /**< 0=days, 1=monthes, 2=years */
- gint user_entry;
- GDate *limit_date;
-} struct_scheduled;
-
-
/* START_DECLARATION */
-void gsb_data_scheduled_free ( struct_scheduled *scheduled);
gint gsb_data_scheduled_get_account_number ( gint scheduled_number );
gint gsb_data_scheduled_get_account_number_transfer ( gint scheduled_number );
gsb_real gsb_data_scheduled_get_amount ( gint scheduled_number );
Index: gsb_file_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_config.c,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- gsb_file_config.c 23 Mar 2010 22:15:21 -0000 1.94
+++ gsb_file_config.c 28 Mar 2010 14:40:28 -0000 1.95
@@ -1359,30 +1359,30 @@
conf.dvips_command = "dvips";
/* mise en conformité avec les recommandations FreeDesktop. */
-#ifndef _WIN32
- if ( g_file_test ( "/usr/bin/firefox", G_FILE_TEST_EXISTS ) )
- {
- conf.browser_command = g_strdup ( "/usr/bin/firefox" );
- }
- else if ( g_file_test ( "/usr/bin/iceweasel", G_FILE_TEST_EXISTS ) )
- {
- conf.browser_command = g_strdup ( "/usr/bin/iceweasel" );
- }
- else if ( g_file_test ( "/usr/bin/opera", G_FILE_TEST_EXISTS ) )
- {
- conf.browser_command = g_strdup ( "/usr/bin/opera" );
- }
- else if ( g_file_test ( "/usr/bin/mozilla", G_FILE_TEST_EXISTS ) )
- {
- conf.browser_command = g_strdup ( "/usr/bin/mozilla" );
- }
- else
- {
-#endif /* _WIN32 */
- conf.browser_command = g_strdup ( ETAT_WWW_BROWSER );
-#ifndef _WIN32
- }
-#endif /* _WIN32 */
+//~ #ifndef _WIN32
+ //~ if ( g_file_test ( "/usr/bin/firefox", G_FILE_TEST_EXISTS ) )
+ //~ {
+ //~ conf.browser_command = g_strdup ( "/usr/bin/firefox" );
+ //~ }
+ //~ else if ( g_file_test ( "/usr/bin/iceweasel", G_FILE_TEST_EXISTS ) )
+ //~ {
+ //~ conf.browser_command = g_strdup ( "/usr/bin/iceweasel" );
+ //~ }
+ //~ else if ( g_file_test ( "/usr/bin/opera", G_FILE_TEST_EXISTS ) )
+ //~ {
+ //~ conf.browser_command = g_strdup ( "/usr/bin/opera" );
+ //~ }
+ //~ else if ( g_file_test ( "/usr/bin/mozilla", G_FILE_TEST_EXISTS ) )
+ //~ {
+ //~ conf.browser_command = g_strdup ( "/usr/bin/mozilla" );
+ //~ }
+ //~ else
+ //~ {
+//~ #endif /* _WIN32 */
+ conf.browser_command = g_strdup (ETAT_WWW_BROWSER);
+//~ #ifndef _WIN32
+ //~ }
+//~ #endif /* _WIN32 */
/* Print */
etat.print_config.printer = 0;
Index: gsb_data_payment.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_payment.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- gsb_data_payment.c 20 Mar 2010 18:37:31 -0000 1.17
+++ gsb_data_payment.c 28 Mar 2010 14:40:28 -0000 1.18
@@ -817,21 +817,24 @@
const gchar *last_number;
gchar *new_number;
gchar *prefix = NULL;
- gint number;
+ gint number = 0;
gint i = 0;
last_number = gsb_data_payment_get_last_number ( payment_number );
- while ( last_number[i] == '0' )
+ if ( last_number && strlen ( last_number ) > 0 )
{
- i++;
+ while ( last_number[i] == '0' )
+ {
+ i++;
+ }
+ if ( i > 0 )
+ prefix = g_strndup ( last_number, i );
}
- if ( i > 0 )
- prefix = g_strndup ( last_number, i );
number = utils_str_atoi ( last_number );
number += increment;
new_number = utils_str_itoa ( number );
- if ( prefix && strlen ( prefix ) )
+ if ( prefix && strlen ( prefix ) > 0 )
new_number = g_strconcat ( prefix, new_number, NULL );
return new_number;
Index: balance_estimate_tab.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- balance_estimate_tab.h 5 Mar 2010 22:18:55 -0000 1.11
+++ balance_estimate_tab.h 28 Mar 2010 14:40:28 -0000 1.12
@@ -23,11 +23,12 @@
#include <gtk/gtk.h>
/* START_INCLUDE_H */
+#include "./gsb_data_scheduled.h"
/* END_INCLUDE_H */
/* START_DECLARATION */
GtkWidget * bet_array_create_page ( void );
-void bet_array_list_add_new_line ( GtkTreeModel *tab_model,
+void bet_array_list_add_new_hist_line ( GtkTreeModel *tab_model,
GtkTreeModel *model,
GtkTreeIter *iter,
GDate *date_min,
Index: accueil.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/accueil.c,v
retrieving revision 1.224
retrieving revision 1.225
diff -u -d -r1.224 -r1.225
--- accueil.c 23 Mar 2010 22:15:21 -0000 1.224
+++ accueil.c 28 Mar 2010 14:40:28 -0000 1.225
@@ -391,8 +391,6 @@
gsb_data_account_get_accounts_amount ( ) ) )
return;
- devel_debug ( "update_liste_comptes_accueil" );
-
mise_a_jour_liste_comptes_accueil = 0;
/* Remove previous child */
Index: menu.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/menu.c,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -d -r1.150 -r1.151
--- menu.c 7 Mar 2010 15:56:05 -0000 1.150
+++ menu.c 28 Mar 2010 14:40:29 -0000 1.151
@@ -767,8 +767,6 @@
GSList *list_tmp;
GtkActionGroup * action_group;
- devel_debug ( "gsb_menu_update_accounts_in_menus" );
-
if ( move_to_account_merge_id != -1 )
gtk_ui_manager_remove_ui ( ui_manager, move_to_account_merge_id );
Index: gsb_file_load.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_load.c,v
retrieving revision 1.214
retrieving revision 1.215
diff -u -d -r1.214 -r1.215
--- gsb_file_load.c 16 Mar 2010 11:48:43 -0000 1.214
+++ gsb_file_load.c 28 Mar 2010 14:40:28 -0000 1.215
@@ -91,6 +91,8 @@
const gchar **attribute_values );
static void gsb_file_load_bet_part ( const gchar **attribute_names,
const gchar **attribute_values );
+static void gsb_file_load_future_data ( const gchar **attribute_names,
+ const gchar **attribute_values );
static void gsb_file_load_bet_historical ( const gchar **attribute_names,
const gchar **attribute_values );
static gboolean gsb_file_load_check_new_structure ( gchar *file_content );
@@ -165,6 +167,7 @@
extern GdkColor calendar_entry_color;
extern GdkColor couleur_bet_division;
extern GdkColor couleur_fond[2];
+extern GdkColor couleur_bet_future;
extern GdkColor couleur_grise;
extern GdkColor couleur_jour;
extern GdkColor couleur_selection;
@@ -631,11 +634,18 @@
gsb_file_load_bet_part ( attribute_names, attribute_values );
return;
}
+
if ( !strcmp ( element_name, "Bet_historical" ) )
{
gsb_file_load_bet_historical ( attribute_names, attribute_values );
return;
}
+
+ if ( !strcmp ( element_name, "Bet_future" ) )
+ {
+ gsb_file_load_future_data ( attribute_names, attribute_values );
+ return;
+ }
#endif /* ENABLE_BALANCE_ESTIMATE */
if ( !strcmp ( element_name,
@@ -1245,6 +1255,24 @@
couleur_bet_division.blue = utils_str_atoi (attribute_values[i]);
}
+ else if ( !strcmp ( attribute_names[i],
+ "Couleur_bet_future_red" ))
+ {
+ couleur_bet_future.red = utils_str_atoi (attribute_values[i]);
+ }
+
+ else if ( !strcmp ( attribute_names[i],
+ "Couleur_bet_future_green" ))
+ {
+ couleur_bet_future.green = utils_str_atoi (attribute_values[i]);
+ }
+
+ else if ( !strcmp ( attribute_names[i],
+ "Couleur_bet_future_blue" ))
+ {
+ couleur_bet_future.blue = utils_str_atoi (attribute_values[i]);
+ }
+
i++;
}
while ( attribute_names[i] );
@@ -3705,7 +3733,7 @@
return;
/* create the structure */
- shd = initialise_struct_hist_div ( );
+ shd = struct_initialise_hist_div ( );
do
{
@@ -3750,7 +3778,7 @@
sub_div_nb = utils_str_atoi ( attribute_values[i] );
if ( sub_div_nb > 0 )
{
- sub_shd = initialise_struct_hist_div ( );
+ sub_shd = struct_initialise_hist_div ( );
sub_shd -> div_number = sub_div_nb;
i++;
continue;
@@ -3784,6 +3812,175 @@
/**
+ * load the bet future data
+ *
+ * \param attribute_names
+ * \param attribute_values
+ *
+ * */
+void gsb_file_load_future_data ( const gchar **attribute_names,
+ const gchar **attribute_values )
+{
+ gint i=0;
+ struct_futur_data *scheduled;
+
+ if ( !attribute_names[i] )
+ return;
+
+ scheduled = struct_initialise_bet_future ( );
+
+ if ( !scheduled )
+ {
+ dialogue_error_memory ();
+ return;
+ }
+
+ do
+ {
+ /* we test at the beginning if the attribute_value is NULL, if yes, */
+ /* go to the next */
+
+ if ( !strcmp (attribute_values[i], "(null)") )
+ {
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i], "Nb" ) )
+ {
+ scheduled -> number = utils_str_atoi ( attribute_values[i] );
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i], "Dt" ) )
+ {
+ scheduled -> date = gsb_parse_date_string_safe ( attribute_values[i] );
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i], "Ac" ) )
+ {
+ scheduled -> account_number = utils_str_atoi ( attribute_values[i] );
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i], "Am" ) )
+ {
+ scheduled -> amount = gsb_real_import_from_string ( attribute_values[i] );
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i], "Pa" ) )
+ {
+ scheduled -> party_number = utils_str_atoi ( attribute_values[i] );
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i], "Ca" ) )
+ {
+ scheduled -> category_number = utils_str_atoi ( attribute_values[i] );
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i], "Sca" ) )
+ {
+ scheduled -> sub_category_number = utils_str_atoi ( attribute_values[i] );
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i], "Pn" ) )
+ {
+ scheduled -> payment_number = utils_str_atoi ( attribute_values[i] );
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i], "Fi" ) )
+ {
+ scheduled -> fyear_number = utils_str_atoi ( attribute_values[i] );
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i], "Bu" ) )
+ {
+ scheduled -> budgetary_number = utils_str_atoi ( attribute_values[i] );
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i], "Sbu" ) )
+ {
+ scheduled -> sub_budgetary_number = utils_str_atoi ( attribute_values[i] );
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i], "No" ) )
+ {
+ scheduled -> notes = g_strdup ( attribute_values[i] );
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i], "Pe" ) )
+ {
+ scheduled -> frequency = utils_str_atoi ( attribute_values[i] );
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i], "Pei" ) )
+ {
+ scheduled -> user_interval = utils_str_atoi ( attribute_values[i] );
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i], "Pep" ) )
+ {
+ scheduled -> user_entry = utils_str_atoi ( attribute_values[i] );
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i], "Dtl" ) )
+ {
+ GDate *date;
+
+ date = gsb_parse_date_string_safe ( attribute_values[i] );
+ if ( g_date_valid ( date ) )
+ scheduled -> limit_date = date;
+ else
+ scheduled -> limit_date = NULL;
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i], "Mo" ) )
+ {
+ scheduled -> mother_row = utils_str_atoi ( attribute_values[i] );
+ i++;
+ continue;
+ }
+
+ /* normally, shouldn't come here */
+ i++;
+ }
+ while ( attribute_names[i] );
+
+ bet_data_future_set_lines_from_file ( scheduled );
+}
+
+
+/**
* load the report structure in the grisbi file
*
* \param attribute_names
Index: balance_estimate_data.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_data.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- balance_estimate_data.c 23 Mar 2010 22:15:21 -0000 1.16
+++ balance_estimate_data.c 28 Mar 2010 14:40:28 -0000 1.17
@@ -41,8 +41,10 @@
#include "./gsb_data_payee.h"
#include "./gsb_data_scheduled.h"
#include "./gsb_data_transaction.h"
+#include "./gsb_file_save.h"
#include "./gsb_fyear.h"
#include "./gsb_scheduler.h"
+#include "./gsb_scheduler_list.h"
#include "./gsb_transactions_list_sort.h"
#include "./main.h"
#include "./navigation.h"
@@ -55,9 +57,11 @@
/*START_STATIC*/
+static struct_futur_data *bet_data_future_copy_struct ( struct_futur_data *scheduled );
+static void bet_data_future_set_max_number ( gint number );
static gboolean bet_data_update_div ( SH *sh, gint transaction_number,
gint sub_div );
-static void free_struct_hist_div ( struct_hist_div *bet_hist_div );
+static void struct_free_hist_div ( struct_hist_div *bet_hist_div );
/*END_STATIC*/
@@ -81,6 +85,8 @@
/** the hashtable which contains all the bet_future structures */
static GHashTable *bet_future_list;
+static gint future_number;
+
/* force la mise à jour des données */
static gboolean bet_maj = FALSE;
@@ -97,14 +103,14 @@
bet_hist_div_list = g_hash_table_new_full ( g_str_hash,
g_str_equal,
(GDestroyNotify) g_free,
- (GDestroyNotify) free_struct_hist_div );
+ (GDestroyNotify) struct_free_hist_div );
bet_future_list = g_hash_table_new_full ( g_str_hash,
g_str_equal,
(GDestroyNotify) g_free,
- (GDestroyNotify) gsb_data_scheduled_free );
+ (GDestroyNotify) struct_free_bet_future );
+ future_number = 0;
return FALSE;
-
}
@@ -138,14 +144,14 @@
*
*
* */
-gboolean bet_data_add_div_hist ( gint account_nb,
+gboolean bet_data_hist_add_div ( gint account_nb,
gint div_number,
gint sub_div_nb )
{
gchar *key;
gchar *sub_key;
struct_hist_div *shd;
-//~ printf ("account_nb = %d, div_number = %d, sub_div_nb = %d\n", account_nb, div_number, sub_div_nb);
+
if ( account_nb == 0 )
key = g_strconcat ("0:", utils_str_itoa ( div_number ), NULL );
else
@@ -164,7 +170,7 @@
{
struct_hist_div *sub_shd;
- sub_shd = initialise_struct_hist_div ( );
+ sub_shd = struct_initialise_hist_div ( );
if ( !sub_shd )
{
dialogue_error_memory ( );
@@ -182,7 +188,7 @@
}
else
{
- shd = initialise_struct_hist_div ( );
+ shd = struct_initialise_hist_div ( );
if ( !shd )
{
dialogue_error_memory ( );
@@ -194,7 +200,7 @@
{
struct_hist_div *sub_shd;
- sub_shd = initialise_struct_hist_div ( );
+ sub_shd = struct_initialise_hist_div ( );
if ( !sub_shd )
{
dialogue_error_memory ( );
@@ -249,8 +255,6 @@
}
g_hash_table_insert ( bet_hist_div_list, key, shd );
}
-
- //~ printf ("long bet_hist_div_list = %d\n", g_hash_table_size ( bet_hist_div_list ));
}
@@ -513,7 +517,7 @@
*
*
* */
-gsb_real bet_data_get_div_amount ( gint account_nb, gint div_number, gint sub_div_nb )
+gsb_real bet_data_hist_get_div_amount ( gint account_nb, gint div_number, gint sub_div_nb )
{
gchar *key;
struct_hist_div *shd;
@@ -637,7 +641,7 @@
bet_data_update_div ( sh, transaction_number, sub_div );
else
{
- sh = initialise_struct_historical ( );
+ sh = struct_initialise_bet_historical ( );
sh -> div = div;
sh -> account_nb = gsb_data_transaction_get_account_number ( transaction_number );
bet_data_update_div ( sh, transaction_number, sub_div );
@@ -670,7 +674,7 @@
bet_data_update_div ( tmp_sh, transaction_number, -1 );
else
{
- tmp_sh = initialise_struct_historical ( );
+ tmp_sh = struct_initialise_bet_historical ( );
tmp_sh -> div = sub_div;
tmp_sh -> account_nb = gsb_data_transaction_get_account_number ( transaction_number );
bet_data_update_div ( tmp_sh, transaction_number, -1 );
@@ -744,6 +748,50 @@
}
}
+ g_hash_table_iter_init ( &iter, bet_future_list );
+ while ( g_hash_table_iter_next ( &iter, &key, &value ) )
+ {
+ struct_futur_data *scheduled = ( struct_futur_data* ) value;
+ gchar *amount;
+ gchar *date;
+ gchar *limit_date;
+
+ /* set the real */
+ amount = gsb_real_save_real_to_string ( scheduled -> amount, 2 );
+
+ /* set the dates */
+ date = gsb_format_gdate_safe ( scheduled -> date );
+ limit_date = gsb_format_gdate_safe ( scheduled -> limit_date );
+
+ tmp_str = g_markup_printf_escaped ( "\t<Bet_future Nb=\"%d\" Dt=\"%s\" Ac=\"%d\" "
+ "Am=\"%s\" Pa=\"%d\" Ca=\"%d\" Sca=\"%d\" Pn=\"%d\" "
+ "Fi=\"%d\" Bu=\"%d\" Sbu=\"%d\" No=\"%s\" Au=\"0\" "
+ "Pe=\"%d\" Pei=\"%d\" Pep=\"%d\" Dtl=\"%s\" Mo=\"%d\" />\n",
+ scheduled -> number,
+ my_safe_null_str ( date ),
+ scheduled -> account_number,
+ my_safe_null_str ( amount ),
+ scheduled -> party_number,
+ scheduled -> category_number,
+ scheduled -> sub_category_number,
+ scheduled -> payment_number,
+ scheduled -> fyear_number,
+ scheduled -> budgetary_number,
+ scheduled -> sub_budgetary_number,
+ my_safe_null_str ( scheduled -> notes ),
+ scheduled -> frequency,
+ scheduled -> user_interval,
+ scheduled -> user_entry,
+ my_safe_null_str ( limit_date ),
+ scheduled -> mother_row );
+
+ g_ptr_array_add ( tab, tmp_str );
+
+ g_free (amount);
+ g_free (date);
+ g_free (limit_date);
+ }
+
return tab;
}
@@ -794,7 +842,7 @@
*
*
* */
-SBR *initialise_struct_bet_range ( void )
+SBR *struct_initialise_bet_range ( void )
{
SBR *sbr;
@@ -816,7 +864,7 @@
*
*
* */
-void free_struct_bet_range ( SBR *sbr )
+void struct_free_bet_range ( SBR *sbr )
{
if ( sbr-> min_date )
g_date_free ( sbr-> min_date );
@@ -833,16 +881,16 @@
*
*
* */
-SH *initialise_struct_historical ( void )
+SH *struct_initialise_bet_historical ( void )
{
SH *sh;
sh = g_malloc ( sizeof ( SH ) );
- sh -> sbr = initialise_struct_bet_range ( );
+ sh -> sbr = struct_initialise_bet_range ( );
sh -> list_sub_div = g_hash_table_new_full ( g_str_hash,
g_str_equal,
NULL,
- (GDestroyNotify) free_struct_historical );
+ (GDestroyNotify) struct_free_bet_historical );
return sh;
}
@@ -853,11 +901,11 @@
*
*
* */
-void free_struct_historical ( SH *sh )
+void struct_free_bet_historical ( SH *sh )
{
if ( sh -> sbr )
- free_struct_bet_range ( sh -> sbr );
+ struct_free_bet_range ( sh -> sbr );
if ( sh -> list_sub_div )
g_hash_table_remove_all ( sh -> list_sub_div );
@@ -871,7 +919,7 @@
*
*
* */
-struct_hist_div *initialise_struct_hist_div ( void )
+struct_hist_div *struct_initialise_hist_div ( void )
{
struct_hist_div *shd;
@@ -883,7 +931,7 @@
shd -> sub_div_list = g_hash_table_new_full ( g_str_hash,
g_str_equal,
(GDestroyNotify) g_free,
- (GDestroyNotify) free_struct_hist_div );
+ (GDestroyNotify) struct_free_hist_div );
return shd;
}
@@ -895,7 +943,7 @@
*
*
* */
-void free_struct_hist_div ( struct_hist_div *shd )
+void struct_free_hist_div ( struct_hist_div *shd )
{
if ( shd -> sub_div_list )
g_hash_table_remove_all ( shd -> sub_div_list );
@@ -955,8 +1003,367 @@
*
*
* */
+struct_futur_data *struct_initialise_bet_future ( void )
+{
+ struct_futur_data *sfd;
+
+ sfd = g_malloc ( sizeof ( struct_futur_data ) );
+
+ sfd -> date = NULL;
+ sfd -> amount = null_real;
+ sfd -> notes = NULL;
+ sfd -> limit_date = NULL;
+
+ return sfd;
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
+void struct_free_bet_future ( struct_futur_data *scheduled )
+{
+ if ( scheduled -> date )
+ g_date_free ( scheduled -> date );
+ if ( scheduled -> limit_date )
+ g_date_free ( scheduled -> limit_date );
+ if ( scheduled -> notes )
+ g_free ( scheduled -> notes );
+
+ g_free ( scheduled );
+}
+
+
+/**
+ * add lines creates in the tab_array
+ *
+ *
+ *
+ * */
+gboolean bet_data_future_add_lines ( struct_futur_data *scheduled )
+{
+ gchar *key;
+
+ future_number ++;
+
+ if ( scheduled -> frequency == 0 )
+ {
+ //~ if ( ( old_sch = g_hash_table_lookup ( bet_future_list, key ) ) )
+ //~ g_hash_table_replace ( bet_future_list, key, scheduled );
+ //~ else
+ if ( scheduled -> account_number == 0 )
+ key = g_strconcat ("0:", utils_str_itoa ( future_number ), NULL );
+ else
+ key = g_strconcat ( utils_str_itoa ( scheduled -> account_number ), ":",
+ utils_str_itoa ( future_number ), NULL );
+
+ scheduled -> number = future_number;
+ g_hash_table_insert ( bet_future_list, key, scheduled );
+ }
+ else
+ {
+ GDate *date;
+ gint mother_row;
+ struct_futur_data *new_sch = NULL;
+
+ mother_row = future_number;
+
+ /* we don't change the initial date */
+ date = gsb_date_copy ( scheduled -> date );
+ while ( date != NULL && g_date_valid ( date ) )
+ {
+ if ( scheduled -> account_number == 0 )
+ key = g_strconcat ("0:", utils_str_itoa ( future_number ), NULL );
+ else
+ key = g_strconcat ( utils_str_itoa ( scheduled -> account_number ), ":",
+ utils_str_itoa ( future_number ), NULL );
+
+ if ( mother_row == future_number )
+ new_sch = scheduled;
+ else
+ new_sch -> mother_row = mother_row;
+
+ new_sch -> number = future_number;
+ g_hash_table_insert ( bet_future_list, key, new_sch );
+
+ date = bet_data_futur_get_next_date ( new_sch, date );
+ if ( date == NULL )
+ break;
+ future_number ++;
+ new_sch = bet_data_future_copy_struct ( scheduled );
+ new_sch -> date = date;
+ }
+ }
+
+ if ( etat.modification_fichier == 0 )
+ modification_fichier ( TRUE );
+
+ return TRUE;
+}
+
+
+/**
+ * add lines from file
+ *
+ *
+ *
+ * */
+gboolean bet_data_future_set_lines_from_file ( struct_futur_data *scheduled )
+{
+ gchar *key;
+
+ if ( scheduled -> account_number == 0 )
+ key = g_strconcat ("0:", utils_str_itoa ( scheduled -> number ), NULL );
+ else
+ key = g_strconcat ( utils_str_itoa ( scheduled -> account_number ), ":",
+ utils_str_itoa ( scheduled -> number ), NULL );
+
+ bet_data_future_set_max_number ( scheduled -> number );
+ g_hash_table_insert ( bet_future_list, key, scheduled );
+ return TRUE;
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
+void bet_data_future_set_max_number ( gint number )
+{
+ if ( number > future_number )
+ future_number = number;
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
+GHashTable *bet_data_future_get_list ( void )
+{
+ return bet_future_list;
+}
+
+
+/**
+ * find and return the next date after the given date for the given futur data
+ *
+ *
+ * \param struct_futur_data
+ * \param date the current date, we want the next one after that one
+ *
+ * \return a newly allocated date, the next date or NULL if over the limit
+ * */
+GDate *bet_data_futur_get_next_date ( struct_futur_data *scheduled,
+ const GDate *date )
+{
+ GDate *return_date;
+
+ if ( !scheduled
+ ||
+ !scheduled -> frequency
+ ||
+ !date
+ ||
+ !g_date_valid ( date ) )
+ return NULL;
+
+ /* we don't change the initial date */
+ return_date = gsb_date_copy (date);
+
+ switch ( scheduled -> frequency )
+ {
+ case SCHEDULER_PERIODICITY_ONCE_VIEW:
+ return NULL;
+ break;
+
+ case SCHEDULER_PERIODICITY_WEEK_VIEW:
+ g_date_add_days ( return_date, 7 );
+ break;
+
+ case SCHEDULER_PERIODICITY_MONTH_VIEW:
+ g_date_add_months ( return_date, 1 );
+ break;
+
+ case SCHEDULER_PERIODICITY_TWO_MONTHS_VIEW:
+ g_date_add_months ( return_date, 2 );
+ break;
+
+ case SCHEDULER_PERIODICITY_TRIMESTER_VIEW:
+ g_date_add_months ( return_date, 3 );
+ break;
+
+ case SCHEDULER_PERIODICITY_YEAR_VIEW:
+ g_date_add_years ( return_date, 1 );
+ break;
+
+ case SCHEDULER_PERIODICITY_CUSTOM_VIEW:
+ if ( scheduled -> user_entry <= 0 )
+ {
+ g_date_free (return_date);
+ return NULL;
+ }
+
+ switch ( scheduled -> user_interval )
+ {
+ case PERIODICITY_DAYS:
+ g_date_add_days ( return_date, scheduled -> user_entry);
+ break;
+
+ case PERIODICITY_WEEKS:
+ g_date_add_days ( return_date, scheduled -> user_entry * 7 );
+ break;
+
+ case PERIODICITY_MONTHS:
+ g_date_add_months ( return_date, scheduled -> user_entry );
+ break;
+
+ case PERIODICITY_YEARS:
+ g_date_add_years ( return_date, scheduled -> user_entry );
+ break;
+ }
+ break;
+ }
+
+ if ( scheduled -> limit_date
+ &&
+ g_date_compare ( return_date, scheduled -> limit_date ) > 0 )
+ {
+ g_date_free (return_date);
+ return_date = NULL;
+ }
+
+ return ( return_date );
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
+struct_futur_data *bet_data_future_copy_struct ( struct_futur_data *scheduled )
+{
+ struct_futur_data *new_sch;
+
+ new_sch = struct_initialise_bet_future ( );
+
+ new_sch -> number = scheduled -> number;
+ new_sch -> account_number = scheduled -> account_number;
+ if ( g_date_valid ( scheduled -> date ) )
+ new_sch -> date = gsb_date_copy ( scheduled -> date );
+ else
+ new_sch -> date = NULL;
+ new_sch -> amount = gsb_real_new ( scheduled -> amount.mantissa,
+ scheduled -> amount.exponent );
+ new_sch -> fyear_number = scheduled -> fyear_number;
+ new_sch -> payment_number = scheduled -> payment_number;
+ new_sch -> party_number = scheduled -> party_number;
+ new_sch -> category_number = scheduled -> category_number;
+ new_sch -> sub_category_number = scheduled -> sub_category_number;
+ new_sch -> budgetary_number = scheduled -> budgetary_number;
+ new_sch -> sub_budgetary_number = scheduled -> sub_budgetary_number;
+ new_sch -> notes = g_strdup ( scheduled -> notes );
+
+ new_sch -> frequency = scheduled -> frequency;
+ new_sch -> user_interval = scheduled -> user_interval;
+ new_sch -> user_entry = scheduled -> user_entry;
+ if ( g_date_valid ( scheduled -> limit_date ) )
+ new_sch -> limit_date = gsb_date_copy ( scheduled -> limit_date );
+ else
+ new_sch -> limit_date = NULL;
+
+ new_sch -> mother_row = scheduled -> mother_row;
+
+ return new_sch;
+}
+/**
+ *
+ *
+ *
+ *
+ * */
+gboolean bet_data_future_remove_line ( gint account_number, gint number )
+{
+ GHashTableIter iter;
+ gpointer key, value;
+
+ g_hash_table_iter_init ( &iter, bet_future_list );
+ while (g_hash_table_iter_next ( &iter, &key, &value ) )
+ {
+ struct_futur_data *scheduled = ( struct_futur_data *) value;
+
+ if ( account_number != scheduled -> account_number
+ ||
+ number != scheduled -> number)
+ continue;
+
+ g_hash_table_iter_remove ( &iter );
+
+ break;
+ }
+
+ if ( etat.modification_fichier == 0 )
+ modification_fichier ( TRUE );
+
+ return FALSE;
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
+gboolean bet_data_future_remove_lines ( gint account_number,
+ gint number,
+ gint mother_row )
+{
+ GHashTableIter iter;
+ gpointer key, value;
+
+ g_hash_table_iter_init ( &iter, bet_future_list );
+ while (g_hash_table_iter_next ( &iter, &key, &value ) )
+ {
+ struct_futur_data *scheduled = ( struct_futur_data *) value;
+
+ if ( account_number != scheduled -> account_number )
+ continue;
+
+ if ( number == scheduled -> number )
+ g_hash_table_iter_remove ( &iter );
+ else if ( number == scheduled -> mother_row )
+ g_hash_table_iter_remove ( &iter );
+ else if ( mother_row > 0 && mother_row == scheduled -> number )
+ g_hash_table_iter_remove ( &iter );
+ else if ( mother_row > 0 && mother_row == scheduled -> mother_row )
+ g_hash_table_iter_remove ( &iter );
+ }
+
+ if ( etat.modification_fichier == 0 )
+ modification_fichier ( TRUE );
+
+ return FALSE;
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
/* Local Variables: */
/* c-basic-offset: 4 */
/* End: */
Index: balance_estimate_tab.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- balance_estimate_tab.c 23 Mar 2010 22:15:21 -0000 1.57
+++ balance_estimate_tab.c 28 Mar 2010 14:40:28 -0000 1.58
@@ -88,12 +88,18 @@
static void bet_array_list_context_menu ( GtkWidget *tree_view );
static void bet_array_list_delete_menu ( GtkWidget *menu_item,
GtkTreeSelection *tree_selection );
+static void bet_array_list_delete_all_menu ( GtkWidget *menu_item,
+ GtkTreeSelection *tree_selection );
static void bet_array_list_insert_menu ( GtkWidget *menu_item,
GtkTreeSelection *tree_selection );
static void bet_array_list_redo_menu ( GtkWidget *menu_item,
GtkTreeSelection *tree_selection );
static gboolean bet_array_list_set_background_color ( GtkWidget *tree_view );
+void bet_array_list_traite_double_click ( GtkTreeView *tree_view );
static void bet_array_list_update_balance ( GtkTreeModel *model );
+static gboolean bet_array_refresh_futur_data ( GtkTreeModel *tab_model,
+ GDate *date_min,
+ GDate *date_max );
static void bet_array_refresh_scheduled_data ( GtkTreeModel *tab_model,
gint selected_account,
GDate *date_min,
@@ -119,6 +125,7 @@
extern gchar* bet_duration_array[];
extern GdkColor couleur_fond[0];
extern GdkColor couleur_bet_division;
+extern GdkColor couleur_bet_future;
extern GtkWidget *notebook_general;
extern gsb_real null_real;
extern GtkWidget *window;
@@ -299,7 +306,7 @@
//~ devel_debug (NULL);
notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
- tmp_range = initialise_struct_bet_range ( );
+ tmp_range = struct_initialise_bet_range ( );
/* find the selected account */
account_nb = gsb_gui_navigation_get_current_account ( );
@@ -401,6 +408,9 @@
/* search data from the past */
bet_historical_refresh_data ( tree_model, date_min, date_max );
+
+ /* search data from the futur */
+ bet_array_refresh_futur_data ( tree_model, date_min, date_max );
/* search transactions of the account which are in the period */
bet_array_refresh_transactions_data ( tree_model,
@@ -477,8 +487,6 @@
gtk_box_pack_start( GTK_BOX ( hbox ), label, FALSE, FALSE, 5);
spin_button = gtk_spin_button_new_with_range ( 1.0, 240.0, 1.0);
- gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( spin_button ), 1.0 );
- gtk_widget_grab_focus ( spin_button );
gtk_box_pack_start ( GTK_BOX ( hbox ), spin_button, FALSE, FALSE, 5 );
@@ -585,7 +593,6 @@
gtk_tree_view_column_set_alignment ( column, 0.5 );
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view),
GTK_TREE_VIEW_COLUMN(column));
- //~ gtk_tree_view_column_set_min_width(GTK_TREE_VIEW_COLUMN(column), 150);
gtk_tree_view_column_set_resizable ( column, TRUE );
/* Description column */
@@ -597,7 +604,6 @@
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW ( tree_view ),
GTK_TREE_VIEW_COLUMN ( column ) );
- //~ gtk_tree_view_column_set_min_width (column, 300 );
gtk_tree_view_column_set_expand ( GTK_TREE_VIEW_COLUMN ( column ), TRUE );
gtk_tree_view_column_set_resizable ( column, TRUE );
@@ -610,7 +616,6 @@
NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view),
GTK_TREE_VIEW_COLUMN(column));
- //~ gtk_tree_view_column_set_min_width(column, 140);
g_object_set(G_OBJECT(GTK_CELL_RENDERER(cell)), "xalign", 1.0, NULL );
gtk_tree_view_column_set_alignment(column, 1);
gtk_tree_view_column_set_expand(GTK_TREE_VIEW_COLUMN(column), FALSE);
@@ -626,7 +631,6 @@
NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view),
GTK_TREE_VIEW_COLUMN(column));
- //~ gtk_tree_view_column_set_min_width(column, 140);
g_object_set(G_OBJECT(GTK_CELL_RENDERER(cell)), "xalign", 1.0, NULL );
gtk_tree_view_column_set_alignment ( column, 1 );
gtk_tree_view_column_set_expand(GTK_TREE_VIEW_COLUMN(column), FALSE);
@@ -640,9 +644,8 @@
"foreground", SPP_ESTIMATE_TREE_BALANCE_COLOR,
"cell-background-gdk", SPP_ESTIMATE_TREE_BACKGROUND_COLOR,
NULL);
- gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view),
+ gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view ),
GTK_TREE_VIEW_COLUMN(column));
- //~ gtk_tree_view_column_set_min_width(column, 170);
g_object_set(G_OBJECT(GTK_CELL_RENDERER(cell)), "xalign", 1.0, NULL );
gtk_tree_view_column_set_alignment(column, 1);
gtk_tree_view_column_set_expand(GTK_TREE_VIEW_COLUMN(column), FALSE);
@@ -652,6 +655,10 @@
G_CALLBACK ( bet_array_list_button_press ),
NULL );
+ gtk_widget_grab_focus ( tree_view );
+ gtk_tree_selection_select_path ( gtk_tree_view_get_selection ( GTK_TREE_VIEW ( tree_view ) ),
+ gtk_tree_path_new_from_string ( "0" ) );
+
gtk_widget_show_all ( page );
return page;
@@ -673,7 +680,7 @@
GSList* tmp_list;
//~ devel_debug (NULL);
- tmp_list = gsb_data_scheduled_get_scheduled_list();
+ tmp_list = gsb_data_scheduled_get_scheduled_list ( );
while (tmp_list)
{
@@ -764,7 +771,7 @@
* in the range from date_min (today) to date_max */
date = gsb_data_scheduled_get_date ( scheduled_number );
- while (date != NULL && g_date_valid ( date ) )
+ while ( date != NULL && g_date_valid ( date ) )
{
if ( g_date_compare ( date, date_max ) > 0 )
break;
@@ -777,9 +784,9 @@
return;
str_date = gsb_format_gdate ( date );
- g_value_init ( &date_value, G_TYPE_DATE );
if ( date == NULL )
return;
+ g_value_init ( &date_value, G_TYPE_DATE );
g_value_set_boxed ( &date_value, date );
/* add a line in the estimate array */
@@ -965,7 +972,7 @@
*
*
* */
-void bet_array_list_add_new_line ( GtkTreeModel *tab_model,
+void bet_array_list_add_new_hist_line ( GtkTreeModel *tab_model,
GtkTreeModel *model,
GtkTreeIter *iter,
GDate *date_min,
@@ -1006,7 +1013,7 @@
amount = gsb_real_get_from_string ( str_amount );
- if (amount.mantissa < 0)
+ if ( amount.mantissa < 0 )
str_debit = gsb_real_get_string_with_currency ( gsb_real_opposite ( amount ),
bet_data_get_selected_currency ( ), TRUE );
else
@@ -1066,6 +1073,95 @@
/**
+ * Ajoute la ligne future au tableau des résultats
+ *
+ *
+ *
+ * */
+gboolean bet_array_refresh_futur_data ( GtkTreeModel *tab_model,
+ GDate *date_min,
+ GDate *date_max )
+{
+ GHashTable *future_list;
+ GHashTableIter iter;
+ gpointer key, value;
+ GtkTreeIter tab_iter;
+ GValue date_value = {0, };
+ gchar *str_date;
+ gchar *str_description;
+ gchar *str_debit = NULL;
+ gchar *str_credit = NULL;
+ gchar *str_amount;
+ gint account_number;
+
+ devel_debug (NULL);
+
+ account_number = gsb_gui_navigation_get_current_account ( );
+ future_list = bet_data_future_get_list ( );
+
+ g_hash_table_iter_init ( &iter, future_list );
+ while ( g_hash_table_iter_next ( &iter, &key, &value ) )
+ {
+ struct_futur_data *scheduled = ( struct_futur_data *) value;
+
+ if ( account_number != scheduled -> account_number )
+ continue;
+
+ str_description = g_strdup ( scheduled -> notes );
+
+ if ( !str_description || !strlen ( str_description ) )
+ str_description = g_strdup ( gsb_data_payee_get_name (
+ scheduled -> party_number, FALSE ) );
+
+ str_amount = gsb_real_save_real_to_string ( scheduled -> amount, 2 );
+ if ( scheduled -> amount.mantissa < 0 )
+ str_debit = gsb_real_get_string_with_currency ( gsb_real_opposite (
+ scheduled -> amount ),
+ bet_data_get_selected_currency ( ), TRUE );
+ else
+ str_credit = gsb_real_get_string_with_currency ( scheduled -> amount,
+ bet_data_get_selected_currency ( ), TRUE );;
+
+ if ( g_date_compare ( scheduled -> date, date_max ) > 0 )
+ break;
+ if ( g_date_compare ( scheduled -> date, date_min ) < 0 )
+ break;
+
+ str_date = gsb_format_gdate ( scheduled -> date );
+
+ g_value_init ( &date_value, G_TYPE_DATE );
+ g_value_set_boxed ( &date_value, scheduled -> date );
+
+ /* add a line in the estimate array */
+ gtk_tree_store_append ( GTK_TREE_STORE ( tab_model ), &tab_iter, NULL );
+ gtk_tree_store_set_value ( GTK_TREE_STORE ( tab_model ), &tab_iter,
+ SPP_ESTIMATE_TREE_SORT_DATE_COLUMN,
+ &date_value );
+ gtk_tree_store_set ( GTK_TREE_STORE ( tab_model ), &tab_iter,
+ SPP_ESTIMATE_TREE_ORIGIN_DATA, SPP_ORIGIN_FUTURE,
+ SPP_ESTIMATE_TREE_DIVISION_COLUMN, scheduled -> number,
+ SPP_ESTIMATE_TREE_SUB_DIV_COLUMN, scheduled -> mother_row,
+ SPP_ESTIMATE_TREE_DATE_COLUMN, str_date,
+ SPP_ESTIMATE_TREE_DESC_COLUMN, str_description,
+ SPP_ESTIMATE_TREE_DEBIT_COLUMN, str_debit,
+ SPP_ESTIMATE_TREE_CREDIT_COLUMN, str_credit,
+ SPP_ESTIMATE_TREE_AMOUNT_COLUMN, str_amount,
+ -1);
+
+ g_value_unset ( &date_value );
+ g_free ( str_date );
+ g_free ( str_description );
+ g_free ( str_amount );
+ if ( str_debit )
+ g_free ( str_debit );
+ if ( str_credit )
+ g_free ( str_credit );
+ }
+ return FALSE;
+}
+
+
+/**
* called when we press a button on the list
*
* \param tree_view
@@ -1079,6 +1175,8 @@
/* show the popup */
if ( ev -> button == RIGHT_BUTTON )
bet_array_list_context_menu ( tree_view );
+ if ( ev -> type == GDK_2BUTTON_PRESS )
+ bet_array_list_traite_double_click ( GTK_TREE_VIEW ( tree_view ) );
return FALSE;
}
@@ -1141,19 +1239,22 @@
gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), menu_item );
- /* Separator */
- gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), gtk_separator_menu_item_new ( ) );
- gtk_widget_show ( menu_item );
+ if ( g_date_compare ( date, date_jour ) > 0 )
+ {
+ /* Separator */
+ gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), gtk_separator_menu_item_new ( ) );
+ gtk_widget_show ( menu_item );
- menu_item = gtk_image_menu_item_new_with_label ( _("Insert Row") );
- gtk_image_menu_item_set_image ( GTK_IMAGE_MENU_ITEM ( menu_item ),
+ menu_item = gtk_image_menu_item_new_with_label ( _("Insert Row") );
+ gtk_image_menu_item_set_image ( GTK_IMAGE_MENU_ITEM ( menu_item ),
gtk_image_new_from_stock ( GTK_STOCK_ADD,
GTK_ICON_SIZE_MENU ) );
- g_signal_connect ( G_OBJECT ( menu_item ),
+ g_signal_connect ( G_OBJECT ( menu_item ),
"activate",
G_CALLBACK ( bet_array_list_insert_menu ),
tree_selection );
- gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), menu_item );
+ gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), menu_item );
+ }
/* Delete item */
switch ( origine )
@@ -1174,7 +1275,6 @@
}
break;
case SPP_ORIGIN_HISTORICAL:
- case SPP_ORIGIN_FUTURE:
menu_item = gtk_image_menu_item_new_with_label ( _("Delete selection") );
gtk_image_menu_item_set_image ( GTK_IMAGE_MENU_ITEM ( menu_item ),
gtk_image_new_from_stock ( GTK_STOCK_DELETE,
@@ -1185,6 +1285,28 @@
tree_selection );
gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), menu_item );
break;
+ case SPP_ORIGIN_FUTURE:
+ menu_item = gtk_image_menu_item_new_with_label ( _("Delete selection") );
+ gtk_image_menu_item_set_image ( GTK_IMAGE_MENU_ITEM ( menu_item ),
+ gtk_image_new_from_stock ( GTK_STOCK_DELETE,
+ GTK_ICON_SIZE_MENU ) );
+ g_signal_connect ( G_OBJECT ( menu_item ),
+ "activate",
+ G_CALLBACK ( bet_array_list_delete_menu ),
+ tree_selection );
+ gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), menu_item );
+
+ menu_item = gtk_image_menu_item_new_with_label (
+ _("Delete all occurences of the selection") );
+ gtk_image_menu_item_set_image ( GTK_IMAGE_MENU_ITEM ( menu_item ),
+ gtk_image_new_from_stock ( GTK_STOCK_DELETE,
+ GTK_ICON_SIZE_MENU ) );
+ g_signal_connect ( G_OBJECT ( menu_item ),
+ "activate",
+ G_CALLBACK ( bet_array_list_delete_all_menu ),
+ tree_selection );
+ gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), menu_item );
+ break;
}
/* Separator */
@@ -1251,19 +1373,61 @@
GtkWidget *notebook;
GtkTreeModel *model;
GtkTreeIter iter;
+ gint origine;
+ gint number;
if ( !gtk_tree_selection_get_selected ( GTK_TREE_SELECTION ( tree_selection ),
&model, &iter ) )
return;
+ gtk_tree_model_get ( GTK_TREE_MODEL ( model ), &iter,
+ SPP_ESTIMATE_TREE_ORIGIN_DATA, &origine,
+ SPP_ESTIMATE_TREE_DIVISION_COLUMN, &number,
+ -1 );
+
notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
tree_view = g_object_get_data ( G_OBJECT ( notebook), "bet_estimate_treeview");
gtk_tree_store_remove ( GTK_TREE_STORE ( model ), &iter );
+ if ( origine == SPP_ORIGIN_FUTURE )
+ bet_data_future_remove_line ( gsb_gui_navigation_get_current_account ( ), number );
bet_array_list_set_background_color ( tree_view );
bet_array_list_update_balance ( model );
}
+/**
+ * delete all occurences of future data row
+ *
+ * /param menu item
+ * /param row selected
+ *
+ * */
+void bet_array_list_delete_all_menu ( GtkWidget *menu_item,
+ GtkTreeSelection *tree_selection )
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gint origine;
+ gint number;
+ gint mother_row;
+
+ if ( !gtk_tree_selection_get_selected ( GTK_TREE_SELECTION ( tree_selection ),
+ &model, &iter ) )
+ return;
+
+ gtk_tree_model_get ( GTK_TREE_MODEL ( model ), &iter,
+ SPP_ESTIMATE_TREE_ORIGIN_DATA, &origine,
+ SPP_ESTIMATE_TREE_DIVISION_COLUMN, &number,
+ SPP_ESTIMATE_TREE_SUB_DIV_COLUMN, &mother_row,
+ -1 );
+
+ if ( origine == SPP_ORIGIN_FUTURE )
+ bet_data_future_remove_lines ( gsb_gui_navigation_get_current_account ( ),
+ number, mother_row );
+
+ bet_array_refresh_estimate_tab ( );
+}
+
/**
* insert a row
@@ -1291,7 +1455,7 @@
notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
tree_view = g_object_get_data ( G_OBJECT ( notebook), "bet_estimate_treeview");
- bet_future_new_line_dialog ( tree_view, model, str_date );
+ bet_future_new_line_dialog ( model, str_date );
bet_array_list_set_background_color ( tree_view );
bet_array_list_update_balance ( model );
}
@@ -1470,7 +1634,7 @@
SPP_ESTIMATE_TREE_AMOUNT_COLUMN, &str_current_balance, -1 );
current_balance = gsb_real_get_from_string ( str_current_balance );
- tmp_range = initialise_struct_bet_range ( );
+ tmp_range = struct_initialise_bet_range ( );
tmp_range -> first_pass = TRUE;
tmp_range -> current_balance = current_balance;
@@ -1556,30 +1720,39 @@
if ( gtk_tree_model_get_iter_first ( GTK_TREE_MODEL ( model ), &iter ) )
{
- gint div_number = 0;
- gint sub_div_number;
+ gint origine;
gint current_color = 0;
do
{
gtk_tree_model_get ( GTK_TREE_MODEL ( model ),
&iter,
- SPP_ESTIMATE_TREE_DIVISION_COLUMN, &div_number,
- SPP_ESTIMATE_TREE_SUB_DIV_COLUMN, &sub_div_number,
+ SPP_ESTIMATE_TREE_ORIGIN_DATA, &origine,
-1 );
- if ( div_number == 0 )
+ switch ( origine )
{
+ case SPP_ORIGIN_TRANSACTION:
+ case SPP_ORIGIN_SCHEDULED:
+
gtk_tree_store_set ( GTK_TREE_STORE ( model ),
&iter,
SPP_ESTIMATE_TREE_BACKGROUND_COLOR, &couleur_fond[current_color],
-1 );
current_color = !current_color;
- }
- else
+ break;
+ case SPP_ORIGIN_HISTORICAL:
gtk_tree_store_set ( GTK_TREE_STORE ( model ),
&iter,
SPP_ESTIMATE_TREE_BACKGROUND_COLOR, &couleur_bet_division,
-1 );
+ break;
+ case SPP_ORIGIN_FUTURE:
+ gtk_tree_store_set ( GTK_TREE_STORE ( model ),
+ &iter,
+ SPP_ESTIMATE_TREE_BACKGROUND_COLOR, &couleur_bet_future,
+ -1 );
+ break;
+ }
}
while ( gtk_tree_model_iter_next ( GTK_TREE_MODEL ( model ), &iter ) );
}
@@ -1687,6 +1860,27 @@
*
*
* */
+void bet_array_list_traite_double_click ( GtkTreeView *tree_view )
+{
+//~ printf ("bet_array_list_traite_double_click\n");
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ selection = gtk_tree_view_get_selection ( tree_view );
+ if ( selection && !gtk_tree_selection_get_selected ( selection, &model, &iter ) )
+ return;
+
+
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
/* Local Variables: */
/* c-basic-offset: 4 */
/* End: */
Index: balance_estimate_future.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_future.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- balance_estimate_future.c 23 Mar 2010 22:15:21 -0000 1.4
+++ balance_estimate_future.c 28 Mar 2010 14:40:28 -0000 1.5
@@ -86,16 +86,20 @@
gpointer null );
static GtkWidget *bet_form_scheduler_get_element_widget ( gint element_number );
static GtkWidget *bet_form_widget_get_widget ( gint element_number );
-static gboolean bet_future_add_a_new_line_in_bet_array ( GtkWidget *tree_view,
- GtkTreeModel *tab_model,
- GtkWidget *dialog );
+static gboolean bet_future_get_budget_data ( GtkWidget *widget,
+ gint budget_type,
+ struct_futur_data *scheduled );
+static gboolean bet_future_get_category_data ( GtkWidget *widget,
+ gint budget_type,
+ struct_futur_data *scheduled );
+static gboolean bet_future_take_data_from_form ( GtkWidget *dialog,
+ struct_futur_data *scheduled );
/*END_STATIC*/
/*START_EXTERN*/
extern gboolean balances_with_scheduled;
extern gchar* bet_duration_array[];
extern GdkColor couleur_fond[0];
-extern GdkColor couleur_bet_division;
extern GtkWidget *notebook_general;
extern gsb_real null_real;
extern GtkWidget *window;
@@ -121,79 +125,7 @@
*
*
* */
-GtkWidget *bet_future_create_page ( void )
-{
- GtkWidget *notebook;
- GtkWidget *page;
- //~ GtkWidget *widget = NULL;
- //~ GtkWidget *initial_date = NULL;
- //~ GtkWidget *hbox;
- GtkWidget *align;
- GtkWidget *label;
- //~ GtkWidget *spin_button = NULL;
- //~ GtkWidget *previous = NULL;
- //~ GtkWidget *scrolled_window;
- //~ GtkWidget *tree_view;
- //~ GtkTreeStore *tree_model;
- //~ GtkTreeModel *sortable;
- //~ GtkCellRenderer *cell;
- //~ GtkTreeViewColumn *column;
- //~ gint iduration;
-
- devel_debug (NULL);
- notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
- page = gtk_vbox_new ( FALSE, 5 );
- gtk_widget_set_name ( page, "bet_future_page" );
-
- /* create the title */
- align = gtk_alignment_new (0.5, 0.0, 0.0, 0.0);
- gtk_box_pack_start ( GTK_BOX ( page ), align, FALSE, FALSE, 5) ;
-
- label = gtk_label_new ("Future data");
- gtk_container_add ( GTK_CONTAINER ( align ), label );
- g_object_set_data ( G_OBJECT ( notebook ), "bet_future_title", label );
-
-
- gtk_widget_show_all ( page );
-
- return page;
-}
-
-
-/**
- *
- *
- *
- *
- * */
-gboolean bet_future_configure_form_to_future ( void )
-{
- //~ gtk_widget_show (form_scheduled_part);
-
- return TRUE;
-}
-/**
- *
- *
- *
- *
- * */
-gboolean bet_future_configure_form_to_transaction ( void )
-{
- //~ gtk_widget_hide (form_scheduled_part);
-
- return TRUE;
-}
-
-
-/**
- *
- *
- *
- *
- * */
-gboolean bet_future_new_line_dialog ( GtkWidget *tree_view,
- GtkTreeModel *tab_model,
+gboolean bet_future_new_line_dialog ( GtkTreeModel *tab_model,
gchar *str_date )
{
GtkWidget *widget;
@@ -233,13 +165,20 @@
gtk_widget_show ( vbox );
}
else
+ {
+ bet_form_clean ( gsb_gui_navigation_get_current_account ( ) );
gtk_widget_show ( bet_dialog );
+ }
/* init data */
+
widget = bet_form_widget_get_widget ( TRANSACTION_FORM_DATE );
date = gsb_parse_date_string ( str_date );
if ( g_date_valid ( date ) )
+ {
+ gsb_form_widget_set_empty ( widget, FALSE );
gsb_calendar_entry_set_date ( widget, date );
+ }
gtk_dialog_set_response_sensitive ( GTK_DIALOG ( bet_dialog ), GTK_RESPONSE_OK, FALSE );
@@ -248,15 +187,26 @@
if ( result == GTK_RESPONSE_OK )
{
- if ( bet_future_add_a_new_line_in_bet_array ( tree_view,
- tab_model,
- bet_dialog ) == 0 )
+ struct_futur_data *scheduled;
+
+ scheduled = struct_initialise_bet_future ( );
+
+ if ( !scheduled )
{
- tmp_str = g_strdup ( _("Error: the periodicity defined by the user is not filled in.") );
+ dialogue_error_memory ();
+ gtk_widget_hide ( bet_dialog );
+ return FALSE;
+ }
+
+ if ( bet_future_take_data_from_form ( bet_dialog, scheduled ) == FALSE )
+ {
+ tmp_str = g_strdup ( _("Error: the frequency defined by the user or the amount is "
+ "not specified or the date is invalid.") );
dialogue_warning_hint ( tmp_str, _("One field is not filled in") );
g_free ( tmp_str );
goto dialog_return;
}
+ bet_array_refresh_estimate_tab ( );
}
gtk_widget_hide ( bet_dialog );
@@ -613,7 +563,7 @@
row, row+1,
gsb_form_get_element_expandable ( element_number ),
gsb_form_get_element_expandable ( element_number ),
- 0, 0);
+ 0, 2);
element = g_malloc0 ( sizeof ( struct_element ) );
element -> element_number = element_number;
element -> element_widget = widget;
@@ -731,8 +681,6 @@
/* set the combo_box on 'Automatic' */
gsb_fyear_set_combobox_history ( element -> element_widget, 0 );
- gtk_widget_set_sensitive ( GTK_WIDGET ( element -> element_widget ),
- FALSE );
break;
case TRANSACTION_FORM_PARTY:
@@ -780,8 +728,6 @@
case TRANSACTION_FORM_TYPE:
gsb_payment_method_set_combobox_history ( element -> element_widget,
gsb_data_account_get_default_debit (account_number));
- gtk_widget_set_sensitive ( GTK_WIDGET ( element -> element_widget ),
- FALSE );
break;
}
@@ -1269,27 +1215,22 @@
/**
- *
+ * récupère les données du formulaire
*
*
*
* */
-gboolean bet_future_add_a_new_line_in_bet_array ( GtkWidget *tree_view,
- GtkTreeModel *tab_model,
- GtkWidget *dialog )
+gboolean bet_future_take_data_from_form ( GtkWidget *dialog,
+ struct_futur_data *scheduled )
{
GtkWidget *widget;
- struct_scheduled *scheduled;
-
- scheduled = g_malloc0 ( sizeof ( struct_scheduled ) );
+ gint budget_type;
- if ( !scheduled )
- {
- dialogue_error_memory ();
- return FALSE;
- }
+ /* données liées au compte */
+ scheduled -> account_number = gsb_gui_navigation_get_current_account ( );
- widget = bet_form_scheduler_get_element_widget ( SCHEDULED_FORM_FREQUENCY_BUTTON ) ;
+ /* On traite les données de la planification */
+ widget = bet_form_scheduler_get_element_widget ( SCHEDULED_FORM_FREQUENCY_BUTTON );
scheduled -> frequency = gsb_combo_box_get_index ( widget );
switch ( scheduled -> frequency )
@@ -1327,15 +1268,165 @@
return FALSE;
}
-printf ("frequency = %d date_fin = %s user_frequency = %d user_frequency_button = %d\n",
- scheduled -> frequency,
- gsb_format_gdate (scheduled -> limit_date),
- scheduled -> user_entry,
- scheduled -> user_interval);
+ /* On traite les données de transaction */
+ widget = bet_form_widget_get_widget ( TRANSACTION_FORM_DATE );
+ if ( gsb_form_widget_check_empty( widget ) == FALSE )
+ {
+ GDate *date_jour;
+ date_jour = gdate_today ( );
+ scheduled -> date = gsb_calendar_entry_get_date ( widget );
+ if ( scheduled -> date == NULL
+ ||
+ g_date_compare ( date_jour, scheduled -> date ) > 0 )
+ return FALSE;
+ }
+ else
+ return FALSE;
+
+ widget = bet_form_widget_get_widget ( TRANSACTION_FORM_EXERCICE );
+ if ( gsb_form_widget_check_empty( widget ) == FALSE )
+ scheduled -> fyear_number = gsb_fyear_get_fyear_from_combobox ( widget,
+ scheduled -> date );
+ else
+ scheduled -> fyear_number = 0;
+
+ widget = bet_form_widget_get_widget ( TRANSACTION_FORM_PARTY );
+ if ( gsb_form_widget_check_empty ( widget ) == FALSE )
+ scheduled -> party_number = gsb_data_payee_get_number_by_name (
+ gtk_combofix_get_text ( GTK_COMBOFIX ( widget ) ), TRUE );
+ else
+ scheduled -> party_number = 0;
+
+ widget = bet_form_widget_get_widget ( TRANSACTION_FORM_DEBIT );
+ if ( gsb_form_widget_check_empty ( widget ) == FALSE )
+ {
+ gsb_form_check_auto_separator ( widget );
+ scheduled -> amount = gsb_real_opposite (
+ gsb_utils_edit_calculate_entry ( widget ) );
+ budget_type = 1;
+ }
+ else
+ {
+ widget = bet_form_widget_get_widget ( TRANSACTION_FORM_CREDIT );
+ if ( gsb_form_widget_check_empty ( widget ) == FALSE )
+ {
+ gsb_form_check_auto_separator ( widget );
+ scheduled -> amount = gsb_utils_edit_calculate_entry ( widget );
+ budget_type = 0;
+ }
+ else
+ return FALSE;
+ }
+
+ widget = bet_form_widget_get_widget ( TRANSACTION_FORM_TYPE );
+ if ( gsb_form_widget_check_empty( widget ) == FALSE )
+ scheduled -> payment_number =
+ gsb_payment_method_get_selected_number ( widget );
+ else
+ scheduled -> payment_number = 0;
+
+ widget = bet_form_widget_get_widget ( TRANSACTION_FORM_CATEGORY );
+ if ( gsb_form_widget_check_empty( widget ) == FALSE )
+ bet_future_get_category_data ( widget, budget_type, scheduled );
+ else
+ {
+ scheduled -> category_number = 0;
+ scheduled -> sub_category_number = 0;
+ }
+
+ widget = bet_form_widget_get_widget ( TRANSACTION_FORM_BUDGET );
+ if ( gsb_form_widget_check_empty( widget ) == FALSE )
+ bet_future_get_budget_data ( widget, budget_type, scheduled );
+ else
+ {
+ scheduled -> budgetary_number = 0;
+ scheduled -> sub_budgetary_number = 0;
+ }
+
+ widget = bet_form_widget_get_widget ( TRANSACTION_FORM_NOTES );
+ if ( gsb_form_widget_check_empty( widget ) == FALSE )
+ scheduled -> notes = g_strdup ( gtk_entry_get_text ( GTK_ENTRY ( widget ) ) );
+ else
+ scheduled -> notes = NULL;
+
+ bet_data_future_add_lines ( scheduled );
return TRUE;
}
+
+
+/**
+ * récupère l'imputation et la sous imputation budgétaire
+ *
+ *
+ * \return FALSE
+ * */
+gboolean bet_future_get_budget_data ( GtkWidget *widget,
+ gint budget_type,
+ struct_futur_data *scheduled )
+{
+ const gchar *string;
+ gchar **tab_char;
+
+ string = gtk_combofix_get_text ( GTK_COMBOFIX ( widget ) );
+ if ( string && strlen ( string ) > 0 )
+ {
+ tab_char = g_strsplit ( string, " : ", 2 );
+ scheduled -> budgetary_number = gsb_data_budget_get_number_by_name (
+ tab_char[0], TRUE, budget_type );
+
+ if ( tab_char[1] && strlen ( tab_char[1] ) )
+ scheduled -> sub_budgetary_number = gsb_data_budget_get_sub_budget_number_by_name (
+ scheduled -> budgetary_number, tab_char[1], TRUE );
+ else
+ scheduled -> sub_budgetary_number = 0;
+ }
+ else
+ {
+ scheduled -> budgetary_number = 0;
+ scheduled -> sub_budgetary_number = 0;
+ }
+
+ return FALSE;
+}
+
+
+/**
+ * récupère la catégorie et la sous catégorie
+ *
+ *
+ * \return FALSE
+ * */
+gboolean bet_future_get_category_data ( GtkWidget *widget,
+ gint budget_type,
+ struct_futur_data *scheduled )
+{
+ const gchar *string;
+ gchar **tab_char;
+
+ string = gtk_combofix_get_text ( GTK_COMBOFIX ( widget ) );
+ if ( string && strlen ( string ) > 0 )
+ {
+ tab_char = g_strsplit ( string, " : ", 2 );
+ scheduled -> category_number = gsb_data_category_get_number_by_name (
+ tab_char[0], TRUE, budget_type );
+
+ if ( tab_char[1] && strlen ( tab_char[1] ) )
+ scheduled -> sub_category_number =
+ gsb_data_category_get_sub_category_number_by_name (
+ scheduled -> category_number, tab_char[1], TRUE );
+ else
+ scheduled -> sub_category_number = 0;
+ }
+ else
+ {
+ scheduled -> category_number = 0;
+ scheduled -> category_number = 0;
+ }
+
+ return FALSE;
+}
/**
*
*
Index: gsb_form_scheduler.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form_scheduler.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- gsb_form_scheduler.c 23 Mar 2010 22:15:21 -0000 1.40
+++ gsb_form_scheduler.c 28 Mar 2010 14:40:29 -0000 1.41
@@ -55,12 +55,6 @@
/*END_INCLUDE*/
/*START_STATIC*/
-//~ static gboolean gsb_form_scheduler_button_press_event ( GtkWidget *entry,
- //~ GdkEventButton *ev,
- //~ gint *ptr_origin );
-//~ static gboolean gsb_form_scheduler_entry_lose_focus ( GtkWidget *entry,
- //~ GdkEventFocus *ev,
- //~ gint *ptr_origin );
static void gsb_form_scheduler_free_content_list ( GSList *content_list );
static gboolean gsb_form_scheduler_frequency_button_changed ( GtkWidget *combo_box,
gpointer null );
Index: balance_estimate_hist.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_hist.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- balance_estimate_hist.c 20 Mar 2010 18:37:31 -0000 1.19
+++ balance_estimate_hist.c 28 Mar 2010 14:40:28 -0000 1.20
@@ -255,7 +255,7 @@
if ( valeur == 1 )
{
//~ printf ("avant - account_nb = %d, div = %d, sub_div = %d\n", account_nb, div, sub_div);
- bet_data_add_div_hist ( account_nb, div_number, sub_div_nb );
+ bet_data_hist_add_div ( account_nb, div_number, sub_div_nb );
bet_data_set_div_amount ( account_nb, div_number, sub_div_nb,
gsb_real_import_from_string ( str_amount ) );
gtk_tree_store_set ( GTK_TREE_STORE ( model ), &iter,
@@ -408,7 +408,7 @@
tmp_str = gsb_real_get_string_with_currency ( number, currency_number, TRUE );
if ( bet_data_search_div_hist ( account_nb, div_number, sub_div_nb ) == FALSE )
- bet_data_add_div_hist ( account_nb, div_number, sub_div_nb );
+ bet_data_hist_add_div ( account_nb, div_number, sub_div_nb );
bet_data_set_div_edited ( account_nb, div_number, sub_div_nb, TRUE );
bet_data_set_div_amount ( account_nb, div_number, sub_div_nb, number );
@@ -688,7 +688,7 @@
list_div = g_hash_table_new_full ( g_str_hash,
g_str_equal,
(GDestroyNotify) g_free,
- (GDestroyNotify) free_struct_historical );
+ (GDestroyNotify) struct_free_bet_historical );
/* search transactions of the account */
tmp_list = gsb_data_transaction_get_complete_transactions_list ( );
@@ -821,7 +821,7 @@
||
g_hash_table_size ( sh -> list_sub_div ) <= 1 ) )
{
- retained = bet_data_get_div_amount ( account_nb, div_number, 0 );
+ retained = bet_data_hist_get_div_amount ( account_nb, div_number, 0 );
if ( str_amount )
g_free ( str_amount );
str_amount = gsb_real_save_real_to_string ( retained, 2 );
@@ -893,7 +893,7 @@
if ( bet_data_get_div_edited ( account_nb, div_number, sub_sh -> div ) )
{
//~ printf ("account_nb = %d div_number = %d sub_sh -> div = %d\n", account_nb, div_number, sub_sh -> div );
- retained = bet_data_get_div_amount ( account_nb, div_number, sub_sh -> div );
+ retained = bet_data_hist_get_div_amount ( account_nb, div_number, sub_sh -> div );
if ( str_amount )
g_free ( str_amount );
str_amount = gsb_real_save_real_to_string ( retained, 2 );
@@ -1070,7 +1070,7 @@
-1 );
if ( valeur == 1 )
{
- bet_array_list_add_new_line ( tab_model,
+ bet_array_list_add_new_hist_line ( tab_model,
GTK_TREE_MODEL ( model ), &iter,
date_min, date_max );
}
@@ -1087,7 +1087,7 @@
if ( valeur == 1 )
{
- bet_array_list_add_new_line ( tab_model,
+ bet_array_list_add_new_hist_line ( tab_model,
GTK_TREE_MODEL ( model ), &fils_iter,
date_min, date_max );
}
@@ -1163,7 +1163,7 @@
-1 );
retained = gsb_real_import_from_string ( str_amount );
- bet_data_add_div_hist ( account_nb, div_number, sub_div_nb );
+ bet_data_hist_add_div ( account_nb, div_number, sub_div_nb );
bet_data_set_div_amount ( account_nb, div_number, sub_div_nb,
gsb_real_import_from_string ( str_amount ) );
str_retained = gsb_real_get_string_with_currency ( retained,
@@ -1461,7 +1461,7 @@
tmp_str = gsb_real_get_string_with_currency ( amount, currency_number, TRUE );
//~ printf ("div = %d sub_div_nb = %d tmp_str = %s\n", div_number, sub_div_nb, tmp_str);
if ( bet_data_search_div_hist ( account_number, div_number, sub_div_nb ) == FALSE )
- bet_data_add_div_hist ( account_number, div_number, sub_div_nb );
+ bet_data_hist_add_div ( account_number, div_number, sub_div_nb );
bet_data_set_div_edited ( account_number, div_number, sub_div_nb, TRUE );
bet_data_set_div_amount ( account_number, div_number, sub_div_nb, amount );
- Previous message: [grisbi-cvs] grisbi/po cs.po, 1.103, 1.104 da.po, 1.109, 1.110 de.po, 1.183, 1.184 el.po, 1.73, 1.74 eo.po, 1.66, 1.67 es.po, 1.182, 1.183 fa.po, 1.96, 1.97 fr.po, 1.242, 1.243 grisbi.pot, 1.144, 1.145 he.po, 1.102, 1.103 it.po, 1.102, 1.103 nl.po, 1.101, 1.102 pl.po, 1.107, 1.108 pt_BR.po, 1.104, 1.105 ro.po, 1.103, 1.104 ru.po, 1.101, 1.102 zh_CN.po, 1.97, 1.98
- Next message: [grisbi-cvs] grisbi/src gsb_data_scheduled.c,1.32,1.33
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cvs
mailing list