2
0
forked from Wavyzz/dolibarr

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
This commit is contained in:
EchoLoGeek
2025-03-03 11:24:33 +01:00
committed by ldestailleur
parent 361ac7fa33
commit 3bed970948

View File

@@ -286,7 +286,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;
}