gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Sat Jan 25 19:55:03 EST 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/88bfc8b4 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/3f324952 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/5de18cf1 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/6ab936af (commit)
	 via  https://github.com/Gnucash/gnucash/commit/91b3c8cf (commit)
	 via  https://github.com/Gnucash/gnucash/commit/a9be5d40 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/4839a563 (commit)
	from  https://github.com/Gnucash/gnucash/commit/ffe3aa79 (commit)



commit 88bfc8b477b577b5d8bfa42d91894e295470f99d
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jan 25 17:16:05 2020 +0800

    [new-owner-report] refine payment->description
    
    LHS payment description are memos from APAR splits
    RHS payment description are memos from non-APAR splits
    RHS payment description should match RHS payment amounts

diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm
index ec3d48883..4c1122e79 100644
--- a/gnucash/report/business-reports/new-owner-report.scm
+++ b/gnucash/report/business-reports/new-owner-report.scm
@@ -311,17 +311,12 @@
 
 (define (splits->desc splits)
   (let lp ((splits splits) (result '()))
-    (if (null? splits)
-        (apply gnc:make-html-text
-               (fold
-                (lambda (a b)
-                  (cons* (gnc:html-string-sanitize a) (gnc:html-markup-br) b))
-                '() result))
-        (lp (cdr splits)
-            (let ((memo (xaccSplitGetMemo (car splits))))
-              (if (or (string-null? memo) (member memo result))
-                  result
-                  (cons memo result)))))))
+    (match splits
+      (() (apply gnc:make-html-text result))
+      ((split . rest)
+       (lp rest (cons* (gnc:html-string-sanitize (xaccSplitGetMemo split))
+                       (gnc:html-markup-br)
+                       result))))))
 
 (define (make-aging-table splits to-date payable? date-type currency)
   (let ((table (gnc:make-html-table))
@@ -591,7 +586,7 @@
                        (qof-print-date (xaccTransGetDate lot-txn))
                        (split->reference lot-split)
                        (split->type-str lot-split)
-                       (splits->desc (list lot-split))
+                       (splits->desc pmt-splits)
                        (gnc:make-html-text (split->anchor lot-split #t))
                        (let lp1 ((pmt-splits pmt-splits) (acc '()))
                          (match pmt-splits
@@ -804,7 +799,7 @@
          table odd-row? used-columns date #f
          (split->reference split)
          (split->type-str split)
-         (splits->desc (txn->assetliab-splits txn))
+         (splits->desc (xaccTransGetAPARAcctSplitList txn #t))
          currency (+ total value)
          (and (>= orig-value 0) (amount->anchor split orig-value))
          (and (< orig-value 0) (amount->anchor split (- orig-value)))

commit 3f324952d4b39720e57c7ff258f526ac7f4f997f
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jan 25 15:22:17 2020 +0800

    [new-owner-report] add interactivity to highlight linked rows
    
    add javascript to highlight matching documents/payments via their
    common link-id attribute.

diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm
index ddfe08cbb..ec3d48883 100644
--- a/gnucash/report/business-reports/new-owner-report.scm
+++ b/gnucash/report/business-reports/new-owner-report.scm
@@ -60,6 +60,23 @@
 (define balance-header (N_ "Balance"))
 (define linked-txns-header (N_ "Links"))
 
+(define javascript "
+<script>
+  function getID(cell) { return cell.getAttribute('link-id'); }
+  function clicky() {
+      var id = getID(this);
+      var ishighlighted = this.classList.contains('highlight');
+      TDs.forEach(TD => TD.classList.remove('highlight'));
+      if (ishighlighted) return;
+      TDs
+          .filter (TD => getID(TD) == id)
+          .forEach (TD => TD.classList.add('highlight'));}
+  var TDs = document.getElementsByTagName('td');
+  TDs = [...TDs].filter(getID);
+  TDs.forEach(TD => TD.onclick = clicky);
+</script>
+")
+
 ;; Depending on the report type we want to set up some lists/cases
 ;; with strings to ease overview and translation
 (define owner-string-alist
@@ -1116,7 +1133,9 @@ invoices and amounts.")))))
                (list section-headings headings)
                (list headings)))
 
-          (gnc:html-document-add-object! document table))))))
+          (gnc:html-document-add-object! document table)
+
+          (gnc:html-document-add-object! document javascript))))))
 
     document))
 
diff --git a/gnucash/report/report-system/html-fonts.scm b/gnucash/report/report-system/html-fonts.scm
index c74b8550a..abdd154dd 100644
--- a/gnucash/report/report-system/html-fonts.scm
+++ b/gnucash/report/report-system/html-fonts.scm
@@ -142,6 +142,7 @@
       "th.column-heading-left { text-align: left; " number-header-info " }\n"
       "th.column-heading-center { text-align: center; " number-header-info " }\n"
       "th.column-heading-right { text-align: right; " number-header-info " }\n"
+      "td.highlight {background-color:#e1e1e1}"
       "td.neg { " (if negative-red? "color: red; " "") " }\n"
       "td.number-cell, td.total-number-cell { text-align: right; white-space: nowrap; }\n"
       "td.date-cell { white-space: nowrap; }\n"

commit 5de18cf1015d197c23d4d6d27ec04b0ac1795cee
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jan 25 14:16:49 2020 +0800

    [new-owner-report] add invoice/txn link-id to tag via javascript
    
    This commit adds a link-id attribute to describe <td> elements
    containing invoice & payment details. Each link-id is the invoice or
    transaction guid.

diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm
index d894086ed..ddfe08cbb 100644
--- a/gnucash/report/business-reports/new-owner-report.scm
+++ b/gnucash/report/business-reports/new-owner-report.scm
@@ -88,14 +88,15 @@
   (assv-ref owner-string-alist key))
 
 (define-record-type :link-data
-  (make-link-data date ref type desc partial-amount amount)
+  (make-link-data date ref type desc partial-amount amount rhs-class)
   link-data?
   (date link-data-date)
   (ref link-data-ref)
   (type link-data-type)
   (desc link-data-desc)
   (partial-amount link-data-partial-amount)
-  (amount link-data-amount))
+  (amount link-data-amount)
+  (rhs-class link-data-rhs-class))
 
 (define-record-type :link-desc-amount
   (make-link-desc-amount desc amount)
@@ -346,23 +347,39 @@
 ;; Make a row list based on the visible columns
 ;;
 (define (add-row table odd-row? column-vector date due-date ref type-str
-                 desc currency amt debit credit sale tax
+                 desc currency amt debit credit sale tax lhs-class
                  link-option link-rows)
   (define nrows (if link-rows (length link-rows) 1))
   (define (link-data->cols link-data)
     (cond
      ((link-data? link-data)
       (append
-       (addif (date-col column-vector) (link-data-date link-data))
-       (addif (ref-col column-vector) (link-data-ref link-data))
-       (addif (type-col column-vector) (link-data-type link-data))
-       (addif (desc-col column-vector) (link-data-desc link-data))
-       (addif (or (debit-col column-vector) (credit-col column-vector))
-              (gnc:make-html-table-cell/markup
-               "number-cell" (link-data-partial-amount link-data)))
-       (addif (or (debit-col column-vector) (credit-col column-vector))
-              (gnc:make-html-table-cell/markup
-               "number-cell" (link-data-amount link-data)))))
+       (map
+        (lambda (str)
+          (let ((cell (gnc:make-html-table-cell str))
+                (rhs-class (link-data-rhs-class link-data)))
+            (when rhs-class
+              (gnc:html-table-cell-set-style!
+               cell "td" 'attribute (list "link-id" rhs-class)))
+            cell))
+        (append
+         (addif (date-col column-vector) (link-data-date link-data))
+         (addif (ref-col column-vector) (link-data-ref link-data))
+         (addif (type-col column-vector) (link-data-type link-data))
+         (addif (desc-col column-vector) (link-data-desc link-data))))
+       (map
+        (lambda (str)
+          (let ((cell (gnc:make-html-table-cell/markup "number-cell" str))
+                (rhs-class (link-data-rhs-class link-data)))
+            (when rhs-class
+              (gnc:html-table-cell-set-style!
+               cell "number-cell" 'attribute (list "link-id" rhs-class)))
+            cell))
+        (append
+         (addif (or (debit-col column-vector) (credit-col column-vector))
+                (link-data-partial-amount link-data))
+         (addif (or (debit-col column-vector) (credit-col column-vector))
+                (link-data-amount link-data))))))
 
      ((link-desc-amount? link-data)
       (let ((cols (num-cols column-vector 'rhs-span)))
@@ -386,6 +403,7 @@
       cell))
   (define mid-span
     (if (eq? link-option 'detailed) (num-cols column-vector 'mid-spac) 0))
+
   (let lp ((link-rows link-rows)
            (first-row? #t))
     (unless (null? link-rows)
@@ -394,8 +412,12 @@
            table (if odd-row? "normal-row" "alternate-row")
            (append
             (map
-             (lambda (cell)
-               (gnc:make-html-table-cell/size nrows 1 cell))
+             (lambda (str)
+               (let ((cell (gnc:make-html-table-cell/size nrows 1 str)))
+                 (when lhs-class
+                   (gnc:html-table-cell-set-style!
+                    cell "td" 'attribute (list "link-id" lhs-class)))
+                 cell))
              (append
               (addif (date-col column-vector) (qof-print-date date))
               (addif (date-due-col column-vector)
@@ -404,14 +426,21 @@
               (addif (type-col column-vector)   type-str)
               (addif (desc-col column-vector)   desc)))
             (map
-             (lambda (cell)
-               (gnc:make-html-table-cell/size/markup nrows 1 "number-cell" cell))
+             (lambda (str)
+               (let ((cell (gnc:make-html-table-cell/size/markup
+                            nrows 1 "number-cell" str)))
+                 (when lhs-class
+                   (gnc:html-table-cell-set-style!
+                    cell "number-cell" 'attribute (list "link-id" lhs-class)))
+                 cell))
              (append
               (addif (sale-col column-vector)    (cell sale))
               (addif (tax-col column-vector)     (cell tax))
               (addif (debit-col column-vector)   debit)
-              (addif (credit-col column-vector)  credit)
-              (addif (bal-col column-vector)     (cell amt))))
+              (addif (credit-col column-vector)  credit)))
+            (addif (bal-col column-vector)
+                   (gnc:make-html-table-cell/size/markup
+                    nrows 1 "number-cell" (cell amt)))
             (addif (< 0 mid-span) cell-nohoriz)
             (link-data->cols (car link-rows))))
           (gnc:html-table-append-row/markup!
@@ -494,7 +523,7 @@
 
   (define (add-balance-row odd-row? total)
     (add-row table odd-row? used-columns start-date #f "" (_ "Balance") ""
-             currency total #f #f #f (list (make-list rhs-cols #f))
+             currency total #f #f #f (list (make-list rhs-cols #f)) #f
              link-option (case link-option
                            ((none) '(()))
                            ((simple) '((#f)))
@@ -514,7 +543,8 @@
           (gnc:html-markup-anchor
            (gnc:split-anchor-text (txn->transfer-split posting-txn))
            (gnc:make-gnc-monetary
-            currency (AP-negate (xaccSplitGetAmount posting-split))))))))
+            currency (AP-negate (xaccSplitGetAmount posting-split)))))
+         (gncInvoiceReturnGUID inv))))
     (let ((lot (gncInvoiceGetPostedLot invoice)))
       (let lp ((lot-splits (gnc-lot-get-split-list lot))
                (link-splits-seen '())
@@ -552,7 +582,8 @@
                            ((pmt-split . rest)
                             (lp1 rest (cons* (split->anchor pmt-split #f)
                                              (gnc:html-markup-br)
-                                             acc)))))))
+                                             acc)))))
+                       (gncTransGetGUID lot-txn)))
                     result)))
 
          ;; This is a lot link split. Find corresponding documents,
@@ -633,7 +664,8 @@
                       (gncInvoiceGetTypeString inv)
                       (splits->desc (list APAR-split))
                       (gnc:make-html-text (split->anchor APAR-split #t))
-                      (gnc:make-html-text (split->anchor posting-split #f)))
+                      (gnc:make-html-text (split->anchor posting-split #f))
+                      (gncInvoiceReturnGUID inv))
                      result)))))))
 
   (define (invoice->sale invoice)
@@ -731,6 +763,7 @@
          (and (>= orig-value 0) (amount->anchor split orig-value))
          (and (< orig-value 0) (amount->anchor split (- orig-value)))
          (invoice->sale invoice) (invoice->tax invoice)
+         (gncInvoiceReturnGUID invoice)
          link-option
          (case link-option
            ((simple) (list (list (and (gncInvoiceIsPaid invoice) (_ "Paid")))))
@@ -759,6 +792,7 @@
          (and (>= orig-value 0) (amount->anchor split orig-value))
          (and (< orig-value 0) (amount->anchor split (- orig-value)))
          #f #f
+         (gncTransGetGUID txn)
          link-option
          (case link-option
            ((simple) (make-payment->invoices-list txn))

commit 6ab936af1f36d0fe25a8988c2f9e27b4d21d5926
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jan 25 11:57:22 2020 +0800

    [new-owner-report] LHS payments have no invoice details. remove code.
    
    a previous commit had split LHS invoice vs payment handling. remove
    invoice handling code in the payment section.

diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm
index c9ce1883c..d894086ed 100644
--- a/gnucash/report/business-reports/new-owner-report.scm
+++ b/gnucash/report/business-reports/new-owner-report.scm
@@ -740,26 +740,25 @@
         (lp printed? (not odd-row?) (cdr splits) (+ total value)
             (if (< 0 orig-value) (+ debit orig-value) debit)
             (if (< 0 orig-value) credit (- credit orig-value))
-            (+ tax (or (invoice->tax invoice) 0))
-            (+ sale (or (invoice->sale invoice) 0)))))
+            (+ tax (invoice->tax invoice))
+            (+ sale (invoice->sale invoice)))))
 
      ((txn-is-payment? (xaccSplitGetParent (car splits)))
       (let* ((split (car splits))
              (txn (xaccSplitGetParent split))
              (date (xaccTransGetDate txn))
              (orig-value (xaccTransGetAccountAmount txn acc))
-             (value (AP-negate orig-value))
-             (invoice (gncInvoiceGetInvoiceFromTxn txn)))
+             (value (AP-negate orig-value)))
 
         (add-row
-         table odd-row? used-columns date (invoice->due-date invoice)
+         table odd-row? used-columns date #f
          (split->reference split)
          (split->type-str split)
          (splits->desc (txn->assetliab-splits txn))
          currency (+ total value)
          (and (>= orig-value 0) (amount->anchor split orig-value))
          (and (< orig-value 0) (amount->anchor split (- orig-value)))
-         (invoice->sale invoice) (invoice->tax invoice)
+         #f #f
          link-option
          (case link-option
            ((simple) (make-payment->invoices-list txn))
@@ -769,8 +768,8 @@
         (lp printed? (not odd-row?) (cdr splits) (+ total value)
             (if (< 0 orig-value) (+ debit orig-value) debit)
             (if (< 0 orig-value) credit (- credit orig-value))
-            (+ tax (or (invoice->tax invoice) 0))
-            (+ sale (or (invoice->sale invoice) 0))))))))
+            tax
+            sale))))))
 
 (define (options-generator owner-type)
 

commit 91b3c8cf3a19d6a43c90adc8945e4fd136bc0861
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jan 25 11:56:01 2020 +0800

    [new-owner-report] LHS handle split->anchor differently
    
    remove cell-anchor from add-row
    no functional change

diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm
index 3f538cbfe..c9ce1883c 100644
--- a/gnucash/report/business-reports/new-owner-report.scm
+++ b/gnucash/report/business-reports/new-owner-report.scm
@@ -346,7 +346,7 @@
 ;; Make a row list based on the visible columns
 ;;
 (define (add-row table odd-row? column-vector date due-date ref type-str
-                 desc currency amt credit debit sale tax anchor-split
+                 desc currency amt debit credit sale tax
                  link-option link-rows)
   (define nrows (if link-rows (length link-rows) 1))
   (define (link-data->cols link-data)
@@ -379,12 +379,6 @@
      (else link-data)))
   (define (cell amt)
     (and amt (gnc:make-gnc-monetary currency amt)))
-  (define (cell-anchor amt)
-    (and amt anchor-split
-         (gnc:make-html-text
-          (gnc:html-markup-anchor
-           (gnc:split-anchor-text anchor-split)
-           (gnc:make-gnc-monetary currency amt)))))
   (define cell-nohoriz
     (let ((cell (gnc:make-html-table-cell/size nrows 1 #f)))
       (gnc:html-table-cell-set-style!
@@ -415,8 +409,8 @@
              (append
               (addif (sale-col column-vector)    (cell sale))
               (addif (tax-col column-vector)     (cell tax))
-              (addif (debit-col column-vector)   (cell-anchor debit))
-              (addif (credit-col column-vector)  (cell-anchor (and credit (- credit))))
+              (addif (debit-col column-vector)   debit)
+              (addif (credit-col column-vector)  credit)
               (addif (bal-col column-vector)     (cell amt))))
             (addif (< 0 mid-span) cell-nohoriz)
             (link-data->cols (car link-rows))))
@@ -500,7 +494,7 @@
 
   (define (add-balance-row odd-row? total)
     (add-row table odd-row? used-columns start-date #f "" (_ "Balance") ""
-             currency total #f #f #f #f (list (make-list rhs-cols #f))
+             currency total #f #f #f (list (make-list rhs-cols #f))
              link-option (case link-option
                            ((none) '(()))
                            ((simple) '((#f)))
@@ -662,6 +656,12 @@
          (gncInvoiceIsPosted invoice)
          (gncInvoiceGetDateDue invoice)))
 
+  (define (amount->anchor split amount)
+    (gnc:make-html-text
+     (gnc:html-markup-anchor
+      (gnc:split-anchor-text split)
+      (gnc:make-gnc-monetary currency amount))))
+
   (let lp ((printed? #f)
            (odd-row? #t)
            (splits splits)
@@ -728,10 +728,9 @@
          (split->type-str split)
          (splits->desc (list split))
          currency (+ total value)
-         (and (< orig-value 0) orig-value)
-         (and (>= orig-value 0) orig-value)
+         (and (>= orig-value 0) (amount->anchor split orig-value))
+         (and (< orig-value 0) (amount->anchor split (- orig-value)))
          (invoice->sale invoice) (invoice->tax invoice)
-         split
          link-option
          (case link-option
            ((simple) (list (list (and (gncInvoiceIsPaid invoice) (_ "Paid")))))
@@ -758,10 +757,9 @@
          (split->type-str split)
          (splits->desc (txn->assetliab-splits txn))
          currency (+ total value)
-         (and (< orig-value 0) orig-value)
-         (and (>= orig-value 0) orig-value)
+         (and (>= orig-value 0) (amount->anchor split orig-value))
+         (and (< orig-value 0) (amount->anchor split (- orig-value)))
          (invoice->sale invoice) (invoice->tax invoice)
-         split
          link-option
          (case link-option
            ((simple) (make-payment->invoices-list txn))

commit a9be5d406f6183f37117649749196912a60f0255
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jan 25 00:29:50 2020 +0800

    [new-owner-report] compact code
    
    * reuse split->anchor for RHS splits
    * use invoice->anchor for invoice anchor

diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm
index 3aed85e03..3f538cbfe 100644
--- a/gnucash/report/business-reports/new-owner-report.scm
+++ b/gnucash/report/business-reports/new-owner-report.scm
@@ -251,6 +251,11 @@
 (define (split-is-payment? split)
   (txn-is-payment? (xaccSplitGetParent split)))
 
+(define (invoice->anchor inv)
+  (gnc:html-markup-anchor
+   (gnc:invoice-anchor-text inv)
+   (gncInvoiceGetID inv)))
+
 (define (split->reference split)
   (let* ((txn (xaccSplitGetParent split))
          (type (xaccTransGetTxnType txn)))
@@ -262,10 +267,7 @@
           (gnc:split-anchor-text split) ref))))
      ((eqv? type TXN-TYPE-INVOICE)
       (let ((inv (gncInvoiceGetInvoiceFromLot (xaccSplitGetLot split))))
-        (gnc:make-html-text
-         (gnc:html-markup-anchor
-          (gnc:invoice-anchor-text inv)
-          (gncInvoiceGetID inv))))))))
+        (gnc:make-html-text (invoice->anchor inv)))))))
 
 (define (split->type-str split)
   (let* ((txn (xaccSplitGetParent split))
@@ -434,6 +436,15 @@
                              link-option))
   (define mid-span
     (if (eq? link-option 'detailed) (num-cols used-columns 'mid-spac) 0))
+
+  (define (split->anchor split negate?)
+    (gnc:html-markup-anchor
+     (gnc:split-anchor-text split)
+     (gnc:make-gnc-monetary
+      (xaccAccountGetCommodity (xaccSplitGetAccount split))
+      ((if negate? - +)
+       (AP-negate (xaccSplitGetAmount split))))))
+
   (define (print-totals total debit credit tax sale)
     (define (total-cell cell)
       (gnc:make-html-table-cell/markup "total-number-cell" cell))
@@ -535,13 +546,6 @@
               (cons (let* ((lot-split (car lot-splits))
                            (lot-txn (xaccSplitGetParent lot-split))
                            (pmt-splits (xaccTransGetPaymentAcctSplitList lot-txn)))
-                      (define (split->anchor split negate?)
-                        (gnc:html-markup-anchor
-                         (gnc:split-anchor-text split)
-                         (gnc:make-gnc-monetary
-                          (xaccAccountGetCommodity (xaccSplitGetAccount split))
-                          ((if negate? - +)
-                           (AP-negate (xaccSplitGetAmount split))))))
                       (make-link-data
                        (qof-print-date (xaccTransGetDate lot-txn))
                        (split->reference lot-split)
@@ -598,16 +602,9 @@
       (match splits
         (() (cons (AP-negate overpayment) invoices))
         ((split . rest)
-         (let ((invoice (gncInvoiceGetInvoiceFromLot (xaccSplitGetLot split))))
-           (if (null? invoice)
-               (lp rest
-                   (- overpayment (xaccSplitGetAmount split))
-                   invoices)
-               (lp rest
-                   overpayment
-                   (if (member invoice invoices)
-                       invoices
-                       (cons (cons invoice split) invoices)))))))))
+         (match (gncInvoiceGetInvoiceFromLot (xaccSplitGetLot split))
+           (() (lp rest (- overpayment (xaccSplitGetAmount split)) invoices))
+           (invoice (lp rest overpayment (cons (cons invoice split) invoices))))))))
 
   (define (make-payment->invoices-list txn)
     (list
@@ -616,10 +613,7 @@
        gnc:make-html-text
        (map
         (lambda (inv-split-pair)
-          (let ((inv (car inv-split-pair)))
-            (gnc:html-markup-anchor
-             (gnc:invoice-anchor-text inv)
-             (gncInvoiceGetID inv))))
+          (invoice->anchor (car inv-split-pair)))
         (cdr (payment-txn->overpayment-and-invoices txn)))))))
 
   (define (make-payment->invoices-table txn)
@@ -637,26 +631,15 @@
                        (gnc:make-gnc-monetary currency overpayment))
                       result)))))
         (((inv . APAR-split) . rest)
-         (let* ((tfr-txn (gncInvoiceGetPostedTxn inv)))
+         (let* ((posting-split (lot-split->posting-split APAR-split)))
            (lp rest
                (cons (make-link-data
                       (qof-print-date (gncInvoiceGetDatePosted inv))
-                      (gnc:make-html-text
-                       (gnc:html-markup-anchor
-                        (gnc:invoice-anchor-text inv)
-                        (gncInvoiceGetID inv)))
+                      (gnc:make-html-text (invoice->anchor inv))
                       (gncInvoiceGetTypeString inv)
                       (splits->desc (list APAR-split))
-                      (gnc:make-html-text
-                       (gnc:html-markup-anchor
-                        (gnc:split-anchor-text APAR-split)
-                        (gnc:make-gnc-monetary
-                         currency (AP-negate (- (xaccSplitGetAmount APAR-split))))))
-                      (gnc:make-html-text
-                       (gnc:html-markup-anchor
-                        (gnc:split-anchor-text (lot-split->posting-split APAR-split))
-                        (gnc:make-gnc-monetary
-                         currency (invoice->total inv)))))
+                      (gnc:make-html-text (split->anchor APAR-split #t))
+                      (gnc:make-html-text (split->anchor posting-split #f)))
                      result)))))))
 
   (define (invoice->sale invoice)

commit 4839a5636722793106497cb0d431ffb76cfb4594
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jan 25 00:07:37 2020 +0800

    [new-owner-report] RHS invoice amount links to invoice posting
    
    RHS invoice amounts links to the APAR posting split instead of a APAR
    payment split.

diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm
index ebe76f470..3aed85e03 100644
--- a/gnucash/report/business-reports/new-owner-report.scm
+++ b/gnucash/report/business-reports/new-owner-report.scm
@@ -654,7 +654,7 @@
                          currency (AP-negate (- (xaccSplitGetAmount APAR-split))))))
                       (gnc:make-html-text
                        (gnc:html-markup-anchor
-                        (gnc:split-anchor-text APAR-split)
+                        (gnc:split-anchor-text (lot-split->posting-split APAR-split))
                         (gnc:make-gnc-monetary
                          currency (invoice->total inv)))))
                      result)))))))



Summary of changes:
 .../report/business-reports/new-owner-report.scm   | 222 ++++++++++++---------
 gnucash/report/report-system/html-fonts.scm        |   1 +
 2 files changed, 126 insertions(+), 97 deletions(-)



More information about the gnucash-changes mailing list