new structure to sales_delivery_order.tex
[kivitendo-erp.git] / insettings.tex
index 19954e7..cd7c531 100644 (file)
@@ -1,6 +1,18 @@
+%% insettings.tex
+%% Copyright 2019 Marei Peischl
+\ProvidesFile{insettings.tex}[2019/12/22 Konfigurationsdatei kivitendo ERP]
 % Sprachüberprüfung
-\ifthenelse{\equal{\lxlangcode}{EN}}{\input{english.tex}}{
-  \ifthenelse{\equal{\lxlangcode}{DE}}{\input{deutsch.tex}}{\input{deutsch.tex}}
+\RequirePackage[english, ngerman]{babel}
+\ifstr{\lxlangcode}{EN}{
+       \makeatletter
+       \main@language{english}
+       \makeatother
+       \input{english.tex}}{
+       \ifstr{\lxlangcode}{DE}{
+               \makeatletter
+               \main@language{ngerman}
+               \makeatother
+               \input{deutsch.tex}}{\input{deutsch.tex}}
 } % Ende EN
 
 
 % Hat man mehrere Mandanten muß man statt "Firma1" den Datenbanknamen seines
 % Mandanten eingeben.
 
-\IfSubStringInString{Firma1}{\kivicompany}{\newcommand{\identpath}{firma1}}{
-  \IfSubStringInString{Firma2}{\kivicompany}{\newcommand{\identpath}{firma2}}
-    {\newcommand{\identpath}{firma}} % sonst
-} % Ende Firma1
+\ExplSyntaxOn
+\int_set:Nn \l_kivi_tmp_int {1}
+\bool_set_true:N \l_kivi_tmp_bool
+\bool_while_do:Nn \l_kivi_tmp_bool {
+       \file_if_exist:nTF {firma\int_use:N \l_kivi_tmp_int/ident.tex}
+       {
+       \str_if_in:NnTF \kivicompany {Firma\int_use:N \l_kivi_tmp_int}
+               {
+               \newcommand*{\identpath}{firma\int_use:N \l_kivi_tmpa_int}
+               \bool_set_false:N \l_kivi_tmp_bool
+               }
+               {\int_incr:N \l_kivi_tmp_int}
+       }
+       {
+       \bool_set_false:N \l_kivi_tmp_bool
+       \newcommand*{\identpath}{firma}
+       }
+}
+
+\ExplSyntaxOff
+
 
 % Identität
 \input{\identpath/ident.tex}
 
+\ExplSyntaxOn
+
+%Setze Briefkopf-logo falls vorhanden
+\setkomavar{fromlogo}{\includegraphics[width=.25\linewidth]{\identpath/briefkopf}}
+
 % Währungen/Konten
-\IfSubStringInString{USD}{\lxcurrency}{\input{\identpath/usd_account.tex}}{
-  \IfSubStringInString{CHF}{\lxcurrency}{\input{\identpath/chf_account.tex}}{
-    \IfSubStringInString{EUR}{\lxcurrency}{\input{\identpath/euro_account.tex}}{\input{\identpath/euro_account.tex}}
-  } % Ende CHF
-} % Ende USD
-
-% Briefkopf, Logo oder Briefpapier
-%%\IfSubStringInString{mail}{\lxmedia}{    % nur bei Mail
-  % Nur ein Logo oben rechts
-  \setlength{\wpYoffset}{130mm} % Verschiebung von der Mitte nach oben
-  \setlength{\wpXoffset}{-68mm} % Verschiebung von der Mitte nach rechts
-  \CenterWallPaper{0.2}{\identpath/briefkopf.png} % mit Skalierung
-  % oder ganzer Briefbogen als Hintergrund
-  %% \CenterWallPaper{1}{\identpath/briefbogen.pdf}
-%%} % Mail-Ende
+\tl_new:N \g_kivi_currency_tl
+\str_if_in:NnT \lxcurrency {USD} {\tl_gset:Nn \g_kivi_currency_tl {usd}}
+\str_if_in:NnT \lxcurrency {CHF} {\tl_gset:Nn \g_kivi_currency_tl {chf}}
+\str_if_in:NnT \lxcurrency {EUR} {\tl_gset:Nn \g_kivi_currency_tl {euro}}
+\tl_if_empty:NT  \g_kivi_currency_tl {
+       \tl_gset:Nn \g_kivi_currency_tl {default}
+       \edef \currency {\tl_to_str:N \lxcurrency}
+}
+
+\input{\identpath/\g_kivi_currency_tl _account.tex}
+
+\ExplSyntaxOff
 
 
 % keine Absätze nach rechts einrücken
 \setlength\parindent{0pt}
 
-% Papierformat, Ränder, usw.
-\geometry{
-        a4paper,      % DINA4
-        %% left=19mm,    % Linker Rand
-        width=182mm,  % Textbreite
-        top=39mm,     % Abstand Textanfang von oben
-        head=44mm,     % Höhe des Kopfes
-        headsep=4mm, % Abstand Kopf zu Textanfang
-        bottom=30mm,  % Abstand von unten
-        % showframe,    % Rahmen zum Debuggen anzeigen
-}
 
 
 % Befehl f. normale Schriftart und -größe
-\newcommand{\ourfont}{\fontfamily{cmss}\fontsize{10pt}{12pt}\selectfont}
-
+\renewcommand*{\familydefault}{\sfdefault}
+\KOMAoptions{fontsize=10pt}
 
 % Einstellungen f. Kopf und Fuss
-\pagestyle{scrheadings}
-\clearscrheadfoot
+\pagestyle{kivitendo.letter}
 %\setheadwidth[20mm]{page} % Kopfzeile nach rechts verschieben
 %\setfootwidth[-39mm]{page} % Fusszeile verschieben
 
 % 4. Belegnummer {oder leer}
 % 5. Belegdatum {oder leer}
 % Beispiel: \ourhead{\kundennummer}{<%customernumber%>}{\angebot}{<%quonumber%>}{<%quodate%>}
+\setkomafont{pagehead}{\scriptsize}
 \newcommand{\ourhead}[5] {
 \chead{
-  \ifthenelse{\equal{\thepage}{1}}
-    {}% then
-    {\normalfont\fontfamily{cmss}\scriptsize
-      \ifthenelse{\equal{#1}{}}{}{#1: #2 \hspace{0.7cm}}{}
+  \ifnum\thepage=1
+  \else
+      \ifstr{#1}{}{}{#1: #2 \hspace{0.7cm}}
       #3
-      \ifthenelse{\equal{#4}{}}{}{~\nr: #4}
-      \ifthenelse{\equal{#5}{}}{}{\vom ~ #5}
-      \hspace{0.7cm} - \seite ~ \thepage/\pageref{LastPage} ~- }
-}%ende chead
+      \ifstr{#4}{}{}{~\nr: #4}
+      \ifstr{#5}{}{}{\vom ~ #5}
+      \hspace{0.7cm} - \seite ~ \thepage/\letterlastpage  ~-%
+  \fi
+}
 }
 
 % Firmenfuss
+\setkomafont{pagefoot}{\tiny}
 \cfoot{
-  {\normalfont\fontfamily{cmss} \tiny
+  {
      \begin{tabular}{p{5cm}p{4.5cm}lr}
         \firma                 & \email              & \textKontonummer & \kontonummer \\
         \strasse               & \homepage           & \textBank        & \bank \\
         \ort                   & \textUstid\ \ustid  & \textIban        & \iban \\
         \textTelefon~\telefon  & \finanzamt          & \textBic         & \bic \\
-        \ifthenelse{\equal{\fax}{}}{}{\textFax~\fax} & &\textBankleitzahl      & \bankleitzahl \\
+        \ifstr{\fax}{}{}{\textFax~\fax} & &\textBankleitzahl   & \bankleitzahl \\
      \end{tabular}
   }
 }
+
+\endinput
\ No newline at end of file