From 31d8a66a1c6d8a57b6c046a7703c877b50bfbc92 Mon Sep 17 00:00:00 2001 From: EchoLoGeek <73399671+EchoLoGeek@users.noreply.github.com> Date: Mon, 3 Mar 2025 11:24:33 +0100 Subject: [PATCH 1/2] Remain to pay in multicurrency If I want to have the remainder to pay in foreign currency, I must deduct it from the amount in multicurrency, not the amount in conf->currency --- htdocs/core/class/commoninvoice.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 8d8fff229b8..780f65fd31c 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -291,7 +291,12 @@ abstract class CommonInvoice extends CommonObject $alreadypaid += $this->getSumDepositsUsed($multicurrency); $alreadypaid += $this->getSumCreditNotesUsed($multicurrency); - $remaintopay = price2num($this->total_ttc - $alreadypaid, 'MT'); + if((int) $multicurrency > 0){ + $totalamount = $this->multicurrency_total_ttc; + } else { + $totalamount = $this->total_ttc; + } + $remaintopay = price2num($totalamount - $alreadypaid, 'MT'); if ($this->status == self::STATUS_CLOSED && $this->close_code == 'discount_vat') { // If invoice closed with discount for anticipated payment $remaintopay = 0.0; } From 580e422bf52674c1470e69a5800ddb4211db4959 Mon Sep 17 00:00:00 2001 From: EchoLoGeek <73399671+EchoLoGeek@users.noreply.github.com> Date: Mon, 3 Mar 2025 11:39:18 +0100 Subject: [PATCH 2/2] fix spaces --- htdocs/core/class/commoninvoice.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 780f65fd31c..a2a431b00db 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -291,7 +291,7 @@ abstract class CommonInvoice extends CommonObject $alreadypaid += $this->getSumDepositsUsed($multicurrency); $alreadypaid += $this->getSumCreditNotesUsed($multicurrency); - if((int) $multicurrency > 0){ + if ((int) $multicurrency > 0) { $totalamount = $this->multicurrency_total_ttc; } else { $totalamount = $this->total_ttc;