Hi,
I'm proposing to add a "Cleared (recursive)" column.
Please find a patch attached.
Reasoning:
I'm keeping (single) bank account transactions in several different gnucash
accounts in order
to track sums on different subjects/themes/groupes.
Though, I need to check the current account value against the
sum provided by my bank. Therefore, I am using the cleared flag provided by
gnucash.
Sadly, this flag is not summed up recursively and I could not figure out
how to a report
displaying this sum.
I think the easiest way to achieve this is by adding a new column providing
the required value.
This is easy to add using the "recursive" parameter of sort_by_xxx_value /
gnc_ui_account_get_print_balance .
I'm not sure how to update the po files, therefore I just added the
appropiate translation to po/de.po .
Thanks,
Michael
Index: src/gnome-utils/gnc-tree-model-account.c
===================================================================
--- src/gnome-utils/gnc-tree-model-account.c (Revision 17836)
+++ src/gnome-utils/gnc-tree-model-account.c (Arbeitskopie)
@@ -391,6 +391,7 @@
case GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_REPORT:
case GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_PERIOD:
case GNC_TREE_MODEL_ACCOUNT_COL_CLEARED:
+ case GNC_TREE_MODEL_ACCOUNT_COL_CLEARED_RECURSIVE:
case GNC_TREE_MODEL_ACCOUNT_COL_CLEARED_REPORT:
case GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED:
case GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED_REPORT:
@@ -679,6 +680,12 @@
account,
FALSE, &negative);
g_value_take_string (value, string);
break;
+ case GNC_TREE_MODEL_ACCOUNT_COL_CLEARED_RECURSIVE:
+ g_value_init (value, G_TYPE_STRING);
+ string =
gnc_ui_account_get_print_balance(xaccAccountGetClearedBalanceInCurrency,
+ account,
TRUE, &negative);
+ g_value_take_string (value, string);
+ break;
case GNC_TREE_MODEL_ACCOUNT_COL_CLEARED_REPORT:
g_value_init (value, G_TYPE_STRING);
string =
gnc_ui_account_get_print_report_balance(xaccAccountGetClearedBalanceInCurrency,
Index: src/gnome-utils/gnc-tree-model-account.h
===================================================================
--- src/gnome-utils/gnc-tree-model-account.h (Revision 17836)
+++ src/gnome-utils/gnc-tree-model-account.h (Arbeitskopie)
@@ -66,6 +66,7 @@
GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_REPORT,
GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_PERIOD,
GNC_TREE_MODEL_ACCOUNT_COL_CLEARED,
+ GNC_TREE_MODEL_ACCOUNT_COL_CLEARED_RECURSIVE,
GNC_TREE_MODEL_ACCOUNT_COL_CLEARED_REPORT,
GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED,
GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED_REPORT,
Index: src/gnome-utils/gnc-tree-view-account.c
===================================================================
--- src/gnome-utils/gnc-tree-view-account.c (Revision 17836)
+++ src/gnome-utils/gnc-tree-view-account.c (Arbeitskopie)
@@ -358,6 +358,16 @@
}
static gint
+sort_by_cleared_recursive_value (GtkTreeModel *f_model,
+ GtkTreeIter *f_iter_a,
+ GtkTreeIter *f_iter_b,
+ gpointer user_data)
+{
+ return sort_by_xxx_value (xaccAccountGetClearedBalanceInCurrency, TRUE,
+ f_model, f_iter_a, f_iter_b, user_data);
+}
+
+static gint
sort_by_reconciled_value (GtkTreeModel *f_model,
GtkTreeIter *f_iter_a,
GtkTreeIter *f_iter_b,
@@ -576,6 +586,12 @@
GNC_TREE_MODEL_ACCOUNT_COL_COLOR_CLEARED,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_cleared_value);
+ gnc_tree_view_add_numeric_column(view, _("Cleared (recursive)"),
"cleared_recursive",
+ SAMPLE_ACCOUNT_VALUE,
+ GNC_TREE_MODEL_ACCOUNT_COL_CLEARED_RECURSIVE,
+ GNC_TREE_MODEL_ACCOUNT_COL_COLOR_CLEARED,
+ GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
+ sort_by_cleared_recursive_value);
priv->cleared_report_column
= gnc_tree_view_add_numeric_column(view, _("Cleared (Report)"),
"cleared_report",
SAMPLE_ACCOUNT_VALUE,
Index: po/de.po
===================================================================
--- po/de.po (Revision 17836)
+++ po/de.po (Arbeitskopie)
@@ -9349,6 +9349,10 @@
msgid "Cleared"
msgstr "Bestätigt"
+#: ../src/gnome-utils/gnc-tree-view-account.c:*
+msgid "Cleared (recursive)"
+msgstr "Bestätigt (rekursiv)"
+
#: ../src/gnome-search/search-reconciled.c:228
#: ../src/gnome-utils/gnc-tree-view-account.c:584
msgid "Reconciled"
_______________________________________________
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel