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, readable only by the QHacc user account owner. In most of the files, the order of the fields is not important.

QHacc writes two files per account, plus a config file.

The config File

Here is an example of a QHacc config file:
ACCTFILES=acct0 acct1 acct2 acct3 acct4 acct5 acct6 acct7 acct8 acct9
DATEFORMAT=AMERICAN
DATESEPARATOR=/
CSYMBOL=$
TRANSTYPES=INT FEE WD ATM DEP Transfer 
TITLEBARNAME=Ryan's Personal Accounts
MAINCOLOR=255 255 255
ALTCOLOR=73 218 109
LINESPERTRANS=2
SHOWINDEX=0
LOCATION=312 356 937 586
FONT=-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1
SHOWCATEGORIES=N
AUTOCOMPLETION=0
HEADINGRATIOS=0.118841 0.118841 0.302899 0.304348 0.111594 0.0434783 
GRAPHTYPE=1
TOOLBAR=2

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 acct.info File

Here is an example of an acct.info file.
ACCTID=1
PARENTID=0
TYPE=0
NAME=Account #1
INSTITUTION=
INSTADDR1=
INSTADDR2=
INSTCITY=
INSTSTATE=
INSTZIP=
INSTCONTACT=
INSTPHONE=
INSTFAX=
INSTEMAIL=
INSTNOTES=
--ENDOFNOTE--
ID=
TAXABLE=Y
BAL=0
TRANSTYPES=INT FEE WD ATM DEP
DEFAULTTRANSTYPE=DEP
MEMS=
This file is also very obvious, I think. The TYPE field specifies which type of account this file represents. The different types are:
TYPE numberAccount Type
0Asset
1Liability
2Equity
3Expense
4Revenue
5Market
Each account must have a unique ACCTID number, but every other field is optional and doesn't have to be unique. It should be noted that account ids can change during normal QHacc operation. The INSTNOTES= and --ENDOFNOTE-- must be present together if they are to be used.

The acct.trans Files

The acct.trans file holds all the transactions for an account. It is simply a number of transactions, followed by the transactions themselves.
NUMTRANS=3
94||1||93||23||1431||Credit Card||||-100||Y||01/03/2000
95||1||96||19||||gas station||||25.22||Y||01/06/2000
97||1||98||18||||grocery store||||40.01||Y||01/06/2000||10
The NUMTRANS line must be the first line in the file. And it's a pretty rudimentary format, I admit, but it gets the job done reasonably well. And lest you think I just made it up when I started writing QHacc, this is actually the fourth revision of this file format. I'm proud to report that after going through three revisions of this format in three consecutive releases at one point, it hasn't changed much since. Here's a quick rundown of the previous versions, and the current version:
VERSION 0.2
        A C E F G H I J

VERSION 0.2.1
        A C D E F G H I J

VERSION 0.2.5 and above
        A B C D E F G H I J (C and D repeat based on B)

VERSION 0.7 and above
        A B C D E F G H I J K (C and D repeat based on B)

where
A: transaction id (unique)
B: number of splits
C: transaction pair's id (double entry transactions only)
D: transaction pair's owner account (double entry transactions only)
E: number
F: payee
G: memo
H: amount
I: reconciled? (Y or N)
J: date (MM/DD/YYYY)
K: shares (market transactions only)

The Schedule File

PAYEE=ryan
MEMO=added with cron!
NUM=3517
RECO=N
SHARES=10
DATE=06/15/1975 ACCTS=4
SPLIT job
105.5 Checking
20 Savings
52.87 auto

The only thing that really has to be in there is the PAYEE tag, and the ACCTS tag. Order doesn't really matter, but the ACCTS section has to be at the end of the file. The account names are prefixed with the amount of the transaction in them, followed by some amount of whitespace. If you would prefer to use a percentage of the account balance as the amount, just put a percent sign (%) immediately following the number. This form might be handy if your bank gives you interest on account balances, or if your credit card charges a predictable fee based on the current balance. The percentage can be positive or negative. This format does not allow for comments. All transactions added in --cron mode will have that day's date as the transaction date, unless the "DATE" tag is used. In this case, the specified date is used, as you might expect. Also, if any transaction has a percentage-based sum, the percentage will be calculated based on the account balance of that date.

The account identifiers can be an account's full name, its short name, or its account id. If you have two accounts with the same name, I guarantee one of the accounts will get the transaction. Finally, if you want a double-entry transaction inserted, you need to include two accounts, but if you give them different amounts, the first amount will be used for both transactions, and an error will be printed to the screen. You can avoid this error message by specifying "SPLIT" as one of the amounts. This is also a good idea if you want to schedule a transaction with percentages, but only for one account.

The SHARES line only has to be in there if you want to schedule a market transaction. If it's not in the file, or set to 1, a regular transaction will be created.