texlive[72630] Master/texmf-dist: zugferd (23oct24)

commits+karl at tug.org commits+karl at tug.org
Wed Oct 23 22:21:58 CEST 2024


Revision: 72630
          https://tug.org/svn/texlive?view=revision&revision=72630
Author:   karl
Date:     2024-10-23 22:21:58 +0200 (Wed, 23 Oct 2024)
Log Message:
-----------
zugferd (23oct24)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/zugferd/DEMO-rechnung-zugferd.tex
    trunk/Master/texmf-dist/doc/latex/zugferd/README.md
    trunk/Master/texmf-dist/doc/latex/zugferd/zugferd.pdf
    trunk/Master/texmf-dist/source/latex/zugferd/zugferd.dtx
    trunk/Master/texmf-dist/tex/latex/zugferd/zugferd-invoice.sty
    trunk/Master/texmf-dist/tex/latex/zugferd/zugferd.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/zugferd/INSTALL.md

Modified: trunk/Master/texmf-dist/doc/latex/zugferd/DEMO-rechnung-zugferd.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/zugferd/DEMO-rechnung-zugferd.tex	2024-10-23 20:21:42 UTC (rev 72629)
+++ trunk/Master/texmf-dist/doc/latex/zugferd/DEMO-rechnung-zugferd.tex	2024-10-23 20:21:58 UTC (rev 72630)
@@ -1,7 +1,7 @@
 % !TeX Program=lualatex
 %
 % Demo file for the LaTeX-ZUGFeRD project
-% This file corresponds to version 0.8 (2024-09-11)
+% This file corresponds to version 0.9 (2024-10-23)
 %
 % Copyright (C) 2024 Marei Peischl <marei at peitex.de>
 % ---------------------------------------------------------
@@ -39,8 +39,8 @@
 %	delivery-date = auto, % commented as this setting matches the initial value
 	subject=komavar,
 	fromaddress=komavar,
-%	tax/category=S,
-%	tax/rate=19,
+%	tax/category=S,  % commented as this setting matches the initial value
+%	tax/rate=19,  % commented as this setting matches the initial value
 	unit=hour,
 	seller/name = {peiTeX (Marei Peischl)},
 	seller/postcode = {20253},
@@ -59,7 +59,7 @@
 	buyer/vatid = {DE123456789},
 	buyer/email = {invoice at example.org},
 	currency=€,
-	payment-terms={Zahlbar innerhalb von 14 Tagen},% entweder das oder das Datum (Zeile drunter) ist notwendig
+	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,

Added: trunk/Master/texmf-dist/doc/latex/zugferd/INSTALL.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/zugferd/INSTALL.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/zugferd/INSTALL.md	2024-10-23 20:21:58 UTC (rev 72630)
@@ -0,0 +1,31 @@
+# Installation
+
+## Recommended setup
+As this package is now released via CTAN, it's hightly recommended to use the TeX Live Manager for installation.
+
+## Minimal portable TeX Live via DEPP
+
+Additionally for it's possible to use the Island of TeX's DEPP project to create a minimal portable TeX Live installation only including the dependencies for this kind of documents. 
+This repository includes a DEPENDS.txt for this purpose. 
+
+Please be aware that the soft dependencies are those required to typeset the demo file. 
+
+## Local user level installation using l3build
+
+This package is not yet released to CTAN, but it provides an \pkg{l3build} installation script and demo files.
+Details on usage can be found in the [l3build documentation](http://texdoc.net/serve/l3build)/0).
+
+To get started one can run
+```
+l3build doc
+```
+
+within the repositories root directory.
+This will build the Demo project as well as the current status of the documentation within the subdirectory `build/doc`.
+
+To Install the package within you `$TEXMFHOME` there is also the `install` action
+```
+l3build install
+```
+
+This will install the `zugferd.sty`  as well as the `zugferd-invoice.sty` and afterwards the TeX compiler will be able to find and use them.


Property changes on: trunk/Master/texmf-dist/doc/latex/zugferd/INSTALL.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/latex/zugferd/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/zugferd/README.md	2024-10-23 20:21:42 UTC (rev 72629)
+++ trunk/Master/texmf-dist/doc/latex/zugferd/README.md	2024-10-23 20:21:58 UTC (rev 72630)
@@ -2,7 +2,7 @@
 
 Copyright (C) 2023–2024 by Marei Peischl (peiTeX) <marei at peitex.de>
 
-zugferd version 0.8 (2024-09-11)
+zugferd version 0.9 (2024-10-23)
 
 ***************************************************************************
 
@@ -19,9 +19,13 @@
 
 There also exist interfaces to attach an XML file generated differently. Please have a look at the documentation.
 
-This package does not provide. Please be aware of you have to use valid input data for a valid ZUGFeRD output. The documentation suggests some options.
+This package does not provide any validation. Please be aware of you have to use valid input data for a valid ZUGFeRD output. The documentation suggests some options.
 
+## Version History
 
-# Version History
-
- * 0.8 (2024-09-11) First version on CTAN
+ * 0.9  (2024-10-23)
+    - Improve validation in testing of the development status.
+    - Add support for BillingSpecifiedPeriod
+    - Add additional user interfaces to simplify development for templates
+ * 0.8a (2024-09-17) Patch to switch to the newly public interface of l3pdfmeta
+ * 0.8  (2024-09-11) First version on CTAN

Modified: trunk/Master/texmf-dist/doc/latex/zugferd/zugferd.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/zugferd/zugferd.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/zugferd/zugferd.dtx	2024-10-23 20:21:42 UTC (rev 72629)
+++ trunk/Master/texmf-dist/source/latex/zugferd/zugferd.dtx	2024-10-23 20:21:58 UTC (rev 72630)
@@ -16,14 +16,14 @@
 % \fi
 % \iffalse
 %<*driver>
-\ProvidesFile{zugferd.dtx}[2024-09-11 v0.8 ZUGFerd Invoice and Faktur-X]
+\ProvidesFile{zugferd.dtx}[2024-10-23 v0.9 ZUGFerd Invoice and Faktur-X]
 %</driver>
 %<package>\NeedsTeXFormat{LaTeX2e}[2023-11-01]
-%<package>\ProvidesExplPackage{zugferd}{2024-09-11}{0.8}{Create ZUGFerd invoices using LaTeX}
+%<package>\ProvidesExplPackage{zugferd}{2024-10-23}{0.9}{Create ZUGFerd invoices using LaTeX}
 %<*driver>
 \DocumentMetadata{pdfstandard=a-3b,lang=en}
 \documentclass[lm-default=false,cs-break-nohyphen]{l3doc}
-\usepackage{zugferd}[2024-09-11]
+\usepackage{zugferd}[2024-10-23]
 \EnableCrossrefs
 %\CodelineIndex
 \RecordChanges
@@ -33,7 +33,7 @@
 \ifnum\ShellEscapeStatus=1\relax\else
 	\PassOptionsToPackage{draft}{minted}
 \fi
-\usepackage{minted}
+\usepackage[highlightmode=immediate]{minted}
 \newcounter{codelist}
 \newenvironment{examplecode}{%
 	\VerbatimEnvironment%
@@ -225,8 +225,8 @@
 \begin{document}
 \EnableDocumentation\DisableImplementation
 \DocInput{zugferd.dtx}
-%\DisableDocumentation\EnableImplementation
-%\DocInputAgain
+\DisableDocumentation\EnableImplementation
+\DocInputAgain
 \PrintChanges
 \printbibliography
 \PrintIndex
@@ -240,7 +240,7 @@
 %
 % \DoNotIndex{\newcommand,\newenvironment}
 % \begin{documentation}
-% \title{The \textsf{zugferd} package\thanks{This document
+% \title{The \pkg{zugferd} package\thanks{This document
 %   corresponds to \textsf{zugferd}~\fileversion, dated \filedate.}}
 % \subtitle{Creating electronic and hybrid invoices using \LaTeX}
 % \author{Marei Peischl \\ \texttt{marei at peitex.de}}
@@ -267,6 +267,7 @@
 % \begin{itemize}
 % \item Pengutronix e.K., \url{https://pengutronix.de}\newline
 % Special thanks to them, as they also sponsored the minimal portable \TeX{} Live setup.
+% \item Frederik Schwan (\href{https://schwan.it}{\nolinkurl{Schwan.IT}})
 % \end{itemize}
 %
 % \IfOnlyDocumentation{\clearpage}
@@ -305,8 +306,8 @@
 %<@@=zugferd>
 %    \end{macrocode}
 % Workaround to replace module name without having a visible <@@=zugferd> in the documentation
+%</package>
 % \fi
-%</package>
 % \ExplSyntaxOn
 % \tl_gset:Nn \g__codedoc_module_name_tl {zugferd}
 % \ExplSyntaxOff
@@ -440,6 +441,7 @@
 % We use these to embed the \XML file.
 %
 % This part prepares the XMP metadata according to the required scheme.
+% \changes{v0.8a}{2024-09-17}{Use the new public interface for l3pdfmeta.}
 %    \begin{macrocode}
 \bool_if:NT \g_@@_active_bool {
 	\cs_if_exist:NF \pdfmeta_xmp_xmlns_new:nn {
@@ -456,14 +458,12 @@
 		urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0\c_hash_str
 	}
 
-	\cs_generate_variant:Nn \__pdfmeta_xmp_schema_new:nnn {nne}
-
-	\__pdfmeta_xmp_schema_new:nne
+	\pdfmeta_xmp_schema_new:nnn
 		  {Factur-X~PDFA~Extension~Schema}
 		  {fx}
 		  {urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0\c_hash_str}
 
-	\__pdfmeta_xmp_property_new:nnnnn
+	\pdfmeta_xmp_property_new:nnnnn
 		  {fx}
 		  {DocumentFileName}
 		  {Text}
@@ -470,7 +470,7 @@
 		  {external}
 		  {name~of~the~embedded~XML~invoice~file}
 
-	\__pdfmeta_xmp_property_new:nnnnn
+	\pdfmeta_xmp_property_new:nnnnn
 		  {fx}
 		  {DocumentType}
 		  {Text}
@@ -477,7 +477,7 @@
 		  {external}
 		  {INVOICE}
 
-	\__pdfmeta_xmp_property_new:nnnnn
+	\pdfmeta_xmp_property_new:nnnnn
 		  {fx}
 		  {Version}
 		  {Text}
@@ -484,7 +484,7 @@
 		  {external}
 		  {The~actual~version~of~the~factur-x~schema}
 
-	\__pdfmeta_xmp_property_new:nnnnn
+	\pdfmeta_xmp_property_new:nnnnn
 		  {fx}
 		  {ConformanceLevel}
 		  {Text}
@@ -733,7 +733,7 @@
 %
 % \begin{examplecode}
 % \begin{ZUGFeRD}
-%	\zugferd_write_Item:nnnnnn {1} {} {Plushie \TeX{} lion} {31.98} {2} {63.78}
+%	\zugferd_write_Item:nnnnnn {1} {} {Plushie~\TeX\ lion} {31.98} {2} {63.78}
 %	\zugferd_startInvoiceSums:
 %	\zugferd_write_TaxEntry:nnnn {S} {19} {63.78} {12.12}
 %	\zugferd_write_Summation:nnnnnnnn {63.78} {0} {0} {63.78} {12.12} {75.90} {0} {75.90}
@@ -756,14 +756,35 @@
 % This command is using the local values of tax information as well as the unit code.
 % If you want to overwrite them, adjust them locally using the corresponding options, e.g.:
 % \begin{examplecode}
-% \begingroup
-%	\keys_set:nn {zugferd}{tax/rate=19, tax/category=S}
-%	\zugferd_write_Item:nnnnnn {1} {} {Plushie \TeX{} lion} {31.98} {2} {63.78}
-%	% Code using the data for visible representation
-% \endgroup
+% \group_begin:
+%	\keys_set:nn {zugferd/item}{tax/rate=19, tax/category=S}
+%	\zugferd_write_Item:nnnnnn {1} {} {Plushie \TeX\ lion} {31.98} {2} {63.78}
+%	% Code using the data for visual representation
+% \group_end:
 % \end{examplecode}
 % This will set the tax rate to 19\,\% unregarding the global setting.
 %
+% This structure might look a bit overcomplicated as one might think the options could also be set as an additional argument.
+% This works as long as the Code for the visual part of the invoice is not referencing the internal data.
+% In case you don't do this it's also possible to use the following variant:
+%
+% \DescribeMacro{\zugferd_write_Item:nnnnnnn}
+% \DescribeMacro{\zugferd_write_Item:ennnnnn}
+% This is grouping the command and adding an argument in front to add additional options.
+% \begin{syntax}
+% \cs[no-index]{zugferd_write_Item:nnnnn}
+%    \marg{additional local options}
+%    \marg{LineID}\marg{optional: item id (\enquote{SellerAssignedID})}\marg{item name}
+%    \marg{NetPriceProductTradePrice}
+%		\marg{BilledQuantity}
+%               \marg{LineTotalAmount}
+% \end{syntax}
+% The example above could then be replaced by
+% \begin{examplecode}
+% \zugferd_write_Item:nnnnnnn {tax/rate=19,tax/category=S} {1} {Plushie-01} {Plushie \TeX\ lion} {31.98} {2} {63.78}
+%  % visual representation now may not refer to the data
+% \end{examplecode}
+%
 % \DescribeMacro{\zugferd_startInvoiceSums:}
 % \DescribeMacro{\zugferd_stopInvoiceSums:}
 % There is some global data which is placed in the \XMLfile after the invoice items have been placed.
@@ -853,6 +874,18 @@
 }
 %    \end{macrocode}
 % \end{function}
+% \changes{v0.9}{2024-10-23}{Add interface using an argument for the keyval options locally per item}
+% \begin{function}{\_@@_write_Item:nnnnnnn}
+%    \begin{macrocode}
+\cs_new:Nn \zugferd_write_Item:nnnnnnn {
+	\group_begin:
+	\keys_set:nn {zugferd/item} {#1}
+	\zugferd_write_Item:nnnnnn {#2} {#3} {#4} {#5} {#6} {#7}
+	\group_end:
+}
+\cs_generate_variant:Nn \zugferd_write_Item:nnnnnnn {ennnnnn}
+%    \end{macrocode}
+% \end{function}
 % \begin{function}{\_@@_write_xml:n,\_@@_define_xml_writer:Nn,\_@@_define_xml_content:Nn}
 % These commands are used to toggle the writing of the \XMLfile. This corresponds to the option \option{write-xml}.
 %    \begin{macrocode}
@@ -1080,6 +1113,9 @@
 	\let\autoref\@gobble
 	\let\ignorespaces\relax
 	\let\ensuremath\@firstofone
+	\def\ {\space\relax}% space
+	\exp_args:NV \cs_set_nopar:cpn \c_space_tl {\space}
+	\let\nobreakspace\space
 	\hook_use:n {zugferd/disable-macros}
 %    \end{macrocode}
 % \endcomment
@@ -1101,6 +1137,13 @@
 % This package is using the UN/CEFACT Cross Industry Invoice Syntax for the data.
 % Currently it is not planned to implement the UBL syntax as well, but generally this would be possible.
 %
+% Please be aware that the \pkg{zugferd} package does currently not handle any replacements concerning the content.
+% Therefore it might be necessary to escape special characters, like |&| to |&|.
+% This also applies to |<|, |>|, |"| and |'|.
+% It's technically possible to do this either via active characters or string replacements.
+% But since it's adjusting the content this feature would never be enabled by default.
+% The corresponding issue can be found at \url{https://github.com/TeXhackse/LaTeX-ZUGFeRD/issues/9}.
+%
 % In most cases this functionality will be used to change the tax setting or unit for a single item.
 % \autoref{sec:xml-interfaces} also provided an example for this.
 %
@@ -1189,6 +1232,7 @@
 % \end{implementation}
 % \begin{documentation}
 % \subsubsection{Dates}
+% \label{sec:dates}
 % \DescribeKeyOption{date=auto/\meta{date formatted as YYYYMMDD}}{auto}
 % \DescribeKeyOption{delivery-date=auto/\meta{date formatted as YYYYMMDD}}{auto}
 % \DescribeKeyOption*{due-date=\meta{date formatted as YYYYMMDD}}{}*
@@ -1222,7 +1266,7 @@
 		\tl_gset:Nn \g_@@_delivery_date_tl {#1}
 	},
 	delivery-date .initial:n = auto,
-	due-date .tl_gset:N = \_@@_due_date_tl,
+	due-date .tl_gset:N = \g_@@_due_date_tl,
 	due-date .initial:n =,
 %    \end{macrocode}
 % \end{optionenv}
@@ -1238,7 +1282,7 @@
 % \begin{implementation}
 % \begin{optionenv}{payment-terms}
 %    \begin{macrocode}
-	payment-terms .str_gset:N = \_@@_payment_terms_str,
+	payment-terms .str_gset:N = \g_@@_payment_terms_str,
 	payment-terms .initial:n =,
 %    \end{macrocode}
 % \end{optionenv}
@@ -1541,7 +1585,7 @@
 	\int_gdecr:N \g_@@_indent_int%
 	\_@@_write_xml:n {</ram:BuyerTradeParty>}%
 	\int_gdecr:N \g_@@_indent_int%
-	\_@@_write_xml:n {</ram:ApplicableHeaderTradeAgreement>}
+	\_@@_write_xml:n {</ram:ApplicableHeaderTradeAgreement>}%
 	\_@@_ApplicableHeaderTradeDelivery:V \g_@@_delivery_date_tl%
 }%
 %
@@ -1915,11 +1959,37 @@
 %    \begin{macrocode}
 	rate .fp_set:N =  \l_@@_tax_rate_fp,
 	rate .initial:n = 19,
-	rate .usage:n = general,
+	rate .usage:n = general
+}%
+\keys_define:nn {zugferd/item} {
+	tax .choice:,
+	tax / unknown .code:n = \keys_set:ne {zugferd/tax} { \l_keys_key_str = \exp_not:V \l_keys_value_tl},
+	unknown .code:n = \keys_set:ne {zugferd} { \l_keys_key_str = \exp_not:V \l_keys_value_tl}
 }
 %    \end{macrocode}
 % \endoptionenv
+% \end{implementation}
+% \begin{documentation}
+% \DescribeKeyOption*{item/start-date=\meta{date formatted as YYYYMMDD}}{}*
+% \DescribeKeyOption*{item/end-date=\meta{date formatted as YYYYMMDD}}{}*
+% With version 0.00 support for |BillingSpecifiedPeriod| was added.
+% This supports setting |start-date| and |end-date| per item.
+% As this is optional, there is no default.
+% The element will be printed if both dates are set, as setting a single one will enforce the element to be invalid.
+% This element should be set as all the other dates (see \autoref{sec:dates}).
+% \end{documentation}
+% \begin{implementation}
+% \optionenv{start-date,end-date}
 %    \begin{macrocode}
+\keys_define:nn { zugferd / item } {
+	start-date .tl_gset:N = \l_@@_start_date_tl,
+	start-date .initial:n =,
+	end-date .tl_gset:N = \l_@@_end_date_tl,
+	end-date .initial:n =,
+}%
+%    \end{macrocode}
+% \endoptionenv
+%    \begin{macrocode}
 \_@@_define_xml_writer:Nn \_@@_write_inline:nn {
 	\tl_if_blank:nF {#2} {
 		<#1>#2</#1>
@@ -2070,7 +2140,7 @@
 %%%\subsubsection{SpecifiedLineTradeDelivery}%:nn <unit code > <number>
 % \begin{function}{\_@@_SpecifiedLineTradeDelivery:nn}
 %    \begin{macrocode}
-\_@@_define_xml_writer:Nn \_@@_SpecifiedLineTradeDelivery:nn {%
+\_@@_define_xml_content:Nn \_@@_SpecifiedLineTradeDelivery:nn {%
 	<ram:SpecifiedLineTradeDelivery>
 	% SPACE!
 	\_@@_indent: <ram:BilledQuantity~unitCode="#1">#2</ram:BilledQuantity>
@@ -2079,27 +2149,54 @@
 %    \end{macrocode}
 % \end{function}
 % \begin{function}{\_@@_SpecifiedLineTradeSettlement:nnn,\_@@_SpecifiedLineTradeSettlement:Vnn}
+% \changes{v0.9}{2024-10-23}{Split SpecifiedLineTradeSettlement to be more flexible and add support for BillingSpecifiedPeriod}
 %    \begin{macrocode}
-\_@@_define_xml_content:Nn \_@@_SpecifiedLineTradeSettlement:nnn {%
-	<ram:SpecifiedLineTradeSettlement>
-	\_@@_indent: <ram:ApplicableTradeTax>
+\_@@_define_xml_writer:Nn \_@@_write_SpecifiedLineTradeSettlement:nnn {%
+	\_@@_write_xml:n {<ram:SpecifiedLineTradeSettlement>}%
+	\int_gincr:N \g_@@_indent_int%
+	 \_@@_write_xml:e {\_@@_Line_ApplicableTradeTax:nn {#1} {#2}}%
+	 \_@@_write_xml:e {\_@@_BillingSpecifiedPeriod:VV \l_@@_start_date_tl \l_@@_end_date_tl}%
+	 \_@@_write_xml:e {\_@@_SpecifiedTradeSettlementLineMonetarySummation:n {#3}}%
+	\int_gdecr:N \g_@@_indent_int%
+	\_@@_write_xml:n {</ram:SpecifiedLineTradeSettlement>}%
+}%
+\cs_generate_variant:Nn \_@@_write_SpecifiedLineTradeSettlement:nnn {Vnn}%
+\_@@_define_xml_content:Nn \_@@_Line_ApplicableTradeTax:nn {%
+	<ram:ApplicableTradeTax>
 	%BT-151
-	\_@@_indent:n {2} <ram:TypeCode>VAT</ram:TypeCode>
+	\_@@_indent: <ram:TypeCode>VAT</ram:TypeCode>
 	%BT-151
-	\_@@_indent:n {2} <ram:CategoryCode>#1</ram:CategoryCode>
+	\_@@_indent:  <ram:CategoryCode>#1</ram:CategoryCode>
 	%BT-152
-	\_@@_indent:n {2} <ram:RateApplicablePercent>#2</ram:RateApplicablePercent>
-	\_@@_indent: </ram:ApplicableTradeTax>
-	\_@@_indent: <ram:SpecifiedTradeSettlementLineMonetarySummation>
+	\_@@_indent: <ram:RateApplicablePercent>#2</ram:RateApplicablePercent>
+	</ram:ApplicableTradeTax>
+}%
+\_@@_define_xml_content:Nn \_@@_BillingSpecifiedPeriod:nn {%
+	\bool_lazy_or:nnF {\tl_if_blank_p:n {#1}} {\tl_if_blank_p:n {#2}} {%
+	<ram:BillingSpecifiedPeriod>
+	%<!-- BT-134 -->
+	\_@@_indent:<ram:StartDateTime>
+	\_@@_indent:n {2} <udt:DateTimeString~format="102">#1</udt:DateTimeString>
+	\_@@_indent:</ram:StartDateTime>
+	%<!-- BT-135 -->
+	\_@@_indent:<ram:EndDateTime>
+	\_@@_indent:n {2} <udt:DateTimeString~format="102">#2</udt:DateTimeString>
+	\_@@_indent:</ram:EndDateTime>
+     </ram:BillingSpecifiedPeriod>
+     }%
+}%
+\_@@_define_xml_content:Nn \_@@_SpecifiedTradeSettlementLineMonetarySummation:n {%
+	<ram:SpecifiedTradeSettlementLineMonetarySummation>
 	% BT-131
-	\_@@_indent:n {2} <ram:LineTotalAmount>#3</ram:LineTotalAmount>
-	\_@@_indent: </ram:SpecifiedTradeSettlementLineMonetarySummation>
-	</ram:SpecifiedLineTradeSettlement>%
-}%
+	\_@@_indent: <ram:LineTotalAmount>#1</ram:LineTotalAmount>
+	 </ram:SpecifiedTradeSettlementLineMonetarySummation>
+}
+
 %    \end{macrocode}
 %    \begin{macrocode}
 \cctab_end:
 \cs_generate_variant:Nn \_@@_SpecifiedLineTradeSettlement:nnn {Vnn}
+\cs_generate_variant:Nn \_@@_BillingSpecifiedPeriod:nn {VV}
 %    \end{macrocode}
 % \end{function}
 % The exemption reason was placed wrong with the pre-CTAN release.
@@ -2138,10 +2235,10 @@
 	\_@@_write_xml:n {</ram:SpecifiedLineTradeAgreement>}
 	\_@@_write_xml:e {%
 		\_@@_SpecifiedLineTradeDelivery:nn { \l_@@_unit_code_tl } {#5}
-		\_@@_SpecifiedLineTradeSettlement:Vnn \l_@@_tax_category_code_tl %
-			{ \fp_use:N \l_@@_tax_rate_fp} {#6}
 	}%
-	\int_gdecr:N \g_@@_indent_int
+	\_@@_write_SpecifiedLineTradeSettlement:Vnn \l_@@_tax_category_code_tl %
+			{ \fp_use:N \l_@@_tax_rate_fp} {#6}%
+	\int_gdecr:N \g_@@_indent_int%
 	\_@@_write_xml:n {</ram:IncludedSupplyChainTradeLineItem>}
 }
 %    \end{macrocode}
@@ -2252,7 +2349,7 @@
 \cctab_end:
 \cs_generate_variant:Nn \_@@_SpecifiedTradePaymentTerms:nn {VV}
 \_@@_define_xml_writer:Nn \_@@_SpecifiedTradePaymentTerms: {
-	\_@@_SpecifiedTradePaymentTerms:VV \_@@_payment_terms_str \_@@_due_date_tl
+	\_@@_SpecifiedTradePaymentTerms:VV \g_@@_payment_terms_str \g_@@_due_date_tl
 }
 %    \end{macrocode}
 % \begin{function}{\_@@_SpecifiedTradeSettlementPaymentMeans:}

Modified: trunk/Master/texmf-dist/tex/latex/zugferd/zugferd-invoice.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/zugferd/zugferd-invoice.sty	2024-10-23 20:21:42 UTC (rev 72629)
+++ trunk/Master/texmf-dist/tex/latex/zugferd/zugferd-invoice.sty	2024-10-23 20:21:58 UTC (rev 72630)
@@ -12,7 +12,7 @@
 % and version 1.3c or later is part of all distributions of LaTeX
 % version 2008-05-04 or later.
 %
-\ProvidesExplPackage{zugferd-invoice}{2024-09-11}{0.8}{Invoice wrapper example package for the factur-x to create ZUGFerD invoices}
+\ProvidesExplPackage{zugferd-invoice}{2024-10-23}{0.9}{Invoice wrapper example package for the factur-x to create ZUGFerD invoices}
 
 \keys_define:nn {zugferd/invoice}{
 	default-vat .tl_set:N =  \defaultVAT,
@@ -44,25 +44,31 @@
 \newcounter{invoiceitem}
 \seq_new:N  \g__ptxcd_VAT_rates_seq 
 
-\NewDocumentCommand{\InitVAT}{omO{S}}{
-	\seq_gput_right:Nn \g__ptxcd_VAT_rates_seq {#2}
-	\fp_new:c {g__ptxcd_invoice_sum_vat#2_fp}
-	\fp_new:c {g__ptxcd_invoice_base_vat#2_fp}
-	\cs_new:cn {__ptxcd_invoice_type_code#2:} {#3}
+% InitVAT accepts 2 Arguments
+% Percentage + Tax Type Code the latter one is set to S as a default
+\NewDocumentCommand{\InitVAT}{mO{S}}{
+	\seq_gput_right:Nn \g__ptxcd_VAT_rates_seq {#1}
+	\fp_new:c {g__ptxcd_invoice_sum_vat#1_fp}
+	\fp_new:c {g__ptxcd_invoice_base_vat#1_fp}
+	\cs_new:cn {__ptxcd_invoice_type_code#1:} {#2}
 }
 
-%%initialisierung auf 5,7,16 oder 19 % Mwst
-\InitVAT{16}
+%Initialize VAT rates for (5),7,(16) and 19 % VAT
+%\InitVAT{16}
 \InitVAT{19}
-\InitVAT{5}
+%\InitVAT{5}
 \InitVAT{7}
 
+% Tax initialisation with a different Code than S in this example Syntax would be
+% \InitVAT{0}[AE]
+
+
 \newcommand*{\SetDefaultVAT}[1]{\def\defaultVAT{#1}}
 
 
 \seq_new:N \l__ptxcd_invoice_items_seq
 
-%\newcommand*{\AddInvoiceItem}[4][\defaultVAT]{%
+% Auxiliary macro to allow setting the Invoice items at a different position as they are printed later
 \NewDocumentCommand{\AddInvoiceItem}{D<>{}O{\defaultVAT}mmm}{
 	\seq_put_right:Nn \l__ptxcd_invoice_items_seq {
 		{#2}{#3}{#4}{#5}{#1}
@@ -143,14 +149,12 @@
 	\theinvoiceitem%Positionsnummer
 	\fp_gset:Nn \g__ptxcd_invoice_item_vat_fp  {#2 * (#1/100) * #4}
 	\fp_gset:Nn \g__ptxcd_invoice_item_fp  {#2 * #4}
-%	\fp_gadd:Nn \g__ptxcd_invoice_sum_vat_fp 
 	\fp_gadd:cn {g__ptxcd_invoice_base_vat#1_fp} {\g__ptxcd_invoice_item_fp}
 	\fp_gadd:cn {g__ptxcd_invoice_sum_vat#1_fp} {\g__ptxcd_invoice_item_vat_fp}
 	\fp_gadd:Nn \g__ptxcd_invoice_sum_fp {\g__ptxcd_invoice_item_fp}
 	
-	% position nummer name einzel-preis anzahl gesamtpreis	
-	\keys_set:ne {zugferd}{tax/rate=#1, tax/category=\use:c {__ptxcd_invoice_type_code#1:},#5}
-	\zugferd_write_Item:nnnnnn {\theinvoiceitem} {} {#3} {#4} {#2} {\fp_use:N \g__ptxcd_invoice_item_fp}
+	% optionen position nummer name einzel-preis anzahl gesamtpreis	
+	\zugferd_write_Item:ennnnnn {tax/rate=#1, tax/category=\use:c {__ptxcd_invoice_type_code#1:},#5} {\theinvoiceitem} {} {#3} {#4} {#2} {\fp_use:N \g__ptxcd_invoice_item_fp}
 	
 	&#2% Anzahl
 	&#3\space(\printVAT{#1}~MwSt.)% Beschreibung mit Angabe der MwSt, in Klammern

Modified: trunk/Master/texmf-dist/tex/latex/zugferd/zugferd.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/zugferd/zugferd.sty	2024-10-23 20:21:42 UTC (rev 72629)
+++ trunk/Master/texmf-dist/tex/latex/zugferd/zugferd.sty	2024-10-23 20:21:58 UTC (rev 72630)
@@ -9,7 +9,7 @@
 %% Copyright (C) 2023--2024 by Marei Peischl (peiTeX) <marei at peitex.de>
 %% 
 \NeedsTeXFormat{LaTeX2e}[2023-11-01]
-\ProvidesExplPackage{zugferd}{2024-09-11}{0.8}{Create ZUGFerd invoices using LaTeX}
+\ProvidesExplPackage{zugferd}{2024-10-23}{0.9}{Create ZUGFerd invoices using LaTeX}
 \tl_new:N \l__zugferd_tmp_tl
 \str_new:N \g__zugferd_format_str
 \str_new:N \g__zugferd_businessProcessId_str
@@ -85,14 +85,12 @@
 urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0\c_hash_str
 }
 
-\cs_generate_variant:Nn \__pdfmeta_xmp_schema_new:nnn {nne}
-
-\__pdfmeta_xmp_schema_new:nne
+\pdfmeta_xmp_schema_new:nnn
   {Factur-X~PDFA~Extension~Schema}
   {fx}
   {urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0\c_hash_str}
 
-\__pdfmeta_xmp_property_new:nnnnn
+\pdfmeta_xmp_property_new:nnnnn
   {fx}
   {DocumentFileName}
   {Text}
@@ -99,7 +97,7 @@
   {external}
   {name~of~the~embedded~XML~invoice~file}
 
-\__pdfmeta_xmp_property_new:nnnnn
+\pdfmeta_xmp_property_new:nnnnn
   {fx}
   {DocumentType}
   {Text}
@@ -106,7 +104,7 @@
   {external}
   {INVOICE}
 
-\__pdfmeta_xmp_property_new:nnnnn
+\pdfmeta_xmp_property_new:nnnnn
   {fx}
   {Version}
   {Text}
@@ -113,7 +111,7 @@
   {external}
   {The~actual~version~of~the~factur-x~schema}
 
-\__pdfmeta_xmp_property_new:nnnnn
+\pdfmeta_xmp_property_new:nnnnn
   {fx}
   {ConformanceLevel}
   {Text}
@@ -226,7 +224,7 @@
 \pdfmanagement_add:nnx{Catalog}{AF}{\pdf_object_ref:n{zugferd/rechnung}}
 }
 }
-%% Code using the data for visible representation
+%% Code using the data for visual representation
 \cs_new:Nn \zugferd_enable_XML_interfaces: {
 \bool_if:NT \g__zugferd_write_xml_bool {
 \cs_gset:Nn \zugferd_write_Header: {
@@ -268,6 +266,13 @@
 }{
 \zugferd_disable_XML_interfaces:
 }
+\cs_new:Nn \zugferd_write_Item:nnnnnnn {
+\group_begin:
+\keys_set:nn {zugferd/item} {#1}
+\zugferd_write_Item:nnnnnn {#2} {#3} {#4} {#5} {#6} {#7}
+\group_end:
+}
+\cs_generate_variant:Nn \zugferd_write_Item:nnnnnnn {ennnnnn}
 \bool_if:NTF \g__zugferd_write_xml_bool {
 \cs_new:Nn \__zugferd_write_xml:n {
 \iow_now:Ne \__zugferd_xml_writer_iow {\__zugferd_xml_auto_indent: #1}
@@ -427,6 +432,9 @@
 \let\autoref\@gobble
 \let\ignorespaces\relax
 \let\ensuremath\@firstofone
+\def\ {\space\relax}% space
+\exp_args:NV \cs_set_nopar:cpn \c_space_tl {\space}
+\let\nobreakspace\space
 \hook_use:n {zugferd/disable-macros}
 }
 \hook_new:n {zugferd/disable-macros}
@@ -479,9 +487,9 @@
 \tl_gset:Nn \g__zugferd_delivery_date_tl {#1}
 },
 delivery-date .initial:n = auto,
-due-date .tl_gset:N = \__zugferd_due_date_tl,
+due-date .tl_gset:N = \g__zugferd_due_date_tl,
 due-date .initial:n =,
-payment-terms .str_gset:N = \__zugferd_payment_terms_str,
+payment-terms .str_gset:N = \g__zugferd_payment_terms_str,
 payment-terms .initial:n =,
 subject .choice:,
 subject / komavar .code:n = {
@@ -641,7 +649,7 @@
 \int_gdecr:N \g__zugferd_indent_int%
 \__zugferd_write_xml:n {</ram:BuyerTradeParty>}%
 \int_gdecr:N \g__zugferd_indent_int%
-\__zugferd_write_xml:n {</ram:ApplicableHeaderTradeAgreement>}
+\__zugferd_write_xml:n {</ram:ApplicableHeaderTradeAgreement>}%
 \__zugferd_ApplicableHeaderTradeDelivery:V \g__zugferd_delivery_date_tl%
 }%
 \__zugferd_define_xml_content:Nn \__zugferd_ApplicableHeaderTradeDelivery:n {%
@@ -861,8 +869,19 @@
 category .usage:n = general,
 rate .fp_set:N =  \l__zugferd_tax_rate_fp,
 rate .initial:n = 19,
-rate .usage:n = general,
+rate .usage:n = general
+}%
+\keys_define:nn {zugferd/item} {
+tax .choice:,
+tax / unknown .code:n = \keys_set:ne {zugferd/tax} { \l_keys_key_str = \exp_not:V \l_keys_value_tl},
+unknown .code:n = \keys_set:ne {zugferd} { \l_keys_key_str = \exp_not:V \l_keys_value_tl}
 }
+\keys_define:nn { zugferd / item } {
+start-date .tl_gset:N = \l__zugferd_start_date_tl,
+start-date .initial:n =,
+end-date .tl_gset:N = \l__zugferd_end_date_tl,
+end-date .initial:n =,
+}%
 \__zugferd_define_xml_writer:Nn \__zugferd_write_inline:nn {
 \tl_if_blank:nF {#2} {
 <#1>#2</#1>
@@ -974,25 +993,51 @@
 </ram:SpecifiedLineTradeAgreement>
 }%
 %%%\subsubsection{SpecifiedLineTradeDelivery}%:nn <unit code > <number>
-\__zugferd_define_xml_writer:Nn \__zugferd_SpecifiedLineTradeDelivery:nn {%
+\__zugferd_define_xml_content:Nn \__zugferd_SpecifiedLineTradeDelivery:nn {%
 <ram:SpecifiedLineTradeDelivery>
 \__zugferd_indent: <ram:BilledQuantity~unitCode="#1">#2</ram:BilledQuantity>
 </ram:SpecifiedLineTradeDelivery>
 }%
-\__zugferd_define_xml_content:Nn \__zugferd_SpecifiedLineTradeSettlement:nnn {%
-<ram:SpecifiedLineTradeSettlement>
-\__zugferd_indent: <ram:ApplicableTradeTax>
-\__zugferd_indent:n {2} <ram:TypeCode>VAT</ram:TypeCode>
-\__zugferd_indent:n {2} <ram:CategoryCode>#1</ram:CategoryCode>
-\__zugferd_indent:n {2} <ram:RateApplicablePercent>#2</ram:RateApplicablePercent>
-\__zugferd_indent: </ram:ApplicableTradeTax>
-\__zugferd_indent: <ram:SpecifiedTradeSettlementLineMonetarySummation>
-\__zugferd_indent:n {2} <ram:LineTotalAmount>#3</ram:LineTotalAmount>
-\__zugferd_indent: </ram:SpecifiedTradeSettlementLineMonetarySummation>
-</ram:SpecifiedLineTradeSettlement>%
+\__zugferd_define_xml_writer:Nn \__zugferd_write_SpecifiedLineTradeSettlement:nnn {%
+\__zugferd_write_xml:n {<ram:SpecifiedLineTradeSettlement>}%
+\int_gincr:N \g__zugferd_indent_int%
+ \__zugferd_write_xml:e {\__zugferd_Line_ApplicableTradeTax:nn {#1} {#2}}%
+ \__zugferd_write_xml:e {\__zugferd_BillingSpecifiedPeriod:VV \l__zugferd_start_date_tl \l__zugferd_end_date_tl}%
+ \__zugferd_write_xml:e {\__zugferd_SpecifiedTradeSettlementLineMonetarySummation:n {#3}}%
+\int_gdecr:N \g__zugferd_indent_int%
+\__zugferd_write_xml:n {</ram:SpecifiedLineTradeSettlement>}%
 }%
+\cs_generate_variant:Nn \__zugferd_write_SpecifiedLineTradeSettlement:nnn {Vnn}%
+\__zugferd_define_xml_content:Nn \__zugferd_Line_ApplicableTradeTax:nn {%
+<ram:ApplicableTradeTax>
+\__zugferd_indent: <ram:TypeCode>VAT</ram:TypeCode>
+\__zugferd_indent:  <ram:CategoryCode>#1</ram:CategoryCode>
+\__zugferd_indent: <ram:RateApplicablePercent>#2</ram:RateApplicablePercent>
+</ram:ApplicableTradeTax>
+}%
+\__zugferd_define_xml_content:Nn \__zugferd_BillingSpecifiedPeriod:nn {%
+\bool_lazy_or:nnF {\tl_if_blank_p:n {#1}} {\tl_if_blank_p:n {#2}} {%
+<ram:BillingSpecifiedPeriod>
+
+\__zugferd_indent:<ram:StartDateTime>
+\__zugferd_indent:n {2} <udt:DateTimeString~format="102">#1</udt:DateTimeString>
+\__zugferd_indent:</ram:StartDateTime>
+
+\__zugferd_indent:<ram:EndDateTime>
+\__zugferd_indent:n {2} <udt:DateTimeString~format="102">#2</udt:DateTimeString>
+\__zugferd_indent:</ram:EndDateTime>
+     </ram:BillingSpecifiedPeriod>
+     }%
+}%
+\__zugferd_define_xml_content:Nn \__zugferd_SpecifiedTradeSettlementLineMonetarySummation:n {%
+<ram:SpecifiedTradeSettlementLineMonetarySummation>
+\__zugferd_indent: <ram:LineTotalAmount>#1</ram:LineTotalAmount>
+ </ram:SpecifiedTradeSettlementLineMonetarySummation>
+}
+
 \cctab_end:
 \cs_generate_variant:Nn \__zugferd_SpecifiedLineTradeSettlement:nnn {Vnn}
+\cs_generate_variant:Nn \__zugferd_BillingSpecifiedPeriod:nn {VV}
 \cs_new:Nn \__zugferd_SpecifiedLineTradeSettlement:nnnn {
 \msg_warning:nnnn {zugferd} {macro-deprecated}
 { \__zugferd_SpecifiedLineTradeSettlement:nnnn }
@@ -1017,10 +1062,10 @@
 \__zugferd_write_xml:n {</ram:SpecifiedLineTradeAgreement>}
 \__zugferd_write_xml:e {%
 \__zugferd_SpecifiedLineTradeDelivery:nn { \l__zugferd_unit_code_tl } {#5}
-\__zugferd_SpecifiedLineTradeSettlement:Vnn \l__zugferd_tax_category_code_tl %
-{ \fp_use:N \l__zugferd_tax_rate_fp} {#6}
 }%
-\int_gdecr:N \g__zugferd_indent_int
+\__zugferd_write_SpecifiedLineTradeSettlement:Vnn \l__zugferd_tax_category_code_tl %
+{ \fp_use:N \l__zugferd_tax_rate_fp} {#6}%
+\int_gdecr:N \g__zugferd_indent_int%
 \__zugferd_write_xml:n {</ram:IncludedSupplyChainTradeLineItem>}
 }
 \__zugferd_define_xml_writer:Nn \__zugferd_SpecifiedTradeSettlementHeaderMonetarySummation:nnnnnnnn {%
@@ -1113,7 +1158,7 @@
 \cctab_end:
 \cs_generate_variant:Nn \__zugferd_SpecifiedTradePaymentTerms:nn {VV}
 \__zugferd_define_xml_writer:Nn \__zugferd_SpecifiedTradePaymentTerms: {
-\__zugferd_SpecifiedTradePaymentTerms:VV \__zugferd_payment_terms_str \__zugferd_due_date_tl
+\__zugferd_SpecifiedTradePaymentTerms:VV \g__zugferd_payment_terms_str \g__zugferd_due_date_tl
 }
 \cs_generate_variant:Nn  \__zugferd_SpecifiedTradeSettlementPaymentMeans:nnn {vvv}
 \__zugferd_define_xml_writer:Nn \__zugferd_SpecifiedTradeSettlementPaymentMeans: {



More information about the tex-live-commits mailing list.