Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix invalid tax if zero #7

Merged
merged 4 commits into from
Dec 20, 2024
Merged

Conversation

yogi70
Copy link
Contributor

@yogi70 yogi70 commented Dec 20, 2024

on a tax-less invoice the generated XML did not contain some values where they are expected:

<ubl:Invoice …>
  …
  <cac:TaxTotal>
    <cac:TaxSubtotal>
      <cbc:TaxableAmount>226.60</cbc:TaxableAmount>
      <cbc:TaxAmount>0.00</cbc:TaxAmount>
      <cac:TaxCategory>
        <cbc:ID>K</cbc:ID>
        <cbc:Percent>0.00</cbc:Percent>
        <cbc:TaxExemptionReasonCode>VATEX-EU-IC</cbc:TaxExemptionReasonCode>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:TaxCategory>
    </cac:TaxSubtotal>
  </cac:TaxTotal>
  …
</ubl:Invioce>

it validates if I manually add some data:
ubl:Invoice.cac:TaxTotal.cbc:TaxAmount and twice the currencyID Attribute to ubl:Invoice.cac:TaxTotal.cac:TaxSubtotal.{cbc:TaxableAmount,cbc:TaxAmount}

<ubl:Invoice …>
  …
  <cac:TaxTotal>
    <cbc:TaxAmount currencyID="EUR">0.00</cbc:TaxAmount>
    <cac:TaxSubtotal>
      <cbc:TaxableAmount currencyID="EUR">226.60</cbc:TaxableAmount>
      <cbc:TaxAmount currencyID="EUR">0.00</cbc:TaxAmount>
      <cac:TaxCategory>
        <cbc:ID>K</cbc:ID>
        <cbc:Percent>0.00</cbc:Percent>
        <cbc:TaxExemptionReasonCode>VATEX-EU-IC</cbc:TaxExemptionReasonCode>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:TaxCategory>
    </cac:TaxSubtotal>
  </cac:TaxTotal>
  …
</ubl:Invioce>

Also fixed the forwarded parameteres on XmlDocumentReader:

  • .whenNotExists()
    the reference could only be given to $callbackElse, not the the $callback function
  • .wnehNotEquals()
    added the reference values to the $callbackElse as on .whenEquals()

@horstoeko
Copy link
Owner

Hi @yogi70,

looks good. Can you add your test to ./build/phpunit.xml - otherwise the test will not run... ;)

@yogi70
Copy link
Contributor Author

yogi70 commented Dec 20, 2024

Added the test to the build/phpunit.xml file

@horstoeko horstoeko merged commit 8a4d16f into horstoeko:master Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants