Debian Codegraph @

texmf-dist/source/latex/qrbill/qrbill.dtx

raw
1 % \iffalse meta-comment
2 %
3 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 %
5 % Copyright (C) 2020–2023 by Marei Peischl (peiTeX) <[email protected]>
6 %
7 % This work is a collaboration of
8 % Marei Peischl (peiTeX) and Alex Antener (foobar LLC).
9 %
10 % This work may be distributed and/or modified under the
11 % conditions of the LaTeX Project Public License, either version 1.3c
12 % of this license or (at your option) any later version.
13 % The latest version of this license is in
14 % http://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2005/12/01 or later.
17 %
18 % This work has the LPPL maintenance status `maintained'.
19 %
20 % The Current Maintainer of this work is
21 % Marei Peischl <[email protected]>.
22 %
23 % This work consists of the files
24 % qrbill.dtx and qrbill.ins, qrbill-vocab.csv
25 % and the derived files
26 % qrbill.sty, swiss.qrbill-cfg.tex, epc.qrbill-cfg.tex,
27 % qrbill-letter-demo.tex, qrbill-standalone-demo.tex.
28 %
29 % The development repository can be found at
30 % https://github.com/peitex/qrbill
31 % Please use the issue tracker for feedback!
32 %
33 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34 %
35 % \fi
36 % \iffalse
37 %<*package>
38 % \CharacterTable
39 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
40 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
41 % Digits \0\1\2\3\4\5\6\7\8\9
42 % Exclamation \! Double quote \" Hash (number) \#
43 % Dollar \$ Percent \% Ampersand \&
44 % Acute accent \' Left paren \( Right paren \)
45 % Asterisk \* Plus \+ Comma \,
46 % Minus \- Point \. Solidus \/
47 % Colon \: Semicolon \; Less than \<
48 % Equals \= Greater than \> Question mark \?
49 % Commercial at \@ Left bracket \[ Backslash \\
50 % Right bracket \] Circumflex \^ Underscore \_
51 % Grave accent \` Left brace \{ Vertical bar \|
52 % Right brace \} Tilde \~}
53 %</package>
54 % \fi
55 % \iffalse
56 %<*driver>
57 \ProvidesFile{qrbill.dtx}[2023/07/24 v2.01 \ create QR-bills based on the Swiss standard]
58 \documentclass[english, parskip=half-]{scrartcl}
59 \usepackage{iftex}
60 \ifPDFTeX
61 \usepackage[T1]{fontenc}
62 \fi
63 \usepackage[hyperref=false]{doc}
64 \usepackage[cache, langlinenos]{minted}
65 % Need to set the style here so that it is defined and brought in here.
66 % If the style is set later, then docstrip interferes with any comments in
67 % the style definition so that they appear as literal text in the document.
68
69 \setminted{style=default, tabsize=4}
70 \newminted{latex}{gobble=4,escapeinside=||}
71
72 \newenvironment{doccode}{
73 \VerbatimEnvironment
74 \begin{VerbatimOut}[gobble=1, tabsize=4]{minted.doc.out}}
75 {\end{VerbatimOut}
76 \inputminted[autogobble, escapeinside=||,tabsize=4]{latex}{minted.doc.out}
77 }
78
79 \newenvironment{doccode*}{
80 \VerbatimEnvironment
81 \begin{VerbatimOut}[tabsize=4]{minted.doc.out}}
82 {\end{VerbatimOut}
83 \inputminted[autogobble, escapeinside=||,tabsize=4]{latex}{minted.doc.out}
84 }
85 \usepackage{babel}
86 \usepackage[babel]{csquotes}
87
88 \PageIndex
89 \RecordChanges
90 \newmintinline{latex}{}
91
92 \newcommand*\repl[1]{\meta{#1}}
93 \newcommand*\opt[1]{\colorbox{black!20}{\meta{#1}}}
94 \newcommand*\marg[1]{%
95 {\ttfamily\char`\{}\repl{#1}{\ttfamily\char`\}}}
96 \newcommand*\oarg[1]{%
97 {\ttfamily[}\opt{#1}{\ttfamily]}
98 }
99 \newcommand*{\sarg}{\texttt{*}}
100
101 \usepackage{xparse}
102
103 \OnlyDescription
104 \makeatletter
105
106 \def\qrbill@optionNoDefault #1(#2) (#3){%
107 \vspace{0.1in}%
108 \leavevmode%
109 \marginpar{\raggedleft\small\ttfamily#1\ }%
110 \kern-\parindent\textsf{(#2)}\hfill#3\\}
111
112
113 \def\qrbill@option #1 (#2) (#3){%
114 \qrbill@optionNoDefault#1(#2) ({(default: \texttt{#3})})%
115 }
116
117 \ExplSyntaxOn
118
119 \newcommand*\qrbill@nextopt{}%
120 \newenvironment{optionlist}%
121 {%
122 \par\vspace{-.5\baselineskip}
123 \def\pipechar{|}%
124 \let\|\pipechar%
125 \RenewDocumentCommand{\item}{sr[]}{%
126 \qrbill@nextopt%
127 \renewcommand*\qrbill@nextopt{\par}%
128 \IfBooleanTF {##1}%
129 {\qrbill@optionNoDefault ##2}%
130 {\qrbill@option ##2}%
131 }}
132 {%
133 \par}
134 \ExplSyntaxOff
135
136
137
138 % Create a short verbatim pipe that handles quotation marks properly
139 \begingroup
140 \catcode`\|=\active
141 \gdef\pipe@active@verbatim{%
142 \begingroup
143 \let\do\@makeother\dospecials
144 \catcode`\|=\active
145 \catcode`\`=\active
146 \catcode`\'=\active
147 \catcode`\<=\active
148 \catcode`\>=\active
149 \catcode`\-=\active
150 \catcode`\,=\active
151 \catcode`\ =\active
152 \pipe@active@verbatim@i}
153 \gdef\pipe@active@verbatim@i#1|{%
154 \endgroup
155 \begingroup
156 \def\FV@SV@pipe@active@verbatim{%
157 \FV@Gobble
158 \expandafter\FV@ProcessLine\expandafter{#1}}%
159 \BUseVerbatim{pipe@active@verbatim}%
160 \endgroup}
161 \AtBeginDocument{\let|\pipe@active@verbatim}
162 \endgroup
163 \makeatother
164
165 \usepackage{array}
166 \usepackage{booktabs}
167
168 \usepackage{qrbill}
169
170 \usepackage{geometry}
171 \geometry{left=4cm}
172
173 \usepackage[hidelinks]{hyperref}
174
175 \begin{document}
176 \DocInput{qrbill.dtx}
177 \end{document}
178 %</driver>
179 %\fi
180 %
181 % \changes{v1.00}{2020/06/28}{First official version}
182 %
183 % \GetFileInfo{qrbill.dtx}
184 %
185 % \DoNotIndex{\newcommand,\newenvironment}
186 % \title{qrbill \fileversion}
187 % \subtitle{\LaTeX-package to create QR-bills based on the Swiss payments standards}
188 % \author{Marei Peischl \href{mailto:[email protected]}{<[email protected]>}}
189 % \publishers{A collaborative project of pei\TeX{} and foobar LLC}
190 % \date{\filedate}
191 % \maketitle
192 % \tableofcontents
193 % \section{Introduction}
194 % qrbill.sty, the \LaTeX-package, is the Free Software and Open Source answer to the launch of the swiss payments conversion, introduced mid 2020, replacing the former payment order slip by a restructured, QR enhanced slip. The published source code is based on the payment standard guidelines issued for Switzerland and intentionally has a modular structure to enable further development and adaptation for international use.
195 %
196 % By means of the \LaTeX{} framework, the qrbill can simply be integrated into existing accounting environments and automated billing systems.
197 % \iffalse
198 %<*package>
199 % \fi
200 % \section{Example of use}
201 % The easies way to use the qrbill package is to create a bill with the standalone documentclass:
202 %
203 % \begin{doccode}
204 % \documentclass{standalone}
205 % \usepackage[ngerman]{babel}
206 %
207 % \usepackage{xcolor}
208 % \usepackage{qrbill}
209 %
210 % \begin{document}
211 %
212 % \QRbill[
213 % creditor={foobar LLC\\
214 % Postfach 404\\
215 % 2342 Zurich\\
216 % CH},
217 % Account=CH1280808005649899718,
218 % % insert additional data here
219 % ]
220 %
221 % \end{document}
222 % \end{doccode}
223 %
224 % \DescribeMacro{\QRbill}\sarg\oarg{Data Setup}
225 % The macro \latexinline{\QRbill} creates a box of 210\,mm${}\times{}$105\,mm size. It will include a qrbill as described in the design guide \cite{qrbill-design} and insert all available data.
226 % The starred version (\latexinline{\QRbill*}) is only creating the QRcode without additional visible data. This is not necessarry for the swiss standard, but allows the usage with other QRcode schemes like the EPC QR codes (see section \ref{sec:epc}).
227 %
228 % There is also an example in the appendix showing all data fields (see appendix \ref{standalone-complete} on page \pageref{standalone-complete}).
229 %
230 % The headings are provided in German, English, Italian and French and will be translated using the document's language setup. The terms have been taken from the official guidelines.
231 %
232 % \section{Technical Requirements}
233 % qrbill has been built for \TeX Live 2020. Currently it is not possible to ensure it's functionality with older Releases of \TeX Distributions.
234 %
235 % The packages loaded by qrbill are:
236 % \begin{itemize}
237 % \item expl3
238 % \item fontspec (except one is using a custom font setup)
239 % \item graphicx
240 % \item scrbase (which is part of the koma-script bundle)
241 % \item qrcode
242 % \item iftex
243 % \item l3keys2e
244 % \item numprint
245 % \end{itemize}
246 %
247 % As a default font \enquote{Liberation Sans} will be used. This will be loaded using fontspec, which would require the use of Lua\LaTeX{} or Xe\LaTeX{} as a compiler. To have a workaround for this, see the \latexinline{font} option on page \pageref{opt:font} for a custom font setup.
248 %
249 % \section{Package options}
250 %
251 % \begin{optionlist}
252 %
253 % \item[billinginfo (true/false) (true)]
254 % Activate/deactivate the automatic fill of the BillingInformation. If this is set to \latexinline{false} one still can add data to this field using the \latexinline{BillingInformation} key, as Described in section \ref{sec:data-setup}.
255 %
256 % \item[creditorprefix\\debtorprefix (String) (CR-/UD-)]
257 % For custom setups the predefined prefixes for the debtor and creditoraddress can be changes. The initial configuration is a requirement of the Swiss standards.
258 %
259 % \item[data-to-string (true/false) (false)]
260 % Converts data to be used to setup the billing QRcode into a string. This option has to be updated if the data should not be treated as ordinary \LaTeX{} code.
261 % You can use this to automatically escape special characters.\changes{v1.05}{2022/09/15}{add data-to-string option}
262 %
263 % \item[font (Frutiger/Arial/Helvetica/Liberation Sans/custom) (Liberation Sans)]
264 % \label{opt:font}
265 % The official guideline for the Swiss qrbill limits the choice of the font to the first four values of this option. The font selection and sizes currently hardcoded to fit to the size. Custom setups might be provided in the future.
266 %
267 % In case one wants to use a custom font, you can set the option \latexinline{font=custom}. This will disable all font setup and not prevent the fontspec package from being loaded. You can redefine the macro \latexinline{qrbillfont} to use any font available on your system, for example:
268 % \begin{doccode}
269 % \usepackage{fontspec}
270 % % The Laconic font has to be installed
271 % \renewcommand*{\qrbillfont}{\fontspec{Laconic}}
272 % \end{doccode}
273 %
274 % \item[frame (true/false/top/bottom/none) (true)]
275 % Switch to disable the frame around the created QRbill. The top/bottom options should be prefered when the bill is embedded into a document of a4 papersize.
276 % The option none also disables the vertical line inside the bill as this may be included on preprinted paper.
277 %
278 % \changes{v1.02}{2020/08/25}{add ibanseparator option}
279 % \item[ibanseparator (tokenlist) (\textbackslash,)]
280 % Set the tokenlist to separate the account numbers. See option \latexinline{sep-iban} for
281 % further information.
282 %
283 % \item[icon (swiss-cross/filename) (<empty>)]
284 % The swiss standard describes the placement of a swiss-cross icon in the center of the QRcode. This can be achieved using this option. The default is set empty, so no icon will be placed. If this option holds another string than \enquote{swiss-cross} it will be interpreted as filename and try to load a custom image.
285 %
286 % \item[iconwidth (length) (7mm)]
287 % This option allows custom scaling for custom icons.
288 %
289 % \item[ignore-if-empty (comma list) (<empty>)]
290 % Allows to define a list of fields for the qrscheme to be ignored if they have empty values.
291 % For the swiss QRbill standard this is recommended for the fields \enquote{AV1-Parameters}, \enquote{AV2-Parameters} and \enquote{BillingInfo}.
292 % \changes{v1.06}{2022/10/18}{Add ignore-if-empty option}
293 %
294 % \item[qrmode (package/lua) (package)] Selects the mechanism for QRcode generation.
295 % \changes{v2.00}{2023/02/28}{qrencode.lua now is part of the qrbill package}
296 % With Version 2.0 the package supports usage of the the luaqrcode library \cite{luaqrcode}. This can be enabled by using the \latexinline{qmode=lua} option.
297 %
298 % \changes{v2.01}{2023/07/24}{add qrsize option}
299 % \item[qrsize (length) (46mm)]
300 % Allows to change the size of the created QRcoode.
301 % The default setting is chosen to match the swiss QRbills.
302 %
303 % \item[qrscheme (Name of a QRbill scheme e.g. swiss or epc) (swiss)]
304 % Loads the definitions for the QRcode and the BillingInformation.
305 % Currently only the swiss qrbill scheme (\latexinline{qrscheme=swiss}) and EPC QRcodes (\latexinline{qrscheme=epc}) are available, but one can define own variants based on this file.
306 % Users can copy the file swiss.qrbill-cfg.tex as a template.
307 % The package will look for a file named “\textlangle value of the qrscheme option\textrangle.qrbill-cfg.tex” to load the scheme.
308 %
309 % \changes{v1.02}{2020/08/25}{add referenceseparator option}
310 % \item[referenceseparator (tokenlist) (\textbackslash,)]
311 % Set the tokenlist to separate the reference codes. See option \latexinline{sep-reference} for
312 % further information.
313 %
314 % \changes{v1.02}{2020/08/25}{add sep-iban/sep-reference option}
315 % \item[sep-iban\\sep-reference (integer) (0)]
316 % Set the size of character groups to separate these. Positive values will be counted left to right. Negative ones the other way round.
317 % The most variants of the Swiss QRbill use values of \latexinline{sep-iban=4} and \latexinline{sep-reference=-5} e.\,g.:
318 %
319 % \ExplSyntaxOn
320 % \begingroup
321 % \keys_set:nn {qrbill} {sep-iban=4,sep-reference=-5}
322 % Iban:~\__qrbill_sep_tl:nn {iban} {CH1280808005649899718}\\
323 % Reference:~\__qrbill_sep_tl:nn {reference} {000000000000000000000000152}
324 % \endgroup
325 % \ExplSyntaxOff
326 %
327 % \changes{v1.01}{2020/06/29}{Add separate option to modify the top rule of the QR bill}
328 % \changes{v1.02}{2020/08/25}{Fix placement issue with separate option}
329 % \item[separate (false/text/symbol) (text)]
330 % Setup the separation rule between the document and the qrbill. If the value is text or symbol the Info \enquote{\qrbillseparatename} or the corresponding translation will be printed on top of the frame. This option will be ignored it the frame has no top rule.
331 %
332 % \item[replace-tilde\\replace-umlauts (true/false) (false)]
333 % Add automatic string replacements for \latexinline{~} and Umlauts.
334 % In general the Data has either to be parsed as string or be expandable.
335 % There are some specials about active characters like \latexinline{~}.
336 % The option \latexinline{replace-tilde=true} will replace this by an ordinary space within the data string for the QRcode.
337 %
338 % Similarly the replace-umlauts options is mapping Umlauts to the two character representation. This can be used if UTF-8 is not supported.
339 % Custom replacements can be set up using \latexinline{\QRbillAddCustomReplacement} as described in section \ref{sec:custom-replacement}.
340 % \changes{v1.05}{2022/09/15}{Add replace-tilde/replace-umlauts options}
341 %
342 % \item[vrule (true/false/symbol) (true)]
343 % Allows customization of the vertical rule between payment part and receipt. The value \latexinline{vrule=symbol} acts similar to the \latexinline{separator=symbol} option.
344 % \changes{v1.06}{2022/10/18}{Add vrule=symbol option.}
345 %
346 % \end{optionlist}
347 %
348 % \section{Data setup}
349 % \label{sec:data-setup}
350 % \changes{v1.04}{2022/07/02}{Add starrred variant of qrbillsetdata}
351 % \DescribeMacro{\qrbillsetdata}\sarg\marg{data}
352 % The data fields can be filled either using the optional argument of \latexinline{\QRbill} or using the macro \latexinline{\qrbillsetdata}. Section \ref{sec:data-complete} shows a list of all available fields and appendix \ref{standalone-complete} provides an example of use. For further information on the construction of the QRcode see the specification \cite{qrbill-spec}.
353 %
354 % To simplify the usage qrbill provides an interface to use the different types of address data and is able to create a \enquote{billing information} string as described in \cite{qrbill-spec} using the single data elements.
355 %
356 % Version 1.04 adds a starred variant to expand the argument before setting the data. This might be usefull for using counters or other variables inside the command.
357 %
358 % \section{Parsing dates}
359 % In version v1.04 qrbill introduced the functionality to parse dates. For the swiss data scheme the fields \latexinline{invoicedate} and \latexinline{vatdate} are prefilled with the compilation date.
360 % \changes{v1.04}{2022/07/02}{Add date parsing mechanisms}
361 % \DescribeMacro{\QRbillParseDate}\marg{year}\marg{month}\marg{day}
362 % To be compatible with language specific setups the usage of \latexinline{\today} is not allowed directly but one can use
363 % \begin{doccode}
364 % \qrbillsetdata*{
365 % invoicedate=\QRbillParseDate{\the\year}{\the\month}{\the\day}
366 % }
367 % \end{doccode}
368 % By default this setting will return the ISO date (YYYY-MM-DD) but the swiss scheme is already changing this to the desired (YYMMDD) structure.
369 %
370 % \section{String replacements}\label{sec:custom-replacement}
371 % \changes{v1.05}{2022/09/15}{Add support for custom string replacements}
372 % Following a feature request qrbill received support for custom replacements.
373 % Those allow the use of special characters within the data fields.
374 % The corresponding options \latexinline{replace-tilde} and \latexinline{replace-umlauts} provide preset variants for the most common replacements.
375 % In case you want to add another you can use the following structure:
376 % \begin{doccode}
377 % \AddQRbillCustomReplacement{Ä}{Ae}
378 % \end{doccode}
379 %
380 % \section{Setup for the preconfigured Swiss QR-bill}
381 % \subsection{Preconfigured data}
382 % \changes{v1.03}{2021/05/07}{Update to swiss qrbill standard version 2.2}
383 % The initial configuration which uses the Swiss standard already adds the following data:
384 % \begin{doccode}
385 % \SetupQrBill{
386 % QRType=SPC,
387 % Version=0200,
388 % CodingType=1,
389 % Trailer=EPD,
390 % }
391 % \end{doccode}
392 % These fields are required to use these values for Version 2.2 of the QRbill standard. If any future changes on the standard would require changes, they can be overwritten or redefined by using a custom implementation file, similar to swiss.qrbill-cfg.tex.
393 %
394 % \changes{v1.02}{2020/08/25}{Note the version number inconsistency in the official guidelines}
395 % Be aware that version 2.1 of the standard requested to use the versioncode \latexinline{0210}.
396 % With the update to version 2.2 of the standard this was changed to \latexinline{0200}.
397 % This change was caused by a discrepancy between the standard and the commong implementation.
398 % Most of them continued to use the version code \latexinline{0200} therefore SIX decided to keep this error and created a workaround with finally documenting this change in version 2.2 of the guildelines.
399 % \begin{quote}
400 %Note: In collaboration with representatives of the financial center, SIX has decided that only the version designation “0200” is permitted in master version 02. From master version 03 onwards, depiction of subversions is enabled.\\\hspace*{\fill}\cite{qrbill-spec}
401 % \end{quote}
402 % The corresponding issue and discussion concerning this especially for version 2.1 can be found at \url{https://github.com/peiTeX/qrbill/issues/3}.
403 %
404 % Additionally the Currency has been initialized to use \enquote{CHF}. This also can be overwritten. Currently the Swiss standards only allow the values \latexinline{CHF} or \latexinline{EUR}.
405 % \subsection{Address data}
406 % The Swiss payment standards for QR-bills require the following data for the address of creditor (Prefix \latexinline{CR-}) and debtor (Prefix \latexinline{UD-}):
407 % \begin{center}
408 % \begin{tabular}{@{}>{\ttfamily}l>{\centering}p{.25\linewidth}>{\centering\arraybackslash}p{.25\linewidth}@{}}
409 % \toprule
410 % AddressType&S&K\\\cmidrule(r){1-1}\cmidrule(l){2-3}
411 % Name& \multicolumn{2}{c}{Name}\\\cmidrule(r){1-1}\cmidrule(l){2-3}
412 % Address1&Street&Street with number\\\cmidrule(r){1-1}\cmidrule(l){2-3}
413 % Address2&Number&Postal code with City\\\cmidrule(r){1-1}\cmidrule(l){2-3}
414 % ZIP&Postal code& Enforced Empty\\\cmidrule(r){1-1}\cmidrule(l){2-3}
415 % City& City& Enforced Empty\\\cmidrule(r){1-1}\cmidrule(l){2-3}
416 % Country& \multicolumn{2}{c}{Country Code}\\\bottomrule
417 % \end{tabular}
418 % \end{center}
419 % To set an address of type \enquote{K} one can use they option key \latexinline{debtor} or \latexinline{creditor}. Type \enquote{S} can be achieved using the starred variant (\latexinline{debtor*}/\latexinline{creditor*}).
420 %
421 % \begin{minipage}{.4\linewidth}
422 % \begin{doccode}
423 % creditor={Name\\
424 % Street Nr.\\
425 % PostalCode City\\
426 % CountryCode},
427 % \end{doccode}
428 % \end{minipage}\hfill
429 % \begin{minipage}{.5\linewidth}
430 % \begin{doccode}
431 % creditor*={Name\\
432 % Street\\
433 % Nr.\\
434 % PostalCode\\
435 % City\\
436 % CountryCode},
437 % \end{doccode}
438 % \end{minipage}
439 %
440 % \subsection{Billing information}
441 % The billing information is a string which can consist of the following data elements:
442 % \begin{tabular}{@{}>{\ttfamily}ll@{}}
443 % invoicenum & invoice number\\
444 % invoicedate & invoice data \\
445 % customerref & customer reference \\
446 % vat & VAT number\\
447 % vatdate& VAT date\\
448 % vatdetails& VAT percentage / details\\
449 % importvat& import VAT\\
450 % conditions& payment conditions\\
451 % \end{tabular}
452 % The data has to be in the required format. qrbill might add features to automatically validate this in the future.
453 %
454 % Beside setting the data fields all on their own, qrbill can also handle a complete billing information string. One could simply set it by
455 %
456 % \begin{doccode}
457 % BillingInfo=//S1/10/10201409/11/190512/20/1400.000-53/30/106017086
458 % /31/180508/32/7.7/40/2:10;0:30
459 % \end{doccode}
460 % \subsection{AV-Parameters}
461 % The QRcode can use 2 AV Parameters. They have to carry the Prefix of \enquote{Name AV1:}/\enquote{Name AV2:}. This will be automatically added if the keys \latexinline{AV1}/\latexinline{AV2} are used instead of \latexinline{AV1-Parameters}/\latexinline{AV2-Parameters}.
462 %
463 % \subsection{Remaining data elements}
464 % The remaining data elements should be set directly.
465 % For restrictions on the content see the specification. Currently there is no validation taking place.
466 % The remaining for the preconfigures Swiss standard are:
467 % Account,
468 % Amount,
469 % ReferenceType,
470 % Reference,
471 % Message,
472 %
473 % \subsection{The Swiss cross icon}
474 % \cite{qrbill-design} reguires a swiss cross of 7\,mm size to be placed in the center of the QRcode.
475 % This package supports this by using the package option for the icon:
476 % \begin{doccode}
477 % \usepackage[icon=swiss-cross, …]{qrbill}
478 % \end{doccode}
479 % This setting is not activated by default.
480 %
481 %
482 % \subsection{Overview over all data fields}
483 % \label{sec:data-complete}
484 % Data fields which are used in the QRcode:\par
485 % \ExplSyntaxOn
486 % \seq_use:Nn \g__qrbill_qrscheme_seq {\\}
487 % \ExplSyntaxOff
488 % \par\medskip
489 % Data fields, which are custom created by the qrbill package to simplify the use:\par
490 % creditor and creditor*\\
491 % debtor and debtor*\\
492 % AV1 and AV2
493 % \par\medskip
494 % Data fields to automatically create the BillingInfo string. The key in parentheses indicates the prefix to be used to construct the string.\par
495 % \ExplSyntaxOn
496 % \prop_map_inline:Nn \g__qrbill_billing_info_prop {#2~(#1)\\}\strut
497 % \ExplSyntaxOff
498 % \section{Setup for EPC QR codes}
499 % \label{sec:epc}
500 % EPC QR codes can be used for SEPA credit transfer (SCT).
501 % They do not include any data about the debtor or tax information.
502 % Therefore they may only be used with the starred variant of \latexinline{\QRbill*} or the user has to provide additional data interfaces.
503 %
504 % To use this kind of QRcodes with qrbill one has to select the corresponding \latexinline{qrscheme}:
505 % \begin{doccode}
506 % \usepackage[qrscheme=epc]{qrbill}
507 % \end{doccode}
508 % \subsection{Preconfigured data}
509 % \changes{v1.04}{2022/07/01}{Add basic support for EPC QR codes}
510 % The epc qrscheme provided by this package preset the following data:
511 % \begin{doccode}
512 % \SetupQrBill{
513 % QRType=BCD,
514 % Version=002,
515 % CodingType=1,% UTF-8, 2 would be ISO
516 % Trailer=SCT,
517 % }
518 % \end{doccode}
519 % These fields are required to use these values for the current version of the EPC QR code.
520 %
521 % \subsection{Required data}
522 % The data fields required by the EPC QRcode can be set directly. A full example for an easy EPC qrcode can be found in appendix \ref{sec:example-epc}.
523 %
524 % \subsection{Overview over all data fields}
525 % \label{sec:epc-data-complete}
526 % \changes{v2.01}{2023/07/24}{Add overview over all epc qrcode data fields}
527 % Data fields which are used in the QRcode:\par
528 % \begingroup
529 % \ExplSyntaxOn
530 % \file_get:nnN {epc.qrbill-cfg.tex} {\char_set_catcode_comment:N \% } \l_tmpa_tl
531 % \let\endinput\relax
532 % \l_tmpa_tl
533 % \seq_use:Nn \g__qrbill_qrscheme_seq {\\}
534 % \ExplSyntaxOff
535 % \par\medskip
536 % The DTA field is completly optional and can be used to encode the reason for the transfer.
537 % \endgroup
538 % \iffalse
539 % \section{Implementation}
540 % \begin{doccode*}
541 \RequirePackage{expl3}
542 \ProvidesExplPackage{qrbill}{2023/07/24}{2.01}{
543 Template for QR-bills based on the Swiss Payment Standards
544 }
545 \RequirePackage{iftex}
546 \RequirePackage{l3keys2e}
547
548 \tl_new:N \g__qrbill_font_tl
549 \bool_new:N \g__qrbill_top_frame_bool
550 \bool_new:N \g__qrbill_bottom_frame_bool
551 \bool_new:N \g__qrbill_left_frame_bool
552 \bool_new:N \g__qrbill_right_frame_bool
553 \bool_new:N \g__qrbill_vrule_bool
554 \bool_new:N \g__qrbill_separateinfo_bool
555 \prop_new:N \g__qrbill_replacement_prop
556
557 \msg_new:nnn {qrbill} {typo-in-option} {
558 A~typo~within~the~option~#1~was~removed.\\
559 The~correct~name~for~the~option~is~#2.\\
560 Please~use~#2~instead~of~#1,~which~only\\
561 exists~for~backwards~compatibility~and~will~be~removed.
562 }
563
564 \tl_new:N \g__qrbill_qrscheme_tl
565
566 \keys_define:nn {qrbill} {
567 font .choices:nn = {Frutiger, Arial, Helvetica, Liberation Sans} {
568 \tl_gset_eq:NN \g__qrbill_font_tl \l_keys_choice_tl
569 },
570 font .initial:n = Liberation Sans,
571 font / custom .code:n = {\tl_gclear:N \g__qrbill_font_tl},
572 qrscheme .choice:,
573 qrscheme / epc .code:n = \tl_gset:Nn \g__qrbill_qrscheme_tl {epc}\tl_gclear:N \g__qrbill_font_tl,
574 qrscheme / unknown .code:n = \tl_gset:Nn \g__qrbill_qrscheme_tl {
575 #1},
576 qrscheme .initial:n = swiss,
577 qrsize .dim_gset:N = \g_qrbill_QRcode_dim,
578 qrsize .initial:n = 46mm,
579 creditorprefix .tl_gset:N = \g__qrbill_creditorprefix_tl,
580 creditorprefix .initial:n = CR-,
581 debtorprefix .tl_gset:N = \g__qrbill_debtorprefix_tl,
582 debtorprefix .initial:n = UD-,
583 qrmode .choice:,
584 qrmode / package .code:n = \bool_gset_false:N \g__qrbill_luamode_bool,
585 qrmode / lua .code:n = \bool_gset_true:N \g__qrbill_luamode_bool,
586 qrmode .initial:n = package,
587 frame .choice:,
588 frame / false .code:n = {
589 \bool_gset_false:N \g__qrbill_top_frame_bool
590 \bool_gset_false:N \g__qrbill_bottom_frame_bool
591 \bool_gset_false:N \g__qrbill_left_frame_bool
592 \bool_gset_false:N \g__qrbill_right_frame_bool
593 },
594 frame / true .code:n = {
595 \bool_gset_true:N \g__qrbill_top_frame_bool
596 \bool_gset_true:N \g__qrbill_bottom_frame_bool
597 \bool_gset_true:N \g__qrbill_left_frame_bool
598 \bool_gset_true:N \g__qrbill_right_frame_bool
599 },
600 frame / top .code:n = {
601 \bool_gset_true:N \g__qrbill_top_frame_bool
602 \bool_gset_false:N \g__qrbill_bottom_frame_bool
603 \bool_gset_false:N \g__qrbill_left_frame_bool
604 \bool_gset_false:N \g__qrbill_right_frame_bool
605 },
606 frame / bottom .code:n = {
607 \bool_gset_false:N \g__qrbill_top_frame_bool
608 \bool_gset_true:N \g__qrbill_bottom_frame_bool
609 \bool_gset_false:N \g__qrbill_left_frame_bool
610 \bool_gset_false:N \g__qrbill_right_frame_bool
611 },
612 frame / none .code:n = {
613 \bool_gset_false:N \g__qrbill_top_frame_bool
614 \bool_gset_false:N \g__qrbill_bottom_frame_bool
615 \bool_gset_false:N \g__qrbill_left_frame_bool
616 \bool_gset_false:N \g__qrbill_right_frame_bool
617 \keys_set:nn {qrbill} {vrule=false}
618 },
619 frame .initial:n = true,
620 vrule .choice:,
621 vrule / true .code:n = \tl_gset:Nn \g__qrbill_vrule_tl {\rule{\g__qrbill_rule_dim}{\c_qrbill_height_dim}},
622 vrule / false .code:n = \tl_gset:Nn \g__qrbill_vrule_tl {\rule{\g__qrbill_rule_dim}{\c_zero_dim}},
623 vrule / symbol .code:n = {
624 \RequirePackage{marvosym}
625 \tl_gset:Nn \g__qrbill_vrule_tl {
626 \rotatebox{90}{
627 \hbox_to_wd:nn {\c_qrbill_height_dim}{
628 \leaders\hbox{\rule{1mm}{\g__qrbill_rule_dim}\hspace{1mm}}\hskip 0pt\@plus1 fill\relax
629 \llap{\raisebox{-.5\height}[\c_zero_dim][\c_zero_dim]{\LeftScissors}}
630 \leaders\hbox{\rule{1mm}{\g__qrbill_rule_dim}\hspace{1mm}}\hskip 0pt\@plus4 fill\relax
631 \hbox{\rule{1mm}{\g__qrbill_rule_dim}}
632 }
633 }
634 }
635 },
636 vrule .initial:n = true,
637 billinginfo .bool_gset:N = \g__grbill_billinginfo_auto_bool,
638 billinginfo .default:n = true,
639 billinginfo .initial:n = true,
640 icon .choice:,
641 icon / swiss-cross .meta:n = {icon=qrbill_swiss-cross.pdf},
642 icon / unknown .code:n = \tl_gset:Nn \g_qrbill_icon_tl {#1},
643 icon .initial:n =,
644 iconwidth .dim_gset:N = \g_qrbill_iconwidth_dim,
645 iconwidth .initial:n = 7mm,
646 separate .choice:,
647 separate / symbol .code:n = {
648 \bool_gset_true:N \g__qrbill_separateinfo_bool
649 \RequirePackage{marvosym}
650 \cs_set:Nn \qrbill_print_separate_info: {
651 \par\leaders\vbox_to_ht:nn {1sp} {
652 \smash{
653 \hbox_to_wd:nn {\c_qrbill_width_dim }{
654 \leaders\hbox{\rule{1mm}{\g__qrbill_rule_dim}\hspace{1mm}}\hskip 0pt\@plus1 fill\relax
655 \llap{\raisebox{-.5\height}{\LeftScissors}}
656 \leaders\hbox{\rule{1mm}{\g__qrbill_rule_dim}\hspace{1mm}}\hskip 0pt\@plus4 fill\relax
657 }
658 }
659 }
660 \vskip 1sp
661 \vskip -1sp
662 }
663 },
664 separate / text .code:n = {
665 \bool_gset_true:N \g__qrbill_separateinfo_bool
666 \cs_set:Nn \qrbill_print_separate_info: {
667 \centerline{\raisebox{\dimexpr\depth+.3ex\relax}[0pt][0pt]{\footnotesize\qrbillseparatename}}
668 \par\nointerlineskip
669 \rule{\c_qrbill_width_dim}{\g__qrbill_rule_dim}
670 }
671 },
672 separate / false .code:n = {\bool_gset_false:N \g__qrbill_separateinfo_bool},
673 separate .initial:n = text,
674 sep-iban .int_gset:N = \g__qrbill_ibansep_int,
675 sep-iban .initial:n = 0,
676 ibanseparator .tl_gset:N = \g__qrbill_ibansep_tl,
677 ibanseparator .initial:n = {\,},
678 ibanseperator .code:n = \keys_set:nn {qrbill} {ibanseparator=#1}\msg_warning:nnnn {qrbill} {typo-in-option} {ibanseperator} {ibanseparator},
679 sep-reference .int_gset:N = \g__qrbill_referencesep_int,
680 sep-reference .initial:n = 0,
681 referenceseparator .tl_gset:N = \g__qrbill_referencesep_tl,
682 referenceseparator .initial:n = {\,},
683 referenceseperator .code:n = \keys_set:nn {qrbill} {referenceseparator=#1}\msg_warning:nnnn {qrbill} {typo-in-option} {referenceseperator} {referenceseparator},
684 replace-tilde .choice:,
685 replace-tilde / true .code:n = \prop_gput:Nxx \g__qrbill_replacement_prop {\char_generate:nn {126} {12}} {\ },
686 replace-tilde / false .code:n = \exp_args:NNx \prop_gremove:Nn \g__qrbill_replacement_prop {\char_generate:nn {126} {12}},
687 replace-umlauts .choice:,
688 replace-umlauts / true .code:n = \prop_gput_from_keyval:Nn \g__qrbill_replacement_prop {ä=ae,Ä=AE,ü=ue,Ü=UE,ö=oe,Ö=OE,ß=ss,ẞ=SS},
689 replace-umlauts / false .code:n = \clist_map_inline:nn {ä,Ä,ü,Ü,ö,Ö,ß,ẞ} {\prop_gremove:Nn \g__qrbill_replacement_prop {##1}},
690 data-to-string .bool_gset:N = \g__qrbill_to_string_bool,
691 ignore-if-empty .clist_gset:N = \g__qrbill_ignore_if_empty_clist,
692 ignore-if-empty .initial:n = ,
693 }
694
695 \ProcessKeysOptions{qrbill}
696
697 \newcommand*{\qrbillsetup}[1]{\keys_set:nn {qrbill}{#1}}
698 \NewDocumentCommand{\qrbillsetdata}{sm}{
699 \bool_if:NTF \g__qrbill_to_string_bool {
700 \IfBooleanTF {#1} {
701 \tl_set:Nx \l_tmpa_tl {#2}
702 \exp_args:Nnx \keys_set:nn {qrbill/data} {\tl_to_str:V \l_tmpa_tl}
703 }{
704 \exp_args:Nnx \keys_set:nn {qrbill/data} {\tl_to_str:n {#2}}
705 }
706 } {
707 \IfBooleanT {#1}
708 \exp_args:Nnx
709 \keys_set:nn
710 {qrbill/data}{#2}
711 }
712 }
713
714 \tl_if_empty:NTF \g__qrbill_font_tl {
715 \def\qrbillfont{\normalfont}
716 }{
717 \RequirePackage{fontspec}
718 \newfontfamily{\qrbillfont}{\g__qrbill_font_tl}
719 \RequirePackage{anyfontsize}
720 }
721
722 \bool_if:NT \g__qrbill_luamode_bool {
723 \lua_load_module:n {qrbill-latexluaqrcode}
724
725 % qrcode setup
726 \dim_new:N \l__qrbill_QRblocksize_dim
727 \cs_set_protected:Npn \qrbill_qrcode_black: {\rule{\l__qrbill_QRblocksize_dim}{\l__qrbill_QRblocksize_dim}}
728 \cs_set_protected:Npn \qrbill_qrcode_white: {\rule{\l__qrbill_QRblocksize_dim}{0pt}\rule{0pt}{\l__qrbill_QRblocksize_dim}}
729 \cs_new:Nn \qrbill_parse_QRcode:n {
730 \__qrbill_setup_lua_qrcode:x {#1}
731 \dim_set:Nn \l__qrbill_QRblocksize_dim {\g_qrbill_QRcode_dim/\lua_now:n {tex.print(num)}}
732 \let\qrblack\qrbill_qrcode_black:
733 \let\qrwhite\qrbill_qrcode_white:
734 \def\qrnewline{\\[\dimexpr-\baselineskip+\l__qrbill_QRblocksize_dim]}
735 % \end{doccode*}
736 % \changes{v2.01}{2023/07/24}{fix icon alignment for qrmode=lua}
737 % \begin{doccode*}
738 \raisebox{\dimexpr\depth-\l__qrbill_QRblocksize_dim}[\dimexpr\height+\depth-\l__qrbill_QRblocksize_dim][0pt]{
739 \noindent\parbox{\g_qrbill_QRcode_dim}{
740 \lua_now:n {tex.sprint(string)}
741 \hss
742 }
743 }
744 }
745
746 \cs_new:Nn \__qrbill_setup_lua_qrcode:n {
747 \lua_now:e {
748 num, string = printQRcode("\lua_escape:n {#1}")
749 }
750 }
751
752 \cs_generate_variant:Nn \__qrbill_setup_lua_qrcode:n {x}
753 }
754
755
756
757 % \end{doccode*}
758 % \changes{v1.07}{2022/10/20}{patch the qrcode package to work with utf-8 strings}
759 % \begin{doccode*}
760
761 \bool_if:NF \g__qrbill_luamode_bool {
762 \usepackage{qrcode}
763 % modified version of \qr@encode@binary to allow utf8 qrcodes required by swiss qrbill scheme
764 % Copyright (C) 2015 by Anders Hendrickson <[email protected]>
765 \cs_set:Nn \__qrbill_encode_unicode_binary:n {
766 % #1 = string of ascii characters, to be converted into bitstream
767 %
768 % We do this one entirely in hex, rather than binary, because we can.
769 \edef\qr@plaintext{#1}%
770 %
771 %First, the mode indicator.
772 \def\qr@codetext{4}% %This means `binary'
773 % patch character count mechanism, because we have to encode to hex before counting so the package does accept our utf8 string
774 \__qrbill_qr_get_string_length_encoded:n { \qr@plaintext }
775 %Set \qr@charactercountlengthinhex to \qr@charactercountbits@byte/4%
776 \edef\qr@charactercountlengthinhex{\int_eval:n {\qr@charactercountbits@byte / 4}}%
777 \qr@decimaltohex[\qr@charactercountlengthinhex]{\qr@charactercount}{\qr@stringlength}%
778 \xa\g@addto@macro\xa\qr@codetext\xa{\qr@charactercount}%
779 %
780 %Now comes the actual data.
781 \exp_args:NNx \str_set_convert:Nnnn \l_tmpa_str { \qr@plaintext } {} {utf8/hex}
782
783 \str_gput_right:NV \qr@codetext \l_tmpa_str
784 \xdef\qr@codetext{\exp_args:No \str_lowercase:n {\qr@codetext}}
785 %Now the terminator.
786 \g@addto@macro\qr@codetext{0}% %This is '0000' in binary.
787 %
788 %There is no need to pad bits to make a multiple of 8,
789 %because the data length is already 4 + 8 + 8n + 4.
790 %
791 %Now add padding codewords if needed.
792 \setcounter{qr@hexchars}{\tl_count:o {\qr@codetext}}%
793 %Set \qr@numpaddingcodewords equal to \qr@totaldatacodewords - qr@hexchars/2.
794 \edef\qr@numpaddingcodewords{\int_eval:n {(-\c@qr@hexchars / 2)+\qr@totaldatacodewords}}
795 %
796 \int_compare:nNnT {\qr@numpaddingcodewords} < {0} {
797 \edef\ds{ERROR:~Too~much~data!~Over~by~\qr@numpaddingcodewords~bytes.}
798 }
799 \int_compare:nNnT {\qr@numpaddingcodewords} > {0} {
800 \int_step_inline:nnnn {2} {2} {\qr@numpaddingcodewords} {
801 \g@addto@macro{\qr@codetext}{ec11}%
802 }
803 \int_if_odd:nT {\qr@numpaddingcodewords} {
804 \g@addto@macro{\qr@codetext}{ec}%
805 }
806 }
807 }
808 \cs_set:Nn \qrbill_parse_QRcode:n {
809 \cs_set_eq:NN \qr@encode@binary \__qrbill_encode_unicode_binary:n
810 \raisebox{\depth}{
811 \__qrbill_enable_unicode_qrcode_patch:
812 % \end{doccode*}
813 % \changes{v2.01}{2023/07/24}{Disable hyperlink for qrcode in case hyperref is loaded}
814 % \begin{doccode*}
815 \qrcode[nolink,height= \g_qrbill_QRcode_dim]{#1}
816 }
817 }
818
819 \cs_new:Nn \__qrbill_qr_get_string_length_encoded:n {%
820 \exp_args:NNx \str_set_convert:Nnnn \l_tmpa_str { #1 } {} {utf8/hex}
821 \xdef\qr@stringlength{\int_eval:n {\str_count:N \l_tmpa_str / 2}}
822 }
823
824 \cs_new:Nn \__qrbill_qr_padatfront:nn {%
825 % #1 = macro containing text to pad
826 % #2 = desired number of characters
827 % Pads a number with initial zeros.
828 \prg_replicate:nn {\int_max:nn {0} {#2- \tl_count:N #1}} {
829 \qr@g@preface@macro{#1}{0}
830 }
831 }
832
833 \let\orig@qr@getstringlength\qr@getstringlength
834
835 \cs_new:Nn \__qrbill_enable_unicode_qrcode_patch: {
836 \cs_set_eq:NN \qr@padatfront \__qrbill_qr_padatfront:nn
837 \AddToHook{cmd/qr@choose@best@version/before}{\cs_set_eq:NN \qr@getstringlength\__qrbill_qr_get_string_length_encoded:n}
838 \AddToHook{cmd/qr@choose@best@version/after}{\let\qr@getstringlength\orig@qr@getstringlength}
839 }
840 }
841
842 \cs_generate_variant:Nn \qrbill_parse_QRcode:n {V}
843
844 \newcommand*{\QRbillAddCustomReplacement}[2]{
845 \prop_gput:Nxx \g__qrbill_replacement_prop {#1} {#2},
846 }
847
848 \RequirePackage{scrbase}
849 \RequirePackage{graphicx}
850 \RequirePackage{numprint}
851 \npthousandsep{\,}
852 \npdecimalsign{.}
853
854 \dim_new:N \g__qrbill_rule_dim
855 \dim_gset:Nn \g__qrbill_rule_dim {.5pt}
856 \dim_const:Nn \c_qrbill_sep_dim {5mm}
857 \dim_const:Nn \c_qrbill_width_dim {210mm}
858 \dim_const:Nn \c_qrbill_height_dim {105mm}
859
860 \cs_new:Nn \qrbill_title_font: {\fontsize{11bp}{11bp}\selectfont\bfseries}
861
862 \cs_new:Nn \qrbill_headingR_font: {\fontsize{6bp}{9bp}\selectfont\bfseries}
863 \cs_new:Nn \qrbill_valueR_font: {\fontsize{8bp}{9bp}\selectfont}
864 \cs_new:Nn \qrbill_amountR_font: {\fontsize{8bp}{11bp}\selectfont}
865 \cs_new:Nn \qrbill_acceptance_font: {\fontsize{6bp}{8bp}\selectfont\bfseries}
866
867 \cs_new:Nn \qrbill_headingP_font: {\fontsize{8bp}{11bp}\selectfont\bfseries}
868 \cs_new:Nn \qrbill_valueP_font: {\fontsize{10bp}{11bp}\selectfont}
869 \cs_new:Nn \qrbill_amountP_font: {\fontsize{10bp}{13bp}\selectfont}
870
871 \cs_new:Nn \qrbill_infoheading_font: {\fontsize{7bp}{8bp}\selectfont\bfseries}
872 \cs_new:Nn \qrbill_info_font: {\fontsize{7bp}{8bp}\selectfont}
873
874 \dim_new:N \g_qrbill_placeholder_rule_dim
875 \dim_gset:Nn \g_qrbill_placeholder_rule_dim {.75pt}
876 \dim_new:N \g_qrbill_placeholder_corner_dim
877 \dim_gset:Nn \g_qrbill_placeholder_corner_dim {3mm}
878 \cs_new:Nn \__qrbill_placeholder_hmark: {
879 \rule{\g_qrbill_placeholder_corner_dim}{\g_qrbill_placeholder_rule_dim}
880 }
881 \cs_new:Nn \__qrbill_placeholder_vmark: {
882 \rule{\g_qrbill_placeholder_rule_dim}{\g_qrbill_placeholder_corner_dim}
883 }
884
885
886 \cs_new:Nn \__qrbill_placeholder:nn {
887 \vbox_to_ht:nn {#2} {
888 \hbox_to_wd:nn {#1} {\__qrbill_placeholder_hmark: \hfill \__qrbill_placeholder_hmark:}
889 \nointerlineskip
890 \hbox_to_wd:nn {#1} {\__qrbill_placeholder_vmark: \hfill \__qrbill_placeholder_vmark:}
891 \vfill
892 \hbox_to_wd:nn {#1} {\__qrbill_placeholder_vmark: \hfill \__qrbill_placeholder_vmark:}
893 \nointerlineskip
894 \hbox_to_wd:nn {#1} {\__qrbill_placeholder_hmark: \hfill \__qrbill_placeholder_hmark:}
895 }
896 }
897
898 \cs_new:Nn \qrbill_bill_create: {
899 \begingroup
900 \qrbill_parse_BillingInfo:
901 \qrbillfont
902 \setlength{\parindent}{\z@}
903 \parbox{\c_qrbill_width_dim }{
904 \vbox to \c_qrbill_height_dim {
905 \bool_if:NTF \g__qrbill_top_frame_bool
906 {
907 \bool_if:NTF \g__qrbill_separateinfo_bool
908 {\qrbill_print_separate_info:}
909 {\rule{\c_qrbill_width_dim}{\g__qrbill_rule_dim}}
910 }
911 {\rule{\c_zero_dim}{\g__qrbill_rule_dim}}
912 \par\nointerlineskip
913 \skip_vertical:n {\c_qrbill_sep_dim-\g__qrbill_rule_dim}
914 \skip_horizontal:n {\c_qrbill_sep_dim-\g__qrbill_rule_dim}
915 \begin{minipage}[c][95mm][t]{52mm}
916 \vbox_to_ht:nn {7mm} {\qrbill_title_font:\qrbillreceiptname\vfill}
917 \par\nointerlineskip
918 \vbox_to_ht:nn {56mm}{
919 {\qrbill_headingR_font:\qrbillaccountname\par}
920 {
921 \qrbill_valueR_font:
922 \__qrbill_sep_tl:nV {iban} \l_qrbill_data_Account_tl\par
923 \qrbill_insert_address:N \g__qrbill_creditorprefix_tl
924 \par\vskip\baselineskip
925 }
926 \tl_if_empty:NF \l_qrbill_data_Reference_tl {
927 {\qrbill_headingR_font:\qrbillreferencename\par}
928 {
929 \qrbill_valueR_font:
930 \__qrbill_sep_tl:nV {reference} \l_qrbill_data_Reference_tl
931 \par\vskip\baselineskip
932 }
933 }
934 \tl_if_empty:cTF {l_qrbill_data_\g__qrbill_debtorprefix_tl Name_tl}
935 {
936 {\qrbill_headingR_font:\qrbilldebtoraddrname\par}
937 \__qrbill_placeholder:nn {52mm} {20mm}
938 }{
939 {\qrbill_headingR_font:\qrbilldebtorname\par}
940 {
941 \qrbill_valueR_font:
942 \qrbill_insert_address:N \g__qrbill_debtorprefix_tl
943 \par
944 }
945 }
946 \vfill
947 }
948 \par\nointerlineskip
949 \vbox_to_ht:nn {14mm}{
950 \qrbill_headingR_font:
951 \begin{tabular}[t]{@{}ll@{}}
952 \qrbillcurrencyname&\qrbill_headingR_font:\qrbillamountname\\
953 \qrbill_amountR_font:\l_qrbill_data_Currency_tl
954 &\qrbill_amountR_font:
955 \tl_if_empty:NF \l_qrbill_data_Amount_tl
956 {\numprint{\l_qrbill_data_Amount_tl}}
957 \end{tabular}
958 \tl_if_empty:NTF \l_qrbill_data_Amount_tl {
959 \hfill
960 \raisebox{\dimexpr-\height+\ht\strutbox}[\z@]{\llap{
961 \__qrbill_placeholder:nn {30mm} {10mm}
962 }}
963 }
964 \vfill
965 }
966 \par\nointerlineskip
967 \vbox_to_ht:nn {18mm} {
968 \makebox[\linewidth][r]{\qrbill_headingR_font:\qrbillacceptantname}\par
969 \vfill
970 }
971 \end{minipage}%
972 \skip_horizontal:n {2\c_qrbill_sep_dim}
973 \begin{minipage}[c][95mm][t]{138mm}
974 \begin{minipage}[c][85mm][t]{51mm}
975 \parbox[t][7mm][t]{\linewidth}{\qrbill_title_font:\qrbillpaymentpartname\vfill}
976 \par\nointerlineskip
977 \skip_vertical:n {\c_qrbill_sep_dim}
978 \qrcode_setup_QRcode:
979 \leavevmode\qrbill_parse_QRcode:V \l_qrbill_data_str
980 \tl_if_empty:NF \g_qrbill_icon_tl {
981 \llap{\hbox_to_wd:nn {\g_qrbill_QRcode_dim} {
982 \hfill
983 \raisebox{\dimexpr-.5\height+.5\g_qrbill_QRcode_dim}[0pt][0pt]{
984 \includegraphics[width=\g_qrbill_iconwidth_dim]{\g_qrbill_icon_tl}
985 }
986 \hfill
987 }}
988 }
989 \skip_vertical:n {\c_qrbill_sep_dim}
990 \vbox_to_ht:nn {22mm}{
991 \begin{tabular}[b]{@{}ll@{}}
992 \qrbill_headingP_font:\qrbillcurrencyname&\qrbill_headingP_font:
993 \qrbillamountname\\
994 \qrbill_amountP_font:\tl_use:c {l_qrbill_data_Currency_tl}&
995 \tl_if_empty:NF \l_qrbill_data_Amount_tl {
996 \qrbill_amountP_font:\numprint{\l_qrbill_data_Amount_tl}
997 }
998 \end{tabular}
999 \tl_if_empty:NTF \l_qrbill_data_Amount_tl {
1000 \hfill
1001 \raisebox{\dimexpr-\height+\ht\strutbox}[\z@]{
1002 \llap{\__qrbill_placeholder:nn {40mm} {15mm}}
1003 }
1004 }
1005 \vfill
1006 }
1007 \end{minipage}
1008 \begin{minipage}[c][85mm][t]{87mm}
1009 \par\nointerlineskip
1010 {\qrbill_headingP_font:\qrbillaccountname\par}
1011 {
1012 \qrbill_valueP_font:
1013 \__qrbill_sep_tl:nV {iban} \l_qrbill_data_Account_tl \par
1014 \qrbill_insert_address:N \g__qrbill_creditorprefix_tl
1015 \par\vskip\baselineskip
1016 }
1017 \raggedright
1018 \tl_if_empty:NF \l_qrbill_data_Reference_tl {
1019 {\qrbill_headingP_font:\qrbillreferencename\par}
1020 {\qrbill_valueP_font:
1021 \__qrbill_sep_tl:nV {reference} \l_qrbill_data_Reference_tl
1022 \par\vskip\baselineskip}
1023 }
1024 \exp_args:Nf \tl_if_empty:nF {
1025 \l_qrbill_data_BillingInfo_tl
1026 \l_qrbill_data_Message_tl
1027 }{
1028 {\qrbill_headingP_font:\qrbilladdinfoname\par}
1029 {
1030 \qrbill_valueP_font:
1031 \l_qrbill_data_Message_tl\par
1032 \tl_replace_all:Nnn \l_qrbill_data_BillingInfo_tl {/} {\discretionary{}{}{}/}
1033 \l_qrbill_data_BillingInfo_tl
1034 \par\vskip\baselineskip
1035 }
1036 }
1037 \tl_if_empty:cTF {l_qrbill_data_\g__qrbill_debtorprefix_tl Name_tl} {
1038 {\qrbill_headingP_font:\qrbilldebtoraddrname\par}
1039 \__qrbill_placeholder:nn {65mm} {25mm}
1040 }{
1041 {\qrbill_headingP_font:\qrbilldebtorname\par}
1042 {
1043 \qrbill_valueP_font:
1044 \qrbill_insert_address:N \g__qrbill_debtorprefix_tl
1045 \par
1046 }
1047 }
1048 \end{minipage}\par\nointerlineskip
1049 \begin{minipage}[b][10mm][t]{\linewidth}
1050 \strut
1051 \qrbill_insert_AV_parameters:NNn
1052 \qrbill_infoheading_font:
1053 \qrbill_info_font:
1054 {AV1,AV2}
1055 \end{minipage}
1056 \end{minipage}
1057 \par\nointerlineskip\skip_vertical:n {\c_qrbill_sep_dim}
1058 \smash{
1059 \bool_if:NT \g__qrbill_bottom_frame_bool
1060 {\rlap{\rule{\c_qrbill_width_dim}{\g__qrbill_rule_dim}}}
1061 \bool_if:NTF \g__qrbill_left_frame_bool
1062 {\rule{\g__qrbill_rule_dim}{\c_qrbill_height_dim}}
1063 {\rule{\g__qrbill_rule_dim}{\c_zero_dim}}
1064 \hspace{\dimexpr62mm-1.5\g__qrbill_rule_dim}
1065 \g__qrbill_vrule_tl
1066 \hspace{\dimexpr148mm-1.5\g__qrbill_rule_dim}
1067 \bool_if:NTF \g__qrbill_right_frame_bool
1068 {\rule{\g__qrbill_rule_dim}{\c_qrbill_height_dim}}
1069 {\rule{\g__qrbill_rule_dim}{\c_zero_dim}}
1070 }
1071 \vfill
1072 }
1073 }
1074 \endgroup
1075 }
1076
1077 \NewDocumentCommand{\QRbill}{so}{
1078 \begingroup
1079 \IfNoValueF{#2} {\keys_set:nn {qrbill/data} {#2}}
1080 \IfBooleanTF {#1}
1081 {
1082 \qrcode_setup_QRcode:
1083 \leavevmode\qrbill_parse_QRcode:V \l_qrbill_data_str
1084 % \end{doccode*}
1085 % \changes{v2.01}{2023/07/24}{Add icon support for epc qrcodes}
1086 % \begin{doccode*}
1087 \tl_if_empty:NF \g_qrbill_icon_tl {
1088 \llap{\hbox_to_wd:nn {\g_qrbill_QRcode_dim} {
1089 \hfill
1090 \raisebox{\dimexpr-.5\height+.5\g_qrbill_QRcode_dim}[0pt][0pt]{
1091 \includegraphics[width=\g_qrbill_iconwidth_dim]{\g_qrbill_icon_tl}
1092 }
1093 \hfill
1094 }}
1095 }
1096 }{
1097 \qrbill_bill_create:
1098 }
1099 \endgroup
1100 }
1101
1102 \ior_new:N \qrbill_ior
1103 \clist_new:N \l_qrbill_tmpa_clist
1104 \ior_open:Nn \qrbill_ior {qrbill-vocab.csv}
1105
1106 \ior_get:NN \qrbill_ior \l_tmpa_tl
1107 \clist_set:Nx \l_qrbill_tmpa_clist {\l_tmpa_tl}
1108 \int_set:Nn \l_tmpa_int {\clist_count:N \l_qrbill_tmpa_clist}
1109
1110 \ior_str_map_inline:Nn \qrbill_ior {
1111 \int_step_inline:nnn {2} {\l_tmpa_int } {
1112 \exp_args:Nnx \use:n {\exp_args:NNx \exp_args:Nnc \defcaptionname
1113 {\clist_item:Nn \l_qrbill_tmpa_clist {##1}}
1114 {qrbill\clist_item:nn {#1} {1}name}}
1115 {\clist_item:nn {#1} {##1}}
1116 }
1117 }
1118
1119 \ior_close:N \qrbill_ior
1120
1121 \seq_new:N \l_qrbill_tmp_seq
1122
1123 \cs_new:Nn \qrbill_set_address_combined:nn {
1124 \bool_if:NTF \g__qrbill_to_string_bool {
1125 \exp_args:NNxx \seq_set_split:Nnn \l_qrbill_tmp_seq
1126 {\tl_to_str:n {\\}}
1127 { \str_range:nnn { #2 } { 2 } { -2 } }
1128 } {
1129 \seq_set_split:Nnn \l_qrbill_tmp_seq {\\} {#2}
1130 }
1131 \exp_args:Nnx \keys_set:nn {qrbill/data} {
1132 #1AddressType=K,
1133 #1Name={\seq_item:Nn \l_qrbill_tmp_seq {1}},
1134 #1Address1={\seq_item:Nn \l_qrbill_tmp_seq {2}},
1135 #1Address2={\seq_item:Nn \l_qrbill_tmp_seq {3}},
1136 #1PostalCode=,
1137 #1City=,
1138 #1Country={\seq_item:Nn \l_qrbill_tmp_seq {4}},
1139 }
1140 }
1141
1142 \cs_new:Nn \qrbill_set_address_structured:nn {
1143 \bool_if:NTF \g__qrbill_to_string_bool {
1144 \exp_args:NNxx \seq_set_split:Nnn \l_qrbill_tmp_seq
1145 {\tl_to_str:n {\\}}
1146 { \str_range:nnn { #2 } { 2 } { -2 } }
1147 } {
1148 \seq_set_split:Nnn \l_qrbill_tmp_seq {\\} {#2}
1149 }
1150 \exp_args:Nnx \keys_set:nn {qrbill/data} {
1151 #1AddressType=S,
1152 #1Name={\seq_item:Nn \l_qrbill_tmp_seq {1}},
1153 #1Address1={\seq_item:Nn \l_qrbill_tmp_seq {2}},
1154 #1Address2={\seq_item:Nn \l_qrbill_tmp_seq {3}},
1155 #1PostalCode={\seq_item:Nn \l_qrbill_tmp_seq {4}},
1156 #1City={\seq_item:Nn \l_qrbill_tmp_seq {5}},
1157 #1Country={\seq_item:Nn \l_qrbill_tmp_seq {6}},
1158 }
1159 }
1160
1161 \cs_new:Nn \qrbill_insert_address:N {
1162 \tl_use:c {l_qrbill_data_#1Name_tl}\ifhmode\\\fi
1163 \str_case_e:nnF {\use:c {l_qrbill_data_#1AddressType_tl}}
1164 {
1165 {K} {
1166 \tl_use:c {l_qrbill_data_#1Address1_tl}
1167 \tl_if_empty:cF {l_qrbill_data_#1Address2_tl} {
1168 \ifhmode\\\fi
1169 \tl_if_empty:cF {l_qrbill_data_#1Country_tl}
1170 {\tl_use:c {l_qrbill_data_#1Country_tl}-}
1171 \tl_use:c {l_qrbill_data_#1Address2_tl}
1172 }
1173 }
1174 }{
1175 \tl_use:c {l_qrbill_data_#1Address1_tl}~
1176 \tl_use:c {l_qrbill_data_#1Address2_tl}
1177 \tl_if_empty:cF {l_qrbill_data_#1City_tl} {
1178 \ifhmode\\\fi
1179 \tl_if_empty:cF {l_qrbill_data_#1Country_tl}
1180 {\tl_use:c {l_qrbill_data_#1Country_tl}-}
1181 \tl_use:c {l_qrbill_data_#1PostalCode_tl}~
1182 \tl_use:c {l_qrbill_data_#1City_tl}
1183 }
1184 }
1185 }
1186
1187 \cs_new:Nn \__qrbill_sep_tl:nn {
1188 \int_compare:nTF {\int_use:c {g__qrbill_#1sep_int} = 0} {
1189 #2
1190 }{
1191 \str_set:Nn \l_tmpa_str {#2}
1192 \int_compare:nT {\int_use:c {g__qrbill_#1sep_int} < 0} {
1193 \tl_reverse:N \l_tmpa_str
1194 }
1195 \int_set:Nn \l_tmpb_int {\int_abs:n {\int_use:c {g__qrbill_#1sep_int}}}
1196 \int_set:Nn \l_tmpa_int {1}
1197 \tl_clear:N \l_tmpa_tl
1198 \int_while_do:nNnn {\l_tmpa_int} < {\str_count:N \l_tmpa_str - \l_tmpb_int +1 } {
1199 \tl_put_right:Nx \l_tmpa_tl {
1200 \str_range:Nnn \l_tmpa_str {\l_tmpa_int} {\l_tmpa_int + \l_tmpb_int-1}
1201 }
1202 \int_add:Nn \l_tmpa_int {\l_tmpb_int}
1203 \tl_put_right:Nn \l_tmpa_tl {{\tl_use:c {g__qrbill_#1sep_tl}}}
1204 }
1205 \tl_put_right:Nx \l_tmpa_tl {
1206 \str_range:Nnn \l_tmpa_str {\l_tmpa_int} {\str_count:N \l_tmpa_str}
1207 }
1208 \int_compare:nT {\int_use:c {g__qrbill_#1sep_int} < 0} {
1209 \tl_reverse:N \l_tmpa_tl
1210 }
1211 \l_tmpa_tl
1212 }
1213 }
1214 \cs_generate_variant:Nn \__qrbill_sep_tl:nn {nV}
1215
1216 \newcommand*{\insertdebtor}{\null\qrbill_insert_address:N \g__qrbill_debtorprefix_tl}
1217 \newcommand*{\insertcreditor}{\null\qrbill_insert_address:N \g__qrbill_creditorprefix_tl}
1218 \newcommand*{\insertcurrency}{\l_qrbill_data_Currency_tl}
1219
1220 \keys_define:nn {qrbill/data} {
1221 creditor .code:n = \qrbill_set_address_combined:nn {\g__qrbill_creditorprefix_tl}{#1},
1222 creditor* .code:n = \qrbill_set_address_structured:nn {\g__qrbill_creditorprefix_tl} {#1},
1223 debtor .code:n = \qrbill_set_address_combined:nn {\g__qrbill_debtorprefix_tl}{#1},
1224 debtor* .code:n = \qrbill_set_address_structured:nn {\g__qrbill_debtorprefix_tl} {#1},
1225 account .tl_set:N = \l_qrbill_iban_tl,
1226 }
1227
1228 \clist_map_inline:nn {AV1, AV2} {
1229 \keys_define:nn {qrbill/data} {
1230 #1 .code:n = {
1231 \tl_if_empty:nF {##1}{
1232 \exp_args:Nnx \keys_set:nn {qrbill/data} {
1233 #1-Parameters={\qrbill_av_prefix:n {#1}##1}
1234 }
1235 }
1236 \tl_set:cn {l_qrbill_#1_tl} {##1}
1237 },
1238 #1 .initial:n =,
1239 }
1240 }
1241
1242 \newcommand*{\SetupQrBill}[1]{
1243 \bool_if:NTF \g__qrbill_to_string_bool {
1244 \exp_args:Nnx \keys_set:nn {qrbill/data} {\tl_to_str:n {#1}}
1245 } {
1246 \keys_set:nn {qrbill/data} {#1}
1247 }
1248 }
1249
1250 \str_new:N \l_qrbill_data_str
1251 \cs_new:Nn \qrcode_setup_QRcode: {
1252 \str_clear:N \l_qrbill_data_str
1253 \bool_set_false:N \l_tmpa_bool
1254 \seq_map_inline:Nn \g__qrbill_qrscheme_seq {
1255 \clist_if_in:NnTF \g__qrbill_ignore_if_empty_clist {##1}
1256 {
1257 \tl_if_empty:cTF {l_qrbill_data_##1_tl} \use_none:n \use:n
1258 }
1259 \use:n
1260 {
1261 \bool_if:NTF \l_tmpa_bool
1262 {\str_put_right:Nn\l_qrbill_data_str {^^J}}
1263 {\bool_set_true:N \l_tmpa_bool}
1264 \exp_args:NNv \str_put_right:Nn \l_qrbill_data_str {l_qrbill_data_##1_tl}
1265 }
1266 }
1267 %necessary to preserve spaces!
1268 \bool_if:NF \g__qrbill_luamode_bool
1269 { \str_replace_all:Nnn \l_qrbill_data_str {~ } {\ } }
1270 \prop_map_inline:Nn \g__qrbill_replacement_prop {
1271 \str_replace_all:Nnn \l_qrbill_data_str {##1} {##2}
1272 }
1273 \tl_set_rescan:Nno \l_qrbill_data_str {\ExplSyntaxOff} {\l_qrbill_data_str}
1274 }
1275
1276 \seq_new:N \g__qrbill_qrscheme_seq
1277 \newcommand*\SetQrScheme[1]{
1278 \seq_gset_from_clist:Nn \g__qrbill_qrscheme_seq {#1}
1279 \seq_map_inline:Nn \g__qrbill_qrscheme_seq {
1280 \keys_define:nn {qrbill/data} {
1281 ##1 .tl_set:c = l_qrbill_data_##1_tl,
1282 ##1 .initial:n =,
1283 }
1284 }
1285 }
1286
1287 \prop_new:N \g__qrbill_billing_info_prop
1288 \seq_new:N \g__qrbill_billing_info_seq
1289
1290 \clist_new:N \g__qrbill_billing_info_static_clist
1291 \newcommand*{\SetStaticData}[1]{\clist_gset:Nx \g__qrbill_billing_info_static_clist {\tl_to_str:n {#1}}}
1292
1293 \newcommand*{\SetBillingInfoScheme}[1]{
1294 \prop_gset_from_keyval:Nn \g__qrbill_billing_info_prop {#1}
1295 \seq_gclear:N \g__qrbill_billing_info_seq
1296 \prop_map_inline:Nn \g__qrbill_billing_info_prop {
1297 \clist_if_in:NnF \g__qrbill_billing_info_static_clist {##1} {
1298 \seq_push:Nn \g__qrbill_billing_info_seq {##1}
1299 }
1300 \keys_define:nn {qrbill/data} {
1301 ##2 .tl_set:c = l_qrbill_##2_tl,
1302 ##2 .initial:n =,
1303 }
1304 }
1305 \seq_if_empty:NF \g__qrbill_billing_info_seq {
1306 \prop_map_inline:Nn \g__qrbill_billing_info_prop {
1307 \clist_if_in:NnT \g__qrbill_billing_info_static_clist {##1} {
1308 \exp_args:Nx \clist_if_in:nnF {\tl_to_str:n {prefix , postfix}} {##1} {
1309 \seq_push:Nn \g__qrbill_billing_info_seq {##1}
1310 }
1311 }
1312 }
1313 }
1314 \seq_sort:Nn \g__qrbill_billing_info_seq {
1315 \int_compare:nNnTF { ##1 } > { ##2 }
1316 { \sort_return_swapped: }
1317 { \sort_return_same: }
1318 }
1319 }
1320
1321 \tl_new:N \l_qrbill_data_BillingInfo_tl
1322
1323 \cs_new:Nn \qrbill_parse_BillingInfo: {
1324 \bool_if:NT \g__grbill_billinginfo_auto_bool {
1325 \str_put_right:Nx \l_qrbill_data_BillingInfo_tl {
1326 \prop_item:Nn \g__qrbill_billing_info_prop {prefix}
1327 }
1328 \seq_map_inline:Nn \g__qrbill_billing_info_seq {
1329 \prop_get:NnN \g__qrbill_billing_info_prop {##1} \l_tmpa_tl
1330 \tl_if_empty:cF {l_qrbill_\l_tmpa_tl _tl} {
1331 \str_put_right:Nx \l_qrbill_data_BillingInfo_tl {
1332 /##1/\tl_use:c {l_qrbill_\l_tmpa_tl _tl}
1333 }
1334 }
1335 }
1336 }
1337 }
1338
1339 \cs_set:Nn \qrbill_parse_date:nnn {
1340 #1-
1341 \int_compare:nNnT {#2} < {10} {0}#2-
1342 \int_compare:nNnT {#3} < {10} {0}#3
1343 }
1344
1345 \cs_generate_variant:Nn \qrbill_parse_date:nnn {eee}
1346
1347 \cs_set:Npn \QRbillParseDate #1#2#3 {
1348 \qrbill_parse_date:eee {#1}{#2}{#3}
1349 }
1350
1351 \cs_new:Nn \qrbill_insert_AV_parameters:NNn {
1352 \clist_map_inline:nn {#3} {
1353 \tl_if_empty:cF {l_qrbill_##1_tl}
1354 {{#1\qrbill_av_prefix:n {##1}}{#2 \tl_use:c {l_qrbill_##1_tl}}}
1355 }
1356 }
1357
1358 \cs_new:Nn \qrbill_av_prefix:n {Name~#1:~}
1359
1360 \input{\g__qrbill_qrscheme_tl.qrbill-cfg}
1361
1362 % \end{doccode*}
1363 %</package>
1364 % \section{The file swiss.qrbill-cfg.tex as a custom qrbill scheme}
1365 %<*swiss.qrbill-cfg.tex>
1366 \qrbillsetup{
1367 creditorprefix=CR-,
1368 debtorprefix=UD-,
1369 ignore-if-empty={
1370 AV1-Parameters,
1371 AV2-Parameters,
1372 BillingInfo
1373 }
1374 }
1375
1376 \SetQrScheme{
1377 QRType,
1378 Version,
1379 CodingType,
1380 Account,
1381 CR-AddressType,
1382 CR-Name,
1383 CR-Address1,
1384 CR-Address2,
1385 CR-PostalCode,
1386 CR-City,
1387 CR-Country,
1388 UCR-AddressType,
1389 UCR-Name,
1390 UCR-Address1,
1391 UCR-Address2,
1392 UCR-ZIP,
1393 UCR-City,
1394 UCR-Country,
1395 Amount,
1396 Currency,
1397 UD-AddressType,
1398 UD-Name,
1399 UD-Address1,
1400 UD-Address2,
1401 UD-PostalCode,
1402 UD-City,
1403 UD-Country,
1404 ReferenceType,
1405 Reference,
1406 Message,
1407 Trailer,
1408 BillingInfo,
1409 AV1-Parameters,
1410 AV2-Parameters
1411 }
1412
1413 \SetStaticData{prefix,11,31}
1414
1415 \SetBillingInfoScheme{
1416 prefix=//S1,
1417 10=invoicenum,
1418 11=invoicedate,
1419 20=customerref,
1420 30=vat,
1421 31=vatdate,
1422 32=vatdetails,
1423 33=importvat,
1424 40=conditions
1425 }
1426
1427 \ExplSyntaxOn
1428 \cs_set:Nn \qrbill_parse_date:nnn {
1429 \str_range:nnn {#1} {3} {4}
1430 \int_compare:nNnT {#2} < {10} {0}#2
1431 \int_compare:nNnT {#3} < {10} {0}#3
1432 }
1433 \ExplSyntaxOff
1434
1435 \SetupQrBill{
1436 QRType=SPC,
1437 Version=0200,
1438 CodingType=1,
1439 Trailer=EPD,
1440 Currency=CHF,
1441 ReferenceType=NON,
1442 }
1443
1444 \qrbillsetdata*{
1445 invoicedate=\QRbillParseDate{\the\year}{\the\month}{\the\day},
1446 vatdate=\QRbillParseDate{\the\year}{\the\month}{\the\day}
1447 }
1448 % \end{doccode*}
1449 % \iffalse
1450 %</swiss.qrbill-cfg.tex>
1451 % \section{The file epc.qrbill-cfg.tex as additional qrbill scheme}
1452 % This scheme supports much less variables in contrast to the swiss scheme.
1453 % Therefore the \latexinline{\QRbill} macro has to be used as the starred variant or additional variables have to be provided by the user.
1454 %<*epc.qrbill-cfg.tex>
1455 % \end{doccode*}
1456 % \fi
1457 % \begin{doccode*}
1458 \SetQrScheme{
1459 QRType,
1460 Version,
1461 CodingType,
1462 Trailer,
1463 BIC,
1464 Name,
1465 Account,
1466 Amount,
1467 DTA,
1468 Reference,
1469 Message,
1470 Note
1471 }
1472
1473 \SetupQrBill{
1474 QRType=BCD,
1475 Version=002,
1476 CodingType=1,
1477 Trailer=SCT,
1478 }
1479 %</epc.qrbill-cfg.tex>
1480 % \end{doccode*}
1481 % \fi
1482 %
1483 % \PrintChanges
1484 % \begin{thebibliography}{99}
1485 % \bibitem{qrbill-spec} Swiss Implementation Guidelines QR-bill: Technical and professional specifications of the payment part with Swiss QR Code and of the receipt. Version 2.2, with effect from 22 February 2021. \url{https://www.paymentstandards.ch/dam/downloads/ig-qr-bill-en.pdf}. Last checked 2022-08-28
1486 % \bibitem{qrbill-design} Style Guide QR-billStyle Guide QR-bill: The right layout pays off. Layout rules and recommendations for the payment part with Swiss QR Code and for the receipt. \url{https://www.paymentstandards.ch/dam/downloads/style-guide-en.pdf}
1487 % \bibitem{luaqrcode} Luaqrcode – Pure Lua QR Code library. By Patrick Gundlach (SPEEDATA GMBH) and contributors.
1488 % \url{http://speedata.github.io/luaqrcode/}. Last checked 2022-08-28
1489 % \end{thebibliography}
1490 % \appendix
1491 % \section{Example of standalone qrbill}
1492 % \changes{v1.03}{2021/05/07}{set sep-iban and sep-reference in examples}
1493 % \label{standalone-complete}
1494 % \iffalse
1495 %<*qrbill-standalone-demo.tex>
1496 % \fi
1497 % \begin{doccode*}
1498 % !TeX program=lualatex
1499 \documentclass{standalone}
1500 \usepackage[nswissgerman]{babel}
1501
1502 \RequirePackage{xcolor}
1503 \usepackage[
1504 icon=swiss-cross,
1505 separate=false,
1506 sep-iban=4,
1507 sep-reference=-5
1508 ]{qrbill}
1509
1510 \begin{document}
1511
1512 \QRbill[
1513 creditor*={foobar LLC\\
1514 Postfach\\
1515 404\\
1516 2342\\
1517 Zurich\\
1518 CH},
1519 Account=CH1280808005649899718,
1520 vat=123123123,% VAT number with stripped CH and periods
1521 debtor*={peiTeX\\
1522 TeXnikerweg\\
1523 78\\
1524 23420\\
1525 Hamburg\\
1526 DE},
1527 Amount=1337.42,
1528 Message=Bestellung vom 27.06.2020,
1529 invoicenum=100-4242,
1530 % invoicedate=200701,%yymmdd, preset to todays values
1531 vatdetails=0,% 0% VAT
1532 % invoicedate=200701,%yymmdd, preset to todays values
1533 AV1=LX;F00BAR;2342,
1534 ]
1535
1536 \end{document}
1537 % \end{doccode*}
1538 % \iffalse
1539 %</qrbill-standalone-demo.tex>
1540 %<*qrbill-letter-demo.tex>
1541 % \fi
1542 % \section{qrbill scrletter example}
1543 % \label{sec:example-qrbill-letter}
1544 % \begin{doccode*}
1545 % !TeX Program=lualatex
1546 \documentclass[foldmarks=b]{scrletter}
1547 \usepackage[
1548 frame=top,
1549 sep-iban=4,
1550 sep-reference=-5,
1551 ]{qrbill}
1552
1553 % Setup layer:
1554 % This requires the scrlayer package which is already loaded by scrletter
1555 \DeclareNewLayer[
1556 align=bl,
1557 voffset=\paperheight,
1558 hoffset=0pt,
1559 contents={\QRbill},
1560 width=\paperwidth,
1561 height=105mm,
1562 ]{qrbill}
1563
1564
1565
1566 \begin{document}
1567
1568 \qrbillsetdata{
1569 creditor*={foobar LLC\\
1570 Postfach\\
1571 404\\
1572 2342\\
1573 Zurich\\
1574 CH},
1575 Account=CH1280808005649899718,
1576 vat=123123123,% VAT number with stripped CH and periods
1577 debtor*={peiTeX\\
1578 TeXnikerweg\\
1579 78\\
1580 23420\\
1581 Hamburg\\
1582 DE},
1583 Amount=1337.42,
1584 Message=Bestellung vom 27.06.2020,
1585 invoicenum=100-4242,
1586 % invoicedate=200701,%yymmdd, preset to todays values
1587 vatdetails=0,% 0% VAT
1588 % vatdate=200701,%yymmdd, preset to todays values
1589 AV1=LX;F00BAR;2342,
1590 }
1591
1592 \setkomavar{fromaddress}{\insertcreditor}
1593
1594 \begin{letter}{\insertdebtor}
1595
1596 \opening{opening}
1597
1598 Text
1599
1600 \closing{closing}
1601
1602 % Add qbill on last page
1603 % For more details
1604 \AddLayersToPageStyle{@everystyle@}{qrbill}
1605
1606 \end{letter}
1607 \end{document}
1608 % \end{doccode*}
1609 % \iffalse
1610 %</qrbill-letter-demo.tex>
1611 %<*qrbill-epc-demo.tex>
1612 % \fi
1613 % \section{Example for EPC qrcode}
1614 % \label{sec:example-epc}
1615 % \changes{v2.01}{2023/07/24}{edd epc qrcode example document}
1616 % \begin{doccode*}
1617 \documentclass{article}
1618 \usepackage[qrscheme=epc]{qrbill}
1619
1620 \begin{document}
1621
1622 \QRbill*[
1623 BIC=BYLADEM1GLS,
1624 Account=DE68430609671013251700,
1625 Name=peiTeX,
1626 Amount=EUR1 .42,
1627 Message={Invoice 2022:1337, customer 1337}
1628 ]
1629
1630 \end{document}
1631 % \end{doccode*}
1632 % \iffalse
1633 %\endinput
1634 %</qrbill-epc-demo.tex>
1635 % \fi
1636 %\Finale
1637 \endinput