GnuCash
Contact   Instructions
Bug 797418 - In budget report, column with Actual Totals for Liabilities and Income are reversed
Summary: In budget report, column with Actual Totals for Liabilities and Income are re...
Status: RESOLVED FIXED
Alias: None
Product: GnuCash
Classification: Unclassified
Component: Reports (show other bugs)
Version: 3.7
Hardware: PC All
: Normal normal
Target Milestone: ---
Assignee: reports
QA Contact: reports
URL:
Whiteboard:
Keywords:
: 797427 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-09-18 12:10 EDT by acc.gnucash
Modified: 2019-12-08 20:41 EST (History)
6 users (show)

See Also:


Attachments
test datafile (6.76 KB, application/x-gnucash)
2019-09-19 22:12 EDT, acc.gnucash
no flags Details

Description acc.gnucash 2019-09-18 12:10:18 EDT
I am using Reversed Balanced Accounts for Credit accounts. I believe that since 3.7, when viewing a budget report the year's Actual Total for Liabilities and Income are reversed from the report's monthly totals and so the Total Actual and Total Difference are incorrect.

When looking at a budget report, for each month it shows something like (numbers are examples):

Liabilities
Bgt   Act   Diff
-4    -3     -1
(debiting the accounts, paying liabilities down)

Income
Bgt   Act   Diff
+6    +6    0
(crediting the accounts, making money)


For the year's totals, since 3.7 it now shows:

Liabilities:
Bgt   Act   Diff
-48   +27   -75
(actual shows crediting the accounts, increasing liabilities)

Income
Bgt   Act   Diff
+72   -54    -126
(actual shows debiting the accounts, like I'm making negative income)

I would expect the year's actual column totals to have their signs to be reversed, so Liabilities would have -27 and Income would have +54.
Comment 1 Christopher Lam 2019-09-19 20:53:59 EDT
I would be *very* grateful for a small test datafile please!
Comment 2 acc.gnucash 2019-09-19 22:12:15 EDT
Created attachment 373400 [details]
test datafile

Here's a test datafile.
Comment 3 Christopher Lam 2019-09-19 23:08:39 EDT
My understanding is that only the *total* column is being miscalculated, and the periodic bdt/act/diff are correct? Then it's a simple fix. Modify budget.scm as follows:

modified   gnucash/report/standard-reports/budget.scm
@@ -396,12 +396,15 @@
                                budget acct total-periods))
                    (act-total (gnc:get-account-periodlist-actual-value
                                budget acct total-periods))
+                   (act-abs (if reverse-balance?
+                                (- act-total)
+                                act-total))
                    (dif-total (if income-acct?
-                                  (- act-total bgt-total)
-                                  (- bgt-total act-total))))
+                                  (- act-abs bgt-total)
+                                  (- bgt-total act-abs))))
               (loop (cdr column-list)
                     (disp-cols "total-number-cell" current-col
-                               bgt-total act-total dif-total))))
+                               bgt-total act-abs dif-total))))
 
            (else
             (let* ((period-list (cond
Comment 4 Christopher Lam 2019-09-19 23:11:10 EDT
Or, just add one line:

modified   gnucash/report/standard-reports/budget.scm
@@ -396,6 +396,7 @@
                                budget acct total-periods))
                    (act-total (gnc:get-account-periodlist-actual-value
                                budget acct total-periods))
+                   (act-total (if reverse-balance? (- act-total) act-total))
                    (dif-total (if income-acct?
                                   (- act-total bgt-total)
                                   (- bgt-total act-total))))
Comment 5 Christopher Lam 2019-09-20 00:17:59 EDT
Hmm the fix above will restore expected behaviour for this bug.

But any other amount-reversal option will cause problems, probably due to bug 780717; internal budget-amounts assume 'credit accounts' and show invalid report/budget editor for any other reversal option.
Comment 6 acc.gnucash 2019-09-20 03:38:36 EDT
Unsure what could be considered "miscalculated" or "correct" in this case. I've chosen (or not changed from) the default configuration of Reversed Credit Accounts.

It was not an issue in prior versions (pre-3.7) of GnuCash. Now the budget's Total section has the Actual column reversed from what was expected. The effect of this is that the Total's Diff column is incorrect, going in the incorrect(?) direction by the absolute of the actual column. So instead of:

Liabilities
Budget (-5) - Actual (-3) = Total (-2)

We get:

Budget (-5) - Actual 3 = Total (-8)

Putting aside changing the Budget module to account for whatever is selected in the Reversed Balance Accounts preferences section, would it be possible to correct whatever changed between 3.6 and 3.7 that broke budget reporting for the default Reversed Balance Accounts setting?
Comment 7 Christopher Lam 2019-09-20 04:27:50 EDT
I've fixed as above in development branch which means the next release will fix it.

If you're confident try modifying budget.scm in C:\Program Files (x86\...etc... as per comment 4 above; this should fix the total 'actual' amount sign. If you're not confident then you'll have to wait for the next release I'm afraid.
Comment 8 Christopher Lam 2019-09-20 04:29:02 EDT
or you can try the windows nightly after it's built tomorrow:
https://code.gnucash.org/builds/win32/
Comment 9 acc.gnucash 2019-09-21 12:40:54 EDT
Thank you. Looks like there are build errors for 9/20 and 9/21 builds in the maint branch: https://code.gnucash.org/builds/win32/build-logs/maint/2019-09/
Comment 10 Geert Janssens 2019-09-21 13:30:08 EDT
Indeed. Those should be fixed for the next nightly.
Comment 11 Christopher Lam 2019-09-24 07:55:28 EDT
*** Bug 797427 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.