Report Generation
Edward Doolittle
edward.doolittle at gmail.com
Sun Mar 12 00:11:09 EST 2017
Yes, that all seems to be right as far as I can tell. The error is in the
code that accumulates amounts for totals. For sign reversed accounts (e.g.,
credit accounts, if that is the setting), the amount of any transaction
should be negated before adding it to the running total.
On 11 March 2017 at 22:59, Cindy Doughty <dbdoughty at gmail.com> wrote:
> the accounts to be reversed seem to match with the definition you see when
> hovering the mouse over the global preferences accounts reverse balanced
> accounts. The code is:
>
>> (define account-types-to-reverse-assoc-list
>> (list (cons 'none '())
>> (cons 'income-expense
>> (list ACCT-TYPE-INCOME ACCT-TYPE-EXPENSE))
>> (cons 'credit-accounts
>> (list ACCT-TYPE-LIABILITY ACCT-TYPE-PAYABLE ACCT-TYPE-EQUITY
>>
>>> ACCT-TYPE-CREDIT ACCT-TYPE-INCOME))))
>>>
>>
> On Sat, Mar 11, 2017 at 11:45 PM, Cindy Doughty <dbdoughty at gmail.com>
> wrote:
>
>> the actual line of code says
>>
>>> (if (member account-type account-types-to-reverse)
>>> (gnc-numeric-neg damount)
>>>
>>>> damount))
>>>>
>>>
>> which means when the entry is set to credit accounts they are checking
>> if the account is a credit account and if so switching the value from
>> positive to negative
>>
>> On Sat, Mar 11, 2017 at 11:36 PM, Cindy Doughty <dbdoughty at gmail.com>
>> wrote:
>>
>>> I am wondering if an additional choice should be added to reverse all,
>>> would this solve the problem?
>>>
>>> On Sat, Mar 11, 2017 at 10:18 PM, Edward Doolittle <
>>> edward.doolittle at gmail.com> wrote:
>>>
>>>> So, I've done some more testing on this. You're right, the problem is
>>>> with the original transaction.scm report. I imagine no one has noticed the
>>>> problem before because everyone has only used the transaction report with a
>>>> limited set of accounts, all of the same account time (all assets, for
>>>> example). With your new report, there are many more creative ways it can be
>>>> used, which makes the bug more apparent.
>>>>
>>>> You can reproduce the problem reliably in the following manner: create
>>>> the account Expenses:Test-Expenses. Create the account
>>>> Liabilities:Test-Liabilities. Create a transfer from
>>>> Liabilities:Test-Liabilities to Expenses:Test-Expenses of $100, say. Since
>>>> everything balances, the net total of the two accounts should be $0.
>>>>
>>>> Run a transaction report including both accounts Expenses:Test-Expenses
>>>> and Liabilities:Test-Liabilities. If Options -> Display -> Sign Reverses is
>>>> set to None, the Grand Total on the report is $0, as expected. If Options
>>>> -> Display -> Sign Reverses is set to Credit Accounts, the Grand Total on
>>>> the report becomes $200, which is incorrect.
>>>>
>>>> No other setting seems to have an effect on this: not the global
>>>> Preferences -> Account -> Reversed Balanced Accounts setting, not any other
>>>> setting in the old transaction report. It is all about that one setting,
>>>> Sign Reverses in the transaction report.
>>>>
>>>> How to fix this in the transaction report: When Options -> Display ->
>>>> Sign Reverses is set to Credit Accounts, the correct way to calculate a
>>>> grand total is by adding numbers from debit accounts (Assets and Expenses)
>>>> and *subtracting* numbers from credit accounts (Equity, Income,
>>>> Liabilities).
>>>>
>>>> Using the example I gave above, it is also clear that an analogous fix
>>>> needs to be made when Options -> Display -> Sign Reverses is set to Income
>>>> and Expense.
>>>>
>>>> This problem seems to exist in both the existing, longstanding
>>>> Transaction Report, and your new Transaction by Payee Report.
>>>>
>>>> Since these reports seem to be in flux, I'm not sure whether to submit
>>>> a bug report or not. If you fix your new report and submit it to replace
>>>> the old transaction report, that should take care of the bug.
>>>>
>>>> Edward
>>>>
>>>> On 11 March 2017 at 19:50, Cindy Doughty <dbdoughty at gmail.com> wrote:
>>>>
>>>>> I'll have to think on it awhile - the fact it happens when consolidate
>>>>> transactions is unchecked makes me think it is in the code in the original
>>>>> transaction.scm file included with gnucash I started with. If you turn
>>>>> on running balance and uncheck the entry use old running balance (both at
>>>>> bottom of display tab under options) does it give any clues?
>>>>>
>>>>> On Sat, Mar 11, 2017 at 12:23 PM, Edward Doolittle <
>>>>> edward.doolittle at gmail.com> wrote:
>>>>>
>>>>>> Yes, I just tested it.
>>>>>>
>>>>>> On 11 March 2017 at 11:20, Cindy Doughty <dbdoughty at gmail.com> wrote:
>>>>>>
>>>>>>> Does the interaction happen both when consolidate transactions is
>>>>>>> checked and when it is unchecked? (under options display)
>>>>>>>
>>>>>>> Doug
>>>>>>>
>>>>>>> On Fri, Mar 10, 2017 at 11:05 PM, Edward Doolittle <
>>>>>>> edward.doolittle at gmail.com> wrote:
>>>>>>>
>>>>>>>> Hi Doug,
>>>>>>>>
>>>>>>>> I tried your Transaction by Payee Report today, and it works great.
>>>>>>>> It allows me to save searches, in particular the search for estimated
>>>>>>>> (scheduled) transactions which have managed to move above the blue line
>>>>>>>> into the past. Thank you for this work!
>>>>>>>>
>>>>>>>> I have noticed an oddity, however. I search all accounts, so total
>>>>>>>> of the transactions that I find should balance to zero. I noticed that
>>>>>>>> sometimes they don't. When I change the report option to Sign Reverses:
>>>>>>>> None, then everything does balance to zero like I expect.
>>>>>>>>
>>>>>>>> The issue is that my overall preference in the application is to
>>>>>>>> set "Reverse Balanced accounts" to "Credit accounts". I am puzzled by the
>>>>>>>> interaction between the overall preference setting and the setting in your
>>>>>>>> report.
>>>>>>>>
>>>>>>>
>>>> --
>>>> Edward Doolittle
>>>> Associate Professor of Mathematics
>>>> First Nations University of Canada
>>>> 1 First Nations Way, Regina SK S4S 7K2
>>>>
>>>> « Toutes les fois que je donne une place vacante, je fais cent
>>>> mécontents et un ingrat. »
>>>> -- Louis XIV, dans Voltaire, Le Siècle de Louis XIV, Chap. XXVI
>>>>
>>>
>>>
>>
>
--
Edward Doolittle
Associate Professor of Mathematics
First Nations University of Canada
1 First Nations Way, Regina SK S4S 7K2
« Toutes les fois que je donne une place vacante, je fais cent mécontents
et un ingrat. »
-- Louis XIV, dans Voltaire, Le Siècle de Louis XIV, Chap. XXVI
More information about the gnucash-user
mailing list