texlive[46364] Master/texmf-dist: invoice2 (17jan18)
commits+karl at tug.org
commits+karl at tug.org
Thu Jan 18 00:47:38 CET 2018
Revision: 46364
http://tug.org/svn/texlive?view=revision&revision=46364
Author: karl
Date: 2018-01-18 00:47:37 +0100 (Thu, 18 Jan 2018)
Log Message:
-----------
invoice2 (17jan18)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/invoice2/README.md
trunk/Master/texmf-dist/doc/latex/invoice2/invoice2.pdf
trunk/Master/texmf-dist/source/latex/invoice2/invoice2.dtx
trunk/Master/texmf-dist/source/latex/invoice2/invoice2.ins
trunk/Master/texmf-dist/tex/latex/invoice2/invoice2-english.trsl
trunk/Master/texmf-dist/tex/latex/invoice2/invoice2-german.trsl
trunk/Master/texmf-dist/tex/latex/invoice2/invoice2.sty
Added Paths:
-----------
trunk/Master/texmf-dist/tex/latex/invoice2/invoice2-swissgerman.trsl
Modified: trunk/Master/texmf-dist/doc/latex/invoice2/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/invoice2/README.md 2018-01-17 23:47:04 UTC (rev 46363)
+++ trunk/Master/texmf-dist/doc/latex/invoice2/README.md 2018-01-17 23:47:37 UTC (rev 46364)
@@ -9,26 +9,16 @@
interface for working with caculations, this package (re-)implements invoice
functionalioty using LaTeX3.
-## Building the package
+## Obtaining the Source Code
-invoice2 uses the [l3build](https://www.ctan.org/pkg/l3build) tool to create
-the package and documentation files. If your LaTeX distribution is sufficiently
-up to date, execute
+invoice2 is developed as a
+[Github project](https://github.com/no-preserve-root/invoice2). Yoe are welcome
+to report your issues there and submit pull requests, especially for additional
+translations.
-> ./build.lua ctan
-
-in a source checkout to build a CTAN upload zip and a TDS zip. If you just want
-to install a copy of invoice2, execute
-
-> ./build.lua install
-
-to copy the package to your texmf tree.
-
-After building, consult the invoice2.pdf for the actual package documentation.
-
## Copyright and Licensing
-Copyright (C) 2017 Simon Dierl <simon.dierl at cs.tu-dortmund.de>
+Copyright (C) 2017-2018 Simon Dierl <simon.dierl at cs.tu-dortmund.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Modified: trunk/Master/texmf-dist/doc/latex/invoice2/invoice2.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/invoice2/invoice2.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/invoice2/invoice2.dtx 2018-01-17 23:47:04 UTC (rev 46363)
+++ trunk/Master/texmf-dist/source/latex/invoice2/invoice2.dtx 2018-01-17 23:47:37 UTC (rev 46364)
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% File: invoice2.dtx Copyright (C) 2017 Simon Dierl
+% File: invoice2.dtx Copyright (C) 2017-2018 Simon Dierl
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
@@ -46,9 +46,9 @@
% \author{Simon Dierl
% \texttt{\href{mailto:simon.dierl at cs.tu-dortmund.de}
% {<simon.dierl at cs.tu-dortmund.de>}}\\[.25\baselineskip]
-% \url{https://github.com/no-preserve-root/invoice2}}
+% \url{https://github.com/no-preserve-root/invoice2}}
%
-% \date{Version 1.1\\[.25\baselineskip]\DTMDate{2017-08-16}}
+% \date{Version 1.2\\[.25\baselineskip]\DTMDate{2018-01-15}}
%
% \maketitle
%
@@ -94,6 +94,9 @@
% \item[currency-fraction-digits] The fractional digits to use for the
% currency. For almost all currencies, this is two (100 of the smaller
% unit make 1 of the larger). Default is 2.
+% \item[currency-in-header] Controls if the currency symbol should be
+% printed in the invoice header instead of printing it after each amount.
+% Default is printing after each amount.
% \item[colorize] Enables colorization. While the typographical results may
% be mixed, colorization can help read very long invoices. Default is
% off.
@@ -118,9 +121,10 @@
% package. \pkg{translations} uses a key-to-translation mapping that can be
% overridden by the user. See the package documentation for further information.
%
-% At the moment, localizations for english and german are provided. See the
-% documentation for the \pkg{translations} package for adding new localizations.
-% Please consider contributing your translations to this project.
+% At the moment, localizations for english, german and swiss german are
+% provided. See the documentation for the \pkg{translations} package for adding
+% new localizations. Please consider contributing your translations to this
+% project.
%
% The following keys are defined:
% \begin{description}
@@ -194,10 +198,11 @@
%
% Let us begin with a simple invoice with single items and no VAT. The invoice
% will only have two columns and a gross total. We do, however, change the
-% currency symbol to \euro{}. Since we only have single copies, we will use
-% the \cmd{\invoicesingleitem} command.
+% currency symbol to \euro{} (provided by the \pkg{eurosym} package). Since we
+% only have single copies, we will use the \cmd{\invoicesingleitem} command.
%
% \begin{verbatim}
+% \usepackage{eurosym}
% \begin{invoice}[currency-symbol={\euro{}}]
% \invoicesingleitem{Ignition!}{4087.99}
% \invoicesingleitem{The Art of Computer Programming 1--4}{162.99}
@@ -210,10 +215,27 @@
% \invoicesingleitem{The TeXbook}{55.69}
% \end{invoice}
%
+% For some currencies, the symbol ist fairly long. In this case, it is advisable
+% to move the currency symbol to the invoice header.
+%
+% \begin{verbatim}
+% \begin{invoice}[currency-symbol={CHF}, currency-in-header]
+% \invoicesingleitem{Ignition!}{4087.99}
+% \invoicesingleitem{The Art of Computer Programming 1--4}{162.99}
+% \invoicesingleitem{The TeXbook}{55.69}
+% \end{invoice}
+% \end{verbatim}
+% \begin{invoice}[currency-symbol={CHF}, currency-in-header]
+ % \invoicesingleitem{Ignition!}{4087.99}
+ % \invoicesingleitem{The Art of Computer Programming 1--4}{162.99}
+ % \invoicesingleitem{The TeXbook}{55.69}
+ % \end{invoice}
+%
% Now, let us apply a VAT of 9\,\%. This will show the VAT column, the item
% price column and the extended total.
%
% \begin{verbatim}
+% \usepackage{eurosym}
% \invoiceoptions{vat=.09}
% \begin{invoice}[currency-symbol={\euro{}}]
% \invoicesingleitem{Ignition!}{4087.99}
@@ -233,6 +255,7 @@
% different. Additionally, we specify our options as environment options.
%
% \begin{verbatim}
+% \usepackage{eurosym}
% \begin{invoice}[vat=.09, included-vat=true, currency-symbol={\euro{}}]
% \invoicesingleitem{Ignition!}{4087.99}
% \invoicesingleitem{The Art of Computer Programming 1--4}{162.99}
@@ -251,6 +274,7 @@
% TeXbook. This will enable all columns and an extended total.
%
% \begin{verbatim}
+% \usepackage{eurosym}
% \invoiceoptions{vat=.09}
% \begin{invoice}[currency-symbol={\euro{}}]
% \invoicesingleitem{Ignition!}{4087.99}
@@ -271,6 +295,7 @@
% rows.
%
% \begin{verbatim}
+% \usepackage{eurosym}
% \begin{invoice}[currency-symbol={\euro{}}, colorize,
% even-color={lightgray!50}]
% \invoicesingleitem{Ignition!}{4087.99}
@@ -287,6 +312,22 @@
%
% \section{Version History}
%
+% \subsection{Version 1.2}
+% \changes{1.2}{2018/01/15}{Bugfix release}
+% \begin{itemize}[nosep]
+% \item Fix option loading for the \pkg{xcolor} package. Thanks to Alfred
+% H.\ Gitter for reporting.
+% \item Corrected german translation of ``VAT'' to ``USt''. Thanks to Alfred
+% H.\ Gitter for reporting.
+% \item Clarified that \pkg{eurosym} is required to use the \cmd{euro}
+% symbol. Thanks to Alfred H.\ Gitter for the suggestion.
+% \item Split the \texttt{README.md} into a Github version and one for CTAN.
+% \item Add support for Swiss German. Thanks to \texttt{@foreachthing} for
+% the translation.
+% \item Permit moving the currency symbol to the header. Thanks to
+% \texttt{@foreachthing} for the report.
+% \end{itemize}
+%
% \subsection{Version 1.1}
% \changes{1.1}{2017/08/16}{Bugfix release}
% \begin{itemize}[nosep]
@@ -343,9 +384,10 @@
\RequirePackage{longtable}
\RequirePackage{siunitx}
\RequirePackage{translations}
-\RequirePackage[table]{xcolor}
+\PassOptionsToPackage{table}{xcolor}
+\RequirePackage{xcolor}
\RequirePackage{xparse}
-\ProvidesExplPackage{invoice2}{2017/08/16}{1.1}
+\ProvidesExplPackage{invoice2}{2018/01/15}{1.2}
{Intelligent invoices with LaTeX3}
% \end{macrocode}
%
@@ -355,6 +397,7 @@
% \begin{macrocode}
\LoadDictionaryFor{english}{invoice2}
\LoadDictionaryFor{german}{invoice2}
+\LoadDictionaryFor{swissgerman}{invoice2}
\DeclareTranslationFallback{invoice2-thousands-sep}{\,}
\DeclareTranslationFallback{invoice2-decimal-point}{.}
\DeclareTranslationFallback{invoice2-amount}{Amount}
@@ -418,6 +461,16 @@
% \end{macrocode}
% \end{variable}
%
+% \begin{variable}{\l_@@_currency_in_header_bool}
+% Controls if the invoice currency symbol should be moved intro the table
+% header (``Unit Price (\$)'') instead of printing it after each amount
+% (``123.45\ \$''). Can save space for long currencies.
+%
+% \begin{macrocode}
+\bool_new:N \l_@@_currency_in_header_bool
+% \end{macrocode}
+% \end{variable}
+%
% \subsection{Colorization}
%
% \begin{variable}{\l_@@_colorize_bool}
@@ -557,6 +610,8 @@
currency-fraction-digits .int_set:N = \l_@@_currency_fraction_digits_int,
currency-fraction-digits .value_required:n = true,
currency-fraction-digits .initial:n = 2,
+ currency-in-header .bool_set:N = \l_@@_currency_in_header_bool,
+ currency-in-header .initial:n = false,
colorize .bool_set:N = \l_@@_colorize_bool,
colorize .initial:n = false,
odd-color .initial:n = white,
@@ -604,18 +659,18 @@
% centered or skipped, if all VATs are zero. The unit price and price columns
% are right-justified; unit price is skipped if amount is.
%
-% Sind \pkg{longtable} refuses to expand the column specification, we force
+% Since \pkg{longtable} refuses to expand the column specification, we force
% prior expansion of the booleans.
%
% \begin{macrocode}
\cs_new:Nn {\@@_print_begin_table:}{
- \exp_args:Nx \longtable {
- \bool_if:NT \l_@@_amount_nonone_bool { c }
- l
- \bool_if:NT \l_@@_vat_nonzero_bool { c }
- r
- \bool_if:nT { \l_@@_amount_nonone_bool || \l_@@_vat_nonzero_bool } { r }
- }
+ \exp_args:Nx \longtable {
+ \bool_if:NT \l_@@_amount_nonone_bool { c }
+ l
+ \bool_if:NT \l_@@_vat_nonzero_bool { c }
+ r
+ \bool_if:nT { \l_@@_amount_nonone_bool || \l_@@_vat_nonzero_bool } { r }
+ }
}
% \end{macrocode}
% \end{macro}
@@ -678,7 +733,12 @@
% \begin{macrocode}
\cs_new:Nn {\@@_print_unit_price_title:}{
\bool_if:nT { \l_@@_amount_nonone_bool || \l_@@_vat_nonzero_bool } {
- \@@_print_column_title:n {\GetTranslation{invoice2-unit-price}} &
+ \@@_print_column_title:n {
+ \GetTranslation{invoice2-unit-price}
+ \bool_if:NT \l_@@_currency_in_header_bool {
+ \ (\tl_use:N \l_@@_currency_symbol_tl)
+ }
+ } &
}
}
% \end{macrocode}
@@ -689,7 +749,11 @@
%
% \begin{macrocode}
\cs_new:Nn {\@@_print_price_title:}{
- \@@_print_column_title:n {\GetTranslation{invoice2-price}}
+ \@@_print_column_title:n {\GetTranslation{invoice2-price}
+ \bool_if:NT \l_@@_currency_in_header_bool {
+ \ (\tl_use:N \l_@@_currency_symbol_tl)
+ }
+ }
}
% \end{macrocode}
% \end{macro}
@@ -721,12 +785,12 @@
%
% \begin{macrocode}
\cs_new:Nn {\@@_print_real_value:n}{
- \num[round-integer-to-decimal,
- group-minimum-digits=4,
- group-separator={\GetTranslation{invoice2-thousands-sep}},
- output-decimal-marker={\GetTranslation{invoice2-decimal-point}}]{
- #1
- }
+ \num[round-integer-to-decimal,
+ group-minimum-digits=4,
+ group-separator={\GetTranslation{invoice2-thousands-sep}},
+ output-decimal-marker={\GetTranslation{invoice2-decimal-point}}]{
+ #1
+ }
}
% \end{macrocode}
% \end{macro}
@@ -745,7 +809,9 @@
output-decimal-marker={\GetTranslation{invoice2-decimal-point}}]{
#1
}
- \, \tl_use:N \l_@@_currency_symbol_tl
+ \bool_if:NF \l_@@_currency_in_header_bool {
+ \, \tl_use:N \l_@@_currency_symbol_tl
+ }
}
\cs_new:Nn {\@@_print_currency_value:N}{
\@@_print_currency_value:n {\fp_use:N #1}
@@ -941,8 +1007,8 @@
% \begin{macrocode}
\NewDocumentCommand{\invoiceitem}{ommm}{
\@@_add_row:nnnn {#2} {#3}
- {\IfValueTF{#1}{#1}{\fp_use:N \l_@@_vat_fp}}
- {#4}
+ {\IfValueTF{#1}{#1}{\fp_use:N \l_@@_vat_fp}}
+ {#4}
}
\NewDocumentCommand{\invoicesingleitem}{omm}{
\@@_add_row:nnnn {1} {#2}
@@ -994,7 +1060,12 @@
% \begin{macrocode}
\cs_new:Nn {\@@_print_net_item:}{
\bool_if:NT \l_@@_vat_nonzero_bool {
- \@@_print_footer_item:n {\GetTranslation{invoice2-net-total}}
+ \@@_print_footer_item:n {
+ \GetTranslation{invoice2-net-total}
+ \bool_if:NT \l_@@_currency_in_header_bool {
+ \ (\tl_use:N \l_@@_currency_symbol_tl)
+ }
+ }
\@@_print_currency_value:N \l_@@_net_total_fp \\
}
}
@@ -1019,7 +1090,12 @@
%
% \begin{macrocode}
\cs_new:Nn {\@@_print_gross_item:}{
- \@@_print_footer_item:n {\GetTranslation{invoice2-gross-total}}
+ \@@_print_footer_item:n {
+ \GetTranslation{invoice2-gross-total}
+ \bool_if:NT \l_@@_currency_in_header_bool {
+ \ (\tl_use:N \l_@@_currency_symbol_tl)
+ }
+ }
\@@_print_currency_value:N \l_@@_gross_total_fp \\
}
% \end{macrocode}
@@ -1125,16 +1201,26 @@
\ProvideDictTranslation{invoice2-decimal-point}{,}
\ProvideDictTranslation{invoice2-amount}{Anzahl}
\ProvideDictTranslation{invoice2-item}{Posten}
-\ProvideDictTranslation{invoice2-vat}{MwSt.}
+\ProvideDictTranslation{invoice2-vat}{USt}
\ProvideDictTranslation{invoice2-unit-price}{St\"uckpreis}
\ProvideDictTranslation{invoice2-price}{Preis}
\ProvideDictTranslation{invoice2-net-total}{Nettobetrag}
-\ProvideDictTranslation{invoice2-vat-total}{MwSt.}
+\ProvideDictTranslation{invoice2-vat-total}{USt}
\ProvideDictTranslation{invoice2-gross-total}{Gesamtbetrag}
%</dictGerman>
% \end{macrocode}
+%
+% \subsection{Swiss German Dictionary}
+%
+% \begin{macrocode}
+%<*dictSwissGerman>
+\ProvideDictionaryFor{Swiss German}{invoice2}
+\ProvideDictTranslation{invoice2-thousands-sep}{'}
+\ProvideDictTranslation{invoice2-decimal-point}{.}
+%</dictSwissGerman>
+% \end{macrocode}
% \end{implementation}
%
% \PrintChanges
% \PrintIndex
-%
\ No newline at end of file
+%
Modified: trunk/Master/texmf-dist/source/latex/invoice2/invoice2.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/invoice2/invoice2.ins 2018-01-17 23:47:04 UTC (rev 46363)
+++ trunk/Master/texmf-dist/source/latex/invoice2/invoice2.ins 2018-01-17 23:47:37 UTC (rev 46364)
@@ -1,6 +1,6 @@
\iffalse meta-comment
-File invoice2.ins Copyright (C) 2017 Simon Dierl
+File invoice2.ins Copyright (C) 2017-2018 Simon Dierl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
\preamble
-Copyright (C) 2017 Simon Dierl
+Copyright (C) 2017-2018 Simon Dierl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -47,5 +47,7 @@
\generate{\file{invoice2.sty} {\from{invoice2.dtx} {package}}}
\generate{\file{invoice2-english.trsl} {\from{invoice2.dtx} {dictEnglish}}}
\generate{\file{invoice2-german.trsl} {\from{invoice2.dtx} {dictGerman}}}
+\generate{\file{invoice2-swissgerman.trsl}
+ {\from{invoice2.dtx} {dictSwissGerman}}}
\endbatchfile
Modified: trunk/Master/texmf-dist/tex/latex/invoice2/invoice2-english.trsl
===================================================================
--- trunk/Master/texmf-dist/tex/latex/invoice2/invoice2-english.trsl 2018-01-17 23:47:04 UTC (rev 46363)
+++ trunk/Master/texmf-dist/tex/latex/invoice2/invoice2-english.trsl 2018-01-17 23:47:37 UTC (rev 46364)
@@ -6,7 +6,7 @@
%%
%% invoice2.dtx (with options: `dictEnglish')
%%
-%% Copyright (C) 2017 Simon Dierl
+%% Copyright (C) 2017-2018 Simon Dierl
%%
%% This program is free software: you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by
@@ -21,6 +21,10 @@
%% You should have received a copy of the GNU General Public License
%% along with this program. If not, see <http://www.gnu.org/licenses/>.
%%
+ % \invoicesingleitem{Ignition!}{4087.99}
+ % \invoicesingleitem{The Art of Computer Programming 1--4}{162.99}
+ % \invoicesingleitem{The TeXbook}{55.69}
+ % \end{invoice}
\ProvideDictionaryFor{English}{invoice2}
\ProvideDictTranslation{invoice2-thousands-sep}{\,}
\ProvideDictTranslation{invoice2-decimal-point}{.}
Modified: trunk/Master/texmf-dist/tex/latex/invoice2/invoice2-german.trsl
===================================================================
--- trunk/Master/texmf-dist/tex/latex/invoice2/invoice2-german.trsl 2018-01-17 23:47:04 UTC (rev 46363)
+++ trunk/Master/texmf-dist/tex/latex/invoice2/invoice2-german.trsl 2018-01-17 23:47:37 UTC (rev 46364)
@@ -6,7 +6,7 @@
%%
%% invoice2.dtx (with options: `dictGerman')
%%
-%% Copyright (C) 2017 Simon Dierl
+%% Copyright (C) 2017-2018 Simon Dierl
%%
%% This program is free software: you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by
@@ -21,16 +21,20 @@
%% You should have received a copy of the GNU General Public License
%% along with this program. If not, see <http://www.gnu.org/licenses/>.
%%
+ % \invoicesingleitem{Ignition!}{4087.99}
+ % \invoicesingleitem{The Art of Computer Programming 1--4}{162.99}
+ % \invoicesingleitem{The TeXbook}{55.69}
+ % \end{invoice}
\ProvideDictionaryFor{German}{invoice2}
\ProvideDictTranslation{invoice2-thousands-sep}{\,}
\ProvideDictTranslation{invoice2-decimal-point}{,}
\ProvideDictTranslation{invoice2-amount}{Anzahl}
\ProvideDictTranslation{invoice2-item}{Posten}
-\ProvideDictTranslation{invoice2-vat}{MwSt.}
+\ProvideDictTranslation{invoice2-vat}{USt}
\ProvideDictTranslation{invoice2-unit-price}{St\"uckpreis}
\ProvideDictTranslation{invoice2-price}{Preis}
\ProvideDictTranslation{invoice2-net-total}{Nettobetrag}
-\ProvideDictTranslation{invoice2-vat-total}{MwSt.}
+\ProvideDictTranslation{invoice2-vat-total}{USt}
\ProvideDictTranslation{invoice2-gross-total}{Gesamtbetrag}
%%
%%
Added: trunk/Master/texmf-dist/tex/latex/invoice2/invoice2-swissgerman.trsl
===================================================================
--- trunk/Master/texmf-dist/tex/latex/invoice2/invoice2-swissgerman.trsl (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/invoice2/invoice2-swissgerman.trsl 2018-01-17 23:47:37 UTC (rev 46364)
@@ -0,0 +1,33 @@
+%%
+%% This is file `invoice2-swissgerman.trsl',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% invoice2.dtx (with options: `dictSwissGerman')
+%%
+%% Copyright (C) 2017-2018 Simon Dierl
+%%
+%% This program is free software: you can redistribute it and/or modify
+%% it under the terms of the GNU General Public License as published by
+%% the Free Software Foundation, either version 3 of the License, or
+%% (at your option) any later version.
+%%
+%% This program is distributed in the hope that it will be useful,
+%% but WITHOUT ANY WARRANTY; without even the implied warranty of
+%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+%% GNU General Public License for more details.
+%%
+%% You should have received a copy of the GNU General Public License
+%% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%%
+ % \invoicesingleitem{Ignition!}{4087.99}
+ % \invoicesingleitem{The Art of Computer Programming 1--4}{162.99}
+ % \invoicesingleitem{The TeXbook}{55.69}
+ % \end{invoice}
+\ProvideDictionaryFor{Swiss German}{invoice2}
+\ProvideDictTranslation{invoice2-thousands-sep}{'}
+\ProvideDictTranslation{invoice2-decimal-point}{.}
+%%
+%%
+%% End of file `invoice2-swissgerman.trsl'.
Modified: trunk/Master/texmf-dist/tex/latex/invoice2/invoice2.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/invoice2/invoice2.sty 2018-01-17 23:47:04 UTC (rev 46363)
+++ trunk/Master/texmf-dist/tex/latex/invoice2/invoice2.sty 2018-01-17 23:47:37 UTC (rev 46364)
@@ -6,7 +6,7 @@
%%
%% invoice2.dtx (with options: `package')
%%
-%% Copyright (C) 2017 Simon Dierl
+%% Copyright (C) 2017-2018 Simon Dierl
%%
%% This program is free software: you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by
@@ -21,6 +21,10 @@
%% You should have received a copy of the GNU General Public License
%% along with this program. If not, see <http://www.gnu.org/licenses/>.
%%
+ % \invoicesingleitem{Ignition!}{4087.99}
+ % \invoicesingleitem{The Art of Computer Programming 1--4}{162.99}
+ % \invoicesingleitem{The TeXbook}{55.69}
+ % \end{invoice}
\RequirePackage{booktabs}
\RequirePackage{expl3}
\RequirePackage{l3keys2e}
@@ -27,12 +31,14 @@
\RequirePackage{longtable}
\RequirePackage{siunitx}
\RequirePackage{translations}
-\RequirePackage[table]{xcolor}
+\PassOptionsToPackage{table}{xcolor}
+\RequirePackage{xcolor}
\RequirePackage{xparse}
-\ProvidesExplPackage{invoice2}{2017/08/16}{1.1}
+\ProvidesExplPackage{invoice2}{2018/01/15}{1.2}
{Intelligent invoices with LaTeX3}
\LoadDictionaryFor{english}{invoice2}
\LoadDictionaryFor{german}{invoice2}
+\LoadDictionaryFor{swissgerman}{invoice2}
\DeclareTranslationFallback{invoice2-thousands-sep}{\,}
\DeclareTranslationFallback{invoice2-decimal-point}{.}
\DeclareTranslationFallback{invoice2-amount}{Amount}
@@ -47,6 +53,7 @@
\bool_new:N \l__invoicetwo_included_vat_bool
\tl_new:N \l__invoicetwo_currency_symbol_tl
\int_new:N \l__invoicetwo_currency_fraction_digits_int
+\bool_new:N \l__invoicetwo_currency_in_header_bool
\bool_new:N \l__invoicetwo_colorize_bool
\tl_new:N \l__invoicetwo_odd_color_tl
\tl_set:Nn \l__invoicetwo_odd_color_tl {white}
@@ -76,6 +83,8 @@
currency-fraction-digits .int_set:N = \l__invoicetwo_currency_fraction_digits_int,
currency-fraction-digits .value_required:n = true,
currency-fraction-digits .initial:n = 2,
+ currency-in-header .bool_set:N = \l__invoicetwo_currency_in_header_bool,
+ currency-in-header .initial:n = false,
colorize .bool_set:N = \l__invoicetwo_colorize_bool,
colorize .initial:n = false,
odd-color .initial:n = white,
@@ -96,14 +105,14 @@
\keys_set:nn {invoice2} {#1}
}
\cs_new:Nn {\__invoicetwo_print_begin_table:}{
-\exp_args:Nx \longtable {
-\bool_if:NT \l__invoicetwo_amount_nonone_bool { c }
-l
-\bool_if:NT \l__invoicetwo_vat_nonzero_bool { c }
-r
-\bool_if:nT { \l__invoicetwo_amount_nonone_bool || \l__invoicetwo_vat_nonzero_bool } { r }
+ \exp_args:Nx \longtable {
+ \bool_if:NT \l__invoicetwo_amount_nonone_bool { c }
+ l
+ \bool_if:NT \l__invoicetwo_vat_nonzero_bool { c }
+ r
+ \bool_if:nT { \l__invoicetwo_amount_nonone_bool || \l__invoicetwo_vat_nonzero_bool } { r }
+ }
}
-}
\cs_new:Nn {\__invoicetwo_print_column_title:n}{
\multicolumn{1}{c}{
\bool_if:NT \l__invoicetwo_colorize_bool {
@@ -128,11 +137,20 @@
}
\cs_new:Nn {\__invoicetwo_print_unit_price_title:}{
\bool_if:nT { \l__invoicetwo_amount_nonone_bool || \l__invoicetwo_vat_nonzero_bool } {
- \__invoicetwo_print_column_title:n {\GetTranslation{invoice2-unit-price}} &
+ \__invoicetwo_print_column_title:n {
+ \GetTranslation{invoice2-unit-price}
+ \bool_if:NT \l__invoicetwo_currency_in_header_bool {
+ \ (\tl_use:N \l__invoicetwo_currency_symbol_tl)
+ }
+ } &
}
}
\cs_new:Nn {\__invoicetwo_print_price_title:}{
- \__invoicetwo_print_column_title:n {\GetTranslation{invoice2-price}}
+ \__invoicetwo_print_column_title:n {\GetTranslation{invoice2-price}
+ \bool_if:NT \l__invoicetwo_currency_in_header_bool {
+ \ (\tl_use:N \l__invoicetwo_currency_symbol_tl)
+ }
+ }
}
\cs_new:Nn {\__invoicetwo_print_header:}{
\__invoicetwo_print_begin_table:
@@ -146,13 +164,13 @@
\midrule
}
\cs_new:Nn {\__invoicetwo_print_real_value:n}{
-\num[round-integer-to-decimal,
-group-minimum-digits=4,
-group-separator={\GetTranslation{invoice2-thousands-sep}},
-output-decimal-marker={\GetTranslation{invoice2-decimal-point}}]{
-#1
+ \num[round-integer-to-decimal,
+ group-minimum-digits=4,
+ group-separator={\GetTranslation{invoice2-thousands-sep}},
+ output-decimal-marker={\GetTranslation{invoice2-decimal-point}}]{
+ #1
+ }
}
-}
\cs_new:Nn {\__invoicetwo_print_currency_value:n}{
\num[round-precision={\int_use:N \l__invoicetwo_currency_fraction_digits_int},
round-mode=places,
@@ -162,7 +180,9 @@
output-decimal-marker={\GetTranslation{invoice2-decimal-point}}]{
#1
}
- \, \tl_use:N \l__invoicetwo_currency_symbol_tl
+ \bool_if:NF \l__invoicetwo_currency_in_header_bool {
+ \, \tl_use:N \l__invoicetwo_currency_symbol_tl
+ }
}
\cs_new:Nn {\__invoicetwo_print_currency_value:N}{
\__invoicetwo_print_currency_value:n {\fp_use:N #1}
@@ -249,8 +269,8 @@
}
\NewDocumentCommand{\invoiceitem}{ommm}{
\__invoicetwo_add_row:nnnn {#2} {#3}
- {\IfValueTF{#1}{#1}{\fp_use:N \l__invoicetwo_vat_fp}}
- {#4}
+ {\IfValueTF{#1}{#1}{\fp_use:N \l__invoicetwo_vat_fp}}
+ {#4}
}
\NewDocumentCommand{\invoicesingleitem}{omm}{
\__invoicetwo_add_row:nnnn {1} {#2}
@@ -277,7 +297,12 @@
}
\cs_new:Nn {\__invoicetwo_print_net_item:}{
\bool_if:NT \l__invoicetwo_vat_nonzero_bool {
- \__invoicetwo_print_footer_item:n {\GetTranslation{invoice2-net-total}}
+ \__invoicetwo_print_footer_item:n {
+ \GetTranslation{invoice2-net-total}
+ \bool_if:NT \l__invoicetwo_currency_in_header_bool {
+ \ (\tl_use:N \l__invoicetwo_currency_symbol_tl)
+ }
+ }
\__invoicetwo_print_currency_value:N \l__invoicetwo_net_total_fp \\
}
}
@@ -288,7 +313,12 @@
}
}
\cs_new:Nn {\__invoicetwo_print_gross_item:}{
- \__invoicetwo_print_footer_item:n {\GetTranslation{invoice2-gross-total}}
+ \__invoicetwo_print_footer_item:n {
+ \GetTranslation{invoice2-gross-total}
+ \bool_if:NT \l__invoicetwo_currency_in_header_bool {
+ \ (\tl_use:N \l__invoicetwo_currency_symbol_tl)
+ }
+ }
\__invoicetwo_print_currency_value:N \l__invoicetwo_gross_total_fp \\
}
\cs_new:Nn {\__invoicetwo_print_footer:}{
More information about the tex-live-commits
mailing list