mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
*** empty log message ***
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2170 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
15
ChangeLog
15
ChangeLog
@@ -1,3 +1,18 @@
|
||||
2000-04-09 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||
|
||||
* src/scm/prefs.scm: make the default field types be description
|
||||
and total
|
||||
|
||||
* src/gnome/window-main.c (gnc_configure_account_tree): set the
|
||||
state of the total field
|
||||
|
||||
* src/gnome/account-tree.c: add in the new total field
|
||||
|
||||
* src/gnome/dialog-utils.c: add the new account field key
|
||||
ACCOUNT_TOTAL. This key refers to the account's balance plus the
|
||||
balances of all children. The ACCOUNT_BALANCE key now refers to
|
||||
the balance of the account itself, without children.
|
||||
|
||||
2000-04-08 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||
|
||||
* src/scm/report/balance-and-pnl.scm: remove the report description.
|
||||
|
||||
@@ -131,6 +131,9 @@ gnc_account_tree_init(GNCAccountTree *tree)
|
||||
gtk_clist_set_column_justification(GTK_CLIST(tree),
|
||||
tree->balance_column,
|
||||
GTK_JUSTIFY_RIGHT);
|
||||
gtk_clist_set_column_justification(GTK_CLIST(tree),
|
||||
tree->total_column,
|
||||
GTK_JUSTIFY_RIGHT);
|
||||
|
||||
{
|
||||
GtkStyle *style = gtk_widget_get_style(GTK_WIDGET(tree));
|
||||
@@ -697,7 +700,7 @@ gnc_init_account_view_info(AccountViewInfo *avi)
|
||||
|
||||
avi->show_field[ACCOUNT_NAME] = GNC_T;
|
||||
avi->show_field[ACCOUNT_DESCRIPTION] = GNC_T;
|
||||
avi->show_field[ACCOUNT_BALANCE] = GNC_T;
|
||||
avi->show_field[ACCOUNT_TOTAL] = GNC_T;
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
@@ -736,6 +739,9 @@ gnc_account_tree_set_view_info_real(GNCAccountTree *tree)
|
||||
tree->balance_column = i;
|
||||
tree->column_fields[i++] = ACCOUNT_BALANCE;
|
||||
|
||||
tree->total_column = i;
|
||||
tree->column_fields[i++] = ACCOUNT_TOTAL;
|
||||
|
||||
tree->column_fields[i++] = ACCOUNT_NOTES;
|
||||
|
||||
tree->num_columns = i;
|
||||
@@ -918,8 +924,11 @@ gnc_account_tree_insert_row(GNCAccountTree *tree,
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < tree->num_columns; i++)
|
||||
{
|
||||
text[i] = gnc_ui_get_account_field_value_string(acc,
|
||||
tree->column_fields[i]);
|
||||
text[i] = g_strdup(text[i]);
|
||||
}
|
||||
|
||||
text[tree->num_columns] = NULL;
|
||||
|
||||
@@ -927,13 +936,16 @@ gnc_account_tree_insert_row(GNCAccountTree *tree,
|
||||
text, 0, NULL, NULL, NULL, NULL,
|
||||
FALSE, FALSE);
|
||||
|
||||
for (i = 0; i < tree->num_columns; i++)
|
||||
g_free(text[i]);
|
||||
|
||||
#if !USE_NO_COLOR
|
||||
{
|
||||
GtkStyle *style;
|
||||
double balance;
|
||||
gboolean deficit;
|
||||
|
||||
balance = gnc_ui_get_account_full_balance(acc);
|
||||
balance = gnc_ui_account_get_balance(acc, FALSE);
|
||||
deficit = (balance < 0) && !DEQ(balance, 0);
|
||||
|
||||
if (deficit)
|
||||
@@ -944,6 +956,18 @@ gnc_account_tree_insert_row(GNCAccountTree *tree,
|
||||
if (style != NULL)
|
||||
gtk_ctree_node_set_cell_style(GTK_CTREE(tree), node,
|
||||
tree->balance_column, style);
|
||||
|
||||
balance = gnc_ui_account_get_balance(acc, TRUE);
|
||||
deficit = (balance < 0) && !DEQ(balance, 0);
|
||||
|
||||
if (deficit)
|
||||
style = tree->deficit_style;
|
||||
else
|
||||
style = gtk_widget_get_style(GTK_WIDGET(tree));
|
||||
|
||||
if (style != NULL)
|
||||
gtk_ctree_node_set_cell_style(GTK_CTREE(tree), node,
|
||||
tree->total_column, style);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ struct _GNCAccountTree
|
||||
|
||||
gint num_columns;
|
||||
gint balance_column;
|
||||
gint total_column;
|
||||
gint column_fields[NUM_ACCOUNT_FIELDS];
|
||||
gchar * column_headings[NUM_ACCOUNT_FIELDS + 1];
|
||||
|
||||
|
||||
@@ -595,6 +595,9 @@ char * gnc_ui_get_account_field_name(int field)
|
||||
case ACCOUNT_BALANCE :
|
||||
return BALN_STR;
|
||||
break;
|
||||
case ACCOUNT_TOTAL :
|
||||
return TOTAL_STR;
|
||||
break;
|
||||
}
|
||||
|
||||
assert(0);
|
||||
@@ -603,24 +606,25 @@ char * gnc_ui_get_account_field_name(int field)
|
||||
|
||||
|
||||
double
|
||||
gnc_ui_get_account_full_balance(Account *account)
|
||||
gnc_ui_account_get_balance(Account *account, gboolean include_children)
|
||||
{
|
||||
AccountGroup *acc_children;
|
||||
double balance;
|
||||
int type;
|
||||
|
||||
assert(account != NULL);
|
||||
if (account == NULL)
|
||||
return 0.0;
|
||||
|
||||
acc_children = xaccAccountGetChildren (account);
|
||||
type = xaccAccountGetType(account);
|
||||
balance = xaccAccountGetBalance (account);
|
||||
|
||||
/* if the account has children, add in their balance */
|
||||
if (acc_children)
|
||||
balance += xaccGroupGetBalance(acc_children);
|
||||
if (include_children)
|
||||
{
|
||||
AccountGroup *children;
|
||||
|
||||
children = xaccAccountGetChildren (account);
|
||||
balance += xaccGroupGetBalance (children);
|
||||
}
|
||||
|
||||
/* reverse sign if needed */
|
||||
if (gnc_reverse_balance(account))
|
||||
if (gnc_reverse_balance (account))
|
||||
balance = -balance;
|
||||
|
||||
return balance;
|
||||
@@ -629,7 +633,9 @@ gnc_ui_get_account_full_balance(Account *account)
|
||||
|
||||
char * gnc_ui_get_account_field_value_string(Account *account, int field)
|
||||
{
|
||||
assert(account != NULL);
|
||||
if (account == NULL)
|
||||
return NULL;
|
||||
|
||||
assert((field >= 0) && (field < NUM_ACCOUNT_FIELDS));
|
||||
|
||||
switch (field)
|
||||
@@ -657,7 +663,14 @@ char * gnc_ui_get_account_field_value_string(Account *account, int field)
|
||||
break;
|
||||
case ACCOUNT_BALANCE :
|
||||
{
|
||||
double balance = gnc_ui_get_account_full_balance(account);
|
||||
double balance = gnc_ui_account_get_balance(account, FALSE);
|
||||
|
||||
return xaccPrintAmount(balance, PRTSYM | PRTSEP);
|
||||
}
|
||||
break;
|
||||
case ACCOUNT_TOTAL :
|
||||
{
|
||||
double balance = gnc_ui_account_get_balance(account, TRUE);
|
||||
|
||||
return xaccPrintAmount(balance, PRTSYM | PRTSEP);
|
||||
}
|
||||
|
||||
@@ -80,8 +80,8 @@ enum
|
||||
ACCOUNT_NOTES,
|
||||
ACCOUNT_CURRENCY,
|
||||
ACCOUNT_SECURITY,
|
||||
ACCOUNT_BALANCE, /* including children, with sign reversal
|
||||
for income/expense */
|
||||
ACCOUNT_BALANCE, /* with sign reversal */
|
||||
ACCOUNT_TOTAL, /* balance + children's balance with sign reversal */
|
||||
NUM_ACCOUNT_FIELDS
|
||||
};
|
||||
|
||||
@@ -106,7 +106,7 @@ char * gnc_ui_get_account_field_name(int field);
|
||||
|
||||
char * gnc_ui_get_account_field_value_string(Account *account, int field);
|
||||
|
||||
double gnc_ui_get_account_full_balance(Account *account);
|
||||
double gnc_ui_account_get_balance(Account *account, gboolean include_children);
|
||||
|
||||
GtkWidget * gnc_ui_notes_frame_create(GtkEditable **notes_entry);
|
||||
|
||||
|
||||
@@ -577,6 +577,9 @@ gnc_configure_account_tree(void *data)
|
||||
|
||||
else if (safe_strcmp(node->data, "balance") == 0)
|
||||
new_avi.show_field[ACCOUNT_BALANCE] = TRUE;
|
||||
|
||||
else if (safe_strcmp(node->data, "total") == 0)
|
||||
new_avi.show_field[ACCOUNT_TOTAL] = TRUE;
|
||||
}
|
||||
|
||||
gnc_free_list_option_value(list);
|
||||
|
||||
@@ -97,14 +97,15 @@ the account instead of opening a register." #f))
|
||||
(gnc:make-list-option
|
||||
"Main Window" "Account fields to display"
|
||||
"c" ""
|
||||
(list 'description 'balance)
|
||||
(list 'description 'total)
|
||||
(list #(type "Type" "")
|
||||
#(code "Code" "")
|
||||
#(description "Description" "")
|
||||
#(notes "Notes" "")
|
||||
#(currency "Currency" "")
|
||||
#(security "Security" "")
|
||||
#(balance "Balance" ""))))
|
||||
#(balance "Balance" "")
|
||||
#(total "Total" ""))))
|
||||
|
||||
|
||||
;; International options
|
||||
|
||||
Reference in New Issue
Block a user