After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 347274 - to track the difference between budgeted and actual amounts in the budget report
to track the difference between budgeted and actual amounts in the budget report
Status: VERIFIED FIXED
Product: GnuCash
Classification: Other
Component: Budgets
git-master
Other All
: Normal enhancement
: ---
Assigned To: Chris Shoemaker
Chris Shoemaker
: 500696 532060 555171 (view as bug list)
Depends on:
Blocks: backport
 
 
Reported: 2006-07-12 04:32 UTC by guy leavitt
Modified: 2018-06-29 21:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
implements new column difference=(budget-actual) (2.93 KB, patch)
2007-12-10 01:45 UTC, Andrew Ziem
none Details | Review
new budget.scm (13.25 KB, text/plain)
2007-12-10 01:47 UTC, Andrew Ziem
  Details
better patch (2.96 KB, patch)
2007-12-13 23:05 UTC, Andrew Ziem
none Details | Review
new budget.scm (13.27 KB, patch)
2007-12-13 23:06 UTC, Andrew Ziem
none Details | Review
nice cosmetic change from andrewsw (2.91 KB, patch)
2007-12-13 23:51 UTC, Andrew Ziem
none Details | Review
Change reverse patch to forward patch. (2.91 KB, patch)
2007-12-14 20:20 UTC, Andrew Ziem
none Details | Review
patch against trunk (3.01 KB, patch)
2008-07-11 09:23 UTC, Rolf Leggewie
none Details | Review
Combined patch for bug#532060 and bug#347274 (9.45 KB, patch)
2008-10-27 22:44 UTC, C.Ernst
committed Details | Review
Fixes previous patch to calculate correct differences (1.75 KB, patch)
2008-11-01 13:39 UTC, C.Ernst
committed Details | Review
Select individual columns to be displayed in the budget report (4.79 KB, patch)
2008-11-28 21:23 UTC, C.Ernst
committed Details | Review

Description guy leavitt 2006-07-12 04:32:39 UTC
It would be useful (in my case necessary) to be able to track both the period-by-period difference and the cumulative difference between the (total) budgeted amount and the (total) actual amount.  For example, a budget report could display (1) the difference between the two amounts for the week, month, etc., that is the budget's time-increment; and (2) the cumulative difference between the totals of the two amounts for the entire period budgeted to date.
Comment 1 Richard Tango-Lowy 2007-01-01 19:56:43 UTC
I'll vote for this bug.

The budgeting functionality is helpful, but the changes suggested above would make it really functional. In the same vein, I suggest calculating the sum of all budge items for a period, so users can see if the budget exceeds actual income. 
Comment 2 James Janssen 2007-03-04 06:24:56 UTC
I'll second that vote.

I continue to be required to have a spreadsheet open to handle my budget to actual cash flows.

I have been using gnucash for several years and was excited that a budgeting feature was added (thanks Chris!).  But doing the math on the budget vs. actual and having the difference summed for that period would allow for the "in period" financial decisions to be informed.

Here's what I am currently doing in a spreadsheet.  Its kind of a combo budget/cash flow.  If I am crazy for seeing it this way, let me know.


For each period (excuse the formatting):

Income:    Expected , Actual  -  $Checking Account Actual

*Expenses: Budgeted - Actual  =  *Remaining Expenses*
           ------------------------------------------
           sum         sum       SUM

* Categorized list

I have tried doing this using a AR / AP method, but that was overkill and not really correct accounting (because its only budgeted).

In any case, being able to point the "Checking Account Actual" at the appropriate gnucash account, would greatly inform the budget report if sums were included.





Comment 3 Saul Thomas 2007-03-25 05:00:50 UTC
I also vote for this bug. This functionality would be very useful for me, and would help me wean my comrades off of MS Money.
Comment 4 Don 2007-07-01 02:05:28 UTC
If I am understanding this right, I am very in need of this functionality as well.  

The way I'm thinking of it is, suppose I setup a budget with all the income and expenses I expect; lets say this is setup to display in bi-weekly periods (i.e. per paycheck).  

I'd like the budget screen to calculate sums per budget period based on my current balance in my actual accounts.  

for example the first 2 weeks would use this: 

(current actual balance of bank accounts & cash) + bi-weekly budget assets - bi-weekly budget expenses

the result of that could be displayed at the bottom of the bi-weekly budget column.  For the next period you would do the same thing except use the result of the first period as the (current actual balance of bank accounts & cash) for the second period.  Then if things start going negative, I know that my budget is not realistic in terms of how much I currently have, how much I think I'm going to make and how much I'm planning on spending.
Comment 5 Art 2007-07-31 02:04:56 UTC
As a quick fix, can we have just a summaries for each category in budget?
There is a HUGE need for that!!!

Thanks!
Comment 6 Andrew Ziem 2007-12-10 01:45:43 UTC
Created attachment 100668 [details] [review]
implements new column difference=(budget-actual)

I have not yet discovered why budget and actual are not in the same scale, so I just divide actual by 100 to compensate.  It seems to work fine.

