% !TeX Program=lualatex
%
% Demo file for the LaTeX-ZUGFeRD project
% This file corresponds to version 0.12 (2026-07-06)
%
% Copyright (C) 2024--2026 Marei Peischl <marei@peitex.de>
% ---------------------------------------------------------
%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in:
%
%    http://www.latex-project.org/lppl.txt
%
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008-05-04 or later.
%
% We used \DocumentMetadata before, but since this also loads the new tagging code, we currently workaround this loading the pdfmanagement directly:
\RequirePackage{pdfmanagement}
\SetKeys[document/metadata]{
	pdfversion=1.7, % necessary as it would be 2.0 by default for the current releas
	pdfstandard=a-3b,
	lang=de,	
}
\documentclass[parskip=half-,german]{scrartcl}

\usepackage[
	format=xrechnung3.0% 3.0 is the default anyway, but you can select the format to avoid automatic changes.
]{zugferd-invoice}

\setkomavar{invoice}{2024:1337}
\setkomavar{date}{{\InsertZUGFeRDData[set-today]{date}\today}}
\setkomavar{title}{Rechnung}

\SetZUGFeRDData{
%	document-type =  commercial-invoice, % commented as this setting matches the initial value
	id=komavar,
%	date=auto, % commented as this setting matches the initial value
%	delivery-date = auto, % commented as this setting matches the initial value
	subject=komavar,
	fromaddress=komavar,
	unit=hour,
	seller/name = {peiTeX (Marei Peischl)},
	seller/postcode = {20253},
	seller/city ={Hamburg},
	seller/country = DE,
	seller/address = {Address 1},
	seller/vatid = {DE123456789},
	seller/contact= {Marei\\+4900000000\\marei@peitex.de},
	seller/email = {kontakt@peitex.de},
	buyer/reference = {buyer-reference}, %oder Leitweg-ID
	buyer/name = {Käufer Name},
	buyer/postcode = {20253},
	buyer/city ={Hamburg},
	buyer/country = DE,
	buyer/address = {Address 1\\Address 2},
	buyer/vatid = {DE123456789},
	buyer/email = {invoice@example.org},
	currency=€,
	payment-terms={Zahlbar innerhalb von 14 Tagen},% either this one or the due-date below is required
	due-date={20240118},
	payment-means / type = 58, % SEPA Übereisung,
	payment-means / iban = DE68430609671013251700,
	payment-means / account-holder = Marei Peischl,
	payment-means / bic =GENODEM1GLS
}

% An example to rerefence the own address data is shown in DEMO-rechnung-zugferd-Kleinunternehmen.tex.
% See documentation for details.
% This should be configured without your own zugferd-invoice package variant.

\begin{document}

\begin{letter}{\InsertZUGFeRDData[AddressData]{buyer}}% Please be aware that this does not print the Country, as this is only available via the Countrycode in this implementation

\opening{Guten Tag,}

hiermit stelle ich Ihnen meine Arbeit im Rahmen des Projektes XX in Rechnung. Die Leistung wurde im Januar 2024 erbracht. 

\AddInvoiceItem{3}{Weiterentwicklung/funktionale Erweiterung}{90}
\AddInvoiceItem<unit=piece>[7]{3}{Support}{90}
\AddInvoiceItem{2}{Support an Feiertagen/Wochenende}{180}
\AddInvoiceItem{3.25}{Rundungstest}{95.38}


\PrintInvoiceTabular

Ich bitte Sie oben genannte Betrag binnen 30 Tagen auf unten genanntes Konto zu überweisen.

%Falls gewünscht
\closing{Happy \TeX{}ing}

\end{letter}
\end{document}
