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 603183 - Equity statement shows incorrect changes
Equity statement shows incorrect changes
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Reports
2.3.x
Other All
: Normal normal
: ---
Assigned To: Andreas Köhler
Andreas Köhler
: 701158 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-11-27 20:21 UTC by shadowlord325
Modified: 2018-06-29 22:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A sample GnuCash XML save=file (1.71 KB, application/zip)
2009-11-27 20:21 UTC, shadowlord325
  Details
The report (1.54 KB, text/html)
2009-11-27 20:23 UTC, shadowlord325
  Details
patch to be appled on report-utilities.scm (GnuCash 2.5.4) (3.79 KB, patch)
2013-08-28 16:37 UTC, Carsten Rinke
committed Details | Review
patch to be appled on report-utilities.scm (GnuCash 2.5.4) (1.01 KB, patch)
2013-08-28 16:38 UTC, Carsten Rinke
committed Details | Review
patch to be appled on equity-statement.scm (GnuCash 2.5.4) (1.41 KB, patch)
2013-08-28 16:42 UTC, Carsten Rinke
committed Details | Review

Description shadowlord325 2009-11-27 20:21:29 UTC
Created attachment 148616 [details]
A sample GnuCash XML save=file

I open the beta version of GnuCash and make two accounts(One being a bank account and the other being an equity). I simulated an investment ($250 into Account 1 and transferred from there into the Equity account. Then, I opened up my statement of change in owner's equity(called 'Equity Statement' here), and it reported a $500 deposit and a $250 withdrawal, where it should report a $250 investment and a a $0 withdrawal.

Should there be an account type or option that tells GnuCash that it's a withdrawal account or what else can be done?
Comment 1 shadowlord325 2009-11-27 20:23:17 UTC
Created attachment 148617 [details]
The report
Comment 2 Carsten Rinke 2013-08-28 16:37:13 UTC
Created attachment 253413 [details] [review]
patch to be appled on report-utilities.scm (GnuCash 2.5.4)

This bug is introduced by the mis-calculation of the "Withdrawal" amount.

Currently the equity-statement.scm report calls gnc:account-get-pos-trans-total-interval in report-utilities.scm to determine the value for the "Withdrawal" during the report period.

The gnc:account-get-pos-trans-total-interval function seems to get somehow lost when doing the qof-query processing.
I noticed that even accounts that have nothing to do with "Withdrawal" have an impact on the "Withdrawal" value, and I assume that the query result or the processing of the query result is faulty.

As I do not see the point why a qof-query is utilizes to perform the job "get-pos-trans-total" I propose to implement a new function "get-total-flow <direction>" which does the same job if direction="in".

Using this function fixes the behaviour as described in this bug.

Note that the "Withdrawal" calculation is the only place where gnc:account-get-pos-trans-total-interval is done, so only one replacement is needed.
Comment 3 Carsten Rinke 2013-08-28 16:38:56 UTC
Created attachment 253415 [details] [review]
patch to be appled on report-utilities.scm (GnuCash 2.5.4)

To make the new function gnc:account-get-total-flow from the previous patch available for the equity-statement.scm report, it must be exported in report-system.scm.
Comment 4 Carsten Rinke 2013-08-28 16:39:48 UTC
sorry: the patch in Comment 3 needs to be applied on report-system.scm.
Comment 5 Carsten Rinke 2013-08-28 16:42:29 UTC
Created attachment 253417 [details] [review]
patch to be appled on equity-statement.scm (GnuCash 2.5.4)

Replaces the call to

  gnc:account-get-pos-trans-total-interval

with a call to 

  gnc:account-get-total-flow

as introduced with the previous two patches.
Comment 6 Geert Janssens 2013-09-03 14:09:55 UTC
Comment on attachment 253413 [details] [review]
patch to be appled on report-utilities.scm (GnuCash 2.5.4)

Committed as r23156, thank you very much.
Comment 7 Geert Janssens 2013-09-03 14:10:15 UTC
Comment on attachment 253415 [details] [review]
patch to be appled on report-utilities.scm (GnuCash 2.5.4)

Committed as r23157, thank you very much.
Comment 8 Geert Janssens 2013-09-03 14:10:32 UTC
Comment on attachment 253417 [details] [review]
patch to be appled on equity-statement.scm (GnuCash 2.5.4)

Committed as r23158, thank you very much.
Comment 9 Geert Janssens 2013-09-03 14:15:40 UTC
(In reply to comment #2)
> Created an attachment (id=253413) [details] [review]
> patch to be appled on report-utilities.scm (GnuCash 2.5.4)
> 
> This bug is introduced by the mis-calculation of the "Withdrawal" amount.
> 
> Currently the equity-statement.scm report calls
> gnc:account-get-pos-trans-total-interval in report-utilities.scm to determine
> the value for the "Withdrawal" during the report period.
> 
> The gnc:account-get-pos-trans-total-interval function seems to get somehow lost
> when doing the qof-query processing.
> I noticed that even accounts that have nothing to do with "Withdrawal" have an
> impact on the "Withdrawal" value, and I assume that the query result or the
> processing of the query result is faulty.
> 
> As I do not see the point why a qof-query is utilizes to perform the job
> "get-pos-trans-total" I propose to implement a new function "get-total-flow
> <direction>" which does the same job if direction="in".
> 
One strong motivation to use qof queries if possible is performance. Running a query via qof and processing it in C is orders of magnitude faster than doing the same in scheme code.

I don't know what impact your changes will have on performance, but I prefer a correctly functioning report over a fast one that doesn't work properly.

> Using this function fixes the behaviour as described in this bug.
> 
> Note that the "Withdrawal" calculation is the only place where
> gnc:account-get-pos-trans-total-interval is done, so only one replacement is
> needed.

One cleanup question: if the gnc:account-get-pos-trans-total-interval function isn't used anywhere else any more, can you provide a patch to remove this function altogether to avoid collecting dust ? Thanks.
Comment 10 Carsten Rinke 2013-09-03 19:51:00 UTC
This function is also called from trial-balance.scm.

No idea what this report is good for and if it is needed at all. There are no bugs registered on the trial balance report, so I guess it is working fine.

That is why I think a deletion of that function is not (yet) possible.
Comment 11 Geert Janssens 2013-09-03 20:14:16 UTC
Ok, thank you for checking this. I'll just close this bug then.
Comment 12 Geert Janssens 2013-12-10 17:31:04 UTC
*** Bug 701158 has been marked as a duplicate of this bug. ***
Comment 13 John Ralls 2018-06-29 22:31:10 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=603183. Please update any external references or bookmarks.