Hi.

QHacc now comes with a command-line switch to add transactions. The syntax is:
qhacc --cron <Transaction File>. The Transaction File is a special file that
contains information about the transaction you want to add.

The --cron mode is, obviously, intended to help QHacc interact with cron a
little better. In this mode, QHacc only writes to the screen to inform you of
errors (assuming you've compiled with no debug information). It loads all your
files, adds the transaction you want, and then quits silently. --cron mode
supports adding transactions based on a specified value, or based on the
balance of the account at the time of insertion.

Why would you care about --cron? Well, if you want to schedule transactions,
cron is a good way to do it. For a while, I was planning to add my own
scheduling code into QHacc, and then I decided the calendaring stuff needed to
do this would make my config files hairy. Plus, it is completely redundant. So
I vetoed myself. Hopefully, the --cron mode will satisfy most user's needs. I
realise not everyone has access to cron on their systems. I'm sorry about
that. Talk to your administrator. If you have a nice one, maybe (s)he'll put
a job in root's for you. He'd have to be EXTREMELY nice, but it's worth a
shot, right? If not, I suggest using memorized transactions to work around the
problem.

Okay. Enough already, I can hear you saying. What's the Transaction File
format? It's pretty simple, and follows the format specified in FILE_FORMAT
somwhat closely. Here's an example file:
+----------------
| PAYEE=ryan
| MEMO=added with cron!
| NUM=3517
| RECO=N
| ACCTS=4
| SPLIT job
| 105.5 Checking
| 20 Savings
| 52.87 auto
+----------------

And here's another:
+----------------
| PAYEE=ryan
| MEMO=added with cron!
| RECO=N
| ACCTS=2
| 17.99% Credit Card
| 0 bank fees
+----------------

<READ THIS PARAGRAPH>
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. This format does not allow for
comments. All transactions added in --cron mode will have that day's date
as the transaction date. You can specify ONE account with the SPLIT tag. That
account will become the split base transaction. If you don't specify a SPLIT
transaction, the first account will become the split base. If you specify more
than one, you're just going to make everybody upset. Actually, you can specify
more than one SPLIT transaction, but only the last one gets used. The other
transaction will be deleted as soon as you try to look at it. You can have any
number of accounts in the split (including 0 and 1, if you don't want it split
at all). 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. (This
means in the above example, the value of "Credit Card" will get accounted in
"bank fees" as well.)

I hope this give you hours of fun,

ryan <ryan@ostrich-emulators.cx>.


