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 three files per account, plus a config file.

The config File

Here is an example of a QHacc config file:
MAINCOLOR=255 255 255
ALTCOLOR=173 216 230
LINESPERTRANS=2
NUMACCTS=3
SHOWINDEX=0
ACCTFILES=acct0 acct1 acct2 
LOCATION=327 261 600 300
FONT=-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1
DATEFORMAT=AMERICAN
DATESEPARATOR=/
CSYMBOL=$
DECORATION=1
GRAPHTYPE=1
TRANSTYPES=ATM DEP WD

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
4Market
Each account must have a unique ACCTID number, but every other field is optional and doesn't have to be unique. 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. The acct.mem file holds the memorized transactions. Both files use the same format:
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 until this release. 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
ACCTS=4
SHARES=10
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. The account names specified must match available account names exactly. 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.