texlive[45060] Master/texmf-dist: invoice2 (17aug17)

commits+karl at tug.org commits+karl at tug.org
Thu Aug 17 23:18:24 CEST 2017


Revision: 45060
          http://tug.org/svn/texlive?view=revision&revision=45060
Author:   karl
Date:     2017-08-17 23:18:23 +0200 (Thu, 17 Aug 2017)
Log Message:
-----------
invoice2 (17aug17)

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.sty

Removed Paths:
-------------
    trunk/Master/texmf-dist/doc/latex/invoice2/README.txt

Modified: trunk/Master/texmf-dist/doc/latex/invoice2/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/invoice2/README.md	2017-08-17 21:18:09 UTC (rev 45059)
+++ trunk/Master/texmf-dist/doc/latex/invoice2/README.md	2017-08-17 21:18:23 UTC (rev 45060)
@@ -5,7 +5,7 @@
 While there already are several solutions for LaTeX invoices, most are either
 sum-it-yourself templates and the [invoice](https://www.ctan.org/pkg/invoice)
 package, which appears to be unmaintained and fails to work for my documents,
-sespecially documents using KOMA-Script. Since LaTeX3 offers a comfortable
+especially documents using KOMA-Script. Since LaTeX3 offers a comfortable
 interface for working with caculations, this package (re-)implements invoice
 functionalioty using LaTeX3.
 

Deleted: trunk/Master/texmf-dist/doc/latex/invoice2/README.txt
===================================================================
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	2017-08-17 21:18:09 UTC (rev 45059)
+++ trunk/Master/texmf-dist/source/latex/invoice2/invoice2.dtx	2017-08-17 21:18:23 UTC (rev 45060)
@@ -6,7 +6,7 @@
 % 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
@@ -48,7 +48,7 @@
 %       {<simon.dierl at cs.tu-dortmund.de>}}\\[.25\baselineskip]
 %	\url{https://github.com/no-preserve-root/invoice2}}
 %
-% \date{Version 1.0\\[.25\baselineskip]\DTMDate{2017-7-15}}
+% \date{Version 1.1\\[.25\baselineskip]\DTMDate{2017-08-16}}
 %
 % \maketitle
 %
@@ -89,9 +89,9 @@
 %        subtracted to show the net price. If VAT is excluded, all prices are
 %        net prices, the VAT is added to show the gross price. Default is
 %        excluded VAT.
-%    \item[currency-symbol] The currency symbol to use, e.g. \euro{}. 
+%    \item[currency-symbol] The currency symbol to use, e.g. \euro{}.
 %        Default is \$.
-%    \item[currency-fraction-digits] The fractional digits to use for the 
+%    \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[colorize] Enables colorization. While the typographical results may
@@ -100,7 +100,7 @@
 %    \item[odd-color] The color to use for odd invoice rows, if colorization is
 %        enabled. The color must be understood by \pkg{xcolor}. Default is
 %        white.
-%    \item[even-color] The color to use for even invoice rows, if colorization 
+%    \item[even-color] The color to use for even invoice rows, if colorization
 %        is enabled. The color must be understood by \pkg{xcolor}. Default is
 %        light grey (lightgray).
 %    \item[title-color] The color to use for the title row, if colorization is
@@ -121,12 +121,12 @@
 % 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.
-% 
+%
 % The following keys are defined:
 % \begin{description}
 %    \item[invoice2-thousands-sep] The separator between thousands, e.\,g. the
 %        space in 1\,000. Default is a small space.
-%    \item[invoice2-decimal-point] The separator between whole and 
+%    \item[invoice2-decimal-point] The separator between whole and
 %        fractional parts, e.\,g.~the dot in 40.00. Default is a dot.
 %    \item[invoice2-amount] The \enquote{Amount} column title.
 %    \item[invoice2-item] The \enquote{Item} column title.
@@ -180,14 +180,14 @@
 % \cs{invoicesingleitem} \oarg{VAT} \marg{item name} \marg{unit price}
 % \end{syntax}
 % These commands add an item to the current invoice. The VAT argument is
-% optional, if not given, VAT will default to the value set in the 
+% optional, if not given, VAT will default to the value set in the
 % configuration. For singular items, the second form can be used to imply an
 % amount of 1.
-% 
+%
 % VAT must be given as a floating point value (see the configuration parameter
-% list for details). The amount must be an integer, the unit price a floating
-% point number. Do \emph{not} add a currency symbol or formatting to the unit
-% price.
+% list for details). The amount and the unit price can be an integer or a
+% floating point number. Do \emph{not} add a currency symbol or formatting to
+% the unit price.
 % \end{function}
 %
 % \section{Examples}