Sticking to the title of this bug, I suggest closing this bug with this patch.  Then, use bug 500696 for a separate request for adding summaries.
Comment 7 Andrew Ziem 2007-12-10 01:47:39 UTC
Created attachment 100669 [details]
new budget.scm

For those wanting this enhancement without going through the patching process, simply replace your existing budget.scm with this attachment.
Comment 8 Andrew Ziem 2007-12-10 15:54:15 UTC
It turns out this patch is not ready or there is a problem somewhere else.  On Windows both budget and actual are sometimes (but not always) inflated by 100, but on Linux only actual is.  Both are Gnucash 2.2.1.  Hmm.
Comment 9 Andrew Ziem 2007-12-13 23:05:24 UTC
Created attachment 100912 [details] [review]
better patch

This patch is more robust: it handles GC's numeric data types.
Comment 10 Andrew Ziem 2007-12-13 23:06:15 UTC
Created attachment 100913 [details] [review]
new budget.scm

complete budget.scm drop-in replacement for easy use
Comment 11 Andrew Ziem 2007-12-13 23:51:06 UTC
Created attachment 100917 [details] [review]
nice cosmetic change from andrewsw
Comment 12 Andrew Ziem 2007-12-14 20:20:16 UTC
Created attachment 100975 [details] [review]
Change reverse patch to forward patch.  

Mea culpa.  Spotted by Derek.
Comment 13 James Janssen 2007-12-16 06:10:33 UTC
Thanks for giving this a go Andrew.

I tried the patch on Gnucash 2.2.1 (gentoo-linux x86_64; gnome 2.20)

When running the report for the first time, I received the following in the new report tab:

Report error
An error occurred while running the report.


