I think I have finally come to the point of understanding how the
GnuCash "engine" works, which should let me start to load in
transactions Real Soon Now.
I thought I should validate my assumptions, though. I suspect that
Linas/Rob are likely to be the main people that "properly grok it."
QIF essentially provides a structure that sort of looks like:
(chequing
(deposit 500 salary)
(withdraw 300 rent)
(transfer 200 mastercard))
Asset account
--> Bunch of transactions, implicitly associated with it
--> That are also associated with income/expense accounts
This must be transformed to something more like:
- Account points to list of splits, each split points to a transaction
Accounts look (somewhat loosely, omitting information unneccessary for
exposition purposes) in general form, like:
(account (list-of-splits))
where each split consists of
(amount account-reference transaction-reference)
For the above QIF file, it would look like:
('chequing
(500 'chequing 'deposit)
(-300 'chequing 'withdraw)
(-200 'chequing 'transfer))
('mastercard
(200 'mastercard 'transfer))
('salary
(-500 'salary 'deposit))
('rent
(-500 'rent 'withdraw))
Transactions look like a list of splits, of general form:
(transaction-reference (list-of-splits))
where the splits have the same form as before,
(amount account-reference transaction-reference)
('deposit
(500 'chequing 'deposit)
(-500 'salary 'deposit))
(withdraw
(-300 'chequing 'withdraw)
(-500 'rent 'withdraw))
(transfer
(200 'mastercard 'transfer)
(-200 'chequing 'transfer))
It seems to make sense for a "Gnucash Split" to be defined as:
(define gnc-split-structure
'(memo action reconcile-state
reconciled-date docref share-amount
share-price account
parenttransaction
c-split))
Note that this includes the "c-split" component, which would be
populated using the C address of the split. This way we maintain the
data from both sides of the Lisp<==>C "boundary." I suspect that it
may also be necessary to include a couple additional "C pointer
references" that allow referencing the C pointers to the account and
the transaction.
Creating a new split might look like this:
(define (initialize-split) ;;; Returns a gnc-split-structure
(let ((ptr (gnc:split-create))
(splitstruct (build-mystruct-instance gnc-split-structure)))
(splitstruct 'put 'gncpointer ptr)
splitstruct))
Am I way off here? Or does this sound like the right direction?
--
"Consistency is the single most important aspect of *ideology.*
Reality is not nearly so consistent." - <[EMAIL PROTECTED]>
[EMAIL PROTECTED] <http://www.ntlug.org/~cbbrowne/lsf.html>
----- %< -------------------------------------------- >% ------
The GnuCash / X-Accountant Mailing List
To unsubscribe, send mail to [EMAIL PROTECTED] and
put "unsubscribe gnucash-devel [EMAIL PROTECTED]" in the body