@@ -210,9 +210,8 @@
 %    \invoicesingleitem{The TeXbook}{55.69}
 % \end{invoice}
 %
-% A more complex example involves amounts and a VAT. We will apply a 9\,\% VAT
-% to our books and stock up on more copies of the TeXbook. This will enable
-% all columns and an extended total.
+% Now, let us apply a VAT of 9\,\%. This will show the VAT column, the item
+% price column and the extended total.
 %
 % \begin{verbatim}
 %    \invoiceoptions{vat=.09}
@@ -219,6 +218,43 @@
 %    \begin{invoice}[currency-symbol={\euro{}}]
 %        \invoicesingleitem{Ignition!}{4087.99}
 %        \invoicesingleitem{The Art of Computer Programming 1--4}{162.99}
+%        \invoicesingleitem{The TeXbook}{55.69}
+%    \end{invoice}
+% \end{verbatim}
+% \invoiceoptions{vat=.09}
+% \begin{invoice}[currency-symbol={\euro{}}]
+%    \invoicesingleitem{Ignition!}{4087.99}
+%    \invoicesingleitem{The Art of Computer Programming 1--4}{162.99}
+%    \invoicesingleitem{The TeXbook}{55.69}
+% \end{invoice}
+% \invoiceoptions{vat=.0}
+%
+% Note that if we specify included VAT in the above example, the output is
+% different. Additionally, we specify our options as environment options.
+%
+% \begin{verbatim}
+%    \begin{invoice}[vat=.09, included-vat=true, currency-symbol={\euro{}}]
+%        \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}[vat=.09, included-vat=true, currency-symbol={\euro{}}]
+%    \invoicesingleitem{Ignition!}{4087.99}
+%    \invoicesingleitem{The Art of Computer Programming 1--4}{162.99}
+%    \invoicesingleitem{The TeXbook}{55.69}
+% \end{invoice}
+%
+% A more complex example involves amounts and a VAT. We keep the 9\,\% VAT for
+% our books, buy duplicate editions of The Art of Computer Programming 1 and 2
+% (simulated by buying 1.5 copies) and stock up on more copies of the
+% TeXbook. This will enable all columns and an extended total.
+%
+% \begin{verbatim}
+%    \invoiceoptions{vat=.09}
+%    \begin{invoice}[currency-symbol={\euro{}}]
+%        \invoicesingleitem{Ignition!}{4087.99}
+%        \invoiceitem{1.5}{The Art of Computer Programming 1--4}{162.99}
 %        \invoiceitem{20}{The TeXbook}{55.69}
 %    \end{invoice}
 % \end{verbatim}
@@ -225,7 +261,7 @@
 % \invoiceoptions{vat=.09}
 % \begin{invoice}[currency-symbol={\euro{}}]
 %    \invoicesingleitem{Ignition!}{4087.99}
-%    \invoicesingleitem{The Art of Computer Programming 1--4}{162.99}
+%    \invoiceitem{1.5}{The Art of Computer Programming 1--4}{162.99}
 %    \invoiceitem{20}{The TeXbook}{55.69}
 % \end{invoice}
 % \invoiceoptions{vat=0}
@@ -251,8 +287,19 @@
 %
 % \section{Version History}
 %
+% \subsection{Version 1.1}
+% \changes{1.1}{2017/08/16}{Bugfix release}
+% \begin{itemize}[nosep]
+%    \item Spelling fix in \texttt{README.md}. Thanks to Ina Dau for noticing.
+%    \item Clean up unused \texttt{README} generation in the \texttt{.ins} file.
+%    \item Report in with the correct motto.
+%    \item Support non-integer amounts. Thanks to Gijs Hillenius for the
+%        suggestion.
+%    \item Print the unit price column if an item has either VAT or amount
+%        $\neq 1$. Thanks to Gijs Hillenius for the suggestion.
+% \end{itemize}
+%
 % \subsection{Version 1.0}
