gnucash maint: [new-owner-report] fix signs for vendor/employee reports
Christopher Lam
clam at code.gnucash.org
Wed Nov 13 21:26:16 EST 2019
Updated via https://github.com/Gnucash/gnucash/commit/509c542a (commit)
from https://github.com/Gnucash/gnucash/commit/c520c5af (commit)
commit 509c542a9aa7c254eb49406dcf6e54b233eabc70
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Thu Nov 14 10:16:52 2019 +0800
[new-owner-report] fix signs for vendor/employee reports
Handling AP account splits mean we must negate some amounts for
processing and display.
diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm
index 543f9b823..10aaa60c8 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
Summary of changes:
gnucash/report/business-reports/new-owner-report.scm | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
More information about the gnucash-changes
mailing list