## 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.9.2, the preconf file can only be used to determine four values: Debug Level, Plugin directory, i18n directory, and whether or not to run scheduled jobs. An example file looks like:

    DEBUG=6
    PLUGINDIR=/home/ryan/devl/.qhacc/plugins
    LANGDIR=/tmp
    NOJOBS=true

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. If the NOJOBS line is present at all, QHacc will not check for scheduled jobs when starting up.

### 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 eight files: transactions, accounts, preferences, namedtrans, journals, jobs, 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 25 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
25. Metadata

### The Transactions

Transactions have 7 fields.

1. ID
2. Number
3. Payee
4. Memo
5. Date
6. Ledger ID
7. Type
8. Metadata

### Splits

Splits have 6 fields.

1. ID
2. Transaction ID
3. Account ID
4. Sum
5. Reconcile state
6. Reconcile date
7. Metadata

### Named Transactions (memorized)

Memorized transactions have 4 fields

1. ID
2. Name of transaction
3. Transaction ID
4. "Main" account ID

### Jobs

Jobs only have 4 fields

1. ID
2. Last run date
3. Run frequency
4. What to run