commit
747979f1ba
|
|
@ -171,21 +171,30 @@ class pdf_swissqr extends pdf_sponge
|
|||
|
||||
// Calculate total with taxes
|
||||
$deja_regle = $object->getSommePaiement((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0);
|
||||
$creditnoteamount = $object->getSumCreditNotesUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); // Warning, this also include excess received
|
||||
$depositsamount = $object->getSumDepositsUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0);
|
||||
$balance = price2num($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
|
||||
$amount_credit_notes_included = $object->getSumCreditNotesUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0);
|
||||
$amount_deposits_included = $object->getSumDepositsUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0);
|
||||
$total_ttc = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
|
||||
|
||||
$balance = price2num($total_ttc - $deja_regle - $amount_credit_notes_included - $amount_deposits_included, 'MT');
|
||||
|
||||
if ($balance < 0) {
|
||||
$balance = 0;
|
||||
}
|
||||
|
||||
$currencyinvoicecode = $object->multicurrency_code ? $object->multicurrency_code : $conf->currency;
|
||||
|
||||
if ($currencyinvoicecode == "CHF" || $currencyinvoicecode == "EUR") {
|
||||
// Add payment amount information
|
||||
// What amount is to be paid?
|
||||
$qrBill->setPaymentAmountInformation(
|
||||
QrBill\DataGroup\Element\PaymentAmountInformation::create(
|
||||
'CHF',
|
||||
$currencyinvoicecode,
|
||||
$balance
|
||||
));
|
||||
} else {
|
||||
$this->error = "Only CHF or EUR currencies accepted";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Optionally, add some human-readable information about what the bill is for.
|
||||
$qrBill->setAdditionalInformation(
|
||||
|
|
|
|||
Loading…
Reference in New Issue