marei: add colorbox variant without horizontal space
[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         unknown .code:n = \keys_set:no {kivi/Tabular} {\l_keys_key_str=#1}
141 }
142
143 % set default values for colwidth
144 \keys_set:nn {kivi/PricingTable} {
145         pos=5ex,
146         id=4em,
147         amount=5em,
148         price=7em,
149         pricetotal=7em,
150 %       desc=auto,
151         pos/header=\position,
152         id/header=\artikelnummer,
153         desc/header=\bezeichnung,
154         amount/header=\menge,
155         price/header=\einzelpreis,
156         pricetotal/header=\gesamtpreis,
157         price / colspec = Price,
158         pricetotal / colspec = Price ,
159 }
160
161 \dim_new:N \g_kivi_tabcolsep_dim
162 \dim_gset:Nn \g_kivi_tabcolsep_dim {.5\tabcolsep}
163
164 \prg_new_conditional:Nnn \kivi_if_Price_col:n {T} {
165         \prop_get:cnN {l_kivi_col_#1_prop} {colspec} \l_tmpa_tl
166         \exp_args:NV \tl_if_eq:nnTF \l_tmpa_tl {Price}
167                 {\prg_return_true:}
168                 {\prg_return_false:}
169 }
170
171
172 \cs_new:Nn \__kivi_calc_desc_column: {
173         \dim_zero:N \l_kivi_tab_desc_leftskip_dim
174         \dim_zero:N \l_kivi_tab_desc_dim
175         \bool_set_false:N \l_tmpa_bool
176         \tl_gclear:N \g_kivi_Pricing_colspec_tl
177         \clist_map_inline:Nn \g_kivi_pricingtable_col_clist {
178                 \tl_if_eq:nnTF {##1} {desc}  {
179                         \dim_set:Nn \l_kivi_tab_desc_dim {
180                                 \textwidth-\l_kivi_tab_desc_leftskip_dim
181                         }
182                         \bool_set_true:N \l_tmpa_bool
183                         \tl_gput_right:Nn \g_kivi_Pricing_colspec_tl {p{\l_kivi_tab_desc_dim}}
184                 }{
185                         \bool_if:cT {l_kivi_col_##1_bool} {
186                                 \bool_if:NTF \l_tmpa_bool {
187                                         \dim_sub:Nn \l_kivi_tab_desc_dim {
188                                                 \dim_use:c {l_kivi_tab_##1_dim}+2\g_kivi_tabcolsep_dim
189                                         }
190                                 }{
191                                         \dim_add:Nn \l_kivi_tab_desc_leftskip_dim {
192                                                 \dim_use:c {l_kivi_tab_##1_dim}+2\g_kivi_tabcolsep_dim
193                                         }
194                                 }
195                                 \tl_gput_right:Nn \g_kivi_Pricing_colspec_tl {K{\dim_use:c {l_kivi_tab_##1_dim}}}
196                                 \kivi_if_Price_col:nT {##1} {\tl_gput_right:Nn \g_kivi_Pricing_colspec_tl {<{\__kivi_tab_column_currency:}}}
197                         }
198                 }
199         }
200         \tl_gput_left:Nn \g_kivi_Pricing_colspec_tl {@{}}
201         \tl_gput_right:Nn \g_kivi_Pricing_colspec_tl {@{}}
202 }
203
204 \newcolumntype{K}[1]{>{\raggedleft\arraybackslash}p{#1}}
205 \newcolumntype{P}[1]{K{#1}<{\__kivi_tab_column_currency:}}
206
207 \RequirePackage{tcolorbox}
208 \tcbuselibrary{breakable, skins}
209
210 \tcb@new@skin{kivi@LT}{base@unbroken,%
211         frame~engine=empty,interior~titled~engine=empty,interior~engine=empty,segmentation~engine=empty,title~engine=empty,%
212         skin~first=kivi@LT@first,skin~middle=kivi@LT@middle,skin~last=kivi@LT@last,
213         underlay~first~and~middle={
214                 \node[anchor=north]  at (interior.north)  {\csname box_use:c\endcsname  {g_kivi_LT@head_box}};
215                 \node[anchor=south]  at (interior.south)  {\csname box_use:c\endcsname  {g_kivi_LT@foot_box}};
216         },
217         underlay~unbroken~and~last={
218         \node[anchor=north]  at (interior.north)  {\csname box_use:c\endcsname  {g_kivi_LT@head_box}};
219         \node[anchor=south]  at (interior.south)  {\csname box_use:c\endcsname  {g_kivi_LT@lastfoot_box}};
220         },
221         boxsep=0pt,
222         boxrule=0pt,
223         left=0pt,
224         right=0pt,
225         bottom=\box_ht:N  \g_kivi_LT@foot_box+\box_dp:N  \g_kivi_LT@foot_box + \aboverulesep,
226         top=\box_ht:N  \g_kivi_LT@head_box+\box_dp:N  \g_kivi_LT@head_box +\belowrulesep,
227         parbox=false,
228 }
229
230 \tcb@new@skin{kivi@LT@first}{base@first,%
231         frame~engine=empty,interior~titled~engine=empty,interior~engine=empty,segmentation~engine=empty,title~engine=empty,%
232         skin~first=kivi@LT@first,skin~middle=kivi@LT@middle,skin~last=kivi@LT@middle,
233 }
234
235 \tcb@new@skin{kivi@LT@middle}{base@middle,%
236         frame~engine=empty,interior~titled~engine=empty,interior~engine=empty,segmentation~engine=empty,title~engine=empty,%
237         skin~first=kivi@LT@middle,skin~middle=kivi@LT@middle,skin~last=kivi@LT@middle,
238 }
239
240 \tcb@new@skin{kivi@LT@last}{base@last,%
241         frame~engine=empty,interior~titled~engine=empty,interior~engine=empty,segmentation~engine=empty,title~engine=empty,%
242         skin~first=kivi@LT@middle,skin~middle=kivi@LT@middle,skin~last=kivi@LT@last,
243 }
244
245 \tcbset{kivi@LT/.style={skin=kivi@LT}}%
246
247
248
249 \seq_new:N \l_kivi_PricingTable_seq
250 \seq_new:N \l_kivi_columns_seq
251 \seq_new:N \g_kivi_extraDescription_seq
252 \dim_new:N \l__kivi_fboxsep_dim 
253 \dim_set:Nn \l__kivi_fboxsep_dim {\g_kivi_tabcolsep_dim}
254
255 %colorbox variant to only add vertical spacing
256 %based on colorbox definition from xcolor.sty
257 %% ----------------------------------------------------------------
258 %% Copyright (C) 2003-2016 by Dr. Uwe Kern <xcolor at ukern dot de>
259 %% ----------------------------------------------------------------
260 %% This variant of colorbox adds a space of \l__kivi_fboxsep_dim along the vertical axes but no horizontal space
261 \def\kivi@tabcolorbox#1#{\protect\kivi@tabcolor@box{#1}}
262
263 \def\kivi@tabcolor@box#1#2{
264         \tl_if_empty:oTF {#2} 
265                 \kivi@nocolor@b@x
266                 \kivi@color@b@x
267         \relax{\color#1{#2}}
268 }
269 \long\def\kivi@color@b@x#1#2#3%
270 {\leavevmode
271         \setbox\z@\hbox{{\set@color#3}}%
272         \dimen@\ht\z@\advance\dimen@\l__kivi_fboxsep_dim\ht\z@\dimen@
273         \dimen@\dp\z@\advance\dimen@\l__kivi_fboxsep_dim\dp\z@\dimen@
274         {#1{#2\color@block{\wd\z@}{\ht\z@}{\dp\z@}\box\z@}}}
275
276 \long\def\kivi@nocolor@b@x#1#2#3%
277 {\leavevmode
278         \setbox\z@\hbox{#3}%
279         \dimen@\ht\z@\advance\dimen@\l__kivi_fboxsep_dim\ht\z@\dimen@
280         \dimen@\dp\z@\advance\dimen@\l__kivi_fboxsep_dim\dp\z@\dimen@
281         {\box\z@}}
282
283 %%%
284
285
286 \newcommand{\FakeTable}[1]{
287         \par
288         \seq_set_split:Nnn \l_kivi_PricingTable_seq {\tabularnewline} {#1}
289         \seq_remove_all:Nn \l_kivi_PricingTable_seq {}
290         \begingroup
291         \setlength{\parskip}{\c_zero_dim}
292         \let\ExtraDescription\__kivi_addExtraDescription:n
293         \setlength{\tabcolsep}{\g_kivi_tabcolsep_dim}
294         \seq_map_inline:Nn \l_kivi_PricingTable_seq {
295                 \seq_set_split:Nnn  \l_kivi_columns_seq {&} {##1}
296         \seq_gclear:N \g_kivi_extraDescription_seq
297         \exp_args:Nnx \use:n {\tabular[t]}\g_kivi_Pricing_colspec_tl
298                 \seq_pop_left:NN \__l_FakeTable_columns_seq \l_tmpa_tl
299                 \seq_item:Nn \l_kivi_columns_seq {\l_tmpa_tl}
300                 \seq_map_inline:Nn \__l_FakeTable_columns_seq {
301                         &\seq_item:Nn \l_kivi_columns_seq {####1}
302                 }
303         \endtabular
304         \seq_if_empty:NTF \g_kivi_extraDescription_seq
305         {\par}
306         {\par\nopagebreak
307         \begingroup
308         \setlength{\hsize}{\dimexpr\l_kivi_tab_desc_dim+\l_kivi_tab_desc_leftskip_dim}
309         \setlength{\leftskip}{\l_kivi_tab_desc_leftskip_dim}
310         \usekomafont{extraDescription}
311         \seq_use:Nn \g_kivi_extraDescription_seq {\\}
312         \par
313         \endgroup
314         }
315         }
316         \endgroup
317 }
318
319
320 \seq_new:N  \__l_FakeTable_columns_seq
321 \cs_new:Nn \__kivi_setup_FakeTable: {
322         \seq_clear:N \__l_FakeTable_columns_seq
323         \int_zero:N \l_tmpa_int
324         \clist_map_inline:Nn \g_kivi_pricingtable_col_clist {
325                 \int_incr:N \l_tmpa_int
326                 \bool_if:cT {l_kivi_col_##1_bool} {\seq_put_right:Nx \__l_FakeTable_columns_seq {\int_use:N \l_tmpa_int}}
327         }
328 }
329
330 \tl_new:N \g_kivi_Pricing_colspec_tl
331 \tl_gset:Nn \g_kivi_Pricing_colspec_tl {
332         @{}
333         \bool_if:NT \l_kivi_col_pos_bool {p{\l_kivi_tab_pos_dim}}
334         \bool_if:NT \l_kivi_col_id_bool {p{\l_kivi_tab_id_dim}}
335         p{\l_kivi_tab_desc_dim}
336         \bool_if:NT \l_kivi_col_amount_bool {\exp_not:n {>{\raggedleft\arraybackslash}p{\l_kivi_tab_amount_dim}}}
337         \bool_if:NT \l_kivi_col_price_bool {\exp_not:n {>{\raggedleft\arraybackslash}p{\l_kivi_tab_price_dim}<{\__kivi_tab_column_currency:}}}
338         \bool_if:NT \l_kivi_col_pricetotal_bool {\exp_not:n {>{\raggedleft\arraybackslash}p{\l_kivi_tab_pricetotal_dim}<{\__kivi_tab_column_currency:}}}
339         @{}
340 }
341
342 \cs_new_protected:Nn \__kivi_tab_column_currency: {\,\currency}
343 \def\tabcurrency{\__kivi_tab_column_currency:}
344 \cs_set:Nn \__kivi_tab_column_header_currency: {}
345 \cs_set_eq:NN \__kivi_tab_column_body_currency:  \__kivi_tab_column_currency:
346
347 \clist_map_inline:nn {head, foot, firsthead, lastfoot} {%TODO reduce
348         \box_new:c {g_kivi_LT@#1_box}
349 }
350
351 \newkomafont{PricingTableHeader}{\bfseries}
352
353 \cs_new:Nn \__kivi_setup_LT_boxes: {
354         \__kivi_calc_desc_column:
355         \hbox_gset:Nn \g_kivi_LT@head_box {
356                 \setlength{\tabcolsep}{\g_kivi_tabcolsep_dim}
357                 \exp_args:Nnx \use:n {\tabular[b]}\g_kivi_Pricing_colspec_tl
358                 \__kivi_PricingTabular_header:
359                 \endtabular
360         }
361         \hbox_gset:Nn \g_kivi_LT@foot_box {
362                 \raisebox{\depth}{
363                         \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}r@{}}
364                                 \midrule
365                                 \strut\weiteraufnaechsterseite
366                         \end{tabular*}
367                 }
368         }
369         \hbox_gset:Nn \g_kivi_LT@lastfoot_box {
370                 \raisebox{\dimexpr\depth+\baselineskip}[0pt][0pt]{
371                         \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}r@{}}
372                                 \bottomrule
373                         \end{tabular*}
374                 }
375         }
376 }
377
378
379 %Macht es sinn hier eine Variante zu machen, in der alle Spalten Belegbar sind?
380 \newenvironment{PricingTotal}{
381         \par\nointerlineskip
382         \unskip
383         \tabular[t]{@{}p{\dim_eval:n {\linewidth-\l_kivi_tab_pricetotal_dim-2\tabcolsep}}P{\l_kivi_tab_pricetotal_dim}@{}}
384         \midrule
385 }{
386         \endtabular
387 }
388
389
390 \newcommand*\ExtraDescription{
391         \PackageError{kiviletter}{The~command~\string\ExtraDescription\space~may~be~only~used~inside~the~\string\FakeTable\space~environment.}{See~documentation~for~details}
392 }
393
394
395 \cs_new:Nn \__kivi_addExtraDescription:n {\seq_gput_right:Nn \g_kivi_extraDescription_seq {#1}}
396
397 \newenvironment{PricingTabular}[1][]{
398         \begingroup
399         \dim_set:Nn \parskip {\c_zero_dim}
400         \tl_if_empty:nF {#1} {\keys_set:nn {kivi/PricingTable} {#1}}
401         \setlength{\tabcolsep}{\g_kivi_tabcolsep_dim}
402         \__kivi_calc_desc_column:
403         \exp_args:Nx \longtable \g_kivi_Pricing_colspec_tl
404         % Tabellenkopf
405         \__kivi_PricingTabular_header:
406         \endhead
407         \midrule
408         \rlap{\makebox[\textwidth][r]{\weiteraufnaechsterseite}}\\
409         \endfoot
410         \bottomrule
411         \endlastfoot
412 }{
413         \endlongtable
414         \endgroup
415 }
416
417 \cs_set:Nn \__kivi_PricingTabular_header: {
418         \toprule
419         \cs_gset_eq:NN \__kivi_tab_column_currency: \__kivi_tab_column_header_currency:
420         \bool_set_false:N \l_tmpa_bool
421         \clist_map_inline:Nn \g_kivi_pricingtable_col_clist     {
422                 \bool_if:cT {l_kivi_col_##1_bool} {
423                         \bool_if:NT \l_tmpa_bool {&}
424                         \bool_set_true:N \l_tmpa_bool
425                         \usekomafont{PricingTableHeader}
426                         \prop_item:cn {l_kivi_col_##1_prop} {header}
427                 }
428         }
429         \cs_gset_eq:NN \__kivi_tab_column_currency: \__kivi_tab_column_body_currency:
430         \\
431         \midrule
432 }
433
434
435 \keys_define:nn {kivi/SimpleTabular} {
436         colspec .tl_set:N =\l_kivi_SimpleTabular_colspec_tl,
437         colspec .initial:n = {rrX},
438         headline .tl_set:N = \l_kivi_SimpleTabular_headline_tl,
439         headline .initial:n = {\bfseries\position & \bfseries\menge & \bfseries\bezeichnung},
440 \keys_define:nn {kivi/Tabular} {
441         color-rows .bool_gset:N =  \g__kivi_Tabular_rowcolor_bool ,
442         color-rows .initial:n = false,
443         color-rows .default:n = true,
444         rowcolor-odd .tl_gset:N = \g__kivi_Tabular_rowcolor_odd_tl,
445         rowcolor-odd .initial:n = black!10,
446         rowcolor-even .tl_gset:N = \g__kivi_Tabular_rowcolor_even_tl,
447         rowcolor-even .initial:n =,
448         rowcolor-header .tl_gset:N = \g__kivi_Tabular_rowcolor_header_tl,
449         rowcolor-header .initial:n = black!35,
450         rowcolor-total .tl_gset:N = \g__kivi_Tabular_rowcolor_PricingTotal_tl,
451         rowcolor-total .initial:n = black!35,
452         rowsep .tl_set:N =\g__kivi_Tabular_rowsep_tl,
453         hrule .meta:n = {rowsep=\midrule}
454 }
455
456 \newcommand*{\SetupSimpleTabular}[1]{\keys_set:nn {kivi/SimpleTabular} {#1}}
457 \newcommand*{\SetupPricingTabular}[1]{\keys_set:nn {kivi/PricingTable} {#1}}
458
459 \newenvironment{SimpleTabular}[1][]
460 {
461         \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}}}
462         \setlength{\tabcolsep}{\g_kivi_tabcolsep_dim}
463         \dim_set:Nn \parskip {\c_zero_dim}
464         \tl_put_right:Nn \l_kivi_SimpleTabular_colspec_tl {@{}}
465         \tl_put_left:Nn \l_kivi_SimpleTabular_colspec_tl {@{}}
466         \exp_args:NnV \xltabular{\linewidth}\l_kivi_SimpleTabular_colspec_tl
467                 \toprule
468                 \cs_gset_eq:NN \__kivi_tab_column_currency: \__kivi_tab_column_header_currency:
469                 \l_kivi_SimpleTabular_headline_tl
470                 \\
471                 \noalign{\cs_gset_eq:NN \__kivi_tab_column_currency: \__kivi_tab_column_body_currency:}
472                 \midrule
473         \endhead
474                 \midrule
475                 \rlap{\makebox[\textwidth][r]{\weiteraufnaechsterseite}}\\
476         \endfoot
477                 \bottomrule
478         \endlastfoot
479         \ignorespaces
480 }{
481         \def\@currenvir{tabularx}
482         \endxltabular
483 }
484
485 %PricingTabular* kann automatisch spalten ignorieren
486 % \begin{PricingTabular*}[id=false]
487 % deaktiviert damit die Spalte der Produktnummer
488 % analog ist dies für pos, amount, price, pricetotal möglich.
489 % Die Spalte der Bezeichnung ist nicht deaktivierbar
490 \newenvironment{PricingTabular*}[1][]{
491         \tl_if_empty:nF {#1} {\keys_set:nn {kivi/PricingTable} {#1}}
492         \__kivi_setup_LT_boxes:
493         \__kivi_setup_FakeTable:
494         \dim_set:Nn \parskip {\c_zero_dim}
495         \PricingTabularBox\ignorespaces
496 }{\endPricingTabularBox}
497
498 \newtcolorbox{PricingTabularBox}{breakable,skin=kivi@LT}
499
500 \if@kivi@infobox
501
502         \def\locationsep{:}
503
504         \NewDocumentCommand{\locationentry}{som}{
505                 \Ifkomavarempty{#3}{}{
506                 \IfBooleanTF {#1} {
507                         \strut
508                         \IfNoValueTF {#2}
509                                 {\usekomavar*{#3}}
510                                 {#2}
511                         \locationsep
512                         \hfill\strut\space
513                         \hbox_set:Nn \l_tmpa_box {\usekomavar{#3}}
514                         \dim_compare:nTF {\box_wd:N \l_tmpa_box>\linewidth}
515                                 {\newline\hspace*{\fill}\llap}
516                                 {\hspace*{\fill}}
517                                 {\box_use:N \l_tmpa_box\strut}
518                 }{
519                         \@hangfrom{\strut
520                                 \IfNoValueTF {#2}
521                                         {\usekomavar*{#3}}
522                                         {#2}\locationsep~
523                         }{
524                                 \parbox[t]{\dimexpr\linewidth-\hangindent}{
525                                         \raggedleft
526                                         \usekomavar{#3}\strut
527                                 }
528                         }
529                 }
530                 }
531                 \par
532         }
533
534
535 \setkomavar{location}{
536         \Ifkomavarempty{transaction}{}{
537         \bfseries
538         \usekomavar{transaction}
539         }
540         \par
541         \medskip
542         \parbox{\useplength{locwidth}}{
543                 \locationentry{date}
544                 \locationentry{myref}
545                 \locationentry{customer}
546                 \locationentry{yourref}
547                 \locationentry{delivery}
548                 \locationentry{quote}
549                 \locationentry{orderID}
550                 \locationentry{projectID}
551                 \locationentry[\ansprechpartner]{fromname}
552                 \locationentry{fromphone}
553                 \locationentry*{fromemail}
554         }
555 }
556 \removereffields
557 \AtBeginLetter{
558         \ifdim\ht\shippingAddressBox>\z@
559         \@addtoplength{refvpos}{\dimexpr\ht\shippingAddressBox+\dp\shippingAddressBox}
560         \@addtoplength{refvpos}{4\baselineskip}%sep between address boxes
561         \fi
562 }
563
564 \fi
565
566 %Fallback for older KOMA-Script-Versions
567 \cs_if_exist:NF \Ifstr {\let\Ifstr\ifstr}
568 \cs_if_exist:NF \Ifkomavarempty {\let\Ifkomavarempty\ifkomavarempty}
569
570 %Definitionen für die insettings.tex
571
572 \newcommand*{\setupIdentpath}[1]{
573         \int_set:Nn \l_kivi_tmp_int {1}
574         \bool_set_true:N \l_kivi_tmp_bool
575         \bool_while_do:Nn \l_kivi_tmp_bool {
576                 \file_if_exist:nTF {firma\int_use:N \l_kivi_tmp_int/ident.tex}
577                 {
578                         \exp_args:Nf \str_if_in:nnTF {#1} {Firma\int_use:N \l_kivi_tmp_int}
579                         {
580                                 \newcommand*{\identpath}{firma\int_use:N \l_kivi_tmpa_int}
581                                 \bool_set_false:N \l_kivi_tmp_bool
582                         }
583                         {\int_incr:N \l_kivi_tmp_int}
584                 }
585                 {
586                         \bool_set_false:N \l_kivi_tmp_bool
587                         \newcommand*{\identpath}{firma}
588                 }
589         }
590 }
591
592 \newcommand*{\setupCurrencyConfig}[2]{
593         \tl_new:N \g_kivi_currency_tl
594         \exp_args:Nf \str_if_in:nnT {#2} {USD} {\tl_gset:Nn \g_kivi_currency_tl {usd}}
595         \exp_args:Nf \str_if_in:nnT {#2} {CHF} {\tl_gset:Nn \g_kivi_currency_tl {chf}}
596         \exp_args:Nf \str_if_in:nnT {#2} {EUR} {\tl_gset:Nn \g_kivi_currency_tl {euro}}
597         \tl_if_empty:NT  \g_kivi_currency_tl {
598                 \tl_gset:Nn \g_kivi_currency_tl {default}
599                 \edef \currency {\tl_to_str:N \lxcurrency}
600         }
601         \input{#1/\g_kivi_currency_tl _account.tex}
602 }
603
604 \ExplSyntaxOff
605
606
607 \renewcommand*{\raggedsignature}{\raggedright}
608
609 \newkomafont{extraDescription}{}
610
611 \endinput