Invoices according to Zugferd Standard (Xrechnung)

Invoices with Zugferd

Product line

Standard

|

Expert

Operating mode

CLOUD ABO

|

ON-PREMISES

Modules

Services & CRM

Budget & Phases

Purchases

Resource Planning

Business Intelligence

Created: 04.09.2019
Updated: 15.12.2020 | Adapted to version 6.4.0.16

With Vertec, invoices according to Zugferd 2.0 can be created from version 6.3.0.12 and invoice to Zugferd 2.1 standard from version 6.4.0.16. For this purpose, the code of the Extended Office Report generates the XML metadata and passes it to the reporting mechanism, which integrates the metadata into the PDF.

There is a method for doing this in the Advanced Office Reports

metadata_train(context)

This returns a tuple consisting of :

  • profilename : Name of the train horse profile. This must either be the name of a built-in profile (see next section) or return a schema definition as the 3rd argument. Otherwise, the report will report an error on executing.
  • data : Zugferd XML Data. The XML document that represents the Zugferd data for the invoice.
  • schema: Optional. For non-built-in profiles, an XML data string can be passed here, which defines the schema of the profile to be used.
    • As of Vertec 6.4.0.16, a version number can be specified as a string instead of the user-defined XMP structure for schema. Valid values are:
      • 2.0.1 (default)
      • 2.1.1
      Together with the profile name, Vertec creates the appropriate XMP schema for the corresponding Zugferd version. If the version name is missing, the default value is 2.0.1. This is only relevant for built-in profiles. It is still possible to pass a user-defined XMP schema instead of the version name.

The following ZUGFeRD profiles are supported as built-in profiles:

  • EXTENDED
  • EN 16931 (COMFORT, XRechnung)
  • BASIC
  • BASIC WL
  • MINIMUM

The included standard report invoice with list of services contains a corresponding example code for the profile EN 16931.

Customers who wish to use their invoices according to Zugferd standard or as X invoices must adapt this code accordingly.

Implementation with built-in schema

def metadata_trailer(context):

First, the template is created. The XML is created in Python using Vertec’s built-in Template Engine. In XML, variables containing the numbers from Vertec can be used. The XML is then created using the vtcapp.rendertemplate() method.

    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.eu16931:2017</ram:ID>
            </ram:GuidelineSpecifiedDocumentContextParameter>

        ...”"”
    invoice = context.rootlist[0]

    # Render the transferred template for ZUFGeRD
    Zugferdxml = vtcapp.rendertemplate(zugferd_template, invoice=invoice)

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

As ZUGFeRD 2.0 (default):

    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_trailer(context):

First, the template is created. The XML is created in Python using Vertec’s built-in Template Engine. In XML, variables containing the numbers from Vertec can be used. The XML is then created using the vtcapp.rendertemplate() method.

    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.eu16931:2017</ram:ID>
            </ram:GuidelineSpecifiedDocumentContextParameter>

        ...”"”
    invoice = context.rootlist[0]

    # Render the transferred template for ZUFGeRD
    Zugferdxml = vtcapp.rendertemplate(zugferd_template, invoice=invoice)

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.

Bitte wählen Sie Ihren Standort