ZUGFeRD / mustangproject

Open Source Java e-Invoicing library, validator and tool (Factur-X/ZUGFeRD, UNCEFACT/CII XRechnung)
http://www.mustangproject.org
Apache License 2.0
202 stars 113 forks source link

SchemeID "FC" für die Steuernummer wird von der Validierung als ungültig abgelehnt #301

Open msccip opened 1 year ago

msccip commented 1 year ago

Grundsätzlich ist lt. Dokumentation die Kennung "FC" (Fiscal number) zur Kennzeichnung der Steuernummer (nicht USt-ID) erlaubt. Die Validierung bringt jedoch eine Fehlermeldung:

Value of '@schemeID' is not allowed. (From /xslt/ZF_220/FACTUR-X_EN16931.xslt)

Validiert man das XML mit dem KoSIT Validator, kommt keine Fehlermeldung. Warum erfolgt für ZUGFeRD hier eine Einschränkung auf "VA" ?

...

xxxx 99999 Straße 50 Musterstadt DE 47114712
jstaerk commented 1 year ago

Hi, that's interesting, when I tried to reproduce it with a whole file (i.e., this one ) in Mustang 2.5.7 I got a different error, namely

<error type="24" location="/*:CrossIndustryInvoice[namespace-uri()='urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100'][1]/*:SupplyChainTradeTransaction[namespace-uri()='urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100'][1]/*:ApplicableHeaderTradeAgreement[namespace-uri()='urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100'][1]/*:SellerTradeParty[namespace-uri()='urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100'][1]" criterion="(ram:ID) or (ram:GlobalID) or (ram:SpecifiedLegalOrganization/ram:ID) or (ram:SpecifiedTaxRegistration/ram:ID[@schemeID='VA'])">[BR-CO-26]-In order for the buyer to automatically identify a supplier, the Seller identifier (BT-29), the Seller legal registration identifier (BT-30) and/or the Seller VAT identifier (BT-31) shall be present. [ID BR-CO-26] from /xslt/cii16931schematron/EN16931-CII-validation.xslt)</error>

Please note that the upstream location to inquire at would be https://github.com/ConnectingEurope/eInvoicing-EN16931/issues and that this requirement maybe does not stop you from mentioning FC as long as you also mention e.g. a VA. To my unaided eye VA looks more like a domestic identifier and if you assume that the we're talking about EN16931 or a CIUS thereof, international rules may apply.

kind regards Jochen

msccip commented 1 year ago

Hi, when I put the "FC" below SellerTradeParty like in your example, I don't get any errors. But if I set it inside BuyerTradeParty, the schemeID is said to be invalid. And that only if I check it with Mustang.

jstaerk commented 1 year ago

Hi @msccip could you please attach a file that raises the according error? Validation errors are really difficult to chase when you don't have a sample where they occur. Thank you.

msccip commented 1 year ago

ZF2202000002.PDF

<?xml version="1.0" encoding="UTF-8"?>

D:\CIP_VFP\TEST\KOMMU_DEV\CIPRechnung\ERechAusgabe\ZF2202000002.PDF
00:00:00.628 1 0 0 00:00:00.752 Mustang 884 2 urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.2 8 1 2368 Value of '@schemeID' is not allowed. from /xslt/ZF_221/FACTUR-X_EN16931.xslt)
reiz commented 1 month ago

@msccip @jstaerk In my humble opinion the specification and the schematron rules are fine for this case. If you want to create a credit note (Gutschrift) as an e-invoice ZUGFeRD document, you have to choose the typeCode 389. In this case the SellerTradeParty is the contractor/freelancer and the BuyerTradeParty is your own company. This is because your company (BuyerTradeParty) is buying goods or services from the contractor/freelancer (SellerTradeParty).

In this case you can use schemeID="FC" as SpecifiedTaxRegistration under the SellerTradeParty. On the other hand you have to use schemeID="VA" as SpecifiedTaxRegistration under the BuyerTradeParty. This is because ZUGFeRD is only mandatory for B2B & B2G transactions and as a business you should have a VAT ID. That is at least my understanding. Correct my if I'm wrong. I'm not a tax layer. Don't hold my liable for my words here!

