EK-Bericht Suchoptionen für Sollkonto und Erfassungsdatum
[kivitendo-erp.git] / templates / print / marei / kiviletter.sty
1 \NeedsTeXFormat{LaTeX2e}
2 \ProvidesPackage{kiviletter}[2020/04/24 Letter Layouts for Kivitendo]
3
4 \newif\if@kivi@infobox
5 \newif\if@kivi@footer
6 \DeclareOption{reffields}{\@kivi@infoboxfalse}
7 \DeclareOption{infobox}{\@kivi@infoboxtrue}
8 \DeclareOption{nofooter}{\@kivi@footerfalse}
9 \DeclareOption{footer}{\@kivi@footertrue}
10 \@kivi@infoboxtrue
11 \@kivi@footertrue
12
13 \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{scrletter}}
14
15 \ProcessOptions\relax
16
17
18 \RequirePackage{expl3}
19 \RequirePackage{xparse}
20 \RequirePackage{iftex}
21 \KOMAoptions{fontsize=12pt}
22 % Schriftart, Eingabelayout der Tastatur
23 \ifPDFTeX
24         \RequirePackage[utf8]{inputenc}% Nur notwendig, wenn Basis älter als TL2018
25         \RequirePackage[T1]{fontenc}
26         \RequirePackage{lmodern}
27
28         \RequirePackage{eurosym}
29         \DeclareUnicodeCharacter{20AC}{\euro}
30 \else
31         \RequirePackage{fontspec}
32 \fi
33
34 \RequirePackage{xltabular}
35 \RequirePackage{booktabs}
36 \RequirePackage{graphicx}
37
38
39
40 \RequirePackage[fromlogo,fromalign=right,
41   firstfoot=false,%Für einheitliche Randeinstellungen
42   refline=nodate,
43         ]{scrletter}
44 \LoadLetterOption{DIN}
45
46 \newkomavar{transaction}
47 \newkomavar[\lieferschein{}~\nr]{delivery}
48 \newkomavar[\angebot{}~\nr]{quote}
49 \newkomavar[\auftragsnummer]{orderID}
50 \newkomavar[\projektnummer]{projectID}
51 \setkomavar*{fromphone}{\textTelefon}
52 \setkomavar*{fromemail}{\textEmail}
53 \setkomavar*{fromfax}{\textFax}
54 \setkomavar*{customer}{\kundennummer}
55
56
57 \usepackage{geometry}
58
59 \ExplSyntaxOn
60 \dim_new:N \g_kivi_margin_dim
61 \dim_gset:Nn \g_kivi_margin_dim {\useplength{toaddrhpos}}
62 \geometry{a4paper,margin=\g_kivi_margin_dim,heightrounded}
63 %Scratch variables
64 \int_new:N \l_kivi_tmp_int
65 \bool_new:N \l_kivi_tmp_bool
66 \bool_new:N  \g_kivi_TableFoot_bool
67 \dim_new:N \g_kivi_orig@textheight_dim
68 \ExplSyntaxOff
69
70 \newsavebox{\shippingAddressBox}
71
72
73 \DeclareNewLayer[
74 foreground,
75 hoffset=\useplength{toaddrhpos},
76 voffset=\dimexpr\useplength{toaddrvpos}+\useplength{toaddrheight}+4\baselineskip,%sep to shippingaddressbox
77 contents={\usebox\shippingAddressBox}
78 ]{kivitendo.shippingaddress}
79
80 \newpairofpagestyles{kivitendo.letter}{}
81
82 \renewcommand*{\letterpagestyle}{kivitendo.letter}
83
84 \DeclareNewPageStyleByLayers{kivitendo.letter.first}{
85         kivitendo.shippingaddress,
86         plain.kivitendo.letter.head.odd,plain.kivitendo.letter.head.even,plain.kivitendo.letter.head.oneside,%
87         plain.kivitendo.letter.foot.odd,plain.kivitendo.letter.foot.even,plain.kivitendo.letter.foot.oneside,%
88 }
89
90 \setkomavar{backaddress}{\firma\ $\cdot$ \strasse\ $\cdot$ \ort}
91
92 \setkomavar{firsthead}{
93         \if@logo
94         \rlap{\usekomavar{fromlogo}}%
95         \fi
96 }
97
98 \@setplength{locwidth}{6cm}
99
100 \ExplSyntaxOn
101 \dim_new:N \l_kivi_tab_desc_leftskip_dim
102
103
104
105 \cs_new:Nn \__kivi_set_colwidth:nn  {
106         \dim_set:cn {l_kivi_tab_#1_dim} {#2}
107 }
108
109
110 \cs_new:Nn \__kivi_initialize_columns: {
111         \clist_map_inline:Nn \g_kivi_pricingtable_col_clist {
112                 \bool_if_exist:cF {l_kivi_col_##1_bool} 
113                 {
114                         \bool_new:c {l_kivi_col_##1_bool}
115                         \dim_new:c {l_kivi_tab_##1_dim}
116                         \keys_define:nn {kivi/PricingTable} {
117                                 ##1 .choice:,
118                                 ##1 / true .code:n = \bool_set_true:c {l_kivi_col_##1_bool},
119                                 ##1 / false .code:n = \bool_set_false:c {l_kivi_col_##1_bool},
120                                 ##1 / unknown .code:n = {
121                                         \bool_set_true:c {l_kivi_col_##1_bool}
122                                         \dim_set:cn {l_kivi_tab_##1_dim} {####1}
123                                 },
124                                 ##1 .default:n = true,
125                                 ##1 .initial:n = true,
126                                 ##1 / header .prop_put:c = {l_kivi_col_##1_prop},
127                                 ##1 / colspec .prop_put:c = {l_kivi_col_##1_prop},
128                         }
129                 }
130         }
131 }
132
133 \clist_new:N \g_kivi_pricingtable_col_clist
134
135 \keys_define:nn {kivi/PricingTable} {
136         columns .code:n = 
137         \clist_gset:Nn \g_kivi_pricingtable_col_clist {#1}
138         \__kivi_initialize_columns:,
139         columns .initial:n = {pos, id, desc, amount, price, pricetotal},
140 }
141
142 % set default values for colwidth
143 \keys_set:nn {kivi/PricingTable} {
144         pos=5ex,
145         id=4em,
146         amount=5em,
147         price=7em,
148         pricetotal=7em,
149 %       desc=auto,
150         pos/header=\position,
151         id/header=\artikelnummer,
152         desc/header=\bezeichnung,
153         amount/header=\menge,
154         price/header=\einzelpreis,
155         pricetotal/header=\gesamtpreis,
156         price / colspec = Price,
157         pricetotal / colspec = Price ,
158 }
159
160 \dim_new:N \g_kivi_tabcolsep_dim
161 \dim_gset:Nn \g_kivi_tabcolsep_dim {.5\tabcolsep}
162
163 \prg_new_conditional:Nnn \kivi_if_Price_col:n {T} {
164         \prop_get:cnN {l_kivi_col_#1_prop} {colspec} \l_tmpa_tl
165         \exp_args:NV \tl_if_eq:nnTF \l_tmpa_tl {Price}
166                 {\prg_return_true:}
167                 {\prg_return_false:}
168 }
169
170
171 \cs_new:Nn \__kivi_calc_desc_column: {
172         \dim_zero:N \l_kivi_tab_desc_leftskip_dim
173         \dim_zero:N \l_kivi_tab_desc_dim
174         \bool_set_false:N \l_tmpa_bool
175         \tl_gclear:N \g_kivi_Pricing_colspec_tl
176         \clist_map_inline:Nn \g_kivi_pricingtable_col_clist {
177                 \tl_if_eq:nnTF {##1} {desc}  {
178                         \dim_set:Nn \l_kivi_tab_desc_dim {
179                                 \textwidth-\l_kivi_tab_desc_leftskip_dim
180                         }
181                         \bool_set_true:N \l_tmpa_bool
182                         \tl_gput_right:Nn \g_kivi_Pricing_colspec_tl {p{\l_kivi_tab_desc_dim}}
183                 }{
184                         \bool_if:cT {l_kivi_col_##1_bool} {
185                                 \bool_if:NTF \l_tmpa_bool {
186                                         \dim_sub:Nn \l_kivi_tab_desc_dim {
187                                                 \dim_use:c {l_kivi_tab_##1_dim}+2\g_kivi_tabcolsep_dim
188                                         }
189                                 }{
190                                         \dim_add:Nn \l_kivi_tab_desc_leftskip_dim {
191                                                 \dim_use:c {l_kivi_tab_##1_dim}+2\g_kivi_tabcolsep_dim
192                                         }
193                                 }
194                                 \tl_gput_right:Nn \g_kivi_Pricing_colspec_tl {K{\dim_use:c {l_kivi_tab_##1_dim}}}
195                                 \kivi_if_Price_col:nT {##1} {\tl_gput_right:Nn \g_kivi_Pricing_colspec_tl {<{\__kivi_tab_column_currency:}}}
196                         }
197                 }
198         }
199         \tl_gput_left:Nn \g_kivi_Pricing_colspec_tl {@{}}
200         \tl_gput_right:Nn \g_kivi_Pricing_colspec_tl {@{}}
201 }
202
203 \newcolumntype{K}[1]{>{\raggedleft\arraybackslash}p{#1}}
204 \newcolumntype{P}[1]{K{#1}<{\__kivi_tab_column_currency:}}
205
206 \RequirePackage{tcolorbox}
207 \tcbuselibrary{breakable, skins}
208
209 \tcb@new@skin{kivi@LT}{base@unbroken,%
210         frame~engine=empty,interior~titled~engine=empty,interior~engine=empty,segmentation~engine=empty,title~engine=empty,%
211         skin~first=kivi@LT@first,skin~middle=kivi@LT@middle,skin~last=kivi@LT@last,
212         underlay~first~and~middle={
213                 \node[anchor=north]  at (interior.north)  {\csname box_use:c\endcsname  {g_kivi_LT@head_box}};
214                 \node[anchor=south]  at (interior.south)  {\csname box_use:c\endcsname  {g_kivi_LT@foot_box}};
215         },
216         underlay~unbroken~and~last={
217         \node[anchor=north]  at (interior.north)  {\csname box_use:c\endcsname  {g_kivi_LT@head_box}};
218         \node[anchor=south]  at (interior.south)  {\csname box_use:c\endcsname  {g_kivi_LT@lastfoot_box}};
219         },
220         boxsep=0pt,
221         boxrule=0pt,
222         left=0pt,
223         right=0pt,
224         bottom=\box_ht:N  \g_kivi_LT@foot_box+\box_dp:N  \g_kivi_LT@foot_box + \aboverulesep,
225         top=\box_ht:N  \g_kivi_LT@head_box+\box_dp:N  \g_kivi_LT@head_box +\belowrulesep,
226         parbox=false,
227 }
228
229 \tcb@new@skin{kivi@LT@first}{base@first,%
230         frame~engine=empty,interior~titled~engine=empty,interior~engine=empty,segmentation~engine=empty,title~engine=empty,%
231         skin~first=kivi@LT@first,skin~middle=kivi@LT@middle,skin~last=kivi@LT@middle,
232 }
233
234 \tcb@new@skin{kivi@LT@middle}{base@middle,%
235         frame~engine=empty,interior~titled~engine=empty,interior~engine=empty,segmentation~engine=empty,title~engine=empty,%
236         skin~first=kivi@LT@middle,skin~middle=kivi@LT@middle,skin~last=kivi@LT@middle,
237 }
238
239 \tcb@new@skin{kivi@LT@last}{base@last,%
240         frame~engine=empty,interior~titled~engine=empty,interior~engine=empty,segmentation~engine=empty,title~engine=empty,%
241         skin~first=kivi@LT@middle,skin~middle=kivi@LT@middle,skin~last=kivi@LT@last,
242 }
243
244 \tcbset{kivi@LT/.style={skin=kivi@LT}}%
245
246
247
248 \seq_new:N \l_kivi_PricingTable_seq
249 \seq_new:N \l_kivi_columns_seq
250 \seq_new:N \g_kivi_extraDescription_seq
251 \newcommand{\FakeTable}[1]{
252         \par
253         \seq_set_split:Nnn \l_kivi_PricingTable_seq {\tabularnewline} {#1}
254         \seq_remove_all:Nn \l_kivi_PricingTable_seq {}
255         \begingroup
256         \setlength{\parskip}{\c_zero_dim}
257         \let\ExtraDescription\__kivi_addExtraDescription:n
258         \setlength{\tabcolsep}{\g_kivi_tabcolsep_dim}
259         \seq_map_inline:Nn \l_kivi_PricingTable_seq {
260                 \seq_set_split:Nnn  \l_kivi_columns_seq {&} {##1}
261         \seq_gclear:N \g_kivi_extraDescription_seq
262         \exp_args:Nnx \use:n {\tabular[t]}\g_kivi_Pricing_colspec_tl
263                 \seq_pop_left:NN \__l_FakeTable_columns_seq \l_tmpa_tl
264                 \seq_item:Nn \l_kivi_columns_seq {\l_tmpa_tl}
265                 \seq_map_inline:Nn \__l_FakeTable_columns_seq {
266                         &\seq_item:Nn \l_kivi_columns_seq {####1}
267                 }
268         \endtabular
269         \seq_if_empty:NTF \g_kivi_extraDescription_seq
270         {\par}
271         {\par\nopagebreak
272         \begingroup
273         \setlength{\hsize}{\dimexpr\l_kivi_tab_desc_dim+\l_kivi_tab_desc_leftskip_dim}
274         \setlength{\leftskip}{\l_kivi_tab_desc_leftskip_dim}
275         \usekomafont{extraDescription}
276         \seq_use:Nn \g_kivi_extraDescription_seq {\\}
277         \par
278         \endgroup
279         }
280         }
281         \endgroup
282 }
283
284
285 \seq_new:N  \__l_FakeTable_columns_seq
286 \cs_new:Nn \__kivi_setup_FakeTable: {
287         \seq_clear:N \__l_FakeTable_columns_seq
288         \int_zero:N \l_tmpa_int
289         \clist_map_inline:Nn \g_kivi_pricingtable_col_clist {
290                 \int_incr:N \l_tmpa_int
291                 \bool_if:cT {l_kivi_col_##1_bool} {\seq_put_right:Nx \__l_FakeTable_columns_seq {\int_use:N \l_tmpa_int}}
292         }
293 }
294
295 \tl_new:N \g_kivi_Pricing_colspec_tl
296 \tl_gset:Nn \g_kivi_Pricing_colspec_tl {
297         @{}
298         \bool_if:NT \l_kivi_col_pos_bool {p{\l_kivi_tab_pos_dim}}
299         \bool_if:NT \l_kivi_col_id_bool {p{\l_kivi_tab_id_dim}}
300         p{\l_kivi_tab_desc_dim}
301         \bool_if:NT \l_kivi_col_amount_bool {\exp_not:n {>{\raggedleft\arraybackslash}p{\l_kivi_tab_amount_dim}}}
302         \bool_if:NT \l_kivi_col_price_bool {\exp_not:n {>{\raggedleft\arraybackslash}p{\l_kivi_tab_price_dim}<{\__kivi_tab_column_currency:}}}
303         \bool_if:NT \l_kivi_col_pricetotal_bool {\exp_not:n {>{\raggedleft\arraybackslash}p{\l_kivi_tab_pricetotal_dim}<{\__kivi_tab_column_currency:}}}
304         @{}
305 }
306
307 \cs_new_protected:Nn \__kivi_tab_column_currency: {\,\currency}
308 \def\tabcurrency{\__kivi_tab_column_currency:}
309 \cs_set:Nn \__kivi_tab_column_header_currency: {}
310 \cs_set_eq:NN \__kivi_tab_column_body_currency:  \__kivi_tab_column_currency:
311
312 \clist_map_inline:nn {head, foot, firsthead, lastfoot} {%TODO reduce
313         \box_new:c {g_kivi_LT@#1_box}
314 }
315
316 \newkomafont{PricingTableHeader}{\bfseries}
317
318 \cs_new:Nn \__kivi_setup_LT_boxes: {
319         \__kivi_calc_desc_column:
320         \hbox_gset:Nn \g_kivi_LT@head_box {
321                 \setlength{\tabcolsep}{\g_kivi_tabcolsep_dim}
322                 \exp_args:Nnx \use:n {\tabular[b]}\g_kivi_Pricing_colspec_tl
323                 \__kivi_PricingTabular_header:
324                 \endtabular
325         }
326         \hbox_gset:Nn \g_kivi_LT@foot_box {
327                 \raisebox{\depth}{
328                         \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}r@{}}
329                                 \midrule
330                                 \strut\weiteraufnaechsterseite
331                         \end{tabular*}
332                 }
333         }
334         \hbox_gset:Nn \g_kivi_LT@lastfoot_box {
335                 \raisebox{\dimexpr\depth+\baselineskip}[0pt][0pt]{
336                         \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}r@{}}
337                                 \bottomrule
338                         \end{tabular*}
339                 }
340         }
341 }
342
343
344 %Macht es sinn hier eine Variante zu machen, in der alle Spalten Belegbar sind?
345 \newenvironment{PricingTotal}{
346         \par\nointerlineskip
347         \unskip
348         \tabular[t]{@{}p{\dim_eval:n {\linewidth-\l_kivi_tab_pricetotal_dim-2\tabcolsep}}P{\l_kivi_tab_pricetotal_dim}@{}}
349         \midrule
350 }{
351         \endtabular
352 }
353
354
355 \newcommand*\ExtraDescription{
356         \PackageError{kiviletter}{The~command~\string\ExtraDescription\space~may~be~only~used~inside~the~\string\FakeTable\space~environment.}{See~documentation~for~details}
357 }
358
359
360 \cs_new:Nn \__kivi_addExtraDescription:n {\seq_gput_right:Nn \g_kivi_extraDescription_seq {#1}}
361
362 \newenvironment{PricingTabular}[1][]{
363         \begingroup
364         \dim_set:Nn \parskip {\c_zero_dim}
365         \tl_if_empty:nF {#1} {\keys_set:nn {kivi/PricingTable} {#1}}
366         \setlength{\tabcolsep}{\g_kivi_tabcolsep_dim}
367         \__kivi_calc_desc_column:
368         \exp_args:Nx \longtable \g_kivi_Pricing_colspec_tl
369         % Tabellenkopf
370         \__kivi_PricingTabular_header:
371         \endhead
372         \midrule
373         \rlap{\makebox[\textwidth][r]{\weiteraufnaechsterseite}}\\
374         \endfoot
375         \bottomrule
376         \endlastfoot
377 }{
378         \endlongtable
379         \endgroup
380 }
381
382 \cs_set:Nn \__kivi_PricingTabular_header: {
383         \toprule
384         \cs_gset_eq:NN \__kivi_tab_column_currency: \__kivi_tab_column_header_currency:
385         \bool_set_false:N \l_tmpa_bool
386         \clist_map_inline:Nn \g_kivi_pricingtable_col_clist     {
387                 \bool_if:cT {l_kivi_col_##1_bool} {
388                         \bool_if:NT \l_tmpa_bool {&}
389                         \bool_set_true:N \l_tmpa_bool
390                         \usekomafont{PricingTableHeader}
391                         \prop_item:cn {l_kivi_col_##1_prop} {header}
392                 }
393         }
394         \cs_gset_eq:NN \__kivi_tab_column_currency: \__kivi_tab_column_body_currency:
395         \\
396         \midrule
397 }
398
399
400 \keys_define:nn {kivi/SimpleTabular} {
401         colspec .tl_set:N =\l_kivi_SimpleTabular_colspec_tl,
402         colspec .initial:n = {rrX},
403         headline .tl_set:N = \l_kivi_SimpleTabular_headline_tl,
404         headline .initial:n = {\bfseries\position & \bfseries\menge & \bfseries\bezeichnung},
405 }
406
407 \newcommand*{\SetupSimpleTabular}[1]{\keys_set:nn {kivi/SimpleTabular} {#1}}
408 \newcommand*{\SetupPricingTabular}[1]{\keys_set:nn {kivi/PricingTable} {#1}}
409
410 \newenvironment{SimpleTabular}[1][]
411 {
412         \tl_if_in:nnTF {#1} {=} {\keys_set:nn {kivi/SimpleTabular} {#1}} {\tl_if_empty:nF {#1} {\tl_set:Nn \l_kivi_SimpleTabular_headline_tl {#1}}}
413         \setlength{\tabcolsep}{\g_kivi_tabcolsep_dim}
414         \dim_set:Nn \parskip {\c_zero_dim}
415         \tl_put_right:Nn \l_kivi_SimpleTabular_colspec_tl {@{}}
416         \tl_put_left:Nn \l_kivi_SimpleTabular_colspec_tl {@{}}
417         \exp_args:NnV \xltabular{\linewidth}\l_kivi_SimpleTabular_colspec_tl
418                 \toprule
419                 \cs_gset_eq:NN \__kivi_tab_column_currency: \__kivi_tab_column_header_currency:
420                 \l_kivi_SimpleTabular_headline_tl
421                 \\
422                 \noalign{\cs_gset_eq:NN \__kivi_tab_column_currency: \__kivi_tab_column_body_currency:}
423                 \midrule
424         \endhead
425                 \midrule
426                 \rlap{\makebox[\textwidth][r]{\weiteraufnaechsterseite}}\\
427         \endfoot
428                 \bottomrule
429         \endlastfoot
430         \ignorespaces
431 }{
432         \def\@currenvir{tabularx}
433         \endxltabular
434 }
435
436 %PricingTabular* kann automatisch spalten ignorieren
437 % \begin{PricingTabular*}[id=false]
438 % deaktiviert damit die Spalte der Produktnummer
439 % analog ist dies für pos, amount, price, pricetotal möglich.
440 % Die Spalte der Bezeichnung ist nicht deaktivierbar
441 \newenvironment{PricingTabular*}[1][]{
442         \tl_if_empty:nF {#1} {\keys_set:nn {kivi/PricingTable} {#1}}
443         \__kivi_setup_LT_boxes:
444         \__kivi_setup_FakeTable:
445         \dim_set:Nn \parskip {\c_zero_dim}
446         \PricingTabularBox\ignorespaces
447 }{\endPricingTabularBox}
448
449 \newtcolorbox{PricingTabularBox}{breakable,skin=kivi@LT}
450
451 \if@kivi@infobox
452
453         \def\locationsep{:}
454
455         \NewDocumentCommand{\locationentry}{som}{
456                 \Ifkomavarempty{#3}{}{
457                 \IfBooleanTF {#1} {
458                         \strut
459                         \IfNoValueTF {#2}
460                                 {\usekomavar*{#3}}
461                                 {#2}
462                         \locationsep
463                         \hfill\strut\space
464                         \hbox_set:Nn \l_tmpa_box {\usekomavar{#3}}
465                         \dim_compare:nTF {\box_wd:N \l_tmpa_box>\linewidth}
466                                 {\newline\hspace*{\fill}\llap}
467                                 {\hspace*{\fill}}
468                                 {\box_use:N \l_tmpa_box\strut}
469                 }{
470                         \@hangfrom{\strut
471                                 \IfNoValueTF {#2}
472                                         {\usekomavar*{#3}}
473                                         {#2}\locationsep~
474                         }{
475                                 \parbox[t]{\dimexpr\linewidth-\hangindent}{
476                                         \raggedleft
477                                         \usekomavar{#3}\strut
478                                 }
479                         }
480                 }
481                 }
482                 \par
483         }
484
485
486 \setkomavar{location}{
487         \Ifkomavarempty{transaction}{}{
488         \bfseries
489         \usekomavar{transaction}
490         }
491         \par
492         \medskip
493         \parbox{\useplength{locwidth}}{
494                 \locationentry{date}
495                 \locationentry{myref}
496                 \locationentry{customer}
497                 \locationentry{yourref}
498                 \locationentry{delivery}
499                 \locationentry{quote}
500                 \locationentry{orderID}
501                 \locationentry{projectID}
502                 \locationentry[\ansprechpartner]{fromname}
503                 \locationentry{fromphone}
504                 \locationentry*{fromemail}
505         }
506 }
507 \removereffields
508 \AtBeginLetter{
509         \ifdim\ht\shippingAddressBox>\z@
510         \@addtoplength{refvpos}{\dimexpr\ht\shippingAddressBox+\dp\shippingAddressBox}
511         \@addtoplength{refvpos}{4\baselineskip}%sep between address boxes
512         \fi
513 }
514
515 \fi
516
517 %Fallback for older KOMA-Script-Versions
518 \cs_if_exist:NF \Ifstr {\let\Ifstr\ifstr}
519 \cs_if_exist:NF \Ifkomavarempty {\let\Ifkomavarempty\ifkomavarempty}
520
521 %Definitionen für die insettings.tex
522
523 \newcommand*{\setupIdentpath}[1]{
524         \int_set:Nn \l_kivi_tmp_int {1}
525         \bool_set_true:N \l_kivi_tmp_bool
526         \bool_while_do:Nn \l_kivi_tmp_bool {
527                 \file_if_exist:nTF {firma\int_use:N \l_kivi_tmp_int/ident.tex}
528                 {
529                         \exp_args:Nf \str_if_in:nnTF {#1} {Firma\int_use:N \l_kivi_tmp_int}
530                         {
531                                 \newcommand*{\identpath}{firma\int_use:N \l_kivi_tmpa_int}
532                                 \bool_set_false:N \l_kivi_tmp_bool
533                         }
534                         {\int_incr:N \l_kivi_tmp_int}
535                 }
536                 {
537                         \bool_set_false:N \l_kivi_tmp_bool
538                         \newcommand*{\identpath}{firma}
539                 }
540         }
541 }
542
543 \newcommand*{\setupCurrencyConfig}[2]{
544         \tl_new:N \g_kivi_currency_tl
545         \exp_args:Nf \str_if_in:nnT {#2} {USD} {\tl_gset:Nn \g_kivi_currency_tl {usd}}
546         \exp_args:Nf \str_if_in:nnT {#2} {CHF} {\tl_gset:Nn \g_kivi_currency_tl {chf}}
547         \exp_args:Nf \str_if_in:nnT {#2} {EUR} {\tl_gset:Nn \g_kivi_currency_tl {euro}}
548         \tl_if_empty:NT  \g_kivi_currency_tl {
549                 \tl_gset:Nn \g_kivi_currency_tl {default}
550                 \edef \currency {\tl_to_str:N \lxcurrency}
551         }
552         \input{#1/\g_kivi_currency_tl _account.tex}
553 }
554
555 \ExplSyntaxOff
556
557
558 \renewcommand*{\raggedsignature}{\raggedright}
559
560 \newkomafont{extraDescription}{}
561
562 \endinput