And the following on the console:

 109: 38  (let* ((num-periods #) (period 0)) (letrec (# #) (catch # # #)))
In unknown file:
    ...
   ?: 39  [catch break #<procedure #f ()> #<procedure #f v>]
   ?: 40* [#<procedure #f ()>]
   ?: 41* [continue]
   ?: 42  (or (not (< period num-periods)) (begin (begin (let* # # ...)) (continue)))
   ?: 43  (begin (begin (let* (# # # ...) (cond #) ...)) (continue))
   ?: 44* (begin (let* (# # # ...) (cond #) ...))
In /usr/share/gnucash/guile-modules/gnucash/report/budget.scm:
 113: 45  (let* (# # # ...) (cond #) ...)
 134: 46* [gnc-numeric-sub # # 0 ...
 136: 47*  (bitwise-ior 48 8)
/usr/share/gnucash/guile-modules/gnucash/report/budget.scm:136:33: In expression (bitwise-ior 48 8):
/usr/share/gnucash/guile-modules/gnucash/report/budget.scm:136:33: Unbound variable: bitwise-ior

Comment 14 Derek Atkins 2007-12-26 03:39:24 UTC
Perhaps use + instead of bitwise-ior?  Does that fix it for you?
Comment 15 Andrew Ziem 2007-12-28 15:35:01 UTC
I can only test Fedora 7 (32-bit) and Windows XP.  Both seem fine with + or bitwise-ior.
Comment 16 Derek Atkins 2007-12-28 17:29:11 UTC
bitwise-ior appears to be in slib, but "+" should work too (in THIS particular case).  If the + works for you then we can try using that.
Comment 17 James Janssen 2007-12-29 00:57:38 UTC
Changing bitwise-ior to + solved the problem for me.  The budget report displays correctly on gnucash 2.2.2 x86_64.

Thank you.

On a side note, I did retry the bitwise-ior because upgrading to gnucash 2.2.2 on gentoo pulled in slib as a dependency for the first time.  But even when I confirmed slib was in place only + worked.

I think it was an error that they didn't have it listed as a dependency previously, note the Changelog for the ebuild:

*gnucash-2.2.2 (18 Dec 2007)

  18 Dec 2007; Torsten Veller <toveATgentoo.org>
  +files/gnucash-2.2.2-icons.patch, +gnucash-2.2.2.ebuild:
  Version bump. Thanks to Alex Rostovtsev for the icons patch (#199730).
  Change goffice dependency because gnucash works with >=goffice-0.5.1 (#191555).

  25 Oct 2007; Torsten Veller <toveATgentoo.org> gnucash-2.2.1-r1.ebuild:
  Change slib dependency
Comment 18 Rolf Leggewie 2008-07-11 09:10:57 UTC
James, can you paste an update to the patch in attachment 100975 [details] [review] ?
Comment 19 Rolf Leggewie 2008-07-11 09:23:07 UTC
Created attachment 114379 [details] [review]
patch against trunk

(In reply to comment #10)
> Created an attachment (id=100913) [edit]
> new budget.scm
> 
> complete budget.scm drop-in replacement for easy use

I reworked attachment 100913 [details] [review] as a patch against current trunk (but dropped the line which would have deleted the report-guid entry)
Comment 20 Christian Stimming 2008-10-26 21:13:18 UTC
(In reply to comment #19)
> I reworked attachment 100913 [details] [review] [edit] as a patch against current trunk (but dropped the
> line which would have deleted the report-guid entry)

The patch looks fine in principle; however, this adds another column unconditionally i.e. for everyone. This is probably not so desirable, because if there are many periods in the report, there are already a large number of columns with numbers.

The patch would be perfect if you could make this new column a user option, i.e. it would be be possible to retain the current display. I'd commit it immediately if the new column is activated through a user option. Thanks!
Comment 21 Christian Stimming 2008-10-26 21:41:13 UTC
BTW this looks very similar to bug#532060. Could the patch there please be merged with this one? Thanks.
Comment 22 C.Ernst 2008-10-27 22:44:40 UTC
Created attachment 121483 [details] [review]
Combined patch for bug#532060 and bug#347274

I merged the difference column of bug#347274 into the structure of bug#532060.
Comment 23 C.Ernst 2008-10-27 23:00:00 UTC
Could you please check again line 162?
                    (dif-numeric-val (gnc-numeric-sub bgt-numeric-val
                                 act-numeric-val GNC-DENOM-AUTO
                                 (bitwise-ior GNC-DENOM-LCD GNC-RND-NEVER)))
For income and liability accounts it seems to yield the sum of budget and actual values.
Comment 24 Christian Stimming 2008-10-29 14:34:08 UTC
*** Bug 555171 has been marked as a duplicate of this bug. ***
Comment 25 Christian Stimming 2008-10-29 21:18:47 UTC
*** Bug 532060 has been marked as a duplicate of this bug. ***
Comment 26 Christian Stimming 2008-10-29 21:21:19 UTC
Committed as r17675, awaiting audit and back-port. Thanks a lot!
Comment 27 C.Ernst 2008-11-01 13:39:04 UTC
Created attachment 121777 [details] [review]
Fixes previous patch to calculate correct differences

The patch as committed in r17675 should not be backported, because the proposed calculation of differences was wrong for income and liabilities(see comment #23).
The attached patch should fix this issue. Please make sure to apply this one too.
Comment 28 Christian Stimming 2008-11-02 20:51:55 UTC
Committed as r17678, so that both 17675 and 17678 should be back-ported. Thanks a lot!
Comment 29 Christian Stimming 2008-11-07 21:59:58 UTC
On my opensuse system the report crashed because of bitwise-ior not available. I changed this into + according to comment 16; committed as r17684 which would need to be back-ported as well.
Comment 30 Christian Stimming 2008-11-08 20:59:35 UTC
*** Bug 500696 has been marked as a duplicate of this bug. ***
Comment 31 Christian Stimming 2008-11-27 09:20:07 UTC
Hm... after seeing the outcome of this patch "in real life", it occurred to me that it's not longer possible to see only the "Budget" and "Actual" columns. Instead, one has the choice to see either all three columns or one single column. I would like to continue to use the report in the form that it was, i.e. with the budget and actual column alone. This would be achieved by changing the option from one single multichoice (combo box) option into several boolean options. Those should go into a new, separate "View" tab in the whole dialog, similar to the "transaction" report and most of the others as well.

@C.Ernst: Do you think you could provide yet another patch that changes these options? That would be great!
Comment 32 Jason 2008-11-28 04:03:01 UTC
I've just patched budget.scm with the two patches below - very nice.  Thanks for this!

Two wishes:

1) For Income and Expenses, if the Diff column is negative, can it change colour (red?)?  I could be asking a bit much - reverse balanced accounts might have to be considered too (i.e. whether a negative diff is a "red" number or "black" for, say, Liabilities).

2) Account totals, much like the Account Summary report - total expenses, total assets, etc, per budget period.  If I read correctly, something like this was suggested earlier in the thread (Don at 4).  To my untrained eyes, this looks like a big ask, so thanks in advance to anyone who considers it.  It would be a tremendous benefit.

Thanks again for all this.  It's a wonderful piece of software.
Comment 33 C.Ernst 2008-11-28 21:23:09 UTC
Created attachment 123632 [details] [review]
Select individual columns to be displayed in the budget report

This patch introduces a new option tab "Display" with boolean options for each column, as proposed in comment 31. The default behaviour was (and is now again) to display only Budget and Actual.

There still seem to be lots of improvements possible to the budget report.
However, I'd vote for opening new issues and closing this one, after the patch has been applied. - After all, I just wanted to be able to export the single columns Actual to excel ;-)
Comment 34 Christian Stimming 2008-11-30 21:44:56 UTC
Committed to trunk, r17743. Thanks a lot! This bug will be closed as soon as the set of patches is back-ported to the 2.2 branch. Indeed, all new feature requests should be filed as new bugzilla items. Thanks again!
Comment 35 Christian Stimming 2008-12-06 22:08:07 UTC
Committed to 2.2 branch, r17752. Thanks a lot!
Comment 36 John Ralls 2018-06-29 21:09:24 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=347274. Please update any external references or bookmarks.