-%
 % \changes{1.0}{2017/07/15}{First public release}
 % \begin{itemize}[nosep]
 %    \item First public release.
@@ -262,17 +309,17 @@
 % \end{itemize}
 %
 % \section{License}
-% 
+%
 % 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 \url{http://www.gnu.org/licenses/}.
 %
@@ -298,8 +345,8 @@
 \RequirePackage{translations}
 \RequirePackage[table]{xcolor}
 \RequirePackage{xparse}
-\ProvidesExplPackage{invoice2}{2017/07/15}{1.0}
-    {Next-generation invoice typesetting with booktabs}
+\ProvidesExplPackage{invoice2}{2017/08/16}{1.1}
+    {Intelligent invoices with LaTeX3}
 %    \end{macrocode}
 %
 % Now, load our dictionary files and set fallback translations. We emit the
@@ -335,7 +382,7 @@
 % \begin{variable}{\l_@@_vat_fp}
 % The default value for VAT. If an invoice has only zero VAT for all entries,
 % no VAT is added and the column is not rendered. VAT can be set per line.
-% 
+%
 %    \begin{macrocode}
 \fp_new:N \l_@@_vat_fp
 %    \end{macrocode}
@@ -346,7 +393,7 @@
 % total will compute the net total and display it. If false, the total will
 % compute the gross total. If the VAT is zero, this does nothing. We will render
 % a gross total only.
-% 
+%
 %    \begin{macrocode}
 \bool_new:N \l_@@_included_vat_bool
 %    \end{macrocode}
@@ -356,7 +403,7 @@
 % The currency symbol to use.
 %
 % \subsection{Price Typesetting}
-% 
+%
 %    \begin{macrocode}
 \tl_new:N \l_@@_currency_symbol_tl
 %    \end{macrocode}
@@ -365,7 +412,7 @@
 % \begin{variable}{\l_@@_currency_fraction_digits_int}
 % The number of fractional digits for the currency. Contrary to popular opinion,
 % this does not always equal two.
-% 
+%
 %    \begin{macrocode}
 \int_new:N \l_@@_currency_fraction_digits_int
 %    \end{macrocode}
@@ -377,7 +424,7 @@
 % Controls if the invoice should be colorized at all. We only support
 % alternating colorization for even and odd lines and a special color for the
 % total line.
-% 
+%
 %    \begin{macrocode}
 \bool_new:N \l_@@_colorize_bool
 %    \end{macrocode}
@@ -385,7 +432,7 @@
 %
 % \begin{variable}{\l_@@_odd_color_tl}
 % The color for odd lines. Only used if colorization is enabled.
-% 
+%
 %    \begin{macrocode}
 \tl_new:N \l_@@_odd_color_tl
 \tl_set:Nn \l_@@_odd_color_tl {white}
@@ -394,7 +441,7 @@
 %
 % \begin{variable}{\l_@@_even_color_tl}
 % The color for even lines. Only used if colorization is enabled.
-% 
+%
 %    \begin{macrocode}
 \tl_new:N \l_@@_even_color_tl
 \tl_set:Nn \l_@@_even_color_tl {lightgray}
@@ -403,7 +450,7 @@
 %
 % \begin{variable}{\l_@@_title_color_tl}
 % The color for the title line. Only used if colorization is enabled.
-% 
+%
 %    \begin{macrocode}
 \tl_new:N \l_@@_title_color_tl
 \tl_set:Nn \l_@@_title_color_tl {white}
@@ -412,7 +459,7 @@
 %
 % \begin{variable}{\l_@@_total_color_tl}
 % The color for the total line. Only used if colorization is enabled.
-% 
+%
 %    \begin{macrocode}
 \tl_new:N \l_@@_total_color_tl
 \tl_set:Nn \l_@@_total_color_tl {white}
@@ -424,7 +471,7 @@
 % \begin{variable}{\l_@@_in_invoice_bool}
 % Tracks if we are in an invoice environment. This allows us to crash when
 % nesting invoice environments by accident.
-% 
+%
 %    \begin{macrocode}
 \bool_new:N \l_@@_in_invoice_bool
 %    \end{macrocode}
@@ -433,7 +480,7 @@
 % \begin{variable}{\l_@@_row_number_int}
 % Counts the invoice rows. We use this to tell even from odd lines. Starts with
 % 1; this must be reset at the beginning of each invoice.
-% 
+%
 %    \begin{macrocode}
 \int_new:N \g_@@_row_number_int
 %    \end{macrocode}
@@ -442,7 +489,7 @@
 % \begin{variable}{\l_@@_vat_nonzero_bool}
 % Tracks if we have already encountered a line with non-zero VAT. If so, we
 % will render a VAT column and separate gross and net totals.
-% 
+%
 %    \begin{macrocode}
 \bool_new:N \l_@@_vat_nonzero_bool
 %    \end{macrocode}
@@ -451,7 +498,7 @@
 % \begin{variable}{\l_@@_amount_nonone_bool}
 % Tracks if we have already encountered a line with non-one amount. If so, we
 % will render an amount and an unit price column.
-% 
+%
 %    \begin{macrocode}
 \bool_new:N \l_@@_amount_nonone_bool
 %    \end{macrocode}
@@ -459,7 +506,7 @@
 %
 % \begin{variable}{\l_@@_net_total_fp}
 % The running net total.
-% 
+%
 %    \begin{macrocode}
 \fp_new:N \l_@@_net_total_fp
 %    \end{macrocode}
@@ -467,7 +514,7 @@
 %
 % \begin{variable}{\l_@@_vat_total_fp}
 % The running VAT total.
-% 
+%
 %    \begin{macrocode}
 \fp_new:N \l_@@_vat_total_fp
 %    \end{macrocode}
@@ -475,7 +522,7 @@
 %
 % \begin{variable}{\l_@@_gross_total_fp}
 % The running gross total.
-% 
+%
 %    \begin{macrocode}
 \fp_new:N \l_@@_gross_total_fp
 %    \end{macrocode}
@@ -485,7 +532,7 @@
 % The tabular under construction. We create the tabular contents on the fly,
 % using a conditional for the VAT column that is expanded only when emitting the
 % invoice.
-% 
+%
 %    \begin{macrocode}
 \tl_new:N \l_@@_tabular_tl
 %    \end{macrocode}
@@ -536,10 +583,10 @@
 %    \end{macrocode}
 %
 % \subsection{\cmd{invoiceoptions} Command}
-% 
+%
 % \begin{macro}{\invoiceoptions}
 % We also provide an interface to change the configuration at run time.
-% 
+%
 %    \begin{macrocode}
 \NewDocumentCommand{\invoiceoptions}{m}{
     \keys_set:nn {invoice2} {#1}
@@ -559,7 +606,7 @@
 %
 % Sind \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 {
@@ -567,7 +614,7 @@
 		l
 		\bool_if:NT \l_@@_vat_nonzero_bool { c }
 		r
-		\bool_if:NT \l_@@_amount_nonone_bool { r }
+		\bool_if:nT { \l_@@_amount_nonone_bool || \l_@@_vat_nonzero_bool } { r }
 	}
 }
 %    \end{macrocode}
@@ -575,7 +622,7 @@
 %
 % \begin{macro}{\@@_print_column_title:n}
 % Emits a formatted column title.
-% 
+%
 %    \begin{macrocode}
 \cs_new:Nn {\@@_print_column_title:n}{
     \multicolumn{1}{c}{
@@ -630,7 +677,7 @@
 %
 %    \begin{macrocode}
 \cs_new:Nn {\@@_print_unit_price_title:}{
-    \bool_if:NT \l_@@_amount_nonone_bool {
+    \bool_if:nT { \l_@@_amount_nonone_bool || \l_@@_vat_nonzero_bool } {
         \@@_print_column_title:n {\GetTranslation{invoice2-unit-price}} &
     }
 }
@@ -650,7 +697,7 @@
 % \begin{macro}{\@@_print_header:}
 % Emits the invoice header. If all amounts are equal to 1, we skip the amount
 % column and the unit price column. If all VATs are 0, we skip the VAT column.
-% 
+%
 %    \begin{macrocode}
 \cs_new:Nn {\@@_print_header:}{
     \@@_print_begin_table:
@@ -668,10 +715,26 @@
 %
 % \subsection{Content Rendering}
 %
+% \begin{macro}{\@@_print_real_value:n}
+% Emits a currency value, formatted with the current settings. The value must
+% be a floating point number or variable.
+%
+%    \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
+	}
+}
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{\@@_print_currency_value:n, \@@_print_currency_value:N}
 % Emits a currency value, formatted with the current settings. The value must
 % be a floating point number or variable.
-% 
+%
 %    \begin{macrocode}
 \cs_new:Nn {\@@_print_currency_value:n}{
     \num[round-precision={\int_use:N \l_@@_currency_fraction_digits_int},
@@ -693,10 +756,10 @@
 %\begin{macro}{\@@_print_percentage:n}
 % Emits a percentage, formatted with the current settings. The value must be a
 % floating point number.
-% 
+%
 %    \begin{macrocode}
 \cs_new:Nn {\@@_print_percentage:n}{
-    \num[round-integer-to-decimal,,
+    \num[round-integer-to-decimal,
     group-minimum-digits=4,
     group-separator={\GetTranslation{invoice2-thousands-sep}},
     output-decimal-marker={\GetTranslation{invoice2-decimal-point}}]{
@@ -710,10 +773,10 @@
 % \begin{macro}{\@@_update_trackers:nn}
 % Update the VAT-not-zero and amount-not-zero trackers for the given VAT and
 % amount values.
-% 
+%
 %    \begin{macrocode}
 \cs_new:Nn {\@@_update_trackers:nn}{
-    \int_compare:nT {#1 != 1}{
+    \fp_compare:nT {#1 != 1}{
         \bool_set_true:N \l_@@_amount_nonone_bool
     }
     \fp_compare:nT {#2 != 0}{
@@ -724,7 +787,7 @@
 % \end{macro}
 %
 % \begin{macro}{\@@_update_totals:nnn}
-% Update the totals for the given amount, VAT and price per unit values. We 
+% Update the totals for the given amount, VAT and price per unit values. We
 % increase the net total by $\tilde{n}$, the VAT total by $\tilde{v}$ and the
 % gross total by $\tilde{g}$. For unit price $p$, amount $a$, VAT $v$ and
 % non-included VATs, this is computed as
@@ -739,7 +802,7 @@
 %    \tilde{n} &= \frac{\tilde{g}}{1 + v} = \frac{a \cdot p}{1 + v} \\
 %    \tilde{v} &= \tilde{g} - \tilde{n} = \frac{a \cdot v \cdot p}{1 + v} \\
 % \end{align*}
-% 
+%
 %    \begin{macrocode}
 \cs_new:Nn {\@@_update_totals:nnn}{
     \fp_add:Nn \l_@@_gross_total_fp {
@@ -757,11 +820,11 @@
 %
 % \begin{macro}{\@@_print_amount:n}
 % Print the given amount value or nothing, if all amounts are one.
-% 
+%
 %    \begin{macrocode}
 \cs_new:Nn {\@@_print_amount:n}{
     \bool_if:NT \l_@@_amount_nonone_bool {
-        #1 &
+        \@@_print_real_value:n {#1} &
     }
 }
 %    \end{macrocode}
@@ -769,7 +832,7 @@
 %
 % \begin{macro}{\@@_print_item:n}
 % Print the given item name.
-% 
+%
 %    \begin{macrocode}
 \cs_new:Nn {\@@_print_item:n}{
     #1 &
@@ -779,7 +842,7 @@
 %
 % \begin{macro}{\@@_print_vat:n}
 % Print the given VAT or nothing, if all VATs are zero.
-% 
+%
 %    \begin{macrocode}
 \cs_new:Nn {\@@_print_vat:n}{
     \bool_if:NT \l_@@_vat_nonzero_bool {
@@ -790,12 +853,22 @@
 % \end{macro}
 %
 % \begin{macro}{\@@_print_unit_price:n}
-% Print the given unit price or nothing, if all amounts are one.
-% 
+% Print the given unit price or nothing, if all amounts are one. Parameters are
+% VAT and price per unit. For unit price $p$, VAT $v$ and non-included VATs,
+% this is computed as
+% \[\tilde{p} = \frac{p}{1+v},\]
+% for included VATs, as
+% \[\tilde{p} = p.\]
+%
+%
 %    \begin{macrocode}
-\cs_new:Nn {\@@_print_unit_price:n}{
-    \bool_if:NT \l_@@_amount_nonone_bool {
-        \@@_print_currency_value:n {#1} &
+\cs_new:Nn {\@@_print_unit_price:nn}{
+    \bool_if:nT { \l_@@_amount_nonone_bool || \l_@@_vat_nonzero_bool } {
+        \@@_print_currency_value:n {
+            \fp_eval:n {
+                #2 \bool_if:NT \l_@@_included_vat_bool { / (1 + #1) }
+            }
+        } &
     }
 }
 %    \end{macrocode}
@@ -808,7 +881,7 @@
 % \[\tilde{p} = a \cdot (1 + v) \cdot p,\]
 % for included VATs, as
 % \[\tilde{p} = a \cdot p.\]
-% 
+%
 %    \begin{macrocode}
 \cs_new:Nn {\@@_print_price:nnn}{
     \@@_print_currency_value:n {
@@ -823,7 +896,7 @@
 % \begin{macro}{\@@_colorize_row:nnn}
 % Colorize the current row according to even/odd colorization, if color was
 % requested in the configuration.
-% 
+%
 %    \begin{macrocode}
 \cs_new:Nn {\@@_colorize_row:}{
     \bool_if:NT \l_@@_colorize_bool {
@@ -843,7 +916,7 @@
 % Add a new entry with non-default VAT to the invoice. This will update the
 % VAT-not-zero and amount-not-zero trackers. Arguments are expected to be (in
 % this order): amount, item name, VAT, unit price.
-% 
+%
 %    \begin{macrocode}
 \cs_new:Nn {\@@_add_row:nnnn}{
     \@@_update_trackers:nn {#1} {#3}
@@ -853,7 +926,7 @@
         \@@_print_amount:n {#1}
         \@@_print_item:n {#2}
         \@@_print_vat:n {#3}
-        \@@_print_unit_price:n {#4}
+        \@@_print_unit_price:nn {#3} {#4}
         \@@_print_price:nnn {#1} {#3} {#4} \\
     }
 }
@@ -864,7 +937,7 @@
 % This is the user interface to adding items. We read the VAT from the optional
 % argument or the configuration, add an amount of one for single items and
 % delegate to our implementation.
-% 
+%
 %    \begin{macrocode}
 \NewDocumentCommand{\invoiceitem}{ommm}{
     \@@_add_row:nnnn {#2} {#3}
@@ -884,13 +957,14 @@
 % \begin{macro}{\@@_print_multicolumn_count:}
 % Emits the column count to group in the final lines. This is the amount of
 % columns minus one.
-% 
+%
 %    \begin{macrocode}
 \cs_new:Nn {\@@_print_multicolumn_count:}{
     \int_eval:n {
         1
         \bool_if:NT \l_@@_vat_nonzero_bool {+1}
-        \bool_if:NT \l_@@_amount_nonone_bool {+2}
+        \bool_if:NT \l_@@_amount_nonone_bool {+1}
+        \bool_if:nT { \l_@@_amount_nonone_bool || \l_@@_vat_nonzero_bool } {+1}
     }
 }
 %    \end{macrocode}
@@ -899,7 +973,7 @@
 % \begin{macro}{\@@_print_footer_item:n}
 % Emits a formatted footer item. We also handle colorization of the next cell
 % here.
-% 
+%
 %    \begin{macrocode}
 \cs_new:Nn {\@@_print_footer_item:n}{
     \multicolumn{\@@_print_multicolumn_count:}{r}{
@@ -916,7 +990,7 @@
 %
 % \begin{macro}{\@@_print_net_item:}
 % Emits the \enquote{net total} item.
-% 
+%
 %    \begin{macrocode}
 \cs_new:Nn {\@@_print_net_item:}{
     \bool_if:NT \l_@@_vat_nonzero_bool {
@@ -929,7 +1003,7 @@
 %
 % \begin{macro}{\@@_print_vat_item:}
 % Emits the \enquote{VAT total} item.
-% 
+%
 %    \begin{macrocode}
 \cs_new:Nn {\@@_print_vat_item:}{
     \bool_if:NT \l_@@_vat_nonzero_bool {
@@ -942,7 +1016,7 @@
 %
 % \begin{macro}{\@@_print_gross_item:}
 % Emits the \enquote{gross total} item.
-% 
+%
 %    \begin{macrocode}
 \cs_new:Nn {\@@_print_gross_item:}{
     \@@_print_footer_item:n {\GetTranslation{invoice2-gross-total}}
@@ -953,7 +1027,7 @@
 %
 % \begin{macro}{\@@_print_footer:}
 % Emits the invoice footer. If all VATs are 0, we skip the net and VAT rows.
-% 
+%
 %    \begin{macrocode}
 \cs_new:Nn {\@@_print_footer:}{
     \midrule
@@ -971,7 +1045,7 @@
 % \begin{macro}{\@@_begin_invoice:n}
 % Begins a new invoice environment. We check for nested environments and set up
 % configuration overrides.
-% 
+%
 %    \begin{macrocode}
 \cs_new:Nn {\@@_begin_invoice:n}{
     \bool_if:NT \l_@@_in_invoice_bool {
@@ -987,7 +1061,7 @@
 % \begin{macro}{\@@_end_invoice:}
 % End an invoice enviroenment. Here, we can emit the \cmd{longtable} environment
 % since we possess all required information.
-% 
+%
 %    \begin{macrocode}
 \cs_new:Nn {\@@_end_invoice:}{
     \@@_print_header:
@@ -1011,7 +1085,7 @@
 % \end{macro}
 %
 % \section{Messages and Errors}
-% 
+%
 %    \begin{macrocode}
 \msg_new:nnnn {invoice2} {nested-invoice}
     {\msg_error_text:n {invoice2}:~%

Modified: trunk/Master/texmf-dist/source/latex/invoice2/invoice2.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/invoice2/invoice2.ins	2017-08-17 21:18:09 UTC (rev 45059)
+++ trunk/Master/texmf-dist/source/latex/invoice2/invoice2.ins	2017-08-17 21:18:23 UTC (rev 45060)
@@ -6,7 +6,7 @@
 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
@@ -48,7 +48,4 @@
 \generate{\file{invoice2-english.trsl} {\from{invoice2.dtx} {dictEnglish}}}
 \generate{\file{invoice2-german.trsl} {\from{invoice2.dtx} {dictGerman}}}
 
-\nopreamble\nopostamble
-\generate{\file{README.txt} {\from{invoice2.dtx} {readme}}}
-
 \endbatchfile

Modified: trunk/Master/texmf-dist/tex/latex/invoice2/invoice2.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/invoice2/invoice2.sty	2017-08-17 21:18:09 UTC (rev 45059)
+++ trunk/Master/texmf-dist/tex/latex/invoice2/invoice2.sty	2017-08-17 21:18:23 UTC (rev 45060)
@@ -29,8 +29,8 @@
 \RequirePackage{translations}
 \RequirePackage[table]{xcolor}
 \RequirePackage{xparse}
-\ProvidesExplPackage{invoice2}{2017/07/15}{1.0}
-    {Next-generation invoice typesetting with booktabs}
+\ProvidesExplPackage{invoice2}{2017/08/16}{1.1}
+    {Intelligent invoices with LaTeX3}
 \LoadDictionaryFor{english}{invoice2}
 \LoadDictionaryFor{german}{invoice2}
 \DeclareTranslationFallback{invoice2-thousands-sep}{\,}
@@ -101,7 +101,7 @@
 l
 \bool_if:NT \l__invoicetwo_vat_nonzero_bool { c }
 r
-\bool_if:NT \l__invoicetwo_amount_nonone_bool { r }
+\bool_if:nT { \l__invoicetwo_amount_nonone_bool || \l__invoicetwo_vat_nonzero_bool } { r }
 }
 }
 \cs_new:Nn {\__invoicetwo_print_column_title:n}{
@@ -127,7 +127,7 @@
     }
 }
 \cs_new:Nn {\__invoicetwo_print_unit_price_title:}{
-    \bool_if:NT \l__invoicetwo_amount_nonone_bool {
+    \bool_if:nT { \l__invoicetwo_amount_nonone_bool || \l__invoicetwo_vat_nonzero_bool } {
         \__invoicetwo_print_column_title:n {\GetTranslation{invoice2-unit-price}} &
     }
 }
@@ -145,6 +145,14 @@
     \\
     \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
+}
+}
 \cs_new:Nn {\__invoicetwo_print_currency_value:n}{
     \num[round-precision={\int_use:N \l__invoicetwo_currency_fraction_digits_int},
     round-mode=places,
@@ -160,7 +168,7 @@
     \__invoicetwo_print_currency_value:n {\fp_use:N #1}
 }
 \cs_new:Nn {\__invoicetwo_print_percentage:n}{
-    \num[round-integer-to-decimal,,
+    \num[round-integer-to-decimal,
     group-minimum-digits=4,
     group-separator={\GetTranslation{invoice2-thousands-sep}},
     output-decimal-marker={\GetTranslation{invoice2-decimal-point}}]{
@@ -169,7 +177,7 @@
     \, \%
 }
 \cs_new:Nn {\__invoicetwo_update_trackers:nn}{
-    \int_compare:nT {#1 != 1}{
+    \fp_compare:nT {#1 != 1}{
         \bool_set_true:N \l__invoicetwo_amount_nonone_bool
     }
     \fp_compare:nT {#2 != 0}{
@@ -189,7 +197,7 @@
 }
 \cs_new:Nn {\__invoicetwo_print_amount:n}{
     \bool_if:NT \l__invoicetwo_amount_nonone_bool {
-        #1 &
+        \__invoicetwo_print_real_value:n {#1} &
     }
 }
 \cs_new:Nn {\__invoicetwo_print_item:n}{
@@ -200,9 +208,13 @@
         \__invoicetwo_print_percentage:n {#1} &
     }
 }
-\cs_new:Nn {\__invoicetwo_print_unit_price:n}{
-    \bool_if:NT \l__invoicetwo_amount_nonone_bool {
-        \__invoicetwo_print_currency_value:n {#1} &
+\cs_new:Nn {\__invoicetwo_print_unit_price:nn}{
+    \bool_if:nT { \l__invoicetwo_amount_nonone_bool || \l__invoicetwo_vat_nonzero_bool } {
+        \__invoicetwo_print_currency_value:n {
+            \fp_eval:n {
+                #2 \bool_if:NT \l__invoicetwo_included_vat_bool { / (1 + #1) }
+            }
+        } &
     }
 }
 \cs_new:Nn {\__invoicetwo_print_price:nnn}{
@@ -231,7 +243,7 @@
         \__invoicetwo_print_amount:n {#1}
         \__invoicetwo_print_item:n {#2}
         \__invoicetwo_print_vat:n {#3}
-        \__invoicetwo_print_unit_price:n {#4}
+        \__invoicetwo_print_unit_price:nn {#3} {#4}
         \__invoicetwo_print_price:nnn {#1} {#3} {#4} \\
     }
 }
@@ -249,7 +261,8 @@
     \int_eval:n {
         1
         \bool_if:NT \l__invoicetwo_vat_nonzero_bool {+1}
-        \bool_if:NT \l__invoicetwo_amount_nonone_bool {+2}
+        \bool_if:NT \l__invoicetwo_amount_nonone_bool {+1}
+        \bool_if:nT { \l__invoicetwo_amount_nonone_bool || \l__invoicetwo_vat_nonzero_bool } {+1}
     }
 }
 \cs_new:Nn {\__invoicetwo_print_footer_item:n}{



More information about the tex-live-commits mailing list