[GNC] Order of accounts when closing the book

Paul Kroitor paul at kroitor.ca
Tue Jun 10 13:23:51 EDT 2025


Consider using the built-in close action, then duplicating the created closing transactions.

Delete all the Extraordinary items from the originals (and adjust the counter booking to match the new totals).

Then adjust the second to be against your Extraordinary Income / Expense equity accounts and delete all the Ordinary items.

Just a thought…

Sent from my iPad

> On Jun 10, 2025, at 1:13 PM, Stan Brown (using GC 4.14) <stan+gc at fastmail.fm> wrote:
> 
> On 2025-06-10 09:16, Stephen M. Butler wrote:
>>> On 6/10/25 08:41, Michael or Penny Novack via gnucash-user wrote:
>>> On 6/10/2025 12:36 AM, Stan Brown (using GC 4.14) wrote:
>>>> The Close the Book tool generates two transactions, one for all income
>>>> accounts and the other for all expense accounts. The accounts are not in
>>>> alphabetical order in either transaction, nor are they in Account Code
>>>> order, nor arranged by the values of the splits.
>>>> 
>>>> They _seem_ random, but I can't imagine they really are. Can anyone tell
>>>> me (a) how they're actually sorted, and (b) how I can get them in
>>>> Account Code order?
>>> 
>>> If you are really doing a "close the books" << close the "temporary*
>>> accounts of types income and expense" into equity it could be done
>>> three ways:
>>> 
>>> a) In a single transaction.
>>> 
>>> b) In two transactions, one for the income accounts and one for the
>>> expense accounts.
>>> 
>>> c) Separate transactions for each income and expense account.
>>> 
>>> These are logical equivalents. So you appear to be asking, "were I
>>> using method "c" am I forced to do them in some specified work flow
>>> order?" You are of course asking about "b" but what meaning are you
>>> attaching to order?
>>> 
>>> Michael D Novack
>> 
>> The GnuCash book closing module uses method b.
>> 
>> One of the things about data storage that I learned early on (retired
>> Oracle DBA) is never to assume a particular order within the data
>> store.  The order could vary depending on the internal representation. 
>> Does the store use a B-Tree index or a hashing algorithm.  Does it use
>> the raw value or substitute an internal ID that is then associated with
>> the raw value.  Or is it stored in the order in which it was
>> encountered.  This could change from one release of the software to the
>> next (Oracle did that a couple of times during my career).
>> 
>> So, if you need to impose some order then the best method is to extract
>> the data into an external tool where you can sort it as desired.
> Thanks, Stephen. I was afraid that was the answer.
> 
> I guess what I'll need to do is set up a scheduled transaction with one
> simple transaction per income or expense account. I can make them show
> up in the desired order by placing the Account Code in the Num field. Of
> course I'll have to remember to change the SX every time I add or move
> an income or expense account, and at the end of the year I'll have to
> enter the appropriate balances manually. That all seems like a lot of
> work, with plenty of room for mistakes.
> 
> Although ... When HTML was a lot newer, I hung out in the HTML and CSS
> newsgroups. Very often, someone would post a requirement and ask how to
> accomplish it, and the answer was "stop wanting that" because the
> then-current HTML and CSS specs didn't provide an answer. Maybe the
> right answer to my query about getting closing entries in account-code
> order is "stop wanting that". Your point about a new release of the
> software possibly changing its own strategy is a good one; I too have
> seen that happen from time to time.
> 
> (Before I go any further, I should say that I use GC for my personal
> accounting, not for any business or other organization. So I'm free to
> choose the bookkeeping practices that give me the kinds of information I
> want to know.)
> 
> I need to think about just what I hope to gain by closing the books
> every year. And it may be part of a larger context that I need to
> resolve also. Here's what I mean by that.
>    When I learned bookkeeping, we distinguished between ordinary income or
> loss) and extraordinary items. Ordinary income was the result of normal
> recurring activities, what a business would call day-to-day operations.
> Extraordinary items were items that recurred seldom or never and would
> distort the computation of net income if they were included, like
> getting a significant legacy or having your house flood. Extraordinary
> Items was an equity account; it got closed into the top-level equity
> account and didn't appear in the income statement except perhaps as a
> footnote.
>    But ultimately, both Ordinary Income and Extraordinary Items affect
> total equity, whether they get closed into the top-level Equity account
> or not. I need to think carefully about whether keeping Extraordinary
> Items in Equities is really the right thing to do in my situation. Then,
> I suspect, I'll also know whether to close the books every year, and if
> so whether  I can use "Tools » Close Books" or need to do the work manually.
> 
> --
> Stan Brown
> Tehachapi, CA, USA
> https://BrownMath.com
> _______________________________________________
> gnucash-user mailing list
> gnucash-user at gnucash.org
> To update your subscription preferences or to unsubscribe:
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> -----
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.



More information about the gnucash-user mailing list