[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_0_9_4-31-g27c4987
Pierre Biava
nobody at users.sourceforge.net
Tue Sep 27 21:03:42 CEST 2011
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grisbi".
The branch, master has been updated
via 27c4987b6d1c2ffbec164d8f1e23012f7524971f (commit)
from 4f2f3a3215e535b044b36e1d826edb4b6a431e6d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 27c4987b6d1c2ffbec164d8f1e23012f7524971f
Author: pbiava <pierre.biava at nerim.net>
Date: Tue Sep 27 21:01:01 2011 +0200
adding the daily balance even without transaction dated the day
-----------------------------------------------------------------------
Changes:
diff --git a/src/bet_graph.c b/src/bet_graph.c
index 6f9a8eb..cddbfb8 100644
--- a/src/bet_graph.c
+++ b/src/bet_graph.c
@@ -109,6 +109,7 @@ struct _struct_bet_graph_prefs
gint degrees; /* rotation des étiquettes de l'axe X en degrés. 90° par défaut */
gint gap_spinner; /* espace entre deux barres en %. 50 par défaut*/
gboolean before_grid; /* les étiquettes sont cachées par les barres par défaut */
+
};
@@ -674,7 +675,11 @@ gboolean bet_graph_populate_lines_by_forecast_data ( struct_bet_graph_data *self
gchar **tab_libelle_axe_x;
gdouble *tab_Y = self -> tab_Y;
gdouble montant = 0.;
+ GDate *first_date;
+ GDate *last_date;
+ GDate *date_courante;
GDateDay day_courant;
+ gint nbre_iterations;
tab_libelle_axe_x = &libelle_axe_x;
@@ -685,6 +690,8 @@ gboolean bet_graph_populate_lines_by_forecast_data ( struct_bet_graph_data *self
GValue date_value = {0,};
GDate *date;
GDateDay day;
+ gint diff_jours;
+ gint i;
gtk_tree_model_get_value ( model,
&iter,
@@ -693,7 +700,6 @@ gboolean bet_graph_populate_lines_by_forecast_data ( struct_bet_graph_data *self
gtk_tree_model_get ( GTK_TREE_MODEL( model ),
&iter,
SPP_ESTIMATE_TREE_AMOUNT_COLUMN, &amount,
- SPP_ESTIMATE_TREE_DATE_COLUMN, &str_date,
-1 );
date = g_value_get_boxed ( &date_value );
@@ -701,33 +707,72 @@ gboolean bet_graph_populate_lines_by_forecast_data ( struct_bet_graph_data *self
if ( self -> nbre_elemnts == 0 )
{
+ /* on ajoute 1 jour pour passer au 1er du mois */
g_date_add_days ( date, 1 );
+
+ /* on calcule le nombre maxi d'itération pour une année */
+ first_date = gsb_date_copy ( date );
+ last_date = gsb_date_copy ( date );
+ g_date_add_years ( last_date, 1 );
+ nbre_iterations = g_date_days_between ( first_date, last_date );
+
+ date_courante = gsb_date_copy ( date );
day_courant = g_date_get_day ( date );
+
+ str_date = gsb_format_gdate ( date_courante );
strncpy ( &libelle_axe_x[self -> nbre_elemnts * TAILLE_MAX_LIBELLE], str_date, TAILLE_MAX_LIBELLE );
+
self -> nbre_elemnts++;
+ g_free ( str_date );
+ g_date_free ( first_date );
+ g_date_free ( last_date );
}
else
{
day = g_date_get_day ( date );
if ( day != day_courant )
{
- strncpy ( &libelle_axe_x[self -> nbre_elemnts * TAILLE_MAX_LIBELLE], str_date, TAILLE_MAX_LIBELLE );
- tab_Y[self->nbre_elemnts-1] = prev_montant;
-
+ /* nombre de jours manquants */
+ diff_jours = g_date_days_between ( date_courante, date );
+ for ( i = diff_jours; i > 0; i-- )
+ {
+ g_date_add_days ( date_courante, 1 );
+ str_date = gsb_format_gdate ( date_courante );
+
+ strncpy ( &libelle_axe_x[self -> nbre_elemnts * TAILLE_MAX_LIBELLE],
+ str_date, TAILLE_MAX_LIBELLE );
+ tab_Y[self->nbre_elemnts-1] = prev_montant;
+ self -> nbre_elemnts++;
+
+ /* on dépasse d'un jour pour obtenir le solde du dernier jour */
+ if ( self -> nbre_elemnts > nbre_iterations )
+ {
+ self -> nbre_elemnts = nbre_iterations + 1;
+ break;
+ }
+
+ g_free ( str_date );
+ }
day_courant = day;
- self -> nbre_elemnts++;
}
}
-
prev_montant = montant;
- if ( self -> nbre_elemnts >= MAX_POINTS_GRAPHIQUE )
+ if ( self -> nbre_elemnts > nbre_iterations )
+ {
+ self -> nbre_elemnts = nbre_iterations;
+ dialogue_hint ( _("You can not exceed one year of visualization"), _("Overflow") );
+
break;
+ }
+
}
while ( gtk_tree_model_iter_next ( GTK_TREE_MODEL ( model ), &iter ) );
tab_Y[self->nbre_elemnts-1] = prev_montant;
+ g_date_free ( date_courante );
+
return TRUE;
}
diff --git a/src/bet_graph.h b/src/bet_graph.h
index 7c42d46..4fc1e1a 100644
--- a/src/bet_graph.h
+++ b/src/bet_graph.h
@@ -16,7 +16,7 @@
/* Definition du maximum de segments par camembert */
#define MAX_SEGMENT_CAMEMBERT 30
/* Definition du maximum de segments par camembert */
-#define MAX_POINTS_GRAPHIQUE 300
+#define MAX_POINTS_GRAPHIQUE 370
/* Definition de la taille maximum d'un libelle */
#define TAILLE_MAX_LIBELLE 50
hooks/post-receive
--
grisbi
More information about the cvs
mailing list