Skip to content

Commit

Permalink
[report-utilities.scm] pull out gnc:dump-transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherlam committed Oct 13, 2023
1 parent 44c278a commit 73bb340
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions gnucash/report/report-utilities.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1208,6 +1208,15 @@
(maybe-str 'Action (xaccSplitGetAction s))
(maybe-str 'Memo (xaccSplitGetMemo s))))

(define-public (gnc:dump-transaction trans)
(format #t " Transaction:~a Date:~a Currency:~a ~a ~a\n"
(string-take (gncTransGetGUID trans) 8)
(qof-print-date (xaccTransGetDate trans))
(gnc-commodity-get-mnemonic (xaccTransGetCurrency trans))
(maybe-str 'Desc (xaccTransGetDescription trans))
(maybe-str 'Notes (xaccTransGetNotes trans)))
(for-each (cut gnc:dump-split <> #t) (xaccTransGetSplitList trans)))

(define-public (gnc:dump-all-transactions)
(define query (qof-query-create-for-splits))
(define (split-has-no-account? split) (null? (xaccSplitGetAccount split)))
Expand All @@ -1222,13 +1231,7 @@
(((? split-has-no-account?) . rest) (lp rest))
((split . rest)
(let ((trans (xaccSplitGetParent split)))
(format #t " Trans ~a: ~a Curr ~a ~a~a\n"
(string-take (gncTransGetGUID trans) 8)
(qof-print-date (xaccTransGetDate trans))
(gnc-commodity-get-mnemonic (xaccTransGetCurrency trans))
(maybe-str 'Desc (xaccTransGetDescription trans))
(maybe-str 'Notes (xaccTransGetNotes trans)))
(for-each (cut gnc:dump-split <> #t) (xaccTransGetSplitList trans))
(gnc:dump-transaction trans)
(lp rest))))))

;; utility function for testing. dumps the whole book contents to
Expand Down

0 comments on commit 73bb340

Please sign in to comment.