MT940-Import: AQBanking-Unterstützung entfernt
[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         \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 {>{\raggedleft\arraybackslash}p{\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{P}[1]{>{\raggedleft\arraybackslash}p{#1}<{\__kivi_tab_column_currency:}}
204
205 \RequirePackage{tcolorbox}
206 \tcbuselibrary{breakable, skins}
207
208 \tcb@new@skin{kivi@LT}{base@unbroken,%
209         frame~engine=empty,interior~titled~engine=empty,interior~engine=empty,segmentation~engine=empty,title~engine=empty,%
210         skin~first=kivi@LT@first,skin~middle=kivi@LT@middle,skin~last=kivi@LT@last,
211         underlay~first~and~middle={
212                 \node[anchor=north]  at (interior.north)  {\csname box_use:c\endcsname  {g_kivi_LT@head_box}};
213                 \node[anchor=south]  at (interior.south)  {\csname box_use:c\endcsname  {g_kivi_LT@foot_box}};
214         },
215         underlay~unbroken~and~last={
216         \node[anchor=north]  at (interior.north)  {\csname box_use:c\endcsname  {g_kivi_LT@head_box}};
217         \node[anchor=south]  at (interior.south)  {\csname box_use:c\endcsname  {g_kivi_LT@lastfoot_box}};
218         },
219         boxsep=0pt,
220         boxrule=0pt,
221         left=0pt,
222         right=0pt,
223         bottom=\box_ht:N  \g_kivi_LT@foot_box+\box_dp:N  \g_kivi_LT@foot_box + \aboverulesep,
224         top=\box_ht:N  \g_kivi_LT@head_box+\box_dp:N  \g_kivi_LT@head_box +\belowrulesep,
225         parbox=false,
226 }
227
228 \tcb@new@skin{kivi@LT@first}{base@first,%
229         frame~engine=empty,interior~titled~engine=empty,interior~engine=empty,segmentation~engine=empty,title~engine=empty,%
230         skin~first=kivi@LT@first,skin~middle=kivi@LT@middle,skin~last=kivi@LT@middle,
231 }
232
233 \tcb@new@skin{kivi@LT@middle}{base@middle,%
234         frame~engine=empty,interior~titled~engine=empty,interior~engine=empty,segmentation~engine=empty,title~engine=empty,%
235         skin~first=kivi@LT@middle,skin~middle=kivi@LT@middle,skin~last=kivi@LT@middle,
236 }
237
238 \tcb@new@skin{kivi@LT@last}{base@last,%
239         frame~engine=empty,interior~titled~engine=empty,interior~engine=empty,segmentation~engine=empty,title~engine=empty,%
240         skin~first=kivi@LT@middle,skin~middle=kivi@LT@middle,skin~last=kivi@LT@last,
241 }
242
243 \tcbset{kivi@LT/.style={skin=kivi@LT}}%
244
245
246
247 \seq_new:N \l_kivi_PricingTable_seq
248 \seq_new:N \l_kivi_columns_seq
249 \seq_new:N \g_kivi_extraDescription_seq
250 \newcommand{\FakeTable}[1]{
251         \par
252         \seq_set_split:Nnn \l_kivi_PricingTable_seq {\tabularnewline} {#1}
253         \seq_remove_all:Nn \l_kivi_PricingTable_seq {}
254         \begingroup
255         \setlength{\parskip}{\c_zero_dim}
256         \let\ExtraDescription\__kivi_addExtraDescription:n
257         \setlength{\tabcolsep}{\g_kivi_tabcolsep_dim}
258         \seq_map_inline:Nn \l_kivi_PricingTable_seq {
259                 \seq_set_split:Nnn  \l_kivi_columns_seq {&} {##1}
260         \seq_gclear:N \g_kivi_extraDescription_seq
261         \exp_args:Nnx \use:n {\tabular[t]}\g_kivi_Pricing_colspec_tl
262                 \seq_pop_left:NN \__l_FakeTable_columns_seq \l_tmpa_tl
263                 \seq_item:Nn \l_kivi_columns_seq {\l_tmpa_tl}
264                 \seq_map_inline:Nn \__l_FakeTable_columns_seq {
265                         &\seq_item:Nn \l_kivi_columns_seq {####1}
266                 }
267         \endtabular
268         \seq_if_empty:NTF \g_kivi_extraDescription_seq
269         {\par}
270         {\par\nopagebreak
271         \begingroup
272         \setlength{\hsize}{\dimexpr\l_kivi_tab_desc_dim+\l_kivi_tab_desc_leftskip_dim}
273         \setlength{\leftskip}{\l_kivi_tab_desc_leftskip_dim}
274         \usekomafont{extraDescription}
275         \seq_use:Nn \g_kivi_extraDescription_seq {\\}
276         \par
277         \endgroup
278         }
279         }
280         \endgroup
281 }
282
283
284 \seq_new:N  \__l_FakeTable_columns_seq
285 \cs_new:Nn \__kivi_setup_FakeTable: {
286         \seq_clear:N \__l_FakeTable_columns_seq
287         \int_zero:N \l_tmpa_int
288         \clist_map_inline:Nn \g_kivi_pricingtable_col_clist {
289                 \int_incr:N \l_tmpa_int
290                 \bool_if:cT {l_kivi_col_##1_bool} {\seq_put_right:Nx \__l_FakeTable_columns_seq {\int_use:N \l_tmpa_int}}
291         }
292 }
293
294 \tl_new:N \g_kivi_Pricing_colspec_tl
295 \tl_gset:Nn \g_kivi_Pricing_colspec_tl {
296         @{}
297         \bool_if:NT \l_kivi_col_pos_bool {p{\l_kivi_tab_pos_dim}}
298         \bool_if:NT \l_kivi_col_id_bool {p{\l_kivi_tab_id_dim}}
299         p{\l_kivi_tab_desc_dim}
300         \bool_if:NT \l_kivi_col_amount_bool {\exp_not:n {>{\raggedleft\arraybackslash}p{\l_kivi_tab_amount_dim}}}
301         \bool_if:NT \l_kivi_col_price_bool {\exp_not:n {>{\raggedleft\arraybackslash}p{\l_kivi_tab_price_dim}<{\__kivi_tab_column_currency:}}}
302         \bool_if:NT \l_kivi_col_pricetotal_bool {\exp_not:n {>{\raggedleft\arraybackslash}p{\l_kivi_tab_pricetotal_dim}<{\__kivi_tab_column_currency:}}}
303         @{}
304 }
305
306 \cs_new_protected:Nn \__kivi_tab_column_currency: {\,\currency}
307 \def\tabcurrency{\__kivi_tab_column_currency:}
308 \cs_set:Nn \__kivi_tab_column_header_currency: {}
309 \cs_set_eq:NN \__kivi_tab_column_body_currency:  \__kivi_tab_column_currency:
310
311 \clist_map_inline:nn {head, foot, firsthead, lastfoot} {%TODO reduce
312         \box_new:c {g_kivi_LT@#1_box}
313 }
314
315 \newkomafont{PricingTableHeader}{\bfseries}
316
317 \cs_new:Nn \__kivi_setup_LT_boxes: {
318         \__kivi_calc_desc_column:
319         \hbox_gset:Nn \g_kivi_LT@head_box {
320                 \setlength{\tabcolsep}{\g_kivi_tabcolsep_dim}
321                 \exp_args:Nnx \use:n {\tabular[b]}\g_kivi_Pricing_colspec_tl
322                 \__kivi_PricingTabular_header:
323                 \endtabular
324         }
325         \hbox_gset:Nn \g_kivi_LT@foot_box {
326                 \raisebox{\depth}{
327                         \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}r@{}}
328                                 \midrule
329                                 \strut\weiteraufnaechsterseite
330                         \end{tabular*}
331                 }
332         }
333         \hbox_gset:Nn \g_kivi_LT@lastfoot_box {
334                 \raisebox{\dimexpr\depth+\baselineskip}[0pt][0pt]{
335                         \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}r@{}}
336                                 \bottomrule
337                         \end{tabular*}
338                 }
339         }
340 }
341
342
343 %Macht es sinn hier eine Variante zu machen, in der alle Spalten Belegbar sind?
344 \newenvironment{PricingTotal}{
345         \par\nointerlineskip
346         \unskip
347         \tabular[t]{@{}p{\dim_eval:n {\linewidth-\l_kivi_tab_pricetotal_dim-2\tabcolsep}}P{\l_kivi_tab_pricetotal_dim}@{}}
348         \midrule
349 }{
350         \endtabular
351 }
352
353
354 \newcommand*\ExtraDescription{
355         \PackageError{kiviletter}{The~command~\string\ExtraDescription\space~may~be~only~used~inside~the~\string\FakeTable\space~environment.}{See~documentation~for~details}
356 }
357
358
359 \cs_new:Nn \__kivi_addExtraDescription:n {\seq_gput_right:Nn \g_kivi_extraDescription_seq {#1}}
360
361 \newenvironment{PricingTabular}[1][]{
362         \begingroup
363         \dim_set:Nn \parskip {\c_zero_dim}
364         \tl_if_empty:nF {#1} {\keys_set:nn {kivi/PricingTable} {#1}}
365         \setlength{\tabcolsep}{\g_kivi_tabcolsep_dim}
366         \__kivi_calc_desc_column:
367         \exp_args:Nx \longtable \g_kivi_Pricing_colspec_tl
368         % Tabellenkopf
369         \__kivi_PricingTabular_header:
370         \endhead
371         \midrule
372         \rlap{\makebox[\textwidth][r]{\weiteraufnaechsterseite}}\\
373         \endfoot
374         \bottomrule
375         \endlastfoot
376 }{
377         \endlongtable
378         \endgroup
379 }
380
381 \cs_set:Nn \__kivi_PricingTabular_header: {
382         \toprule
383         \cs_gset_eq:NN \__kivi_tab_column_currency: \__kivi_tab_column_header_currency:
384         \bool_set_false:N \l_tmpa_bool
385         \clist_map_inline:Nn \g_kivi_pricingtable_col_clist     {
386                 \bool_if:cT {l_kivi_col_##1_bool} {
387                         \bool_if:NT \l_tmpa_bool {&}
388                         \bool_set_true:N \l_tmpa_bool
389                         \usekomafont{PricingTableHeader}
390                         \prop_item:cn {l_kivi_col_##1_prop} {header}
391                 }
392         }
393         \cs_gset_eq:NN \__kivi_tab_column_currency: \__kivi_tab_column_body_currency:
394         \\
395         \midrule
396 }
397
398
399 \keys_define:nn {kivi/SimpleTabular} {
400         colspec .tl_set:N =\l_kivi_SimpleTabular_colspec_tl,
401         colspec .initial:n = {rrX},
402         headline .tl_set:N = \l_kivi_SimpleTabular_headline_tl,
403         headline .initial:n = {\bfseries\position & \bfseries\menge & \bfseries\bezeichnung},
404 }
405
406 \newcommand*{\SetupSimpleTabular}[1]{\keys_set:nn {kivi/SimpleTabular} {#1}}
407 \newcommand*{\SetupPricingTabular}[1]{\keys_set:nn {kivi/PricingTable} {#1}}
408
409 \newenvironment{SimpleTabular}[1][]
410 {
411         \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}}}
412         \setlength{\tabcolsep}{\g_kivi_tabcolsep_dim}
413         \dim_set:Nn \parskip {\c_zero_dim}
414         \tl_put_right:Nn \l_kivi_SimpleTabular_colspec_tl {@{}}
415         \tl_put_left:Nn \l_kivi_SimpleTabular_colspec_tl {@{}}
416         \exp_args:NnV \xltabular{\linewidth}\l_kivi_SimpleTabular_colspec_tl
417                 \toprule
418                 \cs_gset_eq:NN \__kivi_tab_column_currency: \__kivi_tab_column_header_currency:
419                 \l_kivi_SimpleTabular_headline_tl
420                 \\
421                 \noalign{\cs_gset_eq:NN \__kivi_tab_column_currency: \__kivi_tab_column_body_currency:}
422                 \midrule
423         \endhead
424                 \midrule
425                 \rlap{\makebox[\textwidth][r]{\weiteraufnaechsterseite}}\\
426         \endfoot
427                 \bottomrule
428         \endlastfoot
429         \ignorespaces
430 }{
431         \def\@currenvir{tabularx}
432         \endxltabular
433 }
434
435 %PricingTabular* kann automatisch spalten ignorieren
436 % \begin{PricingTabular*}[id=false]
437 % deaktiviert damit die Spalte der Produktnummer
438 % analog ist dies für pos, amount, price, pricetotal möglich.
439 % Die Spalte der Bezeichnung ist nicht deaktivierbar
440 \newenvironment{PricingTabular*}[1][]{
441         \tl_if_empty:nF {#1} {\keys_set:nn {kivi/PricingTable} {#1}}
442         \__kivi_setup_LT_boxes:
443         \__kivi_setup_FakeTable:
444         \dim_set:Nn \parskip {\c_zero_dim}
445         \PricingTabularBox\ignorespaces
446 }{\endPricingTabularBox}
447
448 \newtcolorbox{PricingTabularBox}{breakable,skin=kivi@LT}
449
450 \if@kivi@infobox
451
452         \def\locationsep{:}
453
454         \NewDocumentCommand{\locationentry}{som}{
455                 \Ifkomavarempty{#3}{}{
456                 \IfBooleanTF {#1} {
457                         \strut
458                         \IfNoValueTF {#2}
459                                 {\usekomavar*{#3}}
460                                 {#2}
461                         \locationsep
462                         \hfill\strut\space
463                         \hbox_set:Nn \l_tmpa_box {\usekomavar{#3}}
464                         \dim_compare:nTF {\box_wd:N \l_tmpa_box>\linewidth}
465                                 {\newline\hspace*{\fill}\llap}
466                                 {\hspace*{\fill}}
467                                 {\box_use:N \l_tmpa_box\strut}
468                 }{
469                         \@hangfrom{\strut
470                                 \IfNoValueTF {#2}
471                                         {\usekomavar*{#3}}
472                                         {#2}\locationsep~
473                         }{
474                                 \parbox[t]{\dimexpr\linewidth-\hangindent}{
475                                         \raggedleft
476                                         \usekomavar{#3}\strut
477                                 }
478                         }
479                 }
480                 }
481                 \par
482         }
483
484
485 \setkomavar{location}{
486         \Ifkomavarempty{transaction}{}{
487         \bfseries
488         \usekomavar{transaction}
489         }
490         \par
491         \medskip
492         \parbox{\useplength{locwidth}}{
493                 \locationentry{date}
494                 \locationentry{myref}
495                 \locationentry{customer}
496                 \locationentry{yourref}
497                 \locationentry{delivery}
498                 \locationentry{quote}
499                 \locationentry{orderID}
500                 \locationentry{projectID}
501                 \locationentry[\ansprechpartner]{fromname}
502                 \locationentry{fromphone}
503                 \locationentry*{fromemail}
504         }
505 }
506 \removereffields
507 \AtBeginLetter{
508         \ifdim\ht\shippingAddressBox>\z@
509         \@addtoplength{refvpos}{\dimexpr\ht\shippingAddressBox+\dp\shippingAddressBox}
510         \@addtoplength{refvpos}{4\baselineskip}%sep between address boxes
511         \fi
512 }
513
514 \fi
515
516 %Fallback for older KOMA-Script-Versions
517 \cs_if_exist:NF \Ifstr {\let\Ifstr\ifstr}
518 \cs_if_exist:NF \Ifkomavarempty {\let\Ifkomavarempty\ifkomavarempty}
519
520 %Definitionen für die insettings.tex
521
522 \newcommand*{\setupIdentpath}[1]{
523         \int_set:Nn \l_kivi_tmp_int {1}
524         \bool_set_true:N \l_kivi_tmp_bool
525         \bool_while_do:Nn \l_kivi_tmp_bool {
526                 \file_if_exist:nTF {firma\int_use:N \l_kivi_tmp_int/ident.tex}
527                 {
528                         \exp_args:Nf \str_if_in:nnTF {#1} {Firma\int_use:N \l_kivi_tmp_int}
529                         {
530                                 \newcommand*{\identpath}{firma\int_use:N \l_kivi_tmpa_int}
531                                 \bool_set_false:N \l_kivi_tmp_bool
532                         }
533                         {\int_incr:N \l_kivi_tmp_int}
534                 }
535                 {
536                         \bool_set_false:N \l_kivi_tmp_bool
537                         \newcommand*{\identpath}{firma}
538                 }
539         }
540 }
541
542 \newcommand*{\setupCurrencyConfig}[2]{
543         \tl_new:N \g_kivi_currency_tl
544         \exp_args:Nf \str_if_in:nnT {#2} {USD} {\tl_gset:Nn \g_kivi_currency_tl {usd}}
545         \exp_args:Nf \str_if_in:nnT {#2} {CHF} {\tl_gset:Nn \g_kivi_currency_tl {chf}}
546         \exp_args:Nf \str_if_in:nnT {#2} {EUR} {\tl_gset:Nn \g_kivi_currency_tl {euro}}
547         \tl_if_empty:NT  \g_kivi_currency_tl {
548                 \tl_gset:Nn \g_kivi_currency_tl {default}
549                 \edef \currency {\tl_to_str:N \lxcurrency}
550         }
551         \input{#1/\g_kivi_currency_tl _account.tex}
552 }
553
554 \ExplSyntaxOff
555
556
557 \renewcommand*{\raggedsignature}{\raggedright}
558
559 \newkomafont{extraDescription}{}
560
561 \endinput