Open DinkyToys opened 5 years ago
Running into the same issue. Were you able to fix this?
No. Also didn't go further with it. Too much not documented etc.
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);
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.