E-INVOICE : corrige PriceAmount

This commit is contained in:
sparkyx 2025-10-03 16:46:26 +02:00
parent 472406aa3f
commit 51e9e47250
2 changed files with 6 additions and 1 deletions

View file

@ -498,7 +498,7 @@ class InvoiceUBL21 extends XMLInvoice {
$item->appendChild($classifiedTaxCat);
$result->appendChild($item);
$price=$result->appendChild($this->createElement("cac:Price"));
$price->appendChild($this->createElement("cbc:PriceAmount",sprintf("%.2f",abs($amount))))
$price->appendChild($this->createElement("cbc:PriceAmount",sprintf("%.2f",abs($row['price_unit']))))
->setAttribute("currencyID",$this->data['currency']);
$result->appendChild($price);

View file

@ -201,9 +201,14 @@ abstract class XMLInvoice extends \DOMDocument
// $operation->det->currency_id == 0 default currency of the folder
if ($operation->det->currency_id == 0 ) {
$result['operation'][$i]['price']=$operation->det->array[$i]['qs_price'];
$result['operation'][$i]['price_unit']=$operation->det->array[$i]['qs_unit'];
$result['operation'][$i]['vat']=$operation->det->array[$i]['qs_vat'];
} else {
$result['operation'][$i]['price']=$operation->det->array[$i]['oc_amount'];
$result['operation'][$i]['price_unit']=bcdiv(
$operation->det->array[$i]['oc_amount'],
$operation->det->array[$i]['qs_quantite'],
2);
$result['operation'][$i]['vat']=$operation->det->array[$i]['oc_vat_amount'];
}