GSTReport: filter out some transactions

This commit restores filtering for closing, link
and payment transactions.
This commit is contained in:
Christopher Lam
2018-02-07 22:00:39 +08:00
parent b261eb18b3
commit 97e415fdf3
2 changed files with 14 additions and 2 deletions

View File

@@ -45,7 +45,17 @@ accounts must be of type ASSET for taxes paid on expenses, and type LIABILITY fo
(define (income-gst-statement-renderer rpt)
(trep-renderer rpt
#:custom-calculated-cells gst-calculated-cells
#:empty-report-message TAX-SETUP-DESC))
#:empty-report-message TAX-SETUP-DESC
#:custom-split-filter gst-custom-split-filter))
(define (gst-custom-split-filter split)
;; split -> bool
;;
;; additional split filter - returns #t if split must be included
;; we need to exclude Closing, Link and Payment transactions
(let ((trans (xaccSplitGetParent split)))
(and (member (xaccTransGetTxnType trans) (list TXN-TYPE-NONE TXN-TYPE-INVOICE))
(not (xaccTransGetIsClosingTxn trans)))))
(define (gst-statement-options-generator)
;; Retrieve the list of options specified within the transaction report

View File

@@ -1603,7 +1603,7 @@ tags within description, notes or memo. ")
;; Here comes the renderer function for this report.
(define* (trep-renderer report-obj #:key custom-calculated-cells empty-report-message)
(define* (trep-renderer report-obj #:key custom-calculated-cells empty-report-message custom-split-filter)
(define options (gnc:report-options report-obj))
(define (opt-val section name) (gnc:option-value (gnc:lookup-option options section name)))
(define BOOK-SPLIT-ACTION (qof-book-use-split-action-for-num-field (gnc-get-current-book)))
@@ -1793,6 +1793,8 @@ tags within description, notes or memo. ")
(match? (xaccTransGetDescription trans))
(match? (xaccTransGetNotes trans))
(match? (xaccSplitGetMemo split)))
(or (not custom-split-filter) ; #f = ignore custom-split-filter
(custom-split-filter split))
(or (not reconcile-status-filter) ; #f = ignore next filter
(member (xaccSplitGetReconcile split) reconcile-status-filter)))))
splits))