(module example mzscheme
(require "../libs.ss"
"../parse.ss")
(define here-path ".")
(unless (file-exists? (build-path here-path "sample-gnucash-file"))
(error 'gnucash-example
"Due to hurried programming, this example can only be run when the current directory is the one containing the sample file."))
(define gnucash-file-source (build-path here-path "sample-gnucash-file"))
(define gnucash-zo-file (build-path here-path "sample-gnucash.zo"))
(init-libs (time (gnucash-read gnucash-file-source gnucash-zo-file)))
(printf "Account names: ~v\n" (map account-name-path accounts))
(define checking-account-id (account-id (find-account `("Assets" "Current Assets" "Checking Account"))))
(define my-transactions (crossers transactions (list checking-account-id)))
(printf "Net Flows: ~v\n"
(map (lambda (t)
(list (transaction-date t)
(net t (list checking-account-id) dollars)))
my-transactions))
)