[grisbi-cvs] grisbi/src balance_estimate_tab.c, 1.25, 1.26 gsb_data_account.c, 1.94, 1.95 gsb_transactions_list.c, 1.192, 1.193 main.c, 1.159, 1.160
Pierre Biava
pbiava at users.sourceforge.net
Fri Jan 8 20:24:37 CET 2010
- Previous message: [grisbi-cvs] grisbi/po cs.po, 1.78, 1.79 da.po, 1.85, 1.86 de.po, 1.152, 1.153 el.po, 1.49, 1.50 eo.po, 1.42, 1.43 es.po, 1.145, 1.146 fa.po, 1.72, 1.73 fr.po, 1.214, 1.215 grisbi.pot, 1.120, 1.121 he.po, 1.78, 1.79 it.po, 1.78, 1.79 nl.po, 1.77, 1.78 pl.po, 1.83, 1.84 pt_BR.po, 1.80, 1.81 ro.po, 1.79, 1.80 ru.po, 1.77, 1.78 zh_CN.po, 1.73, 1.74
- Next message: [grisbi-cvs] grisbi/po es.po,1.146,1.147
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/grisbi/grisbi/src
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv1206/src
Modified Files:
balance_estimate_tab.c gsb_data_account.c
gsb_transactions_list.c main.c
Log Message:
Version test for detecting monetary parameters and the budget module. Remove the settings of the form by account
Index: gsb_transactions_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list.c,v
retrieving revision 1.192
retrieving revision 1.193
diff -u -d -r1.192 -r1.193
--- gsb_transactions_list.c 30 Dec 2009 18:35:27 -0000 1.192
+++ gsb_transactions_list.c 8 Jan 2010 19:24:35 -0000 1.193
@@ -180,24 +180,24 @@
struct conditional_message delete_msg[] =
{
{ "delete-child-transaction", N_("Delete a child transaction."),
- N_(""),
+ NULL,
FALSE, FALSE, },
{ "delete-transaction", N_("Delete a transaction."),
- N_(""),
+ NULL,
FALSE, FALSE, },
{ "delete-child-scheduled", N_("Delete a child of scheduled transaction."),
- N_(""),
+ NULL,
FALSE, FALSE, },
{ "delete-scheduled", N_("Delete a scheduled transaction."),
- N_(""),
+ NULL,
FALSE, FALSE, },
{ "delete-scheduled-occurences", N_("Delete one or all occurences of scheduled "
"transaction."),
- N_(""),
+ NULL,
FALSE, FALSE, },
/*
Index: balance_estimate_tab.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- balance_estimate_tab.c 6 Jan 2010 22:17:45 -0000 1.25
+++ balance_estimate_tab.c 8 Jan 2010 19:24:34 -0000 1.26
@@ -110,6 +110,7 @@
};
struct bet_range
{
+ gboolean first_pass;
GDate min_date;
GDate max_date;
gsb_real min_balance;
@@ -502,52 +503,70 @@
GtkTreeIter *iter,
gpointer data )
{
- /* find the selected account */
+ GtkWidget* dialog;
+ GtkWidget *tree_view;
+ GtkTreeModel *tree_model;
GtkTreeIter iter_account;
- GtkWidget *tree_view = g_object_get_data (G_OBJECT(bet_container), "bet_account_treeview");
- GtkTreeModel *tree_model = gtk_tree_view_get_model(GTK_TREE_VIEW(tree_view));
- GtkTreeSelection* tree_selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view));
- if (!gtk_tree_selection_get_selected(GTK_TREE_SELECTION(tree_selection), &tree_model, &iter_account))
+ GtkTreeSelection* tree_selection;
+ gchar *account_name;
+ gchar *date = NULL;
+ gchar *str_balance = NULL;
+ gchar *tmp_str;
+ gint selected_account;
+ struct bet_range *tmp_range = (struct bet_range*) data;
+ gsb_real amount;
+
+ /* jump the line of the initial balance */
+ if ( tmp_range -> first_pass )
{
- GtkWidget* dialog = gtk_message_dialog_new (GTK_WINDOW(window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- "Please, select an account in the list !\n");
- gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_destroy(GTK_WIDGET(dialog));
- return FALSE;
+ tmp_range -> first_pass = FALSE;
+ return FALSE;
}
- gchar* account_name = NULL;
- gtk_tree_model_get (tree_model, &iter_account, 0, &account_name, -1);
- gint selected_account = gsb_data_account_get_no_account_by_name(account_name);
- g_assert(selected_account != -1);
-
- struct bet_range* tmp_range = (struct bet_range*)data;
+ /* find the selected account */
+ tree_view = g_object_get_data ( G_OBJECT ( bet_container ), "bet_account_treeview" );
+ tree_model = gtk_tree_view_get_model ( GTK_TREE_VIEW ( tree_view ) );
+ tree_selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW ( tree_view ) );
+ if ( !gtk_tree_selection_get_selected ( GTK_TREE_SELECTION ( tree_selection ),
+ &tree_model, &iter_account ) )
+ {
+ dialog = gtk_message_dialog_new ( GTK_WINDOW ( window ),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "Please, select an account in the list !\n" );
+ gtk_dialog_run ( GTK_DIALOG ( dialog ) );
+ gtk_widget_destroy ( GTK_WIDGET ( dialog ) );
+ return FALSE;
+ }
+
+ account_name = NULL;
+ gtk_tree_model_get ( tree_model, &iter_account, 0, &account_name, -1 );
+ selected_account = gsb_data_account_get_no_account_by_name ( account_name );
+ if ( selected_account == -1 )
+ return FALSE;
- gchar* date = NULL;
- gtk_tree_model_get(model, iter, SPP_ESTIMATE_TREE_DATE_COLUMN,
- &date, -1);
+ gtk_tree_model_get ( model, iter, SPP_ESTIMATE_TREE_DATE_COLUMN, &date, -1);
- gchar* str = NULL;
- gsb_real amount;
+ gtk_tree_model_get ( model, iter, SPP_ESTIMATE_TREE_AMOUNT_COLUMN, &tmp_str, -1 );
- gtk_tree_model_get ( model, iter, SPP_ESTIMATE_TREE_AMOUNT_COLUMN, &str, -1);
- amount = gsb_real_get_from_string(str);
+ amount = gsb_real_get_from_string ( tmp_str );
+
+ tmp_range->current_balance = gsb_real_add ( tmp_range->current_balance, amount );
+ str_balance = gsb_real_get_string_with_currency ( tmp_range->current_balance,
+ gsb_data_account_get_currency ( selected_account ), TRUE );
- tmp_range->current_balance = gsb_real_add(tmp_range->current_balance, amount);
- gchar* str_balance = gsb_real_get_string_with_currency (tmp_range->current_balance,
- gsb_data_account_get_currency (selected_account), TRUE);
- gtk_tree_store_set(GTK_TREE_STORE(model), iter,
- SPP_ESTIMATE_TREE_BALANCE_COLUMN, str_balance,
- -1);
- g_free(str_balance);
+ gtk_tree_store_set ( GTK_TREE_STORE ( model ),
+ iter,
+ SPP_ESTIMATE_TREE_BALANCE_COLUMN,
+ str_balance,
+ -1 );
+ g_free ( str_balance );
- if (gsb_real_cmp(tmp_range->min_balance, tmp_range->current_balance) > 0)
- tmp_range->min_balance = tmp_range->current_balance;
- if (gsb_real_cmp(tmp_range->max_balance, tmp_range->current_balance) < 0)
- tmp_range->max_balance = tmp_range->current_balance;
+ if ( gsb_real_cmp ( tmp_range->min_balance, tmp_range->current_balance ) > 0 )
+ tmp_range->min_balance = tmp_range->current_balance;
+ if ( gsb_real_cmp ( tmp_range->max_balance, tmp_range->current_balance ) < 0 )
+ tmp_range->max_balance = tmp_range->current_balance;
return FALSE;
}
@@ -605,6 +624,7 @@
gchar *str_date_max;
gchar *str_current_balance;
gchar *title;
+ gchar *tmp_str;
gint selected_account;
gint months;
GDate *date_min;
@@ -612,34 +632,40 @@
gsb_real current_balance;
GSList* tmp_list;
struct bet_range tmp_range;
+ GValue date_value = {0, };
- tree_view = g_object_get_data (G_OBJECT(bet_container), "bet_account_treeview");
- tree_model = gtk_tree_view_get_model(GTK_TREE_VIEW(tree_view));
- tree_selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view));
+ tree_view = g_object_get_data ( G_OBJECT ( bet_container ), "bet_account_treeview" );
+ tree_model = gtk_tree_view_get_model ( GTK_TREE_VIEW ( tree_view ) );
+ tree_selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW ( tree_view ) );
- if (!gtk_tree_selection_get_selected(GTK_TREE_SELECTION(tree_selection), &tree_model, &iter))
+ if ( !gtk_tree_selection_get_selected ( GTK_TREE_SELECTION ( tree_selection ),
+ &tree_model, &iter ) )
{
/* no selection, select the first account
* (no warning here because cause a conflict with the tree of navigation */
- gtk_notebook_set_current_page ( GTK_NOTEBOOK (bet_container), 0 );
+ gtk_notebook_set_current_page ( GTK_NOTEBOOK ( bet_container ), 0 );
return;
}
- gtk_tree_model_get (tree_model, &iter, 0, &account_name, -1);
+ gtk_tree_model_get ( tree_model, &iter, 0, &account_name, -1 );
selected_account = gsb_data_account_get_no_account_by_name ( account_name );
if ( selected_account == -1 )
return;;
/* calculatextern gboolean balances_with_scheduled;e date_max with user choice */
- data = g_object_get_data(G_OBJECT(bet_container), "bet_months");
- months = ( data ) ? GPOINTER_TO_INT(data): 1;
+ data = g_object_get_data ( G_OBJECT ( bet_container ), "bet_months" );
+ months = ( data ) ? GPOINTER_TO_INT ( data ): 1;
date_min = gdate_today ();
date_max = gdate_today ();
g_date_add_months (date_max, months );
/* set the graph title and the array title */
- str_date_min = gsb_format_gdate (date_min);
+ str_date_min = gsb_format_gdate ( date_min );
+ g_value_init ( &date_value, G_TYPE_DATE );
+ g_value_set_boxed ( &date_value, date_min );
+
str_date_max = gsb_format_gdate (date_max);
+
/* current balance may be in the future if there are transactions
* in the future in the account. So we need to calculate the balance
* of today */
@@ -652,11 +678,8 @@
gsb_data_account_get_currency ( selected_account ), TRUE );
title = g_strdup_printf (
- _("Balance estimate of the account \"%s\" from %s to %s "
- "balance beginning of period = %s"),
- account_name, str_date_min, str_date_max, str_current_balance );
- g_free(str_date_min);
- g_free(str_date_max);
+ _("Balance estimate of the account \"%s\" from %s to %s"),
+ account_name, str_date_min, str_date_max );
widget = GTK_WIDGET ( g_object_get_data ( G_OBJECT ( bet_container ), "bet_array_title") );
gtk_label_set_label ( GTK_LABEL ( widget ), title );
@@ -670,6 +693,32 @@
tree_model = gtk_tree_view_get_model ( GTK_TREE_VIEW ( tree_view ) );
gtk_tree_store_clear(GTK_TREE_STORE ( tree_model ) );
+ /* current balance may be in the future if there are transactions
+ * in the future in the account. So we need to calculate the balance
+ * of today */
+ if ( balances_with_scheduled )
+ current_balance = gsb_data_account_calculate_current_day_balance ( selected_account );
+ else
+ current_balance = gsb_data_account_get_current_balance ( selected_account );
+
+ str_current_balance = gsb_real_get_string_with_currency ( current_balance,
+ gsb_data_account_get_currency ( selected_account ), TRUE );
+
+ tmp_str = g_strdup ( _("balance beginning of period") );
+ gtk_tree_store_append ( GTK_TREE_STORE ( tree_model ), &iter, NULL );
+ gtk_tree_store_set_value (GTK_TREE_STORE ( tree_model ), &iter,
+ SPP_ESTIMATE_TREE_SORT_DATE_COLUMN,
+ &date_value);
+ gtk_tree_store_set(GTK_TREE_STORE(tree_model), &iter,
+ SPP_ESTIMATE_TREE_DATE_COLUMN, str_date_min,
+ SPP_ESTIMATE_TREE_DESC_COLUMN, tmp_str,
+ SPP_ESTIMATE_TREE_BALANCE_COLUMN, str_current_balance,
+ -1);
+
+ g_value_unset ( &date_value );
+ g_free(str_date_min);
+ g_free(str_date_max);
+
/* search transactions of the account which are in the future */
tmp_list = gsb_data_transaction_get_complete_transactions_list ( );
@@ -681,9 +730,10 @@
const gchar* str_description;
gchar* str_date;
gint transaction_number;
+ gint transfer_number;
gint account_number;
+ gint transfer_account_number;
const GDate *date;
- GValue date_value = {0, };
gsb_real amount;
transaction_number = gsb_data_transaction_get_transaction_number ( tmp_list->data );
@@ -693,14 +743,16 @@
if ( account_number != selected_account )
continue;
- /* ignore transaction which are before date_min (today) */
date = gsb_data_transaction_get_date ( transaction_number );
+ /* ignore transaction which are before date_min (today) */
if ( g_date_compare ( date, date_min ) <= 0 )
continue;
-
/* ignore transaction which are after date_max */
if ( g_date_compare (date, date_max ) > 0 )
continue;
+ str_date = gsb_format_gdate ( date );
+ g_value_init ( &date_value, G_TYPE_DATE );
+ g_value_set_boxed ( &date_value, date );
amount = gsb_data_transaction_get_amount ( transaction_number );
str_amount = gsb_real_get_string ( amount );
@@ -710,18 +762,28 @@
gsb_data_transaction_get_currency_number ( transaction_number), TRUE );
else
str_credit = gsb_real_get_string_with_currency ( gsb_real_abs ( amount ),
- gsb_data_transaction_get_currency_number (transaction_number), TRUE);
-
- /* TODO add something else if description is empty ( payee by example ) */
- str_description = gsb_data_transaction_get_notes ( transaction_number );
- str_date = gsb_format_gdate ( date );
+ gsb_data_transaction_get_currency_number (transaction_number), TRUE);
- if (!str_description || !strlen (str_description))
- str_description = gsb_data_payee_get_name (
- gsb_data_transaction_get_party_number ( transaction_number ), TRUE );
+ transfer_number =
+ gsb_data_transaction_get_contra_transaction_number (
+ transaction_number );
+ if ( transfer_number > 0 )
+ {
+ transfer_account_number = gsb_data_transaction_get_account_number (
+ transfer_number );
+ str_description = g_strdup_printf ( _("Transfer between account: %s\n"
+ "and account: %s"),
+ gsb_data_account_get_name ( account_number ),
+ gsb_data_account_get_name ( transfer_account_number ) );
+ }
+ else
+ {
+ str_description = gsb_data_transaction_get_notes ( transaction_number );
- g_value_init ( &date_value, G_TYPE_DATE );
- g_value_set_boxed ( &date_value, date );
+ if (!str_description || !strlen (str_description))
+ str_description = gsb_data_payee_get_name (
+ gsb_data_transaction_get_party_number ( transaction_number ), TRUE );
+ }
/* add a line in the estimate array */
gtk_tree_store_append ( GTK_TREE_STORE ( tree_model ), &iter, NULL );
@@ -756,8 +818,9 @@
const gchar *str_description;
gchar *str_date;
gint scheduled_number;
+ //~ gint transfer_number;
gint account_number;
- //~ gint transfer_account_number;
+ gint transfer_account_number;
GDate *date;
GValue date_value = {0, };
gsb_real amount;
@@ -771,13 +834,14 @@
/* ignore scheduled operations of other account */
account_number = gsb_data_scheduled_get_account_number ( scheduled_number );
- //~ transfer_account_number =
- //~ gsb_data_scheduled_get_account_number_transfer( scheduled_number );
+ if ( account_number != selected_account )
+ continue;
+
+ transfer_account_number =
+ gsb_data_scheduled_get_account_number_transfer ( scheduled_number );
//~ if ( account_number != selected_account &&
//~ transfer_account_number != selected_account)
//~ continue;
- if ( account_number != selected_account )
- continue;
str_description = gsb_data_scheduled_get_notes ( scheduled_number );
amount = gsb_data_scheduled_get_amount ( scheduled_number );
@@ -854,6 +918,7 @@
g_free ( date_max );
/* Calculate the balance column */
+ tmp_range.first_pass = TRUE;
tmp_range.min_date = *date_min;
tmp_range.max_date = *date_max;
tmp_range.min_balance = null_real;
Index: main.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/main.c,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -d -r1.159 -r1.160
--- main.c 6 Jan 2010 22:17:45 -0000 1.159
+++ main.c 8 Jan 2010 19:24:35 -0000 1.160
@@ -181,21 +181,21 @@
init_variables ();
register_import_formats ();
- //~ /* test locale pour les nombres */
- //~ struct lconv *conv = localeconv ( );
+ /* test locale pour les nombres */
+ struct lconv *conv = localeconv ( );
- //~ printf ("currency_symbol = %s\n"
- //~ "mon_thousands_sep = \"%s\"\n"
- //~ "mon_decimal_point = %s\n"
- //~ "positive_sign = \"%s\"\n"
- //~ "negative_sign = \"%s\"\n"
- //~ "frac_digits = \"%d\"\n",
- //~ conv->currency_symbol,
- //~ g_locale_to_utf8 ( conv->mon_thousands_sep, -1, NULL, NULL, NULL ),
- //~ g_locale_to_utf8 ( conv->mon_decimal_point, -1, NULL, NULL, NULL ),
- //~ g_locale_to_utf8 ( conv->positive_sign, -1, NULL, NULL, NULL ),
- //~ g_locale_to_utf8 ( conv->negative_sign, -1, NULL, NULL, NULL ),
- //~ conv->frac_digits );
+ printf ("currency_symbol = %s\n"
+ "mon_thousands_sep = \"%s\"\n"
+ "mon_decimal_point = %s\n"
+ "positive_sign = \"%s\"\n"
+ "negative_sign = \"%s\"\n"
+ "frac_digits = \"%d\"\n",
+ conv->currency_symbol,
+ g_locale_to_utf8 ( conv->mon_thousands_sep, -1, NULL, NULL, NULL ),
+ g_locale_to_utf8 ( conv->mon_decimal_point, -1, NULL, NULL, NULL ),
+ g_locale_to_utf8 ( conv->positive_sign, -1, NULL, NULL, NULL ),
+ g_locale_to_utf8 ( conv->negative_sign, -1, NULL, NULL, NULL ),
+ conv->frac_digits );
/* firt use ? */
if ( ! gsb_file_config_load_config () )
Index: gsb_data_account.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_account.c,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- gsb_data_account.c 6 Jan 2010 22:17:45 -0000 1.94
+++ gsb_data_account.c 8 Jan 2010 19:24:35 -0000 1.95
@@ -2686,8 +2686,8 @@
/**
- * calcule le solde du compte à la date à aujourd'hui.
- * exclut les transactions futures.
+ * Calculates the balance at the date today.
+ * Excludes future transactions.
*
*
* */
- Previous message: [grisbi-cvs] grisbi/po cs.po, 1.78, 1.79 da.po, 1.85, 1.86 de.po, 1.152, 1.153 el.po, 1.49, 1.50 eo.po, 1.42, 1.43 es.po, 1.145, 1.146 fa.po, 1.72, 1.73 fr.po, 1.214, 1.215 grisbi.pot, 1.120, 1.121 he.po, 1.78, 1.79 it.po, 1.78, 1.79 nl.po, 1.77, 1.78 pl.po, 1.83, 1.84 pt_BR.po, 1.80, 1.81 ro.po, 1.79, 1.80 ru.po, 1.77, 1.78 zh_CN.po, 1.73, 1.74
- Next message: [grisbi-cvs] grisbi/po es.po,1.146,1.147
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cvs
mailing list