Here attached is valid credit note as an e-invoice ZUGFeRD document, created at ZEIT.IO. It was validated by services.fnfe-mpe.org: ZEIT.IO-CreditNote.pdf

The PDF contains this XML:

<?xml version="1.0" encoding="UTF-8"?>
<rsm:CrossIndustryInvoice xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100" xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100">
  <rsm:ExchangedDocumentContext>
    <ram:GuidelineSpecifiedDocumentContextParameter>
      <ram:ID>urn:cen.eu:en16931:2017#compliant#urn:factur-x.eu:1p0:basic</ram:ID>
    </ram:GuidelineSpecifiedDocumentContextParameter>
  </rsm:ExchangedDocumentContext>
  <rsm:ExchangedDocument>
    <ram:ID>CN-0010</ram:ID>
    <ram:TypeCode>389</ram:TypeCode>
    <ram:IssueDateTime>
      <udt:DateTimeString format="102">20240828</udt:DateTimeString>
    </ram:IssueDateTime>
    <ram:IncludedNote>
      <ram:Content>Für die erbrachten und genehmigten Leistungen, erlauben wir uns, Ihnen folgende Position(en) gutzuschreiben.</ram:Content>
    </ram:IncludedNote>
    <ram:IncludedNote>
      <ram:Content>Bank: Deutsche Bank
IBAN: DE07 1234 1234 1234 1234 12</ram:Content>
    </ram:IncludedNote>
  </rsm:ExchangedDocument>
  <rsm:SupplyChainTradeTransaction>
    <ram:IncludedSupplyChainTradeLineItem>
      <ram:AssociatedDocumentLineDocument>
        <ram:LineID>1</ram:LineID>
      </ram:AssociatedDocumentLineDocument>
      <ram:SpecifiedTradeProduct>
        <ram:Name>Projekt: UI-TEST
Zeitraum: 01.08.2024 - 28.08.2024</ram:Name>
      </ram:SpecifiedTradeProduct>
      <ram:SpecifiedLineTradeAgreement>
        <ram:NetPriceProductTradePrice>
          <ram:ChargeAmount>75.0</ram:ChargeAmount>
        </ram:NetPriceProductTradePrice>
      </ram:SpecifiedLineTradeAgreement>
      <ram:SpecifiedLineTradeDelivery>
        <ram:BilledQuantity unitCode="HUR">4.0</ram:BilledQuantity>
      </ram:SpecifiedLineTradeDelivery>
      <ram:SpecifiedLineTradeSettlement>
        <ram:ApplicableTradeTax>
          <ram:TypeCode>VAT</ram:TypeCode>
          <ram:CategoryCode>S</ram:CategoryCode>
          <ram:RateApplicablePercent>19.0</ram:RateApplicablePercent>
        </ram:ApplicableTradeTax>
        <ram:SpecifiedTradeSettlementLineMonetarySummation>
          <ram:LineTotalAmount>300.0</ram:LineTotalAmount>
        </ram:SpecifiedTradeSettlementLineMonetarySummation>
      </ram:SpecifiedLineTradeSettlement>
    </ram:IncludedSupplyChainTradeLineItem>
    <ram:ApplicableHeaderTradeAgreement>
      <ram:BuyerReference>PO12</ram:BuyerReference>
      <ram:SellerTradeParty>
        <ram:ID>35182/02473</ram:ID>
        <ram:Name>Max Mustermann</ram:Name>
        <ram:PostalTradeAddress>
          <ram:PostcodeCode>68199</ram:PostcodeCode>
          <ram:LineOne>Otto-Beck-Str. 12</ram:LineOne>
          <ram:CityName>Mannheim</ram:CityName>
          <ram:CountryID>DE</ram:CountryID>
        </ram:PostalTradeAddress>
        <ram:URIUniversalCommunication>
          <ram:URIID schemeID="EM">z_worker@zeit.io</ram:URIID>
        </ram:URIUniversalCommunication>
        <ram:SpecifiedTaxRegistration>
          <ram:ID schemeID="FC">35182/02473</ram:ID>
        </ram:SpecifiedTaxRegistration>
      </ram:SellerTradeParty>
      <ram:BuyerTradeParty>
        <ram:ID>DE12345</ram:ID>
        <ram:Name>AgencyOne GmbH</ram:Name>
        <ram:PostalTradeAddress>
          <ram:PostcodeCode>68112</ram:PostcodeCode>
          <ram:LineOne>Max-Bam-Str. 23</ram:LineOne>
          <ram:CityName>Mannheim</ram:CityName>
          <ram:CountryID>DE</ram:CountryID>
        </ram:PostalTradeAddress>
        <ram:URIUniversalCommunication>
          <ram:URIID schemeID="EM">reiz@zeit.io</ram:URIID>
        </ram:URIUniversalCommunication>
        <ram:SpecifiedTaxRegistration>
          <ram:ID schemeID="VA">DE12345</ram:ID>
        </ram:SpecifiedTaxRegistration>
      </ram:BuyerTradeParty>
    </ram:ApplicableHeaderTradeAgreement>
    <ram:ApplicableHeaderTradeDelivery>
      <ram:ShipToTradeParty>
        <ram:PostalTradeAddress>
          <ram:CountryID>DE</ram:CountryID>
        </ram:PostalTradeAddress>
      </ram:ShipToTradeParty>
      <ram:ActualDeliverySupplyChainEvent>
        <ram:OccurrenceDateTime>
          <udt:DateTimeString format="102">20240826</udt:DateTimeString>
        </ram:OccurrenceDateTime>
      </ram:ActualDeliverySupplyChainEvent>
    </ram:ApplicableHeaderTradeDelivery>
    <ram:ApplicableHeaderTradeSettlement>
      <ram:CreditorReferenceID>DE07 1234 1234 1234 1234 12</ram:CreditorReferenceID>
      <ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>
      <ram:SpecifiedTradeSettlementPaymentMeans>
        <ram:TypeCode>42</ram:TypeCode>
        <ram:PayerPartyDebtorFinancialAccount>
          <ram:IBANID>DE07 1234 1234 1234 1234 12</ram:IBANID>
        </ram:PayerPartyDebtorFinancialAccount>
      </ram:SpecifiedTradeSettlementPaymentMeans>
      <ram:ApplicableTradeTax>
        <ram:CalculatedAmount>57.0</ram:CalculatedAmount>
        <ram:TypeCode>VAT</ram:TypeCode>
        <ram:BasisAmount>300.0</ram:BasisAmount>
        <ram:CategoryCode>S</ram:CategoryCode>
        <ram:RateApplicablePercent>19.0</ram:RateApplicablePercent>
      </ram:ApplicableTradeTax>
      <ram:SpecifiedTradePaymentTerms>
        <ram:Description>Zahlungsziel 30 Tage.</ram:Description>
        <ram:DueDateDateTime>
          <udt:DateTimeString format="102">20240927</udt:DateTimeString>
        </ram:DueDateDateTime>
      </ram:SpecifiedTradePaymentTerms>
      <ram:SpecifiedTradeSettlementHeaderMonetarySummation>
        <ram:LineTotalAmount>300.0</ram:LineTotalAmount>
        <ram:TaxBasisTotalAmount>300.0</ram:TaxBasisTotalAmount>
        <ram:TaxTotalAmount currencyID="EUR">57.0</ram:TaxTotalAmount>
        <ram:GrandTotalAmount>357.0</ram:GrandTotalAmount>
        <ram:DuePayableAmount>357.0</ram:DuePayableAmount>
      </ram:SpecifiedTradeSettlementHeaderMonetarySummation>
    </ram:ApplicableHeaderTradeSettlement>
  </rsm:SupplyChainTradeTransaction>
</rsm:CrossIndustryInvoice>

This ticket is related to this ZUGFeRD Community ticket

jstaerk commented 3 weeks ago

Hello,

to me it seems as if both your, @msccip and your, @reiz file validate as correct on 2.13.0 so just for my understanding, you suggest to change what where?

kind regards Jochen

msccip commented 2 weeks ago

the error is still there with version 2.13:

Value of '@schemeID' is not allowed. from /xslt/ZF_221/FACTUR-X_EN16931.xslt)

zugferd-invoice.txt

jstaerk commented 1 day ago

zf2.3 technical appendix to en16931, page 31 seems to indicate it has to be VA? image