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 570042 - Better default for book-closing entries in Income Statement Report Options
Better default for book-closing entries in Income Statement Report Options
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Reports
2.2.x
Other All
: Normal enhancement
: ---
Assigned To: Andreas Köhler
Andreas Köhler
Depends on:
Blocks:
 
 
Reported: 2009-02-01 00:34 UTC by Josh
Modified: 2018-06-29 22:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch: make reports ignore book-closing entries (7.44 KB, patch)
2011-02-27 09:58 UTC, Tristan Faujour
committed Details | Review

Description Josh 2009-02-01 00:34:34 UTC
Currently, if I use the "Close Books" feature on December 31 to close out 2008's income/expense accounts, and then I run a normal Income Statement from 1/1 through 12/31, income/expense will show zero across the board because the income statement is including the book-closing entry in its calculations.  The income statement should know to ignore the book-closing entry in order to correctly be showing the period's income.

Other information:
Comment 1 C.Ernst 2009-02-01 20:38:45 UTC
The report options of the Income Statement have a tab called "Entries".
I guess if you make sure that the pattern string matches the description of your book-closing entries this will solve your problem?
Comment 2 Josh 2009-02-01 21:11:28 UTC
You're right, I just played with that and it does work.

So perhaps a usability tweak to make this more intuitive to users like me, would be to have a default string in the "Close Books" feature to describe the entries, and then have that same default string in the "Entire" area you described in Income Statement options.  That way if the user doesn't monkey with the description, then they will still get the income statement they expected.

Or even, if the description entered in the "Close Books" feature automatically updates what the "Entries" section looks for to filter out in the Income Statement options, it'd be even better.
Comment 3 Christian Stimming 2009-02-05 13:17:11 UTC
Any proposal for a default string in the "Close Books" feature and also in the "Entries" option?

The second idea would indeed be nicer, but is virtually impossible to be implemented.
Comment 4 Robin Chattopadhyay 2010-12-04 03:36:40 UTC
I have an alternative suggestion. 

In short: Update the database schema to include a boolean flag at transaction (or split) level to identify the transaction as a book-closing transaction.

At a minimum:
* Update the database schema (sqlite, postgres, mysql) to add a column to the transactions table called "closing_entry".
* Update the XML schema to add an element called "<trn:closing-entry>".
* Update income/expense related reports to exclude any transactions where the closing entry flag is set to 'y'.
* Update the Close Books routine to set the closing entry flag to 'y' for each transaction created by the routine.

Possible addition:
* Update the report customization screens to give users an option to exclude the closing entries from the report.
* The default for the option would be 'exclude'.

Honestly, I have a hard time envisioning a use case for the include/exclude option, but users (myself included) seem to prefer customization over the application making a choice for you.
Comment 5 Christian Stimming 2010-12-04 21:04:57 UTC
(In reply to comment #4)
> In short: Update the database schema to include a boolean flag at transaction
> (or split) level to identify the transaction as a book-closing transaction.

At first sight, I thought this is way too much overhead. After thinking about it for a moment, I think your suggestion is indeed the correct solution to this problem. After all, the book closing transactions *are* special and different from the normal ones, so we need a boolean criterion that comes from somewhere anyway. Hence, the most obvious solution is to add exactly this boolean option directly into the database. I agree with that proposal.

However, someone "just" needs to put this into code...
Comment 6 Derek Atkins 2010-12-16 02:09:34 UTC
Actually, this boolean flag has been there for a while..  You installed it on 2010-03-02, Christian.  Just today I added two APIs to make it a little more official.  I added xaccTransGetIsClosingTxn(txn) and xaccTransSetIsClosingTxn(txn,flag).  I re-used the same slot value, so we should be compatible with any closings that used this field.  Of course closings done with 2.2.x or versions of 2.3.x prior to March 2nd wont have this flag set.

Updating the reports to ignore these transactions is left as a future exercise.
Comment 7 Tristan Faujour 2011-02-27 09:58:21 UTC
Created attachment 182031 [details] [review]
Proposed patch: make reports ignore book-closing entries

I chose to:
- Change the reports' default behavior to have them ignore the book-closing entries.
- Do not change anything in reports that deal explicitly with them.

Here is the content of this patch (everything is under gnucash/src/report):
- In function gnc:account-get-trans-type-balance-interval, depending on an argument, closing entries can be ignored (they are identified by xaccTransGetIsClosingTxn).
- Some report utility functions are duplicated (with a "-with closing" suffix) to provide the legacy feature.
- Equity statement and Profit & Loss reports are modified to call the *-with-closing functions.

It tested this patch against SVN head (rev 30345) with a linux OS (Ubuntu 10.10 x86_64).

This is only my second contribution, so it should be taken with all due prudence.
Let me know if I can improve something.
Comment 8 Christian Stimming 2011-02-27 20:53:41 UTC
Comment on attachment 182031 [details] [review]
Proposed patch: make reports ignore book-closing entries

I think the patch is fine and should be committed.

(It was good to note it on gnucash-devel additionally. Thanks!)
Comment 9 Christian Stimming 2011-03-12 15:52:28 UTC
Comment on attachment 182031 [details] [review]
Proposed patch: make reports ignore book-closing entries

r20404, thanks a lot!
Comment 10 John Ralls 2018-06-29 22:17:15 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=570042. Please update any external references or bookmarks.