diff --git a/gnucash/report/standard-reports/income-gst-statement.scm b/gnucash/report/standard-reports/income-gst-statement.scm index 54a4521d76..e3386434aa 100644 --- a/gnucash/report/standard-reports/income-gst-statement.scm +++ b/gnucash/report/standard-reports/income-gst-statement.scm @@ -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 diff --git a/gnucash/report/standard-reports/transaction.scm b/gnucash/report/standard-reports/transaction.scm index d3496dfea6..b94ce09d50 100644 --- a/gnucash/report/standard-reports/transaction.scm +++ b/gnucash/report/standard-reports/transaction.scm @@ -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))