horstoeko / zugferd

ZUGFeRD/XRechnung/Factur-X Library
MIT License
115 stars 23 forks source link

[QUESTION] Invoice with 0 Tax - Code E #40

Closed Dagobert87 closed 5 months ago

Dagobert87 commented 5 months ago

Hello together,

I'm not sure if it's a feature, bug, or question. So I will explain ist

I create invoices with 0.00 tax 'Code E'. when I type the following:

[...]
$document = ZugferdDocumentBuilder::CreateNew(ZugferdProfiles::PROFILE_EN16931);
$document
[...]
->addDocumentTax("E", "VAT", 0.0, 0.0, 0.0, '[reason]', 'VATEX-EU-132-1B') 
->setDocumentSummation(1.0, 1.0, 1.0, 0.0, null, 1.0, 0.0, null, 0.0)
->addDocumentPaymentTerm("Payable immediately")

->addNewPosition(1) 
->setDocumentPositionProductDetails('Item') 
->setDocumentPositionNote('Description') 
->setDocumentPositionGrossPrice(1.0) 
->setDocumentPositionNetPrice(1.0) 
->setDocumentPositionQuantity(1.0, 'H87') 
->addDocumentPositionTax('E ', 'VAT', 0.0, null, '[reason]', 'VATEX-EU-132-1B') 
->setDocumentPositionLineSummation(1.0)
[...]

When I now validate this with an online tool, I get this error message:

[BR-E-08]-In a VAT breakdown (BG-23) where the VAT category code (BT-118) is "Exempt from VAT" the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amounts (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102 ) are "Exempt from VAT".

Where is my mistake in thinking? What did I do wrong? Can someone help me, please?

Sorry my english is not good, I tried to translate it with google ;)

Thanks a lot Dagobert

horstoeko commented 5 months ago

Hi @Dagobert87

I think, that you have to call the addDocumentTax with correct values. :-) It seems to me, that the third parameter (basisAmount) should be equal to 1. You have to sum all line total amounts for each VAT category and VAT type...

If I start from your example and assume that you have only assigned this one position to the document, then you should (in my opinion) pass the third parameter with 1.0 (BasisAmount):

->addDocumentTax("E", "VAT", 1.0, 0.0, 0.0, '[reason]', 'VATEX-EU-132-1B') 
Dagobert87 commented 5 months ago

Hello, yes, it was a test, with only 1 position. To find the error, which was somewhere else ^^. I probably misunderstood the Wiki, now it works fine. Thank you very much, for the quick help. Dagobert

horstoeko commented 5 months ago

Hello, yes, it was a test, with only 1 position. To find the error, which was somewhere else ^^. I probably misunderstood the Wiki, now it works fine. Thank you very much, for the quick help. Dagobert

Can you please briefly explain what you did or misunderstood? Perhaps other users will also benefit from this. Perhaps I can also adapt my wiki to make it even easier to understand.

Dagobert87 commented 5 months ago

Hello, If you want to describe it in more detail on the wiki, I would break it down a bit:

addDocumentTax([Tax Category], [Tax Type], [Sum Netto], [Sum Tax], [Tax value]);

under there, then the points [Sum Netto], [Sum Tax], [Tax value] describe briefly in 2-3 sentences. like you did it with [Tax Category] and [Tax Type] The point about [Sum Netto] was my mistake. For example, you could mention that this value must be > 0 and must also correspond to the sum of the positions for categories E, O...

Hope that will help you.