CleverIT / UBL_invoice

MIT License
36 stars 39 forks source link

UBL-Invoice-2.1.xsd error #21

Open DinkyToys opened 5 years ago

DinkyToys commented 5 years ago

When testing with: https://peppol.helger.com/public/locale-en_US/menuitem-validation-bis2 In the Netherlands we use UBL-Invoice-2.1.

I get an failure message: Error message: [SAX] cvc-complex-type.2.4.b: The content of element 'cac:TaxTotal' is not complete. One of '{"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":TaxAmount}' is expected. Technical details: cvc-complex-type.2.4.b: The content of element 'cac:TaxTotal' is not complete. One of '{"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":TaxAmount}' is expected.

nssnl commented 4 years ago

Running into the same issue. Were you able to fix this?

DinkyToys commented 4 years ago

No. Also didn't go further with it. Too much not documented etc.

martijnderidder commented 1 year ago

I have fix it;

For each invoice line we use this code;

$taxTotal = new TaxTotal();
$taxSubTotal = new TaxSubTotal();
$taxSubTotal->setTaxableAmount($priceLine);
$taxSubTotal->setTaxAmount($priceLine * $taxPercentage);
$taxSubTotal->setTaxCategory($taxCategory);
$taxTotal->addTaxSubTotal($taxSubTotal);
$taxTotal->setTaxAmount($taxSubTotal->getTaxAmount());

And at the end of the invoice we use this code;

$taxTotal = new TaxTotal();
$taxSubTotal = new TaxSubTotal();
$taxSubTotal->setTaxableAmount($this->centToEur($invoice->amountWithoutTax->getAmount()));
$taxSubTotal->setTaxAmount($this->centToEur($invoice->tax->getAmount()));
$taxSubTotal->setTaxCategory($taxCategory);
$taxTotal->addTaxSubTotal($taxSubTotal);
$taxTotal->setTaxAmount($taxSubTotal->getTaxAmount());

And the last line:

$ublInvoice->setTaxTotal($taxTotal);