GNOME Bugzilla – Bug 603183
Equity statement shows incorrect changes
Last modified: 2018-06-29 22:31:10 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?
Created attachment 148617 [details] The report
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.
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.
sorry: the patch in Comment 3 needs to be applied on report-system.scm.
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 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 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 on attachment 253417 [details] [review] patch to be appled on equity-statement.scm (GnuCash 2.5.4) Committed as r23158, thank you very much.
(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.
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.
Ok, thank you for checking this. I'll just close this bug then.
*** Bug 701158 has been marked as a duplicate of this bug. ***
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.