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 570895 - Budget Income Statement: allow reporting for single budget periods
Budget Income Statement: allow reporting for single budget periods
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Reports
git-master
Other All
: Normal enhancement
: ---
Assigned To: Andreas Köhler
Andreas Köhler
Depends on:
Blocks:
 
 
Reported: 2009-02-07 20:30 UTC by Forest Bond
Modified: 2018-06-29 22:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch implementing requested feature. (4.67 KB, patch)
2009-02-07 20:32 UTC, Forest Bond
none Details | Review
Updated patch with improved "Net income for ..." / "Net loss for .." text. (5.53 KB, patch)
2009-02-14 21:39 UTC, Forest Bond
none Details | Review
Updated patch with support for budget period ranges rather than just single budget periods. (9.39 KB, patch)
2009-02-15 13:33 UTC, Forest Bond
none Details | Review
Updated patch to fix bug in error checking when reporting for entire budget. (9.57 KB, patch)
2009-04-29 11:07 UTC, Forest Bond
needs-work Details | Review
Updated patch against latest svn. (9.57 KB, patch)
2009-11-22 18:42 UTC, Forest Bond
none Details | Review

Description Forest Bond 2009-02-07 20:30:43 UTC
The budget income statement would be more useful if it allowed reporting for single budget periods, rather than always reporting for the entire budget at once.
Comment 1 Forest Bond 2009-02-07 20:32:23 UTC
Created attachment 128186 [details] [review]
Patch implementing requested feature.
Comment 2 Forest Bond 2009-02-14 21:39:08 UTC
Created attachment 128734 [details] [review]
Updated patch with improved "Net income for ..." / "Net loss for .." text.
Comment 3 Forest Bond 2009-02-15 13:33:38 UTC
Created attachment 128771 [details] [review]
Updated patch with support for budget period ranges rather than just single budget periods.
Comment 4 Phil Longstaff 2009-04-24 01:25:36 UTC
I tried to apply this to trunk and when I executed it, I got:

 654: 13  (set! html (gnc:report-render-html report #t))
 654: 14* [gnc:report-render-html # #t]
 620: 15  (if (and (not #) (gnc:report-ctext report)) (gnc:report-ctext report) ...)
 628: 16  (let ((template #) (doc #f)) (set! doc (if template # #f)) doc)
 631: 17* (set! doc (if template (let* # # # ...) #f))
 631: 18* (if template (let* # # # ...) #f)
 632: 19  (let* (# # # ...) (gnc:html-document-set-style-sheet! doc stylesheet) ...)
 634: 20* [budget-income-statement-renderer #]
In /opt/gnucash2-svn/share/gnucash/guile-modules/gnucash/report/budget-income-statement.scm:
 765: 21  [budget-income-statement-renderer-internal # "Budget Income Statement"]
In unknown file:
    ...
   ?: 22  (letrec ((add-rule #) (add-subtotal-line #)) (cond (# #) (# #) ...) ...)
In /opt/gnucash2-svn/share/gnucash/guile-modules/gnucash/report/budget-income-statement.scm:
 461: 23* (cond (# #) (# #) (# #) ...)
 472: 24* [< #f #f]
/opt/gnucash2-svn/share/gnucash/guile-modules/gnucash/report/budget-income-statement.scm:472:8: Inprocedure < in expression (< user-budget-period-end user-budget-period-start):
/opt/gnucash2-svn/share/gnucash/guile-modules/gnucash/report/budget-income-statement.scm:472:8: Wrong type argument in position 1: #f
Comment 5 Forest Bond 2009-04-24 01:39:37 UTC
Works with revision 17885.  I can probably get it back in shape at some point.
Comment 6 Forest Bond 2009-04-29 11:07:34 UTC
Created attachment 133552 [details] [review]
Updated patch to fix bug in error checking when reporting for entire budget.

Sorry, I guess this was just a bug, and didn't actually work correctly in the older svn revision, either.

This is the only change from the last patch:

=== modified file 'src/report/standard-reports/budget-income-statement.scm'
--- src/report/standard-reports/budget-income-statement.scm     2009-04-28 10:22:53 +0000
+++ src/report/standard-reports/budget-income-statement.scm     2009-04-29 11:02:06 +0000
@@ -469,7 +469,8 @@
         ;; No budget selected.
         (gnc:html-document-add-object!
           doc (gnc:html-make-generic-budget-warning report-title)))
-      ((< user-budget-period-end user-budget-period-start)
+      ((and use-budget-period-range?
+          (< user-budget-period-end user-budget-period-start))
         ;; User has selected a range with end period lower than start period.
         (gnc:html-document-add-object!
           doc
Comment 7 Phil Longstaff 2009-05-02 01:18:48 UTC
Would you be willing to do the same for the regular budget report and budget cash flow report?
Comment 8 Forest Bond 2009-05-05 00:37:02 UTC
If my answer was no, would that prevent this patch from being accepted?

Generally speaking, I think that the "Budget Flow" report is of limited value and the "Budget Report" needs a lot of work.  I don't use them.

Note that the "Budget Flow" report is not really equivalent to the "Cash Flow" report.  Actually, given the data captured by budgets, it's impossible to make a real cash flow report.  Budgets have no concept of cash flow, as far as I know.  Funds are allocated, but you don't know where those funds are coming from.

Maybe I'm missing something.

-Forest
Comment 9 Phil Longstaff 2009-05-05 00:53:16 UTC
From what I can tell, the "Budget Income" report is similar to the income report, but uses the budget values rather than real values.  One reason I found it useful was that it was the only place I could find net budget value (income - expense).

I agree with you that the "Budget Report" needs a lot of work.  To that end, I am modifying it to:
1) roll up the budget column so that a parent account will contain the sum of its children.  I plan to use the budget report with Income and Expense and 1 level down.  This change allows me to assign a budget value to the 1st level Income and Expense accounts and it will sum those at Income and Expense.  It will also allow me to assign budget values further down the tree if that is more applicable.
2) Change the columns.  For now, I want 3 columns: January through prev month, this month, next month through December (e.g. Jan-Apr, May, June-Dec).  This will give me year-to-date, current month, rest of year.

I sent an e-mail to gnucash-devel mailing list saying I would like to modify how columns are specified for all report types.  This would allow a Balance Sheet at different points of time, Income Statement for different periods of time and Budget Report for different periods of time.

BTW, if you say no, it wouldn't stop me from accepting your patch.  I did try to apply your patch and ran into a few problems.  I then wanted to borrow pieces from it to apply to the Budget Report to loosen up some of its rigid structure, but ran into some problems.  I had hoped you would be better able to do that.

Given my own plans, I'm not sure I still need you to do that.
Comment 10 Forest Bond 2009-05-05 01:09:07 UTC
What problems did you have with my patch?  I'd be more than willing to fix them (it is working well for me, and I've been using it for a while).

Regarding the budget reports more generally:

My intention with the Budget Income Statement and Budget Balance Sheet reports has always been to have an option to display budget and actual values side by side in separate columns, but I found that difficult to implement given the current restrictions in the reporting system.  I remain somewhat convinced that this would be superior to what the Budget Report appears to be trying to do.

BTW, the Budget Flow report also has some signedness issues.  Actual income is reported as a negative value.
Comment 11 Phil Longstaff 2009-05-05 01:20:48 UTC
Well, my problem is in comment #4.  I'll try the patch again.

I'm doing some experimentation with the Budget Report.  I would bet there would be pieces that could be factored out so you can use them.

1) scheme routine gnc:budget-get-account-period-value which returns the value to use for a specific account for a specific period.  If the budget has a value for the account for the period, it is used.  If not, if the account has children, this routine is called recursively for all children and the values are summed.  If no value and no children, zero is returned.  This provides the budget roll-up to parents.

2) scheme routine gnc:budget-get-account-periodlist-value which returns the sum of the routine just above for a list of periods.  This way, I can show my budget for a group of periods by passing it '(1 2 3) and it will return the budget value for Jan-thru-Mar.

3) I'm then going to modify the gnc:html-table-add-budget-line! routine to pass a column definition list.  This could be, for example '((1 2 3) (4 5 6) (7 8 9) (10 11 12) 'total) i.e. top-level list with 5 elements, first 4 are 3-element lists.  Result will have 5 columns (x 3 for bgt/act/diff).  The number lists give period numbers to be summed, and 'total means to add a final set of bgt/act/diff columns with the row total.  Once I have this flexibility, I can provide different kinds of column definitions (current report would have '(1 2 3 4 5 6 7 8 9 10 11 12) for example).

This gets back to my idea of separating out the row structure from the column structure.
Comment 12 Forest Bond 2009-07-15 10:59:59 UTC
Hi Phil,

Just checking in on this bug.  Are you still making changes to the Budget Report?

Thanks,
Forest
Comment 13 Forest Bond 2009-07-15 11:18:49 UTC
Hi Phil,

BTW, if gnc:budget-get-account-period-value always recurses when a parent account has not budget value for a given period, I don't think the Budget Income Statement can use it.  The BIS only wants to sum sub-account budget values when the account tree is being depth-limited such that the sub-accounts would be hidden.  Ultimately, this means there is not much value in that function for BIS, I think.

Is BIS not factored correctly?  Is there some reason this patch can't simply be applied?  If you point out the code structure issues, I'd be happy to correct them.

Thanks,
Forest
Comment 14 Forest Bond 2009-07-15 11:25:58 UTC
Phil,

One more thing (sorry for all of the noise):

My current understanding of budget numbers is that if A and B are expense accounts and B is a child account of A and both A and B have numbers entered for a given period in the budget, the total expenses for that period is A[period] + B[period].  In other words, A[period] doesn't *override* B[period].  This is how things are handled in BIS, anyway.  I don't think the correct behavior is documented anywhere.  This may be part of a larger design discussion, so feel free to move it to the ML if you think it is appropriate.

Thanks,
Forest
Comment 15 Christian Stimming 2009-11-20 21:07:13 UTC
Comment on attachment 133552 [details] [review]
Updated patch to fix bug in error checking when reporting for entire budget.

For me the patch has one failing hunk in budget-income-statement.scm:

patching file src/report/standard-reports/budget-income-statement.scm
Hunk #6 FAILED at 501.
1 out of 10 hunks FAILED -- saving rejects to file src/report/standard-reports/budget-income-statement.scm.rej

Apart from this, I would like to commit this for now. Other reports can be changed later, but it is a good improvement at least here.
Comment 16 Forest Bond 2009-11-21 23:16:01 UTC
Hi Christian,

Okay, that's a minor conflict due to bit rot.  I have a new patch ready, which I'll uploaded as soon as I can.

Thanks,
Forest
Comment 17 Forest Bond 2009-11-22 18:42:53 UTC
Created attachment 148288 [details] [review]
Updated patch against latest svn.
Comment 18 Forest Bond 2009-11-22 18:43:34 UTC
Hi Christian,

I've uploaded a new patch that should apply cleanly.

Thanks,
Forest
Comment 19 Christian Stimming 2009-11-23 19:58:59 UTC
r18439, thanks a lot!
Comment 20 John Ralls 2018-06-29 22:17:37 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=570895. Please update any external references or bookmarks.