From 4b804a6426eb6ecddcf24ad3d8226221e04086fa Mon Sep 17 00:00:00 2001 From: sparkyx Date: Mon, 26 Jan 2026 13:19:09 +0100 Subject: [PATCH 1/2] Bug PEPPOL: set percent to 0 if autoreverse --- include/XMLDocument/xmlinvoice.class.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/include/XMLDocument/xmlinvoice.class.php b/include/XMLDocument/xmlinvoice.class.php index d681f6c71..0edaef1ee 100644 --- a/include/XMLDocument/xmlinvoice.class.php +++ b/include/XMLDocument/xmlinvoice.class.php @@ -292,7 +292,10 @@ abstract class XMLInvoice extends \DOMDocument $VAT_SubTotal[$idx_subtotal]=array(); $VAT_SubTotal[$idx_subtotal]['idx']=$idx; $VAT_SubTotal[$idx_subtotal]['vat_code']=$result['operation'][$i]['vat_code'] ; - $VAT_SubTotal[$idx_subtotal]['percent']=$percent; + if ( $acc_tva->tva_both_side == 1 ) + $VAT_SubTotal[$idx_subtotal]['percent']=0; + else + $VAT_SubTotal[$idx_subtotal]['percent']=$percent; $VAT_SubTotal[$idx_subtotal]['vatex']=$acc_tva->vx_code; $VAT_SubTotal[$idx_subtotal]['amount']=$VAT_SubTotal[$idx_subtotal]['vat']=0; @@ -302,12 +305,19 @@ abstract class XMLInvoice extends \DOMDocument * @todo Pour les intracomm , quel taux utilisé ? 0 ou 21% */ $VAT_SubTotal[$n]['amount']=bcadd($VAT_SubTotal[$n]['amount'],$result['operation'][$i]['price']); - $VAT_SubTotal[$n]['vat']=bcadd($VAT_SubTotal[$n]['vat'],$result['operation'][$i]['vat']); - $VAT_SubTotal[$n]['vat']=bcsub($VAT_SubTotal[$n]['vat'],$result['operation'][$i]['vat_reversed']); + if ( $acc_tva->tva_both_side == 0 ) + $VAT_SubTotal[$n]['vat']=bcadd($VAT_SubTotal[$n]['vat'],$result['operation'][$i]['vat']); + $result['TaxableAmount']=bcadd( $result['TaxableAmount'],$result['operation'][$i]['price']); - $result['TaxAmount']=bcadd( $result['TaxAmount'],$result['operation'][$i]['vat']); - $result['TaxAmount']=bcsub( $result['TaxAmount'],$result['operation'][$i]['vat_reversed']); + + // $result['TaxAmount']=bcsub( $result['TaxAmount'],$result['operation'][$i]['vat_reversed']); $result['operation'][$i]['vat_percent']=$percent; + if ( $acc_tva->tva_both_side == 1 ) + { + $result['operation'][$i]['vat_percent']=0; + }else { + $result['TaxAmount']=bcadd( $result['TaxAmount'],$result['operation'][$i]['vat']); + } } $result['subTotalVAT']=$VAT_SubTotal; $result['LineExtensionAmount']= $result['TaxableAmount']; From 4835d163c5120cc07057b1bc53d73b986dd2fb57 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Mon, 26 Jan 2026 13:45:20 +0100 Subject: [PATCH 2/2] Fix Bug Intracomm --- include/XMLDocument/invoiceubl21.class.php | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/include/XMLDocument/invoiceubl21.class.php b/include/XMLDocument/invoiceubl21.class.php index 0d7fa1605..546da3074 100644 --- a/include/XMLDocument/invoiceubl21.class.php +++ b/include/XMLDocument/invoiceubl21.class.php @@ -245,6 +245,31 @@ class InvoiceUBL21 extends XMLInvoice { $customer->appendChild($customer_party); return $customer; } + /** + * @brief Delivery Date is mandatory for INTRACOMM , so by default + * we set the invoice date + + + 2026-01-06 + + + */ + function build_deliveryDate() + { + $delivery=$this->createElement("cac:Delivery"); + $delivery->appendChild($this->createElement("cbc:ActualDeliveryDate",$this->data['issue_date'])); + //(cac:Delivery/cac:DeliveryLocation/cac:Address/cac:Country/cbc:IdentificationCode// + $loc= $this->createElement("cac:DeliveryLocation"); + $addr=$this->createElement('cac:Address'); + $country=$this->createElement("cac:Country"); + $country->appendChild($this->createElement("cbc:IdentificationCode", $this->data['customer']['country'])); + $addr->appendChild($country); + $loc->appendChild($addr); + $delivery->appendChild($loc); + + return $delivery; + } + /** /** * @brief Build XML Block for payment * @code @@ -659,6 +684,9 @@ class InvoiceUBL21 extends XMLInvoice { // add the customer $root->appendChild($this->build_customer()); + // add delivery date + $root->appendChild($this->build_deliveryDate()); + // add the payment if there is a bank account if ( $company['COMPANY_BANK_IBAN'] != "") $root->appendChild($this->build_paymentInfo());