gnucash master: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Fri Sep 16 11:15:57 EDT 2022


Updated	 via  https://github.com/Gnucash/gnucash/commit/58c1a518 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/42a22eef (commit)
	from  https://github.com/Gnucash/gnucash/commit/8e6c07db (commit)



commit 58c1a518971c39a7c9521e370153047db3b44b24
Merge: 8e6c07db1 42a22eef0
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Sep 16 23:15:24 2022 +0800

    Merge branch 'master-budget-changes' #1238


commit 42a22eef0f4ae9aed4d83c391e65fa5b761e729d
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Thu Jan 6 22:08:49 2022 +0800

    [gnc-budget-view.c] gbv_get_accumulated_budget_amount returns unreversed amount
    
    Previously it would return an appropriately signed amount for
    display. However it is also used when accumulating amounts therefore
    needs to be sign-reversed again.
    
    This function will now return, for the particular account and period,
    an unreversed accumulated budget amount. The sign reversal now takes
    place only for display using xaccSPrintAmount in #L1112

diff --git a/gnucash/gnome/gnc-budget-view.c b/gnucash/gnome/gnc-budget-view.c
index cbabb810e..49b8f4ecc 100644
--- a/gnucash/gnome/gnc-budget-view.c
+++ b/gnucash/gnome/gnc-budget-view.c
@@ -1042,9 +1042,6 @@ budget_accum_helper (Account *account, gpointer data)
                     info->pdb, numeric, currency, info->total_currency,
                     gnc_budget_get_period_start_date (info->budget, info->period_num));
 
-        if (gnc_reverse_balance (account))
-            numeric = gnc_numeric_neg (numeric);
-
         info->total = gnc_numeric_add (info->total, numeric, GNC_DENOM_AUTO,
                                        GNC_HOW_DENOM_LCD);
     }
@@ -1070,9 +1067,6 @@ gbv_get_accumulated_budget_amount (GncBudget *budget, Account *account, guint pe
     else
         info.total = gnc_budget_get_account_period_value (budget, account, period_num);
 
-    if (gnc_reverse_balance (account))
-        info.total = gnc_numeric_neg (info.total);
-
     return info.total;
 }
 
@@ -1111,6 +1105,10 @@ budget_col_source (Account *account, GtkTreeViewColumn *col,
             gtk_style_context_get_color (stylectxt, GTK_STATE_FLAG_NORMAL, &color);
 
             numeric = gbv_get_accumulated_budget_amount (priv->budget, account, period_num);
+
+            if (gnc_reverse_balance (account))
+                numeric = gnc_numeric_neg (numeric);
+
             xaccSPrintAmount (amtbuff, numeric, gnc_account_print_info (account, FALSE));
             if (gnc_is_dark_theme (&color))
                 g_object_set (cell, "foreground",
@@ -1186,9 +1184,6 @@ bgv_get_total_for_account (Account *account, GncBudget *budget, gnc_commodity *n
             {
                 numeric = gbv_get_accumulated_budget_amount (budget, account, period_num);
 
-                if (gnc_reverse_balance (account))
-                    numeric = gnc_numeric_neg (numeric);
-
                 if (new_currency)
                 {
                     numeric = gnc_pricedb_convert_balance_nearest_price_t64 (



Summary of changes:
 gnucash/gnome/gnc-budget-view.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)



More information about the gnucash-changes mailing list