Q: How do I use the ZUGFeRD SDK?

To use the SDK to create or read ZUGFeRD compliant XML Invoices is pretty easy. First you need to Reference the Object “Aloaha ZUGFeRD Library” or “Aloaha_ZUGFeRD.xml” in .NET. In case your language requires to reference the library file direct please use Aloaha_ZUGFeRD.dll (or Aloaha_ZUGFeRD.pdb)

You create the .NET Object with a code line like:

Dim alo As New Aloaha_ZUGFeRD.XML

You might want to fill the .NET Object directly with data. In that case please create the object with:

Dim zug As Aloaha_ZUGFeRD.iXML.ZUGFeRD = Nothing

To create and prefill the object please call:

zug = alo.CreateInvoice(“INV0815″, “Rechnung gemäß Bestellung”, alo.TodayDate.Document_Date, alo.TodayDate.Document_DateFormat, , , “EUR”)

In case you are NOT planning to fill some data objects manually you can just call the function as VOID

call alo.CreateInvoice(“INV0815″, “Rechnung gemäß Bestellung”, alo.TodayDate.Document_Date, alo.TodayDate.Document_DateFormat, , , “EUR”)

It is possible to optionally add a note to the invoice:

alo.AddDocumentNote(“Notiztext”, “AAA”)

Obviously you need to add the details for the buyer:

alo.WriteBuyer(“Buyer Intermedia GmbH”, “49479”, “Ibbenbüren”, “Rudolf-Diesel-Straße”, “”, “DE”, “Wrock001″, “DE 08154711″)

and also the sellers details:

alo.WriteSeller(“Aloaha”, “PBK4711″, “Pembroke”, “Helgoland”, “45, Triq Gio”, “MT”, “MT0815″)

Optionally you can also add the contact person of the buying party:

alo.WriteBuyerContactPerson(“Hans Mustermann”, “Einkauf”, “mw@domain.tld”, “+49 5451 9435 4711″, “+49 5451 9435 0815″)

Even documents, related to the purchase, can be added optionally:

alo.AddBuyerOrderReferencedDocument(“08154711″, “20130608”, “102”)

You can write your Invoice Number with: (from version 8.0.0.10)
alo.AddSellerAssignedID(“Rechungsnummer”)

The order reference you can write with: (from version 8.0.0.10)
alo.AddBuyerAssignedID(“Bestellnummer”)

Since even the sellers side can have a contact person you can add that person with another single line:

alo.WriteSellerContactPerson(“Haenschen Klein”, “Verkauf”, “stefan@domain.tld”, “+356 4711″, “+356 0815″)

Delivery notes  and payment references can be added:

alo.AddDeliveryNote(“3245″, “20130608”, “102”)

alo.PaymentReference = “Invoice No. INV08154711″

Many different payment means are possible. Here as an example a direct debit and a transfer

alo.AddPaymentMeans(alo.PaymentMeansCode(Aloaha_ZUGFeRD.iXML.Payment_Means.DirectDebit), “Lastschrift”, “iban”, “sparkasse”, “bic”, “BLZ”, “Bankname”, True)

alo.AddPaymentMeans(alo.PaymentMeansCode(Aloaha_ZUGFeRD.iXML.Payment_Means.DebitTransfer_SEPA), “Überweisung”, “MT67 MMEB 4475 0851″, “”, “MMXX MTXX”, “”, “HSBC”, False)

The trade tax should be inserted:

alo.AddTradeTax(“3.06″, “EUR”, “170”, “EUR”, “VAT”, “S”, “18”, “”)

and maybe even some logistics charges:

alo.AddLogisticsServiceCharge(“Post”, “1”, “EUR”, “VAT”, “S”, “18”)

A MUST are obviously the invoice totals:

alo.WriteTotals(100, 94.4, 84.4, 80, 14.4, 20, 10)

There are many different functions to add products to the invoice. One of the most simple functions is:

alo.AddProduct_Comfort_Quick(“Kaffee”, “Getraenk”, “AloKaff01″, “nicht rabattierfähig”, 10, “Tasse(n)”, 1.7, “EUR”, 0, “”, “18”, “VAT”)

In case you need to review or edit some object values directly assign it to zug:

zug = alo.ZUGFeRD_Structure

Edit the object and add a note to an invoice item:

ReDim zug.TradeItems(0).Note(0 To 0)
zug.TradeItems(0).Note(0).SubjectCode = “SCode”
zug.TradeItems(0).Note(0).Content = “Wir erlauben uns Ihnen folgende Positionen aus der Lieferung Nr. 2013-51112 in Rechnung zu stellen”

In case you edited directly the object you need to write it back:

alo.ZUGFeRD_Structure = zug

And last but not least you have to write the ZUGFeRD Data to a file:

alo.SaveXML(“c:\test.xml”)

To read an existing ZUGFeRD XML into the .NET Object please call:

alo.FillZUGFeRD_Structure(“c:\test.xml”)

assign the data with:

alo.ZUGFeRD_Structure = zug

and save it back with

alo.SaveXML(“c:\test.xml”)

Most of the functions are self explaining.  But should you have any questions or suggestions do not hesitate to ask here in the Blog or contact info@zugferdpro.com