diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/invoice2/invoice2.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/invoice2/invoice2.sty | 76 |
1 files changed, 53 insertions, 23 deletions
diff --git a/Master/texmf-dist/tex/latex/invoice2/invoice2.sty b/Master/texmf-dist/tex/latex/invoice2/invoice2.sty index 4972d781de5..8609a7a7cc9 100644 --- a/Master/texmf-dist/tex/latex/invoice2/invoice2.sty +++ b/Master/texmf-dist/tex/latex/invoice2/invoice2.sty @@ -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,18 +21,24 @@ %% 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} \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,13 +105,13 @@ \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}{ @@ -128,11 +137,20 @@ r } \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,12 +164,12 @@ r \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}, @@ -162,7 +180,9 @@ output-decimal-marker={\GetTranslation{invoice2-decimal-point}}]{ 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 @@ output-decimal-marker={\GetTranslation{invoice2-decimal-point}}]{ } \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 @@ output-decimal-marker={\GetTranslation{invoice2-decimal-point}}]{ } \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 @@ output-decimal-marker={\GetTranslation{invoice2-decimal-point}}]{ } } \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:}{ |