marei: new koma-names + fallback for outdated versions
[kivitendo-erp.git] / templates / print / marei / insettings.tex
1 %% insettings.tex
2 %% Copyright 2019 Marei Peischl
3 \ProvidesFile{insettings.tex}[2019/12/22 Konfigurationsdatei kivitendo ERP]
4 % Sprachüberprüfung
5 \RequirePackage[english, ngerman]{babel}
6 \Ifstr{\lxlangcode}{EN}{
7         \makeatletter
8         \main@language{english}
9         \makeatother
10         \input{english.tex}}{
11         \Ifstr{\lxlangcode}{DE}{
12                 \makeatletter
13                 \main@language{ngerman}
14                 \makeatother
15                 \input{deutsch.tex}}{\input{deutsch.tex}}
16 } % Ende EN
17
18
19 % Mandanten-/Firmenabhängigkeiten
20
21 % Pfad zu firmenspez. Angaben
22 % Hat man mehrere Mandanten muß man statt "Firma1" den Datenbanknamen seines
23 % Mandanten eingeben.
24
25 \ExplSyntaxOn
26 \int_set:Nn \l_kivi_tmp_int {1}
27 \bool_set_true:N \l_kivi_tmp_bool
28 \bool_while_do:Nn \l_kivi_tmp_bool {
29         \file_if_exist:nTF {firma\int_use:N \l_kivi_tmp_int/ident.tex}
30         {
31         \str_if_in:NnTF \kivicompany {Firma\int_use:N \l_kivi_tmp_int}
32                 {
33                 \newcommand*{\identpath}{firma\int_use:N \l_kivi_tmpa_int}
34                 \bool_set_false:N \l_kivi_tmp_bool
35                 }
36                 {\int_incr:N \l_kivi_tmp_int}
37         }
38         {
39         \bool_set_false:N \l_kivi_tmp_bool
40         \newcommand*{\identpath}{firma}
41         }
42 }
43
44 \ExplSyntaxOff
45
46
47 % Identität
48 \input{\identpath/ident.tex}
49
50 \ExplSyntaxOn
51
52 %Setze Briefkopf-logo falls vorhanden
53 \setkomavar{fromlogo}{\includegraphics[width=.25\linewidth]{\identpath/briefkopf}}
54
55 % Währungen/Konten
56 \tl_new:N \g_kivi_currency_tl
57 \str_if_in:NnT \lxcurrency {USD} {\tl_gset:Nn \g_kivi_currency_tl {usd}}
58 \str_if_in:NnT \lxcurrency {CHF} {\tl_gset:Nn \g_kivi_currency_tl {chf}}
59 \str_if_in:NnT \lxcurrency {EUR} {\tl_gset:Nn \g_kivi_currency_tl {euro}}
60 \tl_if_empty:NT  \g_kivi_currency_tl {
61         \tl_gset:Nn \g_kivi_currency_tl {default}
62         \edef \currency {\tl_to_str:N \lxcurrency}
63 }
64
65 \input{\identpath/\g_kivi_currency_tl _account.tex}
66
67 \ExplSyntaxOff
68
69
70 % keine Absätze nach rechts einrücken
71 \setlength\parindent{0pt}
72
73
74
75 % Befehl f. normale Schriftart und -größe
76 \renewcommand*{\familydefault}{\sfdefault}
77 \KOMAoptions{fontsize=10pt}
78
79 % Einstellungen f. Kopf und Fuss
80 \pagestyle{kivitendo.letter}
81 % Befehl f. laufende Kopfzeile:
82 % 1. Text f. Kunden- oder Lieferantennummer (oder leer, wenn diese nicht ausgegeben werden soll)
83 % 2. Kunden- oder Lieferantennummer (oder leer)
84 % 3. Belegname {oder leer}
85 % 4. Belegnummer {oder leer}
86 % 5. Belegdatum {oder leer}
87 % Beispiel: \ourhead{\kundennummer}{<%customernumber%>}{\angebot}{<%quonumber%>}{<%quodate%>}
88 \setkomafont{pagehead}{\scriptsize}
89 \newcommand{\ourhead}[5] {
90 \chead{
91   \ifnum\thepage=1
92   \else
93       \makebox[\textwidth]{
94       \Ifstr{#1}{}{}{#1: #2 \hspace{0.7cm}}
95       #3
96       \Ifstr{#4}{}{}{~\nr: #4}
97       \Ifstr{#5}{}{}{\vom ~ #5}
98       \hspace{0.7cm} - \seite ~ \thepage/\letterlastpage  ~-%
99       }
100   \fi
101 }
102 }
103
104
105 \normalfont % damit die footerbox schon in der standard-schriftart gebaut wird.
106 %% % Firmenfuss
107 % Das speichern als Box ermöglicht es, die Höhe automatisch anzupassen:
108 \setkomafont{pagefoot}{\tiny}
109
110 %Box generieren, um die Höhe des Fußres zu kennen
111 \newsavebox\footerbox
112 \begin{lrbox}\footerbox
113         \usekomafont{pagefoot}%
114      \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}p{5cm}p{4.5cm}lr@{}}%
115         \firma                 & \email              & \textKontonummer & \kontonummer \\
116         \strasse               & \homepage           & \textBank        & \bank \\
117         \ort                   & \textUstid\ \ustid  & \textIban        & \iban \\
118         \textTelefon~\telefon  & \finanzamt          & \textBic         & \bic \\
119         \Ifstr{\fax}{}{}{\textFax~\fax} & &\textBankleitzahl    & \bankleitzahl
120         \end{tabular*}
121 \end{lrbox}
122
123 %Fußhöhe auf Höhe der Box
124 \setlength{\footheight}{\dimexpr\ht\footerbox+\dp\footerbox}
125 \geometry{bottom=\dimexpr\csname g_kivi_margin_dim\endcsname +\footheight}
126 \savegeometry{kivi.letter@default}
127
128 %Box in den Fuß eintragen:
129 \cfoot{\usebox\footerbox}
130
131 \endinput