Invoices according to ZUGFeRD Standard (XRechnung)

e-Invoices with ZUGFeRD

The Invoice with list of services (as of Vertec 6.3.0.12), the Invoice with processing sums invoice and the Invoice with phase sums (invoice of Vertec 6.8.0.12) contain a ZUGFeRD implementation, which embeds metadata in the PDF according to the ZUGFeRD standard. Thus, any invoice that is based on one invoice of these templates and is generated as a PDF is automatically also an e-invoice.

For more specific applications, if you have to meet requirements on the recipient side, you can use the Additional Feature E-Invoice Templates, with which you can define e-invoices e-invoicesZUGfERD and XRechnungen) in detail and define content criteria for each invoice recipient.

ZUGFeRD standard implementation

The ZUGFeRD implementation in the supplied invoice templates uses the profile EN 16931 and the following criteria:

Invoicing agent

The invoicing agent shall be the Company used on the invoice. This is:

  • The stored invoice address on the corresponding Payment Type or payment type, if not explicitly stored there,
  • Your company from the system settings.
Invoice recipient
The invoice address shall be the invoice address (InvoiceAddress) of the invoice.  
Invoice type
Fix 380 (commercial invoice) is used as invoice type.
Addresses

The addresses (invoice issuer and invoice recipient) must include the following information:

  • The company’s VAT number (VAT number) must be entered on the More Info page.
  • A complete and valid address (address)
  • ZUGFeRD requires a 2-digit ISO country code as a country (see e.g. https://de.wikipedia.org/wiki/ISO-3166-1-Kodierliste).  
    • In invoice templates before Vertec 6.8.0.12 (or if they were adapted before this version), the 2-digit ISO code must be entered as the country on the addresses.  
    • Templates starting with Vertec 6.8.0.12 use the following mapping if the country is not a 2-digit ISO code:
      • Deutschland/Germany/Allemagne/Germania = DE
      • Austria/Austria/Autriche/Austria = AT
      • France/France/Francia = FR
      • Switzerland/Switzerland/Suisse/Svizzera = CH
      • Netherlands/Netherlands/Pays-bas/Paesi bassi = NL
      • Great Britain/Gross Britain/Great Britain/Vereinigtes Königreich/United Kingdom/R Royaume-uni/Regno unito = GB

If the country of the invoice recipient is empty, the country of the invoice issuer is also used for the invoice recipient, since we then assume that the invoice recipient is located in the country.  

Currency

Only one currency can be used per invoice at a time.

On the currency, rounding should be set to 0.01, otherwise rounding errors may occur, which are rejected by ZUGFeRD.

Services

Outlays

Services, expenses and outlays are summed up and handed over as individual items.

Discounts are simply deducted from the services.

downpayments
Downpayments are transferred as items such as services, expenses and outlays.
VAT

VAT types used must indicate the appropriate Tax category according to uncl5305.  

If these requirements are met, the XML metadata is generated in the code of the Office Reports and passed to the report mechanism, which integrates the metadata into the PDF.

For this purpose, the Office reports provide the method

metadata_zugferd(context)

This returns a tuple consisting of :

  • profilename: Name of the Zugferd profile. This must either be the name of a built-in profile, or a schema definition must be returned as the 3rd argument. Otherwise, the report reports an error on execution. The following ZUGFeRD profiles are supported as built-in profiles:
    • EXTENDED
    • EN 16931 (COMFORT, XInvoice)
    • BASIC
    • BASIC WL
    • MINIMUM
    The supplied standard report invoice with Work List contains a sample code for the profile EN 16931.
  • data: ZUGFeRD XML Data. The XML document that represents the ZUGFeRD data for the invoice.
  • schema: Optional. For non-built profiles, an XML data string can be optionally passed here, which defines the schema of the profile to be used.
    • As of Vertec 6.4.0.16, instead of the user-defined XMP structure, a version number can be specified as a string for schema. Valid values are:
      • 2.0.1 (default value)
      • 2.1.1
      Together with the specification of the profile (“profilename”), Vertec creates the appropriate XMP schema of the corresponding ZUGFeRD version. If the version specification is missing, the default value 2.0.1 applies. This is only relevant for built-in profiles. It is still possible to pass a user-defined XMP schema instead of the version specification.

Customers who want to use their invoices according to the ZUGFeRD standard or as X-invoices must adapt this code according to the requirements of their invoice recipients.

Implementation with built-in schema

def metadata_zugferd(context):

First, the template is created. The XML is created using Vertec’s built-in template engine in Python. This allows the XML to use variables that contain the numbers from Vertec. Use the method vtcapp.rendertemplate() the XML is then created.

    zugferd_template = u"""<?xml version="1.0" encoding="UTF-8"?>
    <rsm:CrossIndustryInvoice xmlns:a="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"..>
        <rsm:ExchangedDocumentContext>
            <ram:GuidelineSpecifiedDocumentContextParameter>
                <ram:ID>urn:cen.eu:en16931:2017</ram:ID>
            </ram:GuidelineSpecifiedDocumentContextParameter>

        ..."""
    rechnung = context.rootlist[0]

    # Render the transferred template for ZUFGeRD
    zugferdxml = vtcapp.rendertemplate(zugferd_template, rechnung=rechnung)

The method returns the schema as well as the finished XML, which is integrated into the PDF by the reporting mechanism.

As ZUGFeRD 2.0 (standard):

    return ("EN 16931", zugferdxml)

As ZUGFeRD 2.1 (from version 6.4.0.16):

    return ("EN 16931", zugferdxml, "2.1.1")

Implementation with no built-in schema

def metadata_zugferd(context):

First, the template is created. The XML is created using Vertec’s built-in template engine in Python. This allows the XML to use variables that contain the numbers from Vertec. Use the method vtcapp.rendertemplate() the XML is then created.

    zugferd_template = u"""<?xml version="1.0" encoding="UTF-8"?>
    <rsm:CrossIndustryInvoice xmlns:a="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"..>
        <rsm:ExchangedDocumentContext>
            <ram:GuidelineSpecifiedDocumentContextParameter>
                <ram:ID>urn:cen.eu:en16931:2017</ram:ID>
            </ram:GuidelineSpecifiedDocumentContextParameter>

        ..."""
    rechnung = context.rootlist[0]

    # Render the transferred template for ZUFGeRD
    zugferdxml = vtcapp.rendertemplate(zugferd_template, rechnung=rechnung)

In addition, the schema is passed as XML:

    schema = u"""<?xpacket begin="?" id="W5M0MpCehiHzreSzNTczkc9d"?>
    <x:xmpmeta xmlns:x="adobe:ns:meta/">
      <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
        <rdf:Description xmlns:pdfaid="http://www.aiim.org/pdfa/ns/id/" rdf:about="">
    ..."""

The method returns the finished XML as well as the schema, which is integrated into the PDF by the reporting mechanism.

    return ("", zugferdxml, Schema)

More information about ZUGFeRD can be found on the official FeRD website.

Netherlands

United Kingdom