Difference between revisions of "Closing Books"
m (→With gcCull.pl: file: is restricted; typos) |
(→Periodic archiving with GncArchive.pl: removing outdated comment about script availability) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 69: | Line 69: | ||
===With jGnucashEditor=== | ===With jGnucashEditor=== | ||
The third party tool [https://sourceforge.net/projects/jgnucashlib/ jGnucashEditor] comes with a [http://apps.sourceforge.net/mediawiki/jgnucashlib/index.php?title=SplitterToolPlugin splitter-plugin] that can split your gnucash-file at a given date keeping balances, accounts, invoices, customers and stock-quotes intact. | The third party tool [https://sourceforge.net/projects/jgnucashlib/ jGnucashEditor] comes with a [http://apps.sourceforge.net/mediawiki/jgnucashlib/index.php?title=SplitterToolPlugin splitter-plugin] that can split your gnucash-file at a given date keeping balances, accounts, invoices, customers and stock-quotes intact. | ||
+ | |||
+ | ==Periodic archiving with GncArchive.pl== | ||
+ | [[GncArchive.pl]] is a development of Doug Pasterello’s original script [[gcCull.pl]]. (Thanks to Doug for the original script!) | ||
+ | |||
+ | GncArchive.pl will remove transactions on and before a given date from an uncompressed GnuCash XML file and replaces these transactions with an opening balance transaction posted to each asset/liability account and a new equity account created for the purpose. | ||
+ | |||
+ | The new equity account is created at the top level, and uses the most popular commodity found in the file. Opening balance transactions posted to accounts with different commodities are generated with a 1:1 valuation, and the description “Opening balance (needs valuation)”. These will need manually adjusting later to get correct opening valuations. | ||
+ | |||
+ | The script creates a backup of the original input file with an added “.original” suffix, and an archive version of the original file which has all the scheduled transactions removed. This should make it usable as a read-only reference if needed in the future. | ||
+ | |||
+ | I’ve only tested this on my domestic accounts file which I’ve been maintaining since 2003. Some years ago I archived the first 6 years using manual transaction deletion and figured I didn’t ever want to do that again. So when the file needed pruning again I decided to enhance Doug’s script to automate the process. | ||
+ | |||
+ | How I used the script: | ||
+ | |||
+ | # Open the existing file in Gnucash. | ||
+ | # Modify preferences so file is saved as uncompressed XML. | ||
+ | # Create a balance sheet report for the current date and export to PDF | ||
+ | #:- This will be used later to verify that the new file is fundamentally intact and unbroken, | ||
+ | #:- Create any other reports you may want to use for verification. | ||
+ | # Create a balance sheet report for the archiving date and export to PDF | ||
+ | #:- This will be used later to provide valuations for accounts that use minority commodities. | ||
+ | # Save and close. | ||
+ | # Make your own backup (should not be necessary, but …!) | ||
+ | # Run GncArchive.pl <file> <yyyymmdd> | ||
+ | #:- removes all transactions before or on the date yyyy/mm/dd | ||
+ | #:- creates a new equity account “Generated Balancing Transactions” at the root level | ||
+ | #:- posts opening balance transactions dated yyyy/mm/dd for any modified asset/liability accounts | ||
+ | #:- saves original GnuCash file as <file>.original | ||
+ | #:- creates archive of original Gnucash file, without scheduled transactions, as <basename>-archive-yyyymmdd.gnucash | ||
+ | # Reopen the file in Gnucash. | ||
+ | # Run Actions/Check&repair/Check&Repair all (should not be necessary, but …!) | ||
+ | # Find the new equity account “Generated Balancing Transactions” and rename, relocate, etc as desired. | ||
+ | # Find the transactions in this account that need proper valuations. | ||
+ | #:- jump to the corresponding entry in the asset/liability account, | ||
+ | #:- edit the valuation using the from the balance sheet report and fix the description. | ||
+ | # Regenerate balance sheet and any other reports and compare with references. | ||
+ | # Tidy up any unused accounts that are no longer required. | ||
+ | |||
+ | Hopefully this will be useful to other script-aware domestic users of GnuCash, but usual disclaimers apply. |
Latest revision as of 22:34, 19 August 2021
It should be noted that GnuCash reports should be able to provide accurate year-end data for accounting purposes without zeroing transactions, so book-closing may not be necessary. Leaving books unclosed does mean that account balances in the Chart of Accounts will not show Year-To-Date amounts.
Many users prefer to close the books however, and a number of approaches are described below.
Contents
Using Close Book Option
Since 2.2.4, there has been a menu item for closing the books under {Tools->Close Book}. This item creates two zeroing transactions (one for expense accounts, one for income accounts). Each account in those portions of the accounts tree is reset to zero by transferring from the equity account of your choosing.
For older versions, a not-unreasonable work around is to copy your data file, and edit it to add zeroing transactions to each income/expense account.
Other methods:
New Account Branch for Year-End Totals
Another method is to transfer your year-end Expense and Income totals to Equity. It is recommended to completely close out the previous year and archive a copy of your GnuCash data file before doing this.
Choose File->New Account and create an equity account for Year End transactions. For each expense and income account, create a transaction on the last day of the year to shift the balance out of the expense account into the Year End account. The account report for the Year End account makes a good summary of the information.
Some people prefer to make separate accounts for
Equity->Year End-> 2005 Expenses
Equity->Year End-> 2005 Income
so that the chart of accounts itself gives a nice summary year over year.
This method has the advantage that when entering new transactions, the auto-complete features will still work. It has the disadvantage that running reports that cross the year boundary will be skewed. Some people move any real transactions that occurred on December 31st to December 30th, so that reports can be run from January 1st through December 30th for the year.
One File Per Year
- Once your current year books are complete, create an empty copy of your Chart of Accounts by selecting File->Export->Accounts. Give the empty file the name you intend to use for the new year. This will eventually become your new set of books.
- Next, generate a Balance Sheet report in your current year file as of your closing date and print this.
- Save the current year books to another drive location. You may wish to copy the entire directory out, as well as burn a more permanent copy to be sent offsite for safekeeping.
- Now, open the empty copy of your books you created. Use the Balance Sheet report you printed earlier to create opening entries for each account that needs it. You can create these as multiple transactions (one for each account), or as fewer split transactions, as you prefer.
Yet Another Method
These are the steps:
- record all transactions that occurred in current year
- optional take inventory of all possessions - add the values to Fixed Assets
- record the end value of all Asset and Liability accounts - these will be the opening balances (from Equity->Opening Balances) for the new year
- zero out all income and expense accounts (transfer balance to Equity->Income$YEAR and Equity->Expense$YEAR accounts)
- cancel all recurring transactions in current year file
- export accounts (File->Export->Export Accounts) to new year file
- Open new year file
- Delete old or unused accounts
- Create opening balance in new years Asset and Liability Accounts from values from current year (from step 3) from Equity->Opening Balances account
- recreate recurring transactions
- add StockQuote information - click on Tools->Price Editor->Get Quotes
With gcCull.pl
For those who expressed interest in this, I've attached my perl script gcCull.pl. It is not the cleanest way to clear out old transactions, but should be O.K. until one of us gets around to doing the real thing in GnuCash.
Here is how I use it;
- Create an account summary report up to the end of <year>
- - This will be used to create the initial account balances in the new file, so export it so you can use it later.
- gunzip the GC file (may need to add a ".gz" to the name)
- run gcCull.pl <file> <year>
- - This removes all transactions older than last day of <year>
- (except for stock and mutual fund accounts)
- - new_<file> is created
- Open the new file in GC
- Run Actions/Check&repair/Check&Repair all
- Delete any unused accounts, sub-account, and transactions
- zero out the "imbalance" accounts using transfers from "Retained Earnings". (optional)
- Create starting balances for cleaned accounts using the account summary created from the original database.
There are 2 subroutines that determine when splits should be removed, so the script should be easy to customize to your needs.
Let me know how things work out :)
- -- Doug. [1]
With jGnucashEditor
The third party tool jGnucashEditor comes with a splitter-plugin that can split your gnucash-file at a given date keeping balances, accounts, invoices, customers and stock-quotes intact.
Periodic archiving with GncArchive.pl
GncArchive.pl is a development of Doug Pasterello’s original script gcCull.pl. (Thanks to Doug for the original script!)
GncArchive.pl will remove transactions on and before a given date from an uncompressed GnuCash XML file and replaces these transactions with an opening balance transaction posted to each asset/liability account and a new equity account created for the purpose.
The new equity account is created at the top level, and uses the most popular commodity found in the file. Opening balance transactions posted to accounts with different commodities are generated with a 1:1 valuation, and the description “Opening balance (needs valuation)”. These will need manually adjusting later to get correct opening valuations.
The script creates a backup of the original input file with an added “.original” suffix, and an archive version of the original file which has all the scheduled transactions removed. This should make it usable as a read-only reference if needed in the future.
I’ve only tested this on my domestic accounts file which I’ve been maintaining since 2003. Some years ago I archived the first 6 years using manual transaction deletion and figured I didn’t ever want to do that again. So when the file needed pruning again I decided to enhance Doug’s script to automate the process.
How I used the script:
- Open the existing file in Gnucash.
- Modify preferences so file is saved as uncompressed XML.
- Create a balance sheet report for the current date and export to PDF
- - This will be used later to verify that the new file is fundamentally intact and unbroken,
- - Create any other reports you may want to use for verification.
- Create a balance sheet report for the archiving date and export to PDF
- - This will be used later to provide valuations for accounts that use minority commodities.
- Save and close.
- Make your own backup (should not be necessary, but …!)
- Run GncArchive.pl <file> <yyyymmdd>
- - removes all transactions before or on the date yyyy/mm/dd
- - creates a new equity account “Generated Balancing Transactions” at the root level
- - posts opening balance transactions dated yyyy/mm/dd for any modified asset/liability accounts
- - saves original GnuCash file as <file>.original
- - creates archive of original Gnucash file, without scheduled transactions, as <basename>-archive-yyyymmdd.gnucash
- Reopen the file in Gnucash.
- Run Actions/Check&repair/Check&Repair all (should not be necessary, but …!)
- Find the new equity account “Generated Balancing Transactions” and rename, relocate, etc as desired.
- Find the transactions in this account that need proper valuations.
- - jump to the corresponding entry in the asset/liability account,
- - edit the valuation using the from the balance sheet report and fix the description.
- Regenerate balance sheet and any other reports and compare with references.
- Tidy up any unused accounts that are no longer required.
Hopefully this will be useful to other script-aware domestic users of GnuCash, but usual disclaimers apply.