File Formats

This section of the manual is not particularly relevant for end-users, but I thought it could be useful for programmers trying to write Perl scripts, or Python scripts, or anything else, against the save files for QHacc. All these files are plain text files, and with the exception of the preconf file, they are readable only by the QHacc user account owner.

The Preconf File

The preconf file is never actually written to by QHacc. Usually, its existance is unnecessary, but if you use it, you'll need to know how it is formatted. As of v2.8, the preconf file can only be used to determine three values: Debug Level, Plugin directory, and i18n directory. An example file looks like:
DEBUG=6
PLUGINDIR=/home/ryan/devl/.qhacc/plugins
LANGDIR=/tmp
There isn't much to say about this file, other than *DIR tokens do not necessarily have to be absolute paths. The current plugins hierarchy is PLUGINDIR/db for database plugins, PLUGINDIR/import for import plugins and PLUGINDIR/export for export plugins.

The Regular Files

The following files are all similar: they all are just lines of text delimited by "||." They are the "regular" files because QHacc needs to read and write them during its normal operation. QHacc writes just six files: transactions, accounts, preferences, memorized, ledgers, and accounttypes. Hopefully, it is clear what is kept in each file.

The Preferences File

The preferences file used to be called the config file. Here is an example of a QHacc preferences file:
ALTCOLOR||46 192 255
AUTOCOMPLETION||0
CHSRHEADINGSIZES||95 66 
CHSRSORTASC||Y
CHSRSORTCOL||0
COLOREDVALUES||N
CSYMBOL||$
DATEFORMAT||0
DATESEPARATOR||/
DOUBLEENTRY||Y
FONT||Lucidabright,12,-1,5,50,0,0,0,0,0
GRAPHDELTAS||Y
GRAPHGUIDES||Y
GRAPHHEADS||Y
GRAPHSHOWTOTALS||Y
GRAPHTIME||12
GRAPHTYPE||2
GRDWINSIZE||816 450
HEADINGSIZES||61 79 237 197 58 67 27 
HIDECATEGORIES||N
LOCATION||0 21 937 586
MAINCOLOR||255 255 255
RECHEADINGSIZES||60 72 127 148 64 67 29 
RECVIEWSORTASC||N
RECVIEWSORTCOL||0
RECWINSIZE||791 348
REPORTTYPE||0
RIGHTCHOOSER||N
SHOWINDEX||0
SPLITTERSIZE||183 754
TITLEBARNAME||Ryan's Personal Accounts
TOOLBAR||2
TRANSTYPES||INT FEE WD ATM DEP Transfer
VIEWSORTASC||Y
VIEWSORTCOL||1
This file is self-explanatory, I think. The colors are specified as "RED GREEN BLUE" and the location box is "LEFT TOP RIGHT BOTTOM."

The Accounts File

The accounts file has a total of 24 fields. They are:
  1. ID
  2. Name
  3. Opening Balance
  4. Current Balance (recalculated upon startup)
  5. Current Reconciled Balance (recalculated upon startup)
  6. Monthly Budget Limit
  7. Transaction Numbers
  8. Default Transaction Number
  9. Account Number
  10. Institution Name
  11. Institution Address 1
  12. Institution Address 2
  13. Institution City
  14. Institution State
  15. Institution Zip
  16. Institution Phone
  17. Institution Fax
  18. Institution Email
  19. Institution Contact
  20. Account Notes
  21. Category
  22. Taxable Account
  23. Account Type
  24. Account Parent ID

The Transactions, Memorized Files

Transactions have 9 fields.
  1. ID
  2. Number
  3. Payee
  4. Memo
  5. Sum
  6. Date
  7. Reconciled
  8. Account ID
  9. Splitgroup
  10. Ledger ID
The Splitgroup is how QHacc maintains which transactions are paired with other transactions. Each pair or group of splits has a unique splitgroup.

The Schedule File

Scheduled files may be created from within QHacc. They are used in conjunction with the --cron option to add recurring transactions from the command line. The format is identical to transaction files with one exception: the sum field may be a number, a percentage, or a positional amount.

If the sum field is a number, the transaction line in indistinguishable from a regular transaction entry. However, a percentage number (15%, for example) will create a transaction with a sum equal to that percentage of the account's current balance. A positional amount will create a transaction using the sum from which ever transaction row (in the schedule file) is specified. For example, using -@2 in a schedule file will create a transaction with a sum equal to the third transaction contained in that file, negated. Together with percentage amounts, positional amounts can keep QHacc's calculations consistent. In a scheduled file, percentages are calculated before positional amounts, and positional amounts must reference a valid sum.

Finally, the date of a schedule file transaction can be either: 1/1/8000, or some other date. In the first case, the current date at the time of insertion will be used. In the latter, the specified date will be used.