gnucash stable: Bug 799069 - Multicurrency Invoice Payment

Christopher Lam clam at code.gnucash.org
Mon Aug 28 01:03:32 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/9802c809 (commit)
	from  https://github.com/Gnucash/gnucash/commit/eb2dd3ef (commit)



commit 9802c80996589143fa3d3738b1e55987d84bf039
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Mon Aug 28 13:00:11 2023 +0800

    Bug 799069 - Multicurrency Invoice Payment
    
    Don't use TransGetCurrency/SplitValue to show payment details. They
    may convert to the user's home currency. Use SplitAccount's and
    SplitAmount to show the payment details in the APAR currency.

diff --git a/gnucash/report/reports/standard/invoice.scm b/gnucash/report/reports/standard/invoice.scm
index f04560313f..04035a74fd 100644
--- a/gnucash/report/reports/standard/invoice.scm
+++ b/gnucash/report/reports/standard/invoice.scm
@@ -357,14 +357,13 @@ for styling the invoice. Please see the exported report for the CSS class names.
                     monetary)
                 monetary))))
 
-    (define (add-payment-row table used-columns split total-collector reverse-payments?)
+    (define (add-payment-row table used-columns currency split total-collector reverse-payments?)
       (let* ((t (xaccSplitGetParent split))
-             (currency (xaccTransGetCurrency t))
              ;; Depending on the document type, the payments may need to be sign-reversed
              (amt (gnc:make-gnc-monetary currency
                                          (if reverse-payments?
-                                             (- (xaccSplitGetValue split))
-                                             (xaccSplitGetValue split)))))
+                                             (- (xaccSplitGetAmount split))
+                                             (xaccSplitGetAmount split)))))
 
         (total-collector 'add
                          (gnc:gnc-monetary-commodity amt)
@@ -511,7 +510,7 @@ for styling the invoice. Please see the exported report for the CSS class names.
                     (for-each
                      (lambda (split)
                        (if (not (equal? (xaccSplitGetParent split) txn))
-                           (add-payment-row table used-columns
+                           (add-payment-row table used-columns currency
                                             split total-collector
                                             reverse-payments?)))
                      splits)))
diff --git a/gnucash/report/reports/support/receipt.eguile.scm b/gnucash/report/reports/support/receipt.eguile.scm
index f73659f311..4c217d7d7f 100644
--- a/gnucash/report/reports/support/receipt.eguile.scm
+++ b/gnucash/report/reports/support/receipt.eguile.scm
@@ -228,14 +228,13 @@
              (lambda (split)
                 (let ((t (xaccSplitGetParent split)))
                   (unless (equal? t txn) ; don't process the entry itself as a split
-                    (let ((c (xaccTransGetCurrency t))
-                          (a (xaccSplitGetValue    split)))
-                      (total-col 'add c a)
+                    (let ((a (xaccSplitGetAmount    split)))
+                      (total-col 'add currency a)
         ?>
         <tr valign="top">
           <td align="center"><?scm:d (qof-print-date (xaccTransGetDate t)) ?></td>
           <td align="left" colspan="<?scm:d (- maxcols 3) ?>"><?scm:d opt-payment-recd-heading ?></td>
-          <td align="right" colspan="2"><?scm:d (fmtmoney c a) ?></td>
+          <td align="right" colspan="2"><?scm:d (fmtmoney currency a) ?></td>
         </tr>
         <?scm ))))
              splits)) ?>
diff --git a/gnucash/report/reports/support/taxinvoice.eguile.scm b/gnucash/report/reports/support/taxinvoice.eguile.scm
index 05e03ca591..e3483f570a 100644
--- a/gnucash/report/reports/support/taxinvoice.eguile.scm
+++ b/gnucash/report/reports/support/taxinvoice.eguile.scm
@@ -383,18 +383,17 @@
          (lambda (split)
            (let ((t (xaccSplitGetParent split)))
              (unless (equal? t txn) ; don't process the entry itself as a split ;'
-               (let ((c (xaccTransGetCurrency t))
-                     (a (if reverse-payments?
-                            (- (xaccSplitGetValue split))
-                            (xaccSplitGetValue split))))
-                 (total-col 'add c a)
+               (let ((a (if reverse-payments?
+                            (- (xaccSplitGetAmount split))
+                            (xaccSplitGetAmount split))))
+                 (total-col 'add currency a)
     ?>
     <tr valign="top">
       <?scm (when opt-col-date ?>
       <td align="center"><?scm:d (qof-print-date (xaccTransGetDate t)) ?></td>
       <?scm ) ?>
       <td align="left" colspan="<?scm:d (+ tbl_cols (if opt-col-date 0 1)) ?>"><?scm:d opt-payment-recd-heading ?></td>
-      <td align="right"><?scm:d (fmtmoney c a) ?></td>
+      <td align="right"><?scm:d (fmtmoney currency a) ?></td>
     </tr>
     <?scm ))))
          splits)) ?>



Summary of changes:
 gnucash/report/reports/standard/invoice.scm          |  9 ++++-----
 gnucash/report/reports/support/receipt.eguile.scm    |  7 +++----
 gnucash/report/reports/support/taxinvoice.eguile.scm | 11 +++++------
 3 files changed, 12 insertions(+), 15 deletions(-)



More information about the gnucash-changes mailing list