Merge pull request #33301 from EchoLoGeek/develop

Remain to pay in multicurrency
This commit is contained in:
Laurent Destailleur 2025-03-03 16:48:57 +01:00 committed by GitHub
commit 3a71de8bfc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;
}