Debian Codegraph @

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

raw
1 % \iffalse meta-comment
2 %
3 % File: invoice2.dtx Copyright (C) 2017-2018 Simon Dierl
4 %
5 % This program is free software: you can redistribute it and/or modify
6 % it under the terms of the GNU General Public License as published by
7 % the Free Software Foundation, either version 3 of the License, or
8 % (at your option) any later version.
9 %
10 % This program is distributed in the hope that it will be useful,
11 % but WITHOUT ANY WARRANTY; without even the implied warranty of
12 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 % GNU General Public License for more details.
14 %
15 % You should have received a copy of the GNU General Public License
16 % along with this program. If not, see <http://www.gnu.org/licenses/>.
17 %
18 % \fi
19 %
20 % \iffalse
21 %<*driver>
22 \documentclass[full,lm-default]{l3doc}
23 \usepackage[T1]{fontenc}
24 \usepackage[utf8]{inputenc}
25
26 \usepackage{amsmath}
27 \usepackage{amsfonts}
28 \usepackage[USenglish]{babel}
29 \usepackage{csquotes}
30 \usepackage[useregional,showdow]{datetime2}
31 \usepackage{enumitem}
32 \usepackage{eurosym}
33 \usepackage{invoice2}
34
35 \hypersetup{hidelinks}
36
37 \begin{document}
38 \DocInput{\jobname.dtx}
39 \end{document}
40 %</driver>
41 % \fi
42 %
43 % \title{The \pkg{invoice2} package\\
44 % Intelligent invoices with \LaTeX{}3}
45 %
46 % \author{Simon Dierl
47 % \texttt{\href{mailto:[email protected]}
48 % {<[email protected]>}}\\[.25\baselineskip]
49 % \url{https://github.com/no-preserve-root/invoice2}}
50 %
51 % \date{Version 1.2\\[.25\baselineskip]\DTMDate{2018-01-15}}
52 %
53 % \maketitle
54 %
55 % \begin{documentation}
56 %
57 % While there exists a vast amount of templates, unpublished packages and code
58 % snippets designed for creating invoices, the only solution available in the
59 % CTAN is the \pkg{invoice}\footnote{\url{https://www.ctan.org/pkg/invoice}}
60 % package, which is not actively maintained and lacks
61 % e.\,g.~internationalization support while requiring use of a project
62 % structure that does not fit many use cases.
63 %
64 % Thus, this package aims to reimplement the functionality provided by
65 % \pkg{invoice} using \LaTeX3, while using the print-friendly layout provided
66 % by the \pkg{booktabs}\footnote{\url{https://www.ctan.org/pkg/booktabs}}
67 % package.
68 %
69 % \tableofcontents
70 %
71 % \part{User documentation}
72 %
73 % \section{Package Configuration}
74 %
75 % \pkg{invoice2} offers extensive options for customization. Most of these
76 % options are not likely to change in the middle of a document; these shold be
77 % passed as package options. However, for maximum flexibility, the global
78 % options can be changed at run time or overridden per \cmd{invoice}
79 % environment.
80 %
81 % The options supported by this package are:
82 % \begin{description}
83 % \item[vat] Controls the global default for VAT. VAT can be overridden per
84 % invoice item and is either automatically added or subtracted (see the
85 % next parameter for details). This is given as a floating point number,
86 % e.\,g.~.19 for 19\,\%. Default is 0\,\%.
87 % \item[included-vat] Controls if prices are provided with VAT included or
88 % excluded. If VAT is included, all prices are gross prices, the VAT is
89 % subtracted to show the net price. If VAT is excluded, all prices are
90 % net prices, the VAT is added to show the gross price. Default is
91 % excluded VAT.
92 % \item[currency-symbol] The currency symbol to use, e.g. \euro{}.
93 % Default is \$.
94 % \item[currency-fraction-digits] The fractional digits to use for the
95 % currency. For almost all currencies, this is two (100 of the smaller
96 % unit make 1 of the larger). Default is 2.
97 % \item[currency-in-header] Controls if the currency symbol should be
98 % printed in the invoice header instead of printing it after each amount.
99 % Default is printing after each amount.
100 % \item[colorize] Enables colorization. While the typographical results may
101 % be mixed, colorization can help read very long invoices. Default is
102 % off.
103 % \item[odd-color] The color to use for odd invoice rows, if colorization is
104 % enabled. The color must be understood by \pkg{xcolor}. Default is
105 % white.
106 % \item[even-color] The color to use for even invoice rows, if colorization
107 % is enabled. The color must be understood by \pkg{xcolor}. Default is
108 % light grey (lightgray).
109 % \item[title-color] The color to use for the title row, if colorization is
110 % enabled. The color must be understood by \pkg{xcolor}. Default is
111 % white.
112 % \item[total-color] The color to use for total rows, if colorization is
113 % enabled. The color must be understood by \pkg{xcolor}. Default is
114 % white.
115 %\end{description}
116 %
117 % \section{Localization}
118 %
119 % Internationalization for this package is provided by the
120 % \pkg{translations}\footnote{\url{https://www.ctan.org/pkg/translations}}
121 % package. \pkg{translations} uses a key-to-translation mapping that can be
122 % overridden by the user. See the package documentation for further information.
123 %
124 % At the moment, localizations for english, german and swiss german are
125 % provided. See the documentation for the \pkg{translations} package for adding
126 % new localizations. Please consider contributing your translations to this
127 % project.
128 %
129 % The following keys are defined:
130 % \begin{description}
131 % \item[invoice2-thousands-sep] The separator between thousands, e.\,g. the
132 % space in 1\,000. Default is a small space.
133 % \item[invoice2-decimal-point] The separator between whole and
134 % fractional parts, e.\,g.~the dot in 40.00. Default is a dot.
135 % \item[invoice2-amount] The \enquote{Amount} column title.
136 % \item[invoice2-item] The \enquote{Item} column title.
137 % \item[invoice2-vat] The \enquote{VAT} column title.
138 % \item[invoice2-unit-price] The \enquote{Unit Price} column title.
139 % \item[invoice2-price] The \enquote{Price} column title.
140 % \item[invoice2-net-total] The \enquote{Net Total} row label.
141 % \item[invoice2-vat-total] The \enquote{VAT} row label.
142 % \item[invoice2-gross-total] The \enquote{Gross Total} row label.
143 %\end{description}
144 %
145 % \begin{function}{\invoiceoptions}
146 % \begin{syntax}
147 % \cs{invoiceoptions} \marg{key=value…}
148 % \end{syntax}
149 % All of the package options can be changed in the document by using this
150 % command. The syntax is identical to the package options.
151 % \end{function}
152 %
153 % \section{Typesetting invoices}
154 %
155 % An invoice is typeset as a table having between two and five columns. Each row
156 % will correspond to an item in the invoice. A row \emph{always} has an item
157 % name and a price. If \emph{any} item in the invoice hat a VAT that is not
158 % 0\,\%, \emph{every} row will list its VAT. Also, if \emph{any} item has an
159 % amount that is not one, \emph{every} row will list both price per unit and
160 % the amount.
161 %
162 % If an item hat non-zero VAT, the net and gross totals will also differ. In
163 % this case, the package will compute the net total, the total VAT and the
164 % gross total and denote them below the invoice. If all items have 0\,\%-VAT,
165 % only a gross total will be given.
166 %
167 % \begin{function}{\begin{invoice}, \end{invoice}}
168 % \begin{syntax}
169 % \cs{begin} \oarg{key=value…} \{invoice\}
170 % \cs{end} \{invoice\}
171 % \end{syntax}
172 % Invoices are enclosed in \cmd{invoice} environments. These environments can
173 % not be nested. Each environment can override the package settings by means of
174 % its optional arguments. The overridden arguments only apply to the current
175 % invoice.
176 %
177 % Inside the environment, \emph{only} \cmd{\invoiceitem} and
178 % \cmd{\invoicesingleitem} commands may be safely used.
179 % \end{function}
180 %
181 % \begin{function}{\invoiceitem, \invoicesingleitem}
182 % \begin{syntax}
183 % \cs{invoiceitem} \oarg{VAT} \marg{amount} \marg{item name} \marg{unit price}
184 % \cs{invoicesingleitem} \oarg{VAT} \marg{item name} \marg{unit price}
185 % \end{syntax}
186 % These commands add an item to the current invoice. The VAT argument is
187 % optional, if not given, VAT will default to the value set in the
188 % configuration. For singular items, the second form can be used to imply an
189 % amount of 1.
190 %
191 % VAT must be given as a floating point value (see the configuration parameter
192 % list for details). The amount and the unit price can be an integer or a
193 % floating point number. Do \emph{not} add a currency symbol or formatting to
194 % the unit price.
195 % \end{function}
196 %
197 % \section{Examples}
198 %
199 % Let us begin with a simple invoice with single items and no VAT. The invoice
200 % will only have two columns and a gross total. We do, however, change the
201 % currency symbol to \euro{} (provided by the \pkg{eurosym} package). Since we
202 % only have single copies, we will use the \cmd{\invoicesingleitem} command.
203 %
204 % \begin{verbatim}
205 % \usepackage{eurosym}
206 % \begin{invoice}[currency-symbol={\euro{}}]
207 % \invoicesingleitem{Ignition!}{4087.99}
208 % \invoicesingleitem{The Art of Computer Programming 1--4}{162.99}
209 % \invoicesingleitem{The TeXbook}{55.69}
210 % \end{invoice}
211 % \end{verbatim}
212 % \begin{invoice}[currency-symbol={\euro{}}]
213 % \invoicesingleitem{Ignition!}{4087.99}
214 % \invoicesingleitem{The Art of Computer Programming 1--4}{162.99}
215 % \invoicesingleitem{The TeXbook}{55.69}
216 % \end{invoice}
217 %
218 % For some currencies, the symbol ist fairly long. In this case, it is advisable
219 % to move the currency symbol to the invoice header.
220 %
221 % \begin{verbatim}
222 % \begin{invoice}[currency-symbol={CHF}, currency-in-header]
223 % \invoicesingleitem{Ignition!}{4087.99}
224 % \invoicesingleitem{The Art of Computer Programming 1--4}{162.99}
225 % \invoicesingleitem{The TeXbook}{55.69}
226 % \end{invoice}
227 % \end{verbatim}
228 % \begin{invoice}[currency-symbol={CHF}, currency-in-header]
229 % \invoicesingleitem{Ignition!}{4087.99}
230 % \invoicesingleitem{The Art of Computer Programming 1--4}{162.99}
231 % \invoicesingleitem{The TeXbook}{55.69}
232 % \end{invoice}
233 %
234 % Now, let us apply a VAT of 9\,\%. This will show the VAT column, the item
235 % price column and the extended total.
236 %
237 % \begin{verbatim}
238 % \usepackage{eurosym}
239 % \invoiceoptions{vat=.09}
240 % \begin{invoice}[currency-symbol={\euro{}}]
241 % \invoicesingleitem{Ignition!}{4087.99}
242 % \invoicesingleitem{The Art of Computer Programming 1--4}{162.99}
243 % \invoicesingleitem{The TeXbook}{55.69}
244 % \end{invoice}
245 % \end{verbatim}
246 % \invoiceoptions{vat=.09}
247 % \begin{invoice}[currency-symbol={\euro{}}]
248 % \invoicesingleitem{Ignition!}{4087.99}
249 % \invoicesingleitem{The Art of Computer Programming 1--4}{162.99}
250 % \invoicesingleitem{The TeXbook}{55.69}
251 % \end{invoice}
252 % \invoiceoptions{vat=.0}
253 %
254 % Note that if we specify included VAT in the above example, the output is
255 % different. Additionally, we specify our options as environment options.
256 %
257 % \begin{verbatim}
258 % \usepackage{eurosym}
259 % \begin{invoice}[vat=.09, included-vat=true, currency-symbol={\euro{}}]
260 % \invoicesingleitem{Ignition!}{4087.99}
261 % \invoicesingleitem{The Art of Computer Programming 1--4}{162.99}
262 % \invoicesingleitem{The TeXbook}{55.69}
263 % \end{invoice}
264 % \end{verbatim}
265 % \begin{invoice}[vat=.09, included-vat=true, currency-symbol={\euro{}}]
266 % \invoicesingleitem{Ignition!}{4087.99}
267 % \invoicesingleitem{The Art of Computer Programming 1--4}{162.99}
268 % \invoicesingleitem{The TeXbook}{55.69}
269 % \end{invoice}
270 %
271 % A more complex example involves amounts and a VAT. We keep the 9\,\% VAT for
272 % our books, buy duplicate editions of The Art of Computer Programming 1 and 2
273 % (simulated by buying 1.5 copies) and stock up on more copies of the
274 % TeXbook. This will enable all columns and an extended total.
275 %
276 % \begin{verbatim}
277 % \usepackage{eurosym}
278 % \invoiceoptions{vat=.09}
279 % \begin{invoice}[currency-symbol={\euro{}}]
280 % \invoicesingleitem{Ignition!}{4087.99}
281 % \invoiceitem{1.5}{The Art of Computer Programming 1--4}{162.99}
282 % \invoiceitem{20}{The TeXbook}{55.69}
283 % \end{invoice}
284 % \end{verbatim}
285 % \invoiceoptions{vat=.09}
286 % \begin{invoice}[currency-symbol={\euro{}}]
287 % \invoicesingleitem{Ignition!}{4087.99}
288 % \invoiceitem{1.5}{The Art of Computer Programming 1--4}{162.99}
289 % \invoiceitem{20}{The TeXbook}{55.69}
290 % \end{invoice}
291 % \invoiceoptions{vat=0}
292 %
293 % Finally, let us toy with colorization. We wisely deceide to leave most
294 % parts of the invoice white and only apply an extemely light grey to the even
295 % rows.
296 %
297 % \begin{verbatim}
298 % \usepackage{eurosym}
299 % \begin{invoice}[currency-symbol={\euro{}}, colorize,
300 % even-color={lightgray!50}]
301 % \invoicesingleitem{Ignition!}{4087.99}
302 % \invoicesingleitem{The Art of Computer Programming 1--4}{162.99}
303 % \invoicesingleitem{The TeXbook}{55.69}
304 % \end{invoice}
305 % \end{verbatim}
306 % \begin{invoice}[currency-symbol={\euro{}}, colorize,
307 % even-color={lightgray!50}]
308 % \invoicesingleitem{Ignition!}{4087.99}
309 % \invoicesingleitem{The Art of Computer Programming 1--4}{162.99}
310 % \invoicesingleitem{The TeXbook}{55.69}
311 % \end{invoice}
312 %
313 % \section{Version History}
314 %
315 % \subsection{Version 1.2}
316 % \changes{1.2}{2018/01/15}{Bugfix release}
317 % \begin{itemize}[nosep]
318 % \item Fix option loading for the \pkg{xcolor} package. Thanks to Alfred
319 % H.\ Gitter for reporting.
320 % \item Corrected german translation of ``VAT'' to ``USt''. Thanks to Alfred
321 % H.\ Gitter for reporting.
322 % \item Clarified that \pkg{eurosym} is required to use the \cmd{euro}
323 % symbol. Thanks to Alfred H.\ Gitter for the suggestion.
324 % \item Split the \texttt{README.md} into a Github version and one for CTAN.
325 % \item Add support for Swiss German. Thanks to \texttt{@foreachthing} for
326 % the translation.
327 % \item Permit moving the currency symbol to the header. Thanks to
328 % \texttt{@foreachthing} for the report.
329 % \end{itemize}
330 %
331 % \subsection{Version 1.1}
332 % \changes{1.1}{2017/08/16}{Bugfix release}
333 % \begin{itemize}[nosep]
334 % \item Spelling fix in \texttt{README.md}. Thanks to Ina Dau for noticing.
335 % \item Clean up unused \texttt{README} generation in the \texttt{.ins} file.
336 % \item Report in with the correct motto.
337 % \item Support non-integer amounts. Thanks to Gijs Hillenius for the
338 % suggestion.
339 % \item Print the unit price column if an item has either VAT or amount
340 % $\neq 1$. Thanks to Gijs Hillenius for the suggestion.
341 % \end{itemize}
342 %
343 % \subsection{Version 1.0}
344 % \changes{1.0}{2017/07/15}{First public release}
345 % \begin{itemize}[nosep]
346 % \item First public release.
347 % \item Support configuration via package options, \cmd{\invoiceoptions}
348 % command and environment options.
349 % \item Localization via \pkg{translations}.
350 % \end{itemize}
351 %
352 % \section{License}
353 %
354 % This program is free software: you can redistribute it and/or modify
355 % it under the terms of the GNU General Public License as published by
356 % the Free Software Foundation, either version 3 of the License, or
357 % (at your option) any later version.
358 %
359 % This program is distributed in the hope that it will be useful,
360 % but WITHOUT ANY WARRANTY; without even the implied warranty of
361 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
362 % GNU General Public License for more details.
363 %
364 % You should have received a copy of the GNU General Public License
365 % along with this program. If not, see \url{http://www.gnu.org/licenses/}.
366 %
367 % \end{documentation}
368 %
369 % \begin{implementation}
370 %
371 % \part{\pkg{invoice2} implementation}
372 %
373 % \begin{macrocode}
374 %<*package>
375 %<@@=invoicetwo>
376 % \end{macrocode}
377 %
378 % \section{Setup and Initialization}
379 %
380 % \begin{macrocode}
381 \RequirePackage{booktabs}
382 \RequirePackage{expl3}
383 \RequirePackage{l3keys2e}
384 \RequirePackage{longtable}
385 \RequirePackage{siunitx}
386 \RequirePackage{translations}
387 \PassOptionsToPackage{table}{xcolor}
388 \RequirePackage{xcolor}
389 \RequirePackage{xparse}
390 \ProvidesExplPackage{invoice2}{2018/01/15}{1.2}
391 {Intelligent invoices with LaTeX3}
392 % \end{macrocode}
393 %
394 % Now, load our dictionary files and set fallback translations. We emit the
395 % dictionaries in section \ref{sec:dictionaries}.
396 %
397 % \begin{macrocode}
398 \LoadDictionaryFor{english}{invoice2}
399 \LoadDictionaryFor{german}{invoice2}
400 \LoadDictionaryFor{swissgerman}{invoice2}
401 \DeclareTranslationFallback{invoice2-thousands-sep}{\,}
402 \DeclareTranslationFallback{invoice2-decimal-point}{.}
403 \DeclareTranslationFallback{invoice2-amount}{Amount}
404 \DeclareTranslationFallback{invoice2-item}{Item}
405 \DeclareTranslationFallback{invoice2-vat}{VAT}
406 \DeclareTranslationFallback{invoice2-unit-price}{Unit~Price}
407 \DeclareTranslationFallback{invoice2-price}{Price}
408 \DeclareTranslationFallback{invoice2-net-total}{Net~Total}
409 \DeclareTranslationFallback{invoice2-vat-total}{VAT}
410 \DeclareTranslationFallback{invoice2-gross-total}{Gross~Total}
411 % \end{macrocode}
412 %
413 % \section{Variables and Constants}
414 %
415 % All variables that control invoice typesetting can be set on
416 % \begin{enumerate}[noitemsep, label=\alph*)]
417 % \item the package level, as a package option
418 % \item the package level, using the \cmd{invoiceoptions} command
419 % \item per \cmd{invoice} environment, via the same syntax
420 % \item per invoice line, for some options (e.\,g.~VAT).
421 % \end{enumerate}
422 %
423 % \subsection{VAT Computation}
424 %
425 % \begin{variable}{\l_@@_vat_fp}
426 % The default value for VAT. If an invoice has only zero VAT for all entries,
427 % no VAT is added and the column is not rendered. VAT can be set per line.
428 %
429 % \begin{macrocode}
430 \fp_new:N \l_@@_vat_fp
431 % \end{macrocode}
432 % \end{variable}
433 %
434 % \begin{variable}{\l_@@_included_vat_bool}
435 % Controls if VAT is already included into the given prices. If true, the
436 % total will compute the net total and display it. If false, the total will
437 % compute the gross total. If the VAT is zero, this does nothing. We will render
438 % a gross total only.
439 %
440 % \begin{macrocode}
441 \bool_new:N \l_@@_included_vat_bool
442 % \end{macrocode}
443 % \end{variable}
444 %
445 % \begin{variable}{\l_@@_currency_symbol_tl}
446 % The currency symbol to use.
447 %
448 % \subsection{Price Typesetting}
449 %
450 % \begin{macrocode}
451 \tl_new:N \l_@@_currency_symbol_tl
452 % \end{macrocode}
453 % \end{variable}
454 %
455 % \begin{variable}{\l_@@_currency_fraction_digits_int}
456 % The number of fractional digits for the currency. Contrary to popular opinion,
457 % this does not always equal two.
458 %
459 % \begin{macrocode}
460 \int_new:N \l_@@_currency_fraction_digits_int
461 % \end{macrocode}
462 % \end{variable}
463 %
464 % \begin{variable}{\l_@@_currency_in_header_bool}
465 % Controls if the invoice currency symbol should be moved intro the table
466 % header (``Unit Price (\$)'') instead of printing it after each amount
467 % (``123.45\ \$''). Can save space for long currencies.
468 %
469 % \begin{macrocode}
470 \bool_new:N \l_@@_currency_in_header_bool
471 % \end{macrocode}
472 % \end{variable}
473 %
474 % \subsection{Colorization}
475 %
476 % \begin{variable}{\l_@@_colorize_bool}
477 % Controls if the invoice should be colorized at all. We only support
478 % alternating colorization for even and odd lines and a special color for the
479 % total line.
480 %
481 % \begin{macrocode}
482 \bool_new:N \l_@@_colorize_bool
483 % \end{macrocode}
484 % \end{variable}
485 %
486 % \begin{variable}{\l_@@_odd_color_tl}
487 % The color for odd lines. Only used if colorization is enabled.
488 %
489 % \begin{macrocode}
490 \tl_new:N \l_@@_odd_color_tl
491 \tl_set:Nn \l_@@_odd_color_tl {white}
492 % \end{macrocode}
493 % \end{variable}
494 %
495 % \begin{variable}{\l_@@_even_color_tl}
496 % The color for even lines. Only used if colorization is enabled.
497 %
498 % \begin{macrocode}
499 \tl_new:N \l_@@_even_color_tl
500 \tl_set:Nn \l_@@_even_color_tl {lightgray}
501 % \end{macrocode}
502 % \end{variable}
503 %
504 % \begin{variable}{\l_@@_title_color_tl}
505 % The color for the title line. Only used if colorization is enabled.
506 %
507 % \begin{macrocode}
508 \tl_new:N \l_@@_title_color_tl
509 \tl_set:Nn \l_@@_title_color_tl {white}
510 % \end{macrocode}
511 % \end{variable}
512 %
513 % \begin{variable}{\l_@@_total_color_tl}
514 % The color for the total line. Only used if colorization is enabled.
515 %
516 % \begin{macrocode}
517 \tl_new:N \l_@@_total_color_tl
518 \tl_set:Nn \l_@@_total_color_tl {white}
519 % \end{macrocode}
520 % \end{variable}
521 %
522 % \subsection{Internal State Tracking}
523 %
524 % \begin{variable}{\l_@@_in_invoice_bool}
525 % Tracks if we are in an invoice environment. This allows us to crash when
526 % nesting invoice environments by accident.
527 %
528 % \begin{macrocode}
529 \bool_new:N \l_@@_in_invoice_bool
530 % \end{macrocode}
531 % \end{variable}
532 %
533 % \begin{variable}{\l_@@_row_number_int}
534 % Counts the invoice rows. We use this to tell even from odd lines. Starts with
535 % 1; this must be reset at the beginning of each invoice.
536 %
537 % \begin{macrocode}
538 \int_new:N \g_@@_row_number_int
539 % \end{macrocode}
540 % \end{variable}
541 %
542 % \begin{variable}{\l_@@_vat_nonzero_bool}
543 % Tracks if we have already encountered a line with non-zero VAT. If so, we
544 % will render a VAT column and separate gross and net totals.
545 %
546 % \begin{macrocode}
547 \bool_new:N \l_@@_vat_nonzero_bool
548 % \end{macrocode}
549 % \end{variable}
550 %
551 % \begin{variable}{\l_@@_amount_nonone_bool}
552 % Tracks if we have already encountered a line with non-one amount. If so, we
553 % will render an amount and an unit price column.
554 %
555 % \begin{macrocode}
556 \bool_new:N \l_@@_amount_nonone_bool
557 % \end{macrocode}
558 % \end{variable}
559 %
560 % \begin{variable}{\l_@@_net_total_fp}
561 % The running net total.
562 %
563 % \begin{macrocode}
564 \fp_new:N \l_@@_net_total_fp
565 % \end{macrocode}
566 % \end{variable}
567 %
568 % \begin{variable}{\l_@@_vat_total_fp}
569 % The running VAT total.
570 %
571 % \begin{macrocode}
572 \fp_new:N \l_@@_vat_total_fp
573 % \end{macrocode}
574 % \end{variable}
575 %
576 % \begin{variable}{\l_@@_gross_total_fp}
577 % The running gross total.
578 %
579 % \begin{macrocode}
580 \fp_new:N \l_@@_gross_total_fp
581 % \end{macrocode}
582 % \end{variable}
583 %
584 % \begin{variable}{\l_@@_tabular_tl}
585 % The tabular under construction. We create the tabular contents on the fly,
586 % using a conditional for the VAT column that is expanded only when emitting the
587 % invoice.
588 %
589 % \begin{macrocode}
590 \tl_new:N \l_@@_tabular_tl
591 % \end{macrocode}
592 % \end{variable}
593 %
594 % \section{Configuration}
595 %
596 % We define a \pkg{l3keys} key list for the package. We will reuse this for all
597 % configuration, except for item-specific VAT, which will override the global
598 % VAT setting. We handle this in the corresponding function.
599 %
600 % \begin{macrocode}
601 \keys_define:nn {invoice2} {
602 vat .fp_set:N = \l_@@_vat_fp,
603 vat .value_required:n = true,
604 vat .initial:n = 0,
605 included-vat .bool_set:N = \l_@@_included_vat_bool,
606 included-vat .initial:n = false,
607 currency-symbol .tl_set:N = \l_@@_currency_symbol_tl,
608 currency-symbol .value_required:n = true,
609 currency-symbol .initial:n = {\$},
610 currency-fraction-digits .int_set:N = \l_@@_currency_fraction_digits_int,
611 currency-fraction-digits .value_required:n = true,
612 currency-fraction-digits .initial:n = 2,
613 currency-in-header .bool_set:N = \l_@@_currency_in_header_bool,
614 currency-in-header .initial:n = false,
615 colorize .bool_set:N = \l_@@_colorize_bool,
616 colorize .initial:n = false,
617 odd-color .initial:n = white,
618 odd-color .value_required:n = true,
619 odd-color .tl_set:N = \l_@@_odd_color_tl,
620 even-color .initial:n = lightgray,
621 even-color .value_required:n = true,
622 even-color .tl_set:N = \l_@@_even_color_tl,
623 title-color .initial:n = white,
624 title-color .value_required:n = true,
625 title-color .tl_set:N = \l_@@_title_color_tl,
626 total-color .initial:n = white,
627 total-color .value_required:n = true,
628 total-color .tl_set:N = \l_@@_total_color_tl
629 }
630 % \end{macrocode}
631 %
632 % \subsection{Package Parameters}
633 %
634 % Fortunately, \pkg{l3keys2e} handles the heavy lifting for us.
635 %
636 % \begin{macrocode}
637 \ProcessKeysOptions{invoice2}
638 % \end{macrocode}
639 %
640 % \subsection{\cmd{invoiceoptions} Command}
641 %
642 % \begin{macro}{\invoiceoptions}
643 % We also provide an interface to change the configuration at run time.
644 %
645 % \begin{macrocode}
646 \NewDocumentCommand{\invoiceoptions}{m}{
647 \keys_set:nn {invoice2} {#1}
648 }
649 % \end{macrocode}
650 % \end{macro}
651 %
652 % \section{The \cmd{invoice} Environment}
653 %
654 % \subsection{Header Rendering}
655 %
656 % \begin{macro}{\@@_print_column_specification:}
657 % Emits the \cmd{\begin{longtable}}. The amount column is centered or skipped,
658 % if all amounts are one. The item column is left-justified. The VAT column is
659 % centered or skipped, if all VATs are zero. The unit price and price columns
660 % are right-justified; unit price is skipped if amount is.
661 %
662 % Since \pkg{longtable} refuses to expand the column specification, we force
663 % prior expansion of the booleans.
664 %
665 % \begin{macrocode}
666 \cs_new:Nn {\@@_print_begin_table:}{
667 \exp_args:Nx \longtable {
668 \bool_if:NT \l_@@_amount_nonone_bool { c }
669 l
670 \bool_if:NT \l_@@_vat_nonzero_bool { c }
671 r
672 \bool_if:nT { \l_@@_amount_nonone_bool || \l_@@_vat_nonzero_bool } { r }
673 }
674 }
675 % \end{macrocode}
676 % \end{macro}
677 %
678 % \begin{macro}{\@@_print_column_title:n}
679 % Emits a formatted column title.
680 %
681 % \begin{macrocode}
682 \cs_new:Nn {\@@_print_column_title:n}{
683 \multicolumn{1}{c}{
684 \bool_if:NT \l_@@_colorize_bool {
685 \cellcolor{ \l_@@_title_color_tl }
686 }
687 \begin{scriptsize}
688 \textbf{#1}
689 \end{scriptsize}}
690 }
691 % \end{macrocode}
692 % \end{macro}
693 %
694 % \begin{macro}{\@@_print_amount_title:}
695 % Emits the \enquote{amount} column title. If all amounts are equal to 1, we
696 % emit nothing.
697 %
698 % \begin{macrocode}
699 \cs_new:Nn {\@@_print_amount_title:}{
700 \bool_if:NT \l_@@_amount_nonone_bool {
701 \@@_print_column_title:n {\GetTranslation{invoice2-amount}} &
702 }
703 }
704 % \end{macrocode}
705 % \end{macro}
706 %
707 % \begin{macro}{\@@_print_item_title:}
708 % Emits the \enquote{item} column title.
709 %
710 % \begin{macrocode}
711 \cs_new:Nn {\@@_print_item_title:}{
712 \@@_print_column_title:n {\GetTranslation{invoice2-item}} &
713 }
714 % \end{macrocode}
715 % \end{macro}
716 %
717 % \begin{macro}{\@@_print_vat_title:}
718 % Emits the \enquote{VAT} column title. If all VATs are zero, we emit nothing.
719 %
720 % \begin{macrocode}
721 \cs_new:Nn {\@@_print_vat_title:}{
722 \bool_if:NT \l_@@_vat_nonzero_bool {
723 \@@_print_column_title:n {\GetTranslation{invoice2-vat}} &
724 }
725 }
726 % \end{macrocode}
727 % \end{macro}
728 %
729 % \begin{macro}{\@@_print_unit_price_title:}
730 % Emits the \enquote{unit price} column title. If all amounts are equal to 1,
731 % we emit nothing.
732 %
733 % \begin{macrocode}
734 \cs_new:Nn {\@@_print_unit_price_title:}{
735 \bool_if:nT { \l_@@_amount_nonone_bool || \l_@@_vat_nonzero_bool } {
736 \@@_print_column_title:n {
737 \GetTranslation{invoice2-unit-price}
738 \bool_if:NT \l_@@_currency_in_header_bool {
739 \ (\tl_use:N \l_@@_currency_symbol_tl)
740 }
741 } &
742 }
743 }
744 % \end{macrocode}
745 % \end{macro}
746 %
747 % \begin{macro}{\@@_print_price_title:}
748 % Emits the \enquote{price} column title.
749 %
750 % \begin{macrocode}
751 \cs_new:Nn {\@@_print_price_title:}{
752 \@@_print_column_title:n {\GetTranslation{invoice2-price}
753 \bool_if:NT \l_@@_currency_in_header_bool {
754 \ (\tl_use:N \l_@@_currency_symbol_tl)
755 }
756 }
757 }
758 % \end{macrocode}
759 % \end{macro}
760 %
761 % \begin{macro}{\@@_print_header:}
762 % Emits the invoice header. If all amounts are equal to 1, we skip the amount
763 % column and the unit price column. If all VATs are 0, we skip the VAT column.
764 %
765 % \begin{macrocode}
766 \cs_new:Nn {\@@_print_header:}{
767 \@@_print_begin_table:
768 \toprule
769 \@@_print_amount_title:
770 \@@_print_item_title:
771 \@@_print_vat_title:
772 \@@_print_unit_price_title:
773 \@@_print_price_title:
774 \\
775 \midrule
776 }
777 % \end{macrocode}
778 % \end{macro}
779 %
780 % \subsection{Content Rendering}
781 %
782 % \begin{macro}{\@@_print_real_value:n}
783 % Emits a currency value, formatted with the current settings. The value must
784 % be a floating point number or variable.
785 %
786 % \begin{macrocode}
787 \cs_new:Nn {\@@_print_real_value:n}{
788 \num[round-integer-to-decimal,
789 group-minimum-digits=4,
790 group-separator={\GetTranslation{invoice2-thousands-sep}},
791 output-decimal-marker={\GetTranslation{invoice2-decimal-point}}]{
792 #1
793 }
794 }
795 % \end{macrocode}
796 % \end{macro}
797 %
798 % \begin{macro}{\@@_print_currency_value:n, \@@_print_currency_value:N}
799 % Emits a currency value, formatted with the current settings. The value must
800 % be a floating point number or variable.
801 %
802 % \begin{macrocode}
803 \cs_new:Nn {\@@_print_currency_value:n}{
804 \num[round-precision={\int_use:N \l_@@_currency_fraction_digits_int},
805 round-mode=places,
806 round-integer-to-decimal,
807 group-minimum-digits=4,
808 group-separator={\GetTranslation{invoice2-thousands-sep}},
809 output-decimal-marker={\GetTranslation{invoice2-decimal-point}}]{
810 #1
811 }
812 \bool_if:NF \l_@@_currency_in_header_bool {
813 \, \tl_use:N \l_@@_currency_symbol_tl
814 }
815 }
816 \cs_new:Nn {\@@_print_currency_value:N}{
817 \@@_print_currency_value:n {\fp_use:N #1}
818 }
819 % \end{macrocode}
820 % \end{macro}
821 %
822 %\begin{macro}{\@@_print_percentage:n}
823 % Emits a percentage, formatted with the current settings. The value must be a
824 % floating point number.
825 %
826 % \begin{macrocode}
827 \cs_new:Nn {\@@_print_percentage:n}{
828 \num[round-integer-to-decimal,
829 group-minimum-digits=4,
830 group-separator={\GetTranslation{invoice2-thousands-sep}},
831 output-decimal-marker={\GetTranslation{invoice2-decimal-point}}]{
832 \fp_eval:n {#1 * 100}
833 }
834 \, \%
835 }
836 % \end{macrocode}
837 % \end{macro}
838 %
839 % \begin{macro}{\@@_update_trackers:nn}
840 % Update the VAT-not-zero and amount-not-zero trackers for the given VAT and
841 % amount values.
842 %
843 % \begin{macrocode}
844 \cs_new:Nn {\@@_update_trackers:nn}{
845 \fp_compare:nT {#1 != 1}{
846 \bool_set_true:N \l_@@_amount_nonone_bool
847 }
848 \fp_compare:nT {#2 != 0}{
849 \bool_set_true:N \l_@@_vat_nonzero_bool
850 }
851 }
852 % \end{macrocode}
853 % \end{macro}
854 %
855 % \begin{macro}{\@@_update_totals:nnn}
856 % Update the totals for the given amount, VAT and price per unit values. We
857 % increase the net total by $\tilde{n}$, the VAT total by $\tilde{v}$ and the
858 % gross total by $\tilde{g}$. For unit price $p$, amount $a$, VAT $v$ and
859 % non-included VATs, this is computed as
860 % \begin{align*}
861 % \tilde{n} &= a \cdot p \\
862 % \tilde{v} &= v \cdot \tilde{n} = a \cdot v \cdot p \\
863 % \tilde{g} &= \tilde{n} + \tilde{v} = a \cdot (1 + v) \cdot p, \\
864 % \end{align*}
865 % for included VATs, as
866 % \begin{align*}
867 % \tilde{g} &= a \cdot p \\
868 % \tilde{n} &= \frac{\tilde{g}}{1 + v} = \frac{a \cdot p}{1 + v} \\
869 % \tilde{v} &= \tilde{g} - \tilde{n} = \frac{a \cdot v \cdot p}{1 + v} \\
870 % \end{align*}
871 %
872 % \begin{macrocode}
873 \cs_new:Nn {\@@_update_totals:nnn}{
874 \fp_add:Nn \l_@@_gross_total_fp {
875 #1 * #3 \bool_if:NF \l_@@_included_vat_bool { * (1 + #2) }
876 }
877 \fp_add:Nn \l_@@_vat_total_fp {
878 #1 * #2 * #3 \bool_if:NT \l_@@_included_vat_bool { / (1 + #2) }
879 }
880 \fp_add:Nn \l_@@_net_total_fp {
881 #1 * #3 \bool_if:NT \l_@@_included_vat_bool { / (1 + #2) }
882 }
883 }
884 % \end{macrocode}
885 % \end{macro}
886 %
887 % \begin{macro}{\@@_print_amount:n}
888 % Print the given amount value or nothing, if all amounts are one.
889 %
890 % \begin{macrocode}
891 \cs_new:Nn {\@@_print_amount:n}{
892 \bool_if:NT \l_@@_amount_nonone_bool {
893 \@@_print_real_value:n {#1} &
894 }
895 }
896 % \end{macrocode}
897 % \end{macro}
898 %
899 % \begin{macro}{\@@_print_item:n}
900 % Print the given item name.
901 %
902 % \begin{macrocode}
903 \cs_new:Nn {\@@_print_item:n}{
904 #1 &
905 }
906 % \end{macrocode}
907 % \end{macro}
908 %
909 % \begin{macro}{\@@_print_vat:n}
910 % Print the given VAT or nothing, if all VATs are zero.
911 %
912 % \begin{macrocode}
913 \cs_new:Nn {\@@_print_vat:n}{
914 \bool_if:NT \l_@@_vat_nonzero_bool {
915 \@@_print_percentage:n {#1} &
916 }
917 }
918 % \end{macrocode}
919 % \end{macro}
920 %
921 % \begin{macro}{\@@_print_unit_price:n}
922 % Print the given unit price or nothing, if all amounts are one. Parameters are
923 % VAT and price per unit. For unit price $p$, VAT $v$ and non-included VATs,
924 % this is computed as
925 % \[\tilde{p} = \frac{p}{1+v},\]
926 % for included VATs, as
927 % \[\tilde{p} = p.\]
928 %
929 %
930 % \begin{macrocode}
931 \cs_new:Nn {\@@_print_unit_price:nn}{
932 \bool_if:nT { \l_@@_amount_nonone_bool || \l_@@_vat_nonzero_bool } {
933 \@@_print_currency_value:n {
934 \fp_eval:n {
935 #2 \bool_if:NT \l_@@_included_vat_bool { / (1 + #1) }
936 }
937 } &
938 }
939 }
940 % \end{macrocode}
941 % \end{macro}
942 %
943 % \begin{macro}{\@@_print_price:nnn}
944 % Print the price $\tilde{p}$ for the current item. Parameters are amount, VAT
945 % and price per unit. For unit price $p$, amount $a$, VAT $v$ and non-included
946 % VATs, this is computed as
947 % \[\tilde{p} = a \cdot (1 + v) \cdot p,\]
948 % for included VATs, as
949 % \[\tilde{p} = a \cdot p.\]
950 %
951 % \begin{macrocode}
952 \cs_new:Nn {\@@_print_price:nnn}{
953 \@@_print_currency_value:n {
954 \fp_eval:n {
955 #1 \bool_if:NF \l_@@_included_vat_bool { * (1 + #2) } * #3
956 }
957 }
958 }
959 % \end{macrocode}
960 % \end{macro}
961 %
962 % \begin{macro}{\@@_colorize_row:nnn}
963 % Colorize the current row according to even/odd colorization, if color was
964 % requested in the configuration.
965 %
966 % \begin{macrocode}
967 \cs_new:Nn {\@@_colorize_row:}{
968 \bool_if:NT \l_@@_colorize_bool {
969 \int_if_odd:nTF \g_@@_row_number_int {
970 \rowcolor{ \l_@@_odd_color_tl }
971 }
972 {
973 \rowcolor{ \l_@@_even_color_tl }
974 }
975 }
976 \int_gincr:N \g_@@_row_number_int
977 }
978 % \end{macrocode}
979 % \end{macro}
980 %
981 % \begin{macro}{\@@_add_row:nnnn}
982 % Add a new entry with non-default VAT to the invoice. This will update the
983 % VAT-not-zero and amount-not-zero trackers. Arguments are expected to be (in
984 % this order): amount, item name, VAT, unit price.
985 %
986 % \begin{macrocode}
987 \cs_new:Nn {\@@_add_row:nnnn}{
988 \@@_update_trackers:nn {#1} {#3}
989 \@@_update_totals:nnn {#1} {#3} {#4}
990 \tl_put_right:Nn \l_@@_tabular_tl {
991 \@@_colorize_row:
992 \@@_print_amount:n {#1}
993 \@@_print_item:n {#2}
994 \@@_print_vat:n {#3}
995 \@@_print_unit_price:nn {#3} {#4}
996 \@@_print_price:nnn {#1} {#3} {#4} \\
997 }
998 }
999 % \end{macrocode}
1000 % \end{macro}
1001 %
1002 % \begin{macro}{\invoiceitem, \invoicesingleitem}
1003 % This is the user interface to adding items. We read the VAT from the optional
1004 % argument or the configuration, add an amount of one for single items and
1005 % delegate to our implementation.
1006 %
1007 % \begin{macrocode}
1008 \NewDocumentCommand{\invoiceitem}{ommm}{
1009 \@@_add_row:nnnn {#2} {#3}
1010 {\IfValueTF{#1}{#1}{\fp_use:N \l_@@_vat_fp}}
1011 {#4}
1012 }
1013 \NewDocumentCommand{\invoicesingleitem}{omm}{
1014 \@@_add_row:nnnn {1} {#2}
1015 {\IfValueTF{#1}{#1}{\fp_use:N \l_@@_vat_fp}}
1016 {#3}
1017 }
1018 % \end{macrocode}
1019 % \end{macro}
1020 %
1021 % \subsection{Footer Rendering}
1022 %
1023 % \begin{macro}{\@@_print_multicolumn_count:}
1024 % Emits the column count to group in the final lines. This is the amount of
1025 % columns minus one.
1026 %
1027 % \begin{macrocode}
1028 \cs_new:Nn {\@@_print_multicolumn_count:}{
1029 \int_eval:n {
1030 1
1031 \bool_if:NT \l_@@_vat_nonzero_bool {+1}
1032 \bool_if:NT \l_@@_amount_nonone_bool {+1}
1033 \bool_if:nT { \l_@@_amount_nonone_bool || \l_@@_vat_nonzero_bool } {+1}
1034 }
1035 }
1036 % \end{macrocode}
1037 % \end{macro}
1038 %
1039 % \begin{macro}{\@@_print_footer_item:n}
1040 % Emits a formatted footer item. We also handle colorization of the next cell
1041 % here.
1042 %
1043 % \begin{macrocode}
1044 \cs_new:Nn {\@@_print_footer_item:n}{
1045 \multicolumn{\@@_print_multicolumn_count:}{r}{
1046 \bool_if:NT \l_@@_colorize_bool {
1047 \cellcolor{ \l_@@_total_color_tl }
1048 }
1049 \textbf{#1}
1050 } & \bool_if:NT \l_@@_colorize_bool {
1051 \cellcolor{ \l_@@_total_color_tl }
1052 }
1053 }
1054 % \end{macrocode}
1055 % \end{macro}
1056 %
1057 % \begin{macro}{\@@_print_net_item:}
1058 % Emits the \enquote{net total} item.
1059 %
1060 % \begin{macrocode}
1061 \cs_new:Nn {\@@_print_net_item:}{
1062 \bool_if:NT \l_@@_vat_nonzero_bool {
1063 \@@_print_footer_item:n {
1064 \GetTranslation{invoice2-net-total}
1065 \bool_if:NT \l_@@_currency_in_header_bool {
1066 \ (\tl_use:N \l_@@_currency_symbol_tl)
1067 }
1068 }
1069 \@@_print_currency_value:N \l_@@_net_total_fp \\
1070 }
1071 }
1072 % \end{macrocode}
1073 % \end{macro}
1074 %
1075 % \begin{macro}{\@@_print_vat_item:}
1076 % Emits the \enquote{VAT total} item.
1077 %
1078 % \begin{macrocode}
1079 \cs_new:Nn {\@@_print_vat_item:}{
1080 \bool_if:NT \l_@@_vat_nonzero_bool {
1081 \@@_print_footer_item:n {\GetTranslation{invoice2-vat-total}}
1082 \@@_print_currency_value:N \l_@@_vat_total_fp \\
1083 }
1084 }
1085 % \end{macrocode}
1086 % \end{macro}
1087 %
1088 % \begin{macro}{\@@_print_gross_item:}
1089 % Emits the \enquote{gross total} item.
1090 %
1091 % \begin{macrocode}
1092 \cs_new:Nn {\@@_print_gross_item:}{
1093 \@@_print_footer_item:n {
1094 \GetTranslation{invoice2-gross-total}
1095 \bool_if:NT \l_@@_currency_in_header_bool {
1096 \ (\tl_use:N \l_@@_currency_symbol_tl)
1097 }
1098 }
1099 \@@_print_currency_value:N \l_@@_gross_total_fp \\
1100 }
1101 % \end{macrocode}
1102 % \end{macro}
1103 %
1104 % \begin{macro}{\@@_print_footer:}
1105 % Emits the invoice footer. If all VATs are 0, we skip the net and VAT rows.
1106 %
1107 % \begin{macrocode}
1108 \cs_new:Nn {\@@_print_footer:}{
1109 \midrule
1110 \@@_print_net_item:
1111 \@@_print_vat_item:
1112 \@@_print_gross_item:
1113 \bottomrule
1114 \endlongtable
1115 }
1116 % \end{macrocode}
1117 % \end{macro}
1118 %
1119 % \subsection{The Environment itself}
1120 %
1121 % \begin{macro}{\@@_begin_invoice:n}
1122 % Begins a new invoice environment. We check for nested environments and set up
1123 % configuration overrides.
1124 %
1125 % \begin{macrocode}
1126 \cs_new:Nn {\@@_begin_invoice:n}{
1127 \bool_if:NT \l_@@_in_invoice_bool {
1128 \msg_error:nn {invoice2} {nested-invoice}
1129 }
1130 \bool_set_true:N \l_@@_in_invoice_bool
1131 \int_gset:Nn \g_@@_row_number_int {1}
1132 \keys_set:nn {invoice2} {#1}
1133 }
1134 % \end{macrocode}
1135 % \end{macro}
1136 %
1137 % \begin{macro}{\@@_end_invoice:}
1138 % End an invoice enviroenment. Here, we can emit the \cmd{longtable} environment
1139 % since we possess all required information.
1140 %
1141 % \begin{macrocode}
1142 \cs_new:Nn {\@@_end_invoice:}{
1143 \@@_print_header:
1144 \tl_use:N \l_@@_tabular_tl
1145 \@@_print_footer:
1146 }
1147 % \end{macrocode}
1148 % \end{macro}
1149 %
1150 % \begin{macro}{\begin{invoice}, \end{invoice}}
1151 % The user interface is the \cmd{invoice} environment.
1152 %
1153 % \begin{macrocode}
1154 \NewDocumentEnvironment{invoice}{o}{
1155 \IfValueTF{#1}{\@@_begin_invoice:n {#1}}{\@@_begin_invoice:n {}}
1156 }
1157 {
1158 \@@_end_invoice:
1159 }
1160 % \end{macrocode}
1161 % \end{macro}
1162 %
1163 % \section{Messages and Errors}
1164 %
1165 % \begin{macrocode}
1166 \msg_new:nnnn {invoice2} {nested-invoice}
1167 {\msg_error_text:n {invoice2}:~%
1168 Nested~invoice~environments~are~not~supported.}
1169 {Invoices~can~not~contain~invoices.\\%
1170 Please~check~your~environment~delimiters.}
1171 %</package>
1172 % \end{macrocode}
1173 %
1174 % \section{Dictionary Files}
1175 % \label{sec:dictionaries}
1176 %
1177 % \subsection{English Dictionary}
1178 %
1179 % \begin{macrocode}
1180 %<*dictEnglish>
1181 \ProvideDictionaryFor{English}{invoice2}
1182 \ProvideDictTranslation{invoice2-thousands-sep}{\,}
1183 \ProvideDictTranslation{invoice2-decimal-point}{.}
1184 \ProvideDictTranslation{invoice2-amount}{Amount}
1185 \ProvideDictTranslation{invoice2-item}{Item}
1186 \ProvideDictTranslation{invoice2-vat}{VAT}
1187 \ProvideDictTranslation{invoice2-unit-price}{Unit~Price}
1188 \ProvideDictTranslation{invoice2-price}{Price}
1189 \ProvideDictTranslation{invoice2-net-total}{Net~Total}
1190 \ProvideDictTranslation{invoice2-vat-total}{VAT}
1191 \ProvideDictTranslation{invoice2-gross-total}{Gross~Total}
1192 %</dictEnglish>
1193 % \end{macrocode}
1194 %
1195 % \subsection{German Dictionary}
1196 %
1197 % \begin{macrocode}
1198 %<*dictGerman>
1199 \ProvideDictionaryFor{German}{invoice2}
1200 \ProvideDictTranslation{invoice2-thousands-sep}{\,}
1201 \ProvideDictTranslation{invoice2-decimal-point}{,}
1202 \ProvideDictTranslation{invoice2-amount}{Anzahl}
1203 \ProvideDictTranslation{invoice2-item}{Posten}
1204 \ProvideDictTranslation{invoice2-vat}{USt}
1205 \ProvideDictTranslation{invoice2-unit-price}{St\"uckpreis}
1206 \ProvideDictTranslation{invoice2-price}{Preis}
1207 \ProvideDictTranslation{invoice2-net-total}{Nettobetrag}
1208 \ProvideDictTranslation{invoice2-vat-total}{USt}
1209 \ProvideDictTranslation{invoice2-gross-total}{Gesamtbetrag}
1210 %</dictGerman>
1211 % \end{macrocode}
1212 %
1213 % \subsection{Swiss German Dictionary}
1214 %
1215 % \begin{macrocode}
1216 %<*dictSwissGerman>
1217 \ProvideDictionaryFor{Swiss German}{invoice2}
1218 \ProvideDictTranslation{invoice2-thousands-sep}{'}
1219 \ProvideDictTranslation{invoice2-decimal-point}{.}
1220 %</dictSwissGerman>
1221 % \end{macrocode}
1222 % \end{implementation}
1223 %
1224 % \PrintChanges
1225 % \PrintIndex
1226 %