From 509c542a9aa7c254eb49406dcf6e54b233eabc70 Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Thu, 14 Nov 2019 10:16:52 +0800 Subject: [PATCH] [new-owner-report] fix signs for vendor/employee reports Handling AP account splits mean we must negate some amounts for processing and display. --- gnucash/report/business-reports/new-owner-report.scm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm index 543f9b8232..10aaa60c8d 100644 --- a/gnucash/report/business-reports/new-owner-report.scm +++ b/gnucash/report/business-reports/new-owner-report.scm @@ -248,6 +248,8 @@ (define (add-owner-table table splits acc start-date end-date date-type used-columns payable? link-option) + (define (AP-negate num) + (if payable? (- num) num)) (define currency (xaccAccountGetCommodity acc)) (define link-cols (assq-ref '((none . 0) (simple . 1) (detailed . 3)) link-option)) (define (print-totals total debit credit tax sale) @@ -314,8 +316,9 @@ (cons (list (gnc:make-html-table-cell/size 1 2 (_ "Outstanding")) (make-cell (gnc:make-gnc-monetary - currency (gnc-lot-get-balance - (gncInvoiceGetPostedLot invoice))))) + currency + (AP-negate (gnc-lot-get-balance + (gncInvoiceGetPostedLot invoice)))))) result)))) (else (let* ((lot-split (car invoice-splits)) @@ -329,7 +332,7 @@ (let* ((tfr-split (car tfr-splits)) (tfr-acct (xaccSplitGetAccount tfr-split)) (tfr-curr (xaccAccountGetCommodity tfr-acct)) - (tfr-amt (xaccSplitGetAmount tfr-split))) + (tfr-amt (AP-negate (xaccSplitGetAmount tfr-split)))) (lp1 (cdr tfr-splits) (cons (list (qof-print-date (xaccTransGetDate lot-txn)) @@ -372,7 +375,7 @@ (let* ((payment-split (car payment-splits)) (inv (car payment-split)) (inv-split (cadr payment-split)) - (inv-amount (xaccSplitGetAmount inv-split))) + (inv-amount (AP-negate (xaccSplitGetAmount inv-split)))) (lp (cdr payment-splits) (- amount inv-amount) (cons (list