commit ab064135c490b6b497611d08385cc44b1fdaafd4
Author: Marei Peischl <marei@peitex.de>
Date:   Tue Dec 19 13:54:19 2023 +0100

    unify identation

diff --git a/templates/print/marei/bin_list.tex b/templates/print/marei/bin_list.tex
index 7907ebe22..b9df0c8cf 100644
--- a/templates/print/marei/bin_list.tex
+++ b/templates/print/marei/bin_list.tex
@@ -15,7 +15,7 @@
 \setkomavar{firsthead}{
   \normalsize
   \noindent\begin{tabular}[t]{@{}l@{}}
-    <%company%>\strut\\
+    <%company%>\strut \\
     <%address%>
   \end{tabular}
   \hfill
@@ -43,43 +43,43 @@
 \makeatother
 
 \begin{letter}{
-<%name%>\ifhmode\\\fi
-<%street%>\ifhmode\\\fi
-<%zipcode%> <%city%>\ifhmode\\\fi
-<%country%>
-}
+    <%name%>\ifhmode\\\fi
+    <%street%>\ifhmode\\\fi
+    <%zipcode%> <%city%>\ifhmode\\\fi
+    <%country%>
+  }
 
-\opening{}
+  \opening{}
 
-\begin{SimpleTabular}[colspec=*6X,headline={\bfseries\bestellnummer&\bfseries\datum&\bfseries\kontakt
-        <%if warehouse%>%
-        &\bfseries\lager%
-        <%end warehouse%>%
-        &\bfseries\lagerplatz&\bfseries\lieferungMit}]
+  \begin{SimpleTabular}[colspec=*6X,headline={\bfseries\bestellnummer&\bfseries\datum&\bfseries\kontakt
+    <%if warehouse%>%
+      &\bfseries\lager%
+    <%end warehouse%>%
+    &\bfseries\lagerplatz&\bfseries\lieferungMit}]
 
-  <%ordnumber%>%
-  &%
-  <%if shippingdate%>%
-  <%shippingdate%>%
-  <%end shippingdate%>%
-  <%if not shippingdate%>%
-  <%orddate%>%
-  <%end shippingdate%>%
-  & <%employee%>%
-  <%if warehouse%>%
-  & <%warehouse%>%
-  <%end warehouse%>%
-  & <%shippingpoint%> & <%shipvia%> \\
-\end{SimpleTabular}
+    <%ordnumber%>%
+    &%
+    <%if shippingdate%>%
+      <%shippingdate%>%
+    <%end shippingdate%>%
+    <%if not shippingdate%>%
+    <%orddate%>%
+    <%end shippingdate%>%
+    & <%employee%>%
+    <%if warehouse%>%
+      & <%warehouse%>%
+    <%end warehouse%>%
+    & <%shippingpoint%> & <%shipvia%> \\
+  \end{SimpleTabular}
 
-\bigskip
+  \bigskip
 
-\begin{SimpleTabular}[colspec=rlXllrrll,headline={\bfseries\position&\bfseries\nummer&\bfseries\beschreibung&\bfseries\seriennummer & &\bfseries\menge&\bfseries\erh&&\bfseries\lagerplatz}]
-  <%foreach number%>%
-  <%runningnumber%> & <%number%> & <%description%> & <%serialnumber%> &
-  <%deliverydate%> & <%qty%> & <%ship%> & <%unit%> & <%bin%> \\
-  <%end number%>%
-\end{SimpleTabular}
+  \begin{SimpleTabular}[colspec=rlXllrrll,headline={\bfseries\position&\bfseries\nummer&\bfseries\beschreibung&\bfseries\seriennummer & &\bfseries\menge&\bfseries\erh&&\bfseries\lagerplatz}]
+    <%foreach number%>%
+      <%runningnumber%> & <%number%> & <%description%> & <%serialnumber%> &
+      <%deliverydate%> & <%qty%> & <%ship%> & <%unit%> & <%bin%> \\
+    <%end number%>%
+  \end{SimpleTabular}
 
 \end{letter}
 
diff --git a/templates/print/marei/check.tex b/templates/print/marei/check.tex
index 7a77d171f..2425a81a7 100644
--- a/templates/print/marei/check.tex
+++ b/templates/print/marei/check.tex
@@ -31,29 +31,29 @@
 \begin{document}
 
 \begin{letter}{%
-<%if billing_address_id%>%
-	<%billing_address_name%> \strut\\%
-	<%billing_address_street%>\strut\\%
-	<%billing_address_zipcode%> <%billing_address_city%> \strut\\%
-	<%billing_address_country%>\strut\\%
-<%else%>%
-	<%name%>\strut\\%
-	<%street%>\strut\\%
-	<%zipcode%> <%city%>\strut\\%
-	<%country%>\strut%
-<%end if%>%
-}
-
-\opening{<%company%>}
-\pagestyle{empty}
-
-<%name%> \hfill <%datepaid%> \hfill <%source%>%
-
-\begin{SimpleTabular}[colspec=lXrr,headline={\bfseries\rechnung&\bfseries\ausgestellt&\bfseries\faellig&\bfseries\verrechnet}]
-  <%foreach invnumber%>%
-  <%invnumber%> & <%invdate%> & <%due%> & <%paid%> \\
-  <%end invnumber%>%
-\end{SimpleTabular}
+  <%if billing_address_id%>%
+    <%billing_address_name%> \strut\\%
+    <%billing_address_street%>\strut\\%
+    <%billing_address_zipcode%> <%billing_address_city%> \strut\\%
+    <%billing_address_country%>\strut\\%
+  <%else%>%
+    <%name%>\strut\\%
+    <%street%>\strut\\%
+    <%zipcode%> <%city%>\strut\\%
+    <%country%>\strut%
+  <%end billing_address_id%>%
+  }
+
+  \opening{<%company%>}
+  \pagestyle{empty}
+
+  <%name%> \hfill <%datepaid%> \hfill <%source%>%
+
+  \begin{SimpleTabular}[colspec=lXrr,headline={\bfseries\rechnung&\bfseries\ausgestellt&\bfseries\faellig&\bfseries\verrechnet}]
+    <%foreach invnumber%>%
+      <%invnumber%> & <%invdate%> & <%due%> & <%paid%> \\
+    <%end invnumber%>%
+  \end{SimpleTabular}
 
 \end{letter}
 
diff --git a/templates/print/marei/credit_note.tex b/templates/print/marei/credit_note.tex
index eb3b9a422..13d4a9089 100644
--- a/templates/print/marei/credit_note.tex
+++ b/templates/print/marei/credit_note.tex
@@ -29,7 +29,7 @@
 <%if invnumber_for_credit_note%>%
   \setkomavar*{myref}{\fuerRechnung}
   \setkomavar{myref}{<%invnumber_for_credit_note%>}
-<%end if%>%
+<%end invnumber_for_credit_note%>%
 
 \setkomavar{transaction}{<%transaction_description%>}
 <%if shiptoname%>%
@@ -52,83 +52,83 @@
   }
 \end{lrbox}
 \makeatother
-<%end if%>%
+<%end shiptoname%>%
 
 \begin{document}
 
 \begin{letter}{%
-<%if billing_address_id%>%
-	<%billing_address_name%> \strut\\%
-	<%if department_1%><%billing_address_department_1%>\\<%end if%>%
-	<%if department_2%><%billing_address_department_2%>\\<%end if%>%
-	<%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%
-	<%billing_address_street%>\strut\\%
-	<%billing_address_zipcode%> <%billing_address_city%> \strut\\%
-	<%billing_address_country%>\strut\\%
-<%else%>%
-	<%name%>\strut\\%
-	<%if department_1%><%department_1%>\\<%end if%>%
-	<%if department_2%><%department_2%>\\<%end if%>%
-	<%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%
-	<%street%>\strut\\%
-	<%zipcode%> <%city%>\strut\\%
-	<%country%>\strut%
-<%end if%>%
-}
+  <%if billing_address_id%>%
+    <%billing_address_name%> \strut\\%
+    <%if department_1%><%billing_address_department_1%>\\<%end if%>%
+    <%if department_2%><%billing_address_department_2%>\\<%end if%>%
+    <%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%
+    <%billing_address_street%>\strut\\%
+    <%billing_address_zipcode%> <%billing_address_city%> \strut\\%
+    <%billing_address_country%>\strut\\%
+  <%else%>%
+    <%name%>\strut\\%
+    <%if department_1%><%department_1%>\\<%end if%>%
+    <%if department_2%><%department_2%>\\<%end if%>%
+    <%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%
+    <%street%>\strut\\%
+    <%zipcode%> <%city%>\strut\\%
+    <%country%>\strut%
+  <%end billing_address_id%>%
+  }
 
-% Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
-% Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
-\opening{
-\Ifstr{<%cp_name%>}{}
-{<%if natural_person%><%greeting%> <%name%>,<%else%>\anrede<%end if%>}
-  {
-    \Ifstr{<%cp_gender%>}{f}
-        {\anredefrau}
-        {\anredeherr}
+  % Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
+  % Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
+  \opening{
+    \Ifstr{<%cp_name%>}{}
+    {<%if natural_person%><%greeting%> <%name%>,<%else%>\anrede}<%end if%>
+    {
+      \Ifstr{<%cp_gender%>}{f}
+      {\anredefrau}
+      {\anredeherr}
       <%cp_title%> <%cp_name%>,
     }
   }
-\thispagestyle{kivitendo.letter.first}
-
-
-\gutschriftformel
-
-<%if notes%>%
-<%notes%>%
-\vspace{0.5cm}
-<%end if%>%
-
-
-\begin{PricingTabular*}%
-  % eigentliche Tabelle%
-  \FakeTable{%
-  <%foreach number%>%
-  <%runningnumber%> &%
-  <%number%> &%
-  \textbf{<%description%>}%
-  <%if longdescription%>\ExtraDescription{<%longdescription%>}<%end longdescription%>%
-  <%if serialnumber%>\ExtraDescription{\seriennummer: <%serialnumber%>}<%end serialnumber%>%
-  <%if ean%>\ExtraDescription{\ean: <%ean%>}<%end ean%>%
-  <%if projectnumber%>\ExtraDescription{\projektnummer: <%projectnumber%>}<%end projectnumber%>%
-  &%
-  <%qty%> <%unit%> &%
-  <%sellprice%>&%
-  \Ifstr{<%p_discount%>}{0}{}{\sffamily\scriptsize{(-<%p_discount%>\,\%)}}%
-    <%linetotal%>\tabularnewline%
-    <%end number%>%
-  }%
-  \begin{PricingTotal}%
-    % Tabellenende letzte Seite
-    \nettobetrag & <%subtotal%>\\%
-    <%foreach tax%>%
-    <%taxdescription%> & <%tax%>\\%
-    <%end tax%>%
-    \bfseries\schlussbetrag &  \bfseries <%invtotal%>\\%
-  \end{PricingTotal}%
-\end{PricingTabular*}
-
-
-\closing{\gruesse}
+  \thispagestyle{kivitendo.letter.first}
+
+
+  \gutschriftformel
+
+  <%if notes%>%
+    <%notes%>%
+    \vspace{0.5cm}
+  <%end notes%>%
+
+
+  \begin{PricingTabular*}%
+    % eigentliche Tabelle%
+    \FakeTable{%
+      <%foreach number%>%
+      <%runningnumber%> &%
+      <%number%> &%
+      \textbf{<%description%>}%
+      <%if longdescription%>\ExtraDescription{<%longdescription%>}<%end longdescription%>%
+      <%if serialnumber%>\ExtraDescription{\seriennummer: <%serialnumber%>}<%end serialnumber%>%
+      <%if ean%>\ExtraDescription{\ean: <%ean%>}<%end ean%>%
+      <%if projectnumber%>\ExtraDescription{\projektnummer: <%projectnumber%>}<%end projectnumber%>%
+      &%
+      <%qty%> <%unit%> &%
+      <%sellprice%>&%
+      \Ifstr{<%p_discount%>}{0}{}{\sffamily\scriptsize{(-<%p_discount%>\,\%)}}%
+      <%linetotal%>\tabularnewline%
+      <%end number%>%
+    }%
+    \begin{PricingTotal}%
+      % Tabellenende letzte Seite
+      \nettobetrag & <%subtotal%>\\%
+      <%foreach tax%>%
+        <%taxdescription%> & <%tax%>\\%
+      <%end tax%>%
+      \bfseries\schlussbetrag &  \bfseries <%invtotal%>\\%
+    \end{PricingTotal}%
+  \end{PricingTabular*}
+
+
+  \closing{\gruesse}
 
 \end{letter}
 
diff --git a/templates/print/marei/ic_supply.tex b/templates/print/marei/ic_supply.tex
index 6539b115b..efed55a95 100644
--- a/templates/print/marei/ic_supply.tex
+++ b/templates/print/marei/ic_supply.tex
@@ -17,56 +17,56 @@
 \begin{document}
 
 \begin{Form}
-\large
-Bestätigung über das Gelangen des Gegenstands einer innergemeinschaftlichen Lieferung
-in einen anderen EU-Mitgliedstaat (Gelangensbestätigung)
-\vspace{0.4cm}
+  \large
+  Bestätigung über das Gelangen des Gegenstands einer innergemeinschaftlichen Lieferung
+  in einen anderen EU-Mitgliedstaat (Gelangensbestätigung)
+  \vspace{0.4cm}
 
-{\color{purple} Bitte unterschreiben und faxen/mailen an:
-\begin{center} <%employee_fax%> / <%employee_email%> \end{center}}
-\normalsize
-\vspace{0.4cm}
-<%name%>, <%street%>, <%zipcode%> <%city%>, <%country%>\hspace*{\fill}\\
-\TextField[name=department, bordercolor=gray, width=\linewidth]{}\\
-{\color{gray}(Name und Anschrift des Abnehmers der innergemeinschaftlichen Lieferung, ggf. E-Mail-Adresse)}
+  {\color{purple} Bitte unterschreiben und faxen/mailen an:
+    \begin{center} <%employee_fax%> / <%employee_email%> \end{center}}
+  \normalsize
+  \vspace{0.4cm}
+  <%name%>, <%street%>, <%zipcode%> <%city%>, <%country%>\hspace*{\fill}\\
+  \TextField[name=department, bordercolor=gray, width=\linewidth]{}\\
+  {\color{gray}(Name und Anschrift des Abnehmers der innergemeinschaftlichen Lieferung, ggf. E-Mail-Adresse)}
 
-\vspace{0.4cm}
+  \vspace{0.4cm}
 
-Hiermit bestätige ich als Abnehmer, dass ich folgenden Gegenstand / dass folgender Gegenstand \textsuperscript{1)} einer
-innergemeinschaftlichen Lieferung\\
+  Hiermit bestätige ich als Abnehmer, dass ich folgenden Gegenstand / dass folgender Gegenstand \textsuperscript{1)} einer
+  innergemeinschaftlichen Lieferung\\
 
 
-\TextField[name=qty, bordercolor=gray, width=\linewidth]{}\\
-{\color{gray}(Menge des Gegenstands der Lieferung)}\\
+  \TextField[name=qty, bordercolor=gray, width=\linewidth]{}\\
+  {\color{gray}(Menge des Gegenstands der Lieferung)}\\
 
-\TextField[name=desc, bordercolor=gray, width=\linewidth]{}\\
-{\color{gray}(handelsübliche Bezeichnung, bei Fahrzeugen zusätzlich die Fahrzeug-Identifikationsnummer)}\\
+  \TextField[name=desc, bordercolor=gray, width=\linewidth]{}\\
+  {\color{gray}(handelsübliche Bezeichnung, bei Fahrzeugen zusätzlich die Fahrzeug-Identifikationsnummer)}\\
 
-im\\
+  im\\
 
-\uline{ \StrGobbleLeft{<%reqdate%>}{3} \hspace*{\fill}}\\
+  \uline{ \StrGobbleLeft{<%reqdate%>}{3} \hspace*{\fill}}\\
   {\color{gray}(Monat und Jahr des Erhalts des Liefergegenstands im Mitgliedstaat, in den der Liefergegenstand gelangt ist, wenn der liefernde Unternehmer den Liefergegenstand befördert oder versendet hat oder wenn der Abnehmer den Liefergegenstand versendet hat)}\\
 
 
-\TextField[name=delivery, bordercolor=gray, width=\linewidth]{}\\
-{\color{gray}(Monat und Jahr des Endes der Beförderung, wenn der Abnehmer den Liefergegenstand selbst befördert hat)}\\
+  \TextField[name=delivery, bordercolor=gray, width=\linewidth]{}\\
+  {\color{gray}(Monat und Jahr des Endes der Beförderung, wenn der Abnehmer den Liefergegenstand selbst befördert hat)}\\
 
-in / nach \textsuperscript{1)}\\
+  in / nach \textsuperscript{1)}\\
 
 
-\uline{<%country%>\hspace*{\fill}}\\
+  \uline{<%country%>\hspace*{\fill}}\\
   {\color{gray}(Mitgliedstaat und Ort, wohin der Liefergegenstand im Rahmen einer Beförderung oder Versendung gelangt ist)}\\
 
-erhalten habe / gelangt ist.
+  erhalten habe / gelangt ist.
 
-\TextField[name=delivery, bordercolor=gray, width=\linewidth]{}\\
-{\color{gray}(Datum der Ausstellung der Bestätigung)}\\
+  \TextField[name=delivery, bordercolor=gray, width=\linewidth]{}\\
+  {\color{gray}(Datum der Ausstellung der Bestätigung)}\\
 
-\uline{\hspace*{\fill}}
+  \uline{\hspace*{\fill}}
 
-{\color{gray}(Unterschrift des Abnehmers oder seines Vertretungsberechtigten sowie Name des Unterzeichnenden in Druckschrift)}\\
+  {\color{gray}(Unterschrift des Abnehmers oder seines Vertretungsberechtigten sowie Name des Unterzeichnenden in Druckschrift)}\\
 
-\textbf{\textsuperscript{1)} Nichtzutreffendes bitte streichen.}
+  \textbf{\textsuperscript{1)} Nichtzutreffendes bitte streichen.}
 \end{Form}
 \end{document}
 
diff --git a/templates/print/marei/ic_supply_EN.tex b/templates/print/marei/ic_supply_EN.tex
index 5f9516c68..41642c3fe 100644
--- a/templates/print/marei/ic_supply_EN.tex
+++ b/templates/print/marei/ic_supply_EN.tex
@@ -17,52 +17,52 @@
 \begin{document}
 
 \begin{Form}
-\large
-Certification of the entry of the object of an intra-Community supply into another EU Member State (Entry Certificate)
+  \large
+  Certification of the entry of the object of an intra-Community supply into another EU Member State (Entry Certificate)
 
-\vspace{0.4cm}
+  \vspace{0.4cm}
 
-{\color{purple} Please sign below and send back to fax-number/mail-address:
-\begin{center} <%employee_fax%> / <%employee_email%> \end{center}}
+  {\color{purple} Please sign below and send back to fax-number/mail-address:
+    \begin{center} <%employee_fax%> / <%employee_email%> \end{center}}
 
-\normalsize
-\vspace{0.4cm}
-<%name%>, <%street%>, <%zipcode%> <%city%>, <%country%>\hspace*{\fill}\\
-\TextField[name=department, bordercolor=gray, width=\linewidth]{}\\
-{\color{gray}(Name and address of the customer of the intra-Community supply, e-mail address if applicable)}
+  \normalsize
+  \vspace{0.4cm}
+  <%name%>, <%street%>, <%zipcode%> <%city%>, <%country%>\hspace*{\fill}\\
+  \TextField[name=department, bordercolor=gray, width=\linewidth]{}\\
+  {\color{gray}(Name and address of the customer of the intra-Community supply, e-mail address if applicable)}
 
 
-\vspace{0.4cm}
-I as the customer hereby certify my receipt / the entry \textsuperscript{1)} of the following object of an intra-Community supply\\
+  \vspace{0.4cm}
+  I as the customer hereby certify my receipt / the entry \textsuperscript{1)} of the following object of an intra-Community supply\\
 
-\TextField[name=qty, bordercolor=gray, width=\linewidth]{}\\
-{\color{gray}(Quantity of the object of the supply)}\\
+  \TextField[name=qty, bordercolor=gray, width=\linewidth]{}\\
+  {\color{gray}(Quantity of the object of the supply)}\\
 
-\TextField[name=desc, bordercolor=gray, width=\linewidth]{}\\
-{\color{gray}(Standard commercial description – in the case of vehicles, including vehicle identification number)}\\
+  \TextField[name=desc, bordercolor=gray, width=\linewidth]{}\\
+  {\color{gray}(Standard commercial description – in the case of vehicles, including vehicle identification number)}\\
 
-in\\
+  in\\
 
-\uline{ \StrGobbleLeft{<%reqdate%>}{3} \hspace*{\fill}}\\
+  \uline{ \StrGobbleLeft{<%reqdate%>}{3} \hspace*{\fill}}\\
   {\color{gray}(Month and year the object of the supply was received in the Member State of entry if the supplying trader transported or dispatched the object of the supply or if the customer dispatched the object of the supply)}\\
 
-\TextField[name=delivery, bordercolor=gray, width=\linewidth]{}\\
-{\color{gray}(Month and year the transportation ended if the customer transported the object of the supply himself or herself)}\\
+  \TextField[name=delivery, bordercolor=gray, width=\linewidth]{}\\
+  {\color{gray}(Month and year the transportation ended if the customer transported the object of the supply himself or herself)}\\
 
-in / at \textsuperscript{1)}\\
+  in / at \textsuperscript{1)}\\
 
-\uline{<%country%>\hspace*{\fill}}\\
+  \uline{<%country%>\hspace*{\fill}}\\
   {\color{gray}(Member State and place of entry as part of the transport or dispatch of the object)}\\
 
 
-% X\TextField[name=delivery, bordercolor=gray, width=\linewidth]{}\\
-\uline{X\hspace*{\fill}}\\
-{\color{gray}(Date of issue of the certificate)}\\
+  % X\TextField[name=delivery, bordercolor=gray, width=\linewidth]{}\\
+  \uline{X\hspace*{\fill}}\\
+  {\color{gray}(Date of issue of the certificate)}\\
 
-\uline{X\hspace*{\fill}}\\
-{\color{gray}(Signature of the customer or of the authorised representative as well as the signatory’s name in capitals)}\\
+  \uline{X\hspace*{\fill}}\\
+  {\color{gray}(Signature of the customer or of the authorised representative as well as the signatory’s name in capitals)}\\
 
-\textbf{\textsuperscript{1)} Delete as appropriate.}
+  \textbf{\textsuperscript{1)} Delete as appropriate.}
 
 \end{Form}
 \end{document}
diff --git a/templates/print/marei/invoice.tex b/templates/print/marei/invoice.tex
index f7b990f26..f64e2c4f1 100644
--- a/templates/print/marei/invoice.tex
+++ b/templates/print/marei/invoice.tex
@@ -7,7 +7,7 @@
   }]{foreground}
   \AddLayersToPageStyle{kivitendo.letter.first}{foreground}%Hintergrund für die erste Seite aktivieren
   \AddLayersToPageStyle{kivitendo.letter}{foreground}%Hintergrund für die erste Seite aktivieren
-<%end if%>
+<%end template_meta.formname == "invoice_copy"%>
 
 
 
@@ -23,11 +23,11 @@
 
 <%if template_meta.formname == "invoice_for_advance_payment"%>
   \renewcommand{\rechnung}{\anzahlungsrechnung}
-<%end if%>
+<%end template_meta.formname == "invoice_for_advance_payment"%>
 
 <%if template_meta.formname == "final_invoice"%>
   \renewcommand{\rechnung}{\schlussrechnung}
-<%end if%>
+<%end template_meta.formname == "final_invoice"%>
 
 % laufende Kopfzeile:
 \ourhead{\kundennummer}{<%customernumber%>}{\rechnung}{<%invnumber%>}{<%invdate%>}
@@ -44,22 +44,22 @@
 <%if ordnumber%>%
   \setkomavar*{myref}{\auftragsnummer}
   \setkomavar{myref}{<%ordnumber%>}
-<%end if%>%
+<%end ordnumber%>%
 <%if tax_point%>%
   \setkomavar*{taxpoint}{\leistungsdatum}
   \setkomavar{taxpoint}{<%tax_point%>}
-<%end if%>%
+<%end tax_point%>%
 <%if cusordnumber%>%
   \setkomavar*{yourref}{\ihreBestellnummer}
   \setkomavar{yourref}{<%cusordnumber%>}
-<%end if%>%
+<%end cusordnumber%>%
 <%if donumber%>%
   \setkomavar{delivery}{<%donumber%>}
-<%end if%>%
+<%end donumber%>%
 
 <%if quonumber%>%
 \setkomavar{quote}{<%quonumber%>}
-<%end if%>%
+<%end quonumber%>%
 
 \setkomavar{transaction}{<%transaction_description%>}
 <%if shiptoname%>%
@@ -82,94 +82,94 @@
   }
 \end{lrbox}
 \makeatother
-<%end if%>%
+<%end shiptoname%>%
 
 \begin{document}
 
 \begin{letter}{%
-<%if billing_address_id%>%
-	<%billing_address_name%> \strut\\%
-	<%if department_1%><%billing_address_department_1%>\\<%end if%>%
-	<%if department_2%><%billing_address_department_2%>\\<%end if%>%
-	<%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%me%>\strut\\%me%>\strut\\%me%>\strut\\%
-	<%billing_address_street%>\strut\\%
-	<%billing_address_zipcode%> <%billing_address_city%> \strut\\%
-	<%billing_address_country%>\strut\\%
-<%else%>%
-	<%name%>\strut\\%
-	<%if department_1%><%department_1%>\\<%end if%>%
-	<%if department_2%><%department_2%>\\<%end if%>%
-	<%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%
-	<%street%>\strut\\%
-	<%zipcode%> <%city%>\strut\\%
-	<%country%>\strut%
-<%end if%>%
-}
+  <%if billing_address_id%>%
+    <%billing_address_name%> \strut\\%
+    <%if department_1%><%billing_address_department_1%>\\<%end if%>%
+    <%if department_2%><%billing_address_department_2%>\\<%end if%>%
+    <%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%me%>\strut\\%me%>\strut\\%me%>\strut\\%
+    <%billing_address_street%>\strut\\%
+    <%billing_address_zipcode%> <%billing_address_city%> \strut\\%
+    <%billing_address_country%>\strut\\%
+  <%else%>%
+    <%name%>\strut\\%
+    <%if department_1%><%department_1%>\\<%end if%>%
+    <%if department_2%><%department_2%>\\<%end if%>%
+    <%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%
+    <%street%>\strut\\%
+    <%zipcode%> <%city%>\strut\\%
+    <%country%>\strut%
+  <%end billing_address_id%>%
+  }
 
-% Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
-% Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
-\opening{
-\Ifstr{<%cp_name%>}{}
-{<%if natural_person%><%greeting%> <%name%>,<%else%>\anrede<%end if%>}
-  {
-    \Ifstr{<%cp_gender%>}{f}
-        {\anredefrau}
-        {\anredeherr}
+  % Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
+  % Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
+  \opening{
+    \Ifstr{<%cp_name%>}{}
+    {<%if natural_person%><%greeting%> <%name%>,<%else%>\anrede}<%end if%>
+    {
+      \Ifstr{<%cp_gender%>}{f}
+      {\anredefrau}
+      {\anredeherr}
       <%cp_title%> <%cp_name%>,
     }
   }
-\thispagestyle{kivitendo.letter.first}
-
-<%if notes%>%
-<%notes%>%
-\vspace{0.5cm}
-<%end if%>%
-
-
-%PricingTabular* kann automatisch spalten ignorieren
-% \begin{PricingTabular*}[id=false]
-% deaktiviert damit die Spalte der Produktnummer
-% analog ist dies für pos, amount, price, pricetotal möglich.
-% Die Spalte der Bezeichnung ist nicht deaktivierbar
-%
-% Darüber hinaus kann die Reihenfolge verändert werden, die Voreinstellung entspricht:
-% \begin{PricingTabular*[columns={pos, id, desc, amount, price, pricetotal}]
-% Auf diese Art ist auch möglich mehrSpalten anzulegen als definiert sind. Für jede Spalte kann die Breite über weitere Optionen angepasst werden, die Einträge der columns-Liste entspricht den Spaltennamen.
-%
-% id = false, % deaktiviert die Spalte der Artikelnummer
-% amount = 1cm, % Setzt die Breite der Mengenspalte auf 1cm
-% desc/header = Artikelbeschreibung, %Ändert die Überschrift der Bezeichnunsspalte in „Artikelbeschreibung”
-\begin{PricingTabular*}%
-  % eigentliche Tabelle
-  \FakeTable{%
-  <%foreach number%>%
-  <%runningnumber%> &%
-  <%number%> &%
-  \textbf{<%description%>}%
-  <%if longdescription%>\ExtraDescription{<%longdescription%>}<%end longdescription%>%
-  <%if serialnumber%>\ExtraDescription{\seriennummer: <%serialnumber%>}<%end serialnumber%>%
-  <%if ean%>\ExtraDescription{\ean: <%ean%>}<%end ean%>%
-  <%if projectnumber%>\ExtraDescription{\projektnummer: <%projectnumber%>}<%end projectnumber%>%
-  &%
-  <%qty%> <%unit%> &%
-  <%sellprice%>&%
-  \Ifstr{<%p_discount%>}{0}{}{\sffamily\scriptsize{(-<%p_discount%>\,\%)}}%
-    <%linetotal%>\tabularnewline%
+  \thispagestyle{kivitendo.letter.first}
+
+  <%if notes%>%
+    <%notes%>%
+    \vspace{0.5cm}
+  <%end notes%>%
+
+
+  %PricingTabular* kann automatisch spalten ignorieren
+  % \begin{PricingTabular*}[id=false]
+  % deaktiviert damit die Spalte der Produktnummer
+  % analog ist dies für pos, amount, price, pricetotal möglich.
+  % Die Spalte der Bezeichnung ist nicht deaktivierbar
+  %
+  % Darüber hinaus kann die Reihenfolge verändert werden, die Voreinstellung entspricht:
+  % \begin{PricingTabular*[columns={pos, id, desc, amount, price, pricetotal}]
+  % Auf diese Art ist auch möglich mehrSpalten anzulegen als definiert sind. Für jede Spalte kann die Breite über weitere Optionen angepasst werden, die Einträge der columns-Liste entspricht den Spaltennamen.
+  %
+  % id = false, % deaktiviert die Spalte der Artikelnummer
+  % amount = 1cm, % Setzt die Breite der Mengenspalte auf 1cm
+  % desc/header = Artikelbeschreibung, %Ändert die Überschrift der Bezeichnunsspalte in „Artikelbeschreibung”
+  \begin{PricingTabular*}%
+    % eigentliche Tabelle
+    \FakeTable{%
+    <%foreach number%>%
+      <%runningnumber%> &%
+      <%number%> &%
+      \textbf{<%description%>}%
+      <%if longdescription%>\ExtraDescription{<%longdescription%>}<%end longdescription%>%
+      <%if serialnumber%>\ExtraDescription{\seriennummer: <%serialnumber%>}<%end serialnumber%>%
+      <%if ean%>\ExtraDescription{\ean: <%ean%>}<%end ean%>%
+      <%if projectnumber%>\ExtraDescription{\projektnummer: <%projectnumber%>}<%end projectnumber%>%
+      &%
+      <%qty%> <%unit%> &%
+      <%sellprice%>&%
+      \Ifstr{<%p_discount%>}{0}{}{\sffamily\scriptsize{(-<%p_discount%>\,\%)}}%
+      <%linetotal%>\tabularnewline%
     <%end number%>%
-  }%
-  \begin{PricingTotal}%
-    % Tabellenende letzte Seite
-    \nettobetrag & <%subtotal%>\\%
-    <%foreach tax%>%
-    <%taxdescription%> & <%tax%>\\%
-    <%end tax%>%
-    \bfseries\schlussbetrag &  \bfseries <%invtotal%>\\%
-  \end{PricingTotal}%
-\end{PricingTabular*}
-
-\vspace{0.2cm}
-
-<%if template_meta.formname == "final_invoice"%>
+    }%
+    \begin{PricingTotal}%
+      % Tabellenende letzte Seite
+      \nettobetrag & <%subtotal%>\\%
+      <%foreach tax%>%
+        <%taxdescription%> & <%tax%>\\%
+      <%end tax%>%
+      \bfseries\schlussbetrag &  \bfseries <%invtotal%>\\%
+    \end{PricingTotal}%
+  \end{PricingTabular*}
+
+  \vspace{0.2cm}
+
+  <%if template_meta.formname == "final_invoice"%>
   <%if iap_existing%>
     \abzueglichAnzahlungsrechnungen:\\
     \begin{SimpleTabular}[colspec=llr<{\tabcurrency}r<{\tabcurrency},headline={\bfseries\nr& \bfseries\date& \bfseries\betrag & \bfseries\ust}]%
@@ -177,35 +177,35 @@
         <%iap_invnumber%> & <%iap_transdate_as_date%> & <%iap_amount%> & <%iap_taxamount%>\\%
       <%end iap_invnumber%>%
     \end{SimpleTabular}%
-      \bfseries\rechnungsbetrag: <%iap_final_amount%> \currency\\%
+    \bfseries\rechnungsbetrag: <%iap_final_amount%> \currency\\%
   <%end iap_existing%>
-<%end%>%
+  <%end%>%
 
-\Ifstr{<%deliverydate%>}{}{%
-  \leistungsdatumGleichRechnungsdatum%
-}{
-  \lieferungErfolgtAm ~<%deliverydate%>.
-}\\
+  \Ifstr{<%deliverydate%>}{}{%
+    \leistungsdatumGleichRechnungsdatum%
+  }{
+    \lieferungErfolgtAm ~<%deliverydate%>.
+  }\\
 
-<%if payment_terms%>%
-\zahlung ~<%payment_terms%>\\
-<%end payment_terms%>%
+  <%if payment_terms%>%
+    \zahlung ~<%payment_terms%>\\
+  <%end payment_terms%>%
 
-<%if delivery_term%>%
-\lieferung ~<%delivery_term.description_long%>\\
-<%end delivery_term%>%
+  <%if delivery_term%>%
+    \lieferung ~<%delivery_term.description_long%>\\
+  <%end delivery_term%>%
 
-<%if ustid%>\ihreustid ~<%ustid%>.\\<%end if%>%
+  <%if ustid%>\ihreustid ~<%ustid%>.\\<%end if%>%
 
-\ifnum<%taxzone_id%>=1
-\steuerfreiEU\\  % EU mit USt-ID Nummer
-\else
-\ifnum<%taxzone_id%>=3
-\steuerfreiAUS\\  % Außerhalb EU
-\fi
-\fi
+  \ifnum<%taxzone_id%>=1
+    \steuerfreiEU\\  % EU mit USt-ID Nummer
+  \else
+    \ifnum<%taxzone_id%>=3
+      \steuerfreiAUS\\  % Außerhalb EU
+    \fi
+  \fi
 
-\closing{\gruesse}
+  \closing{\gruesse}
 
 \end{letter}
 
diff --git a/templates/print/marei/kiviletter.sty b/templates/print/marei/kiviletter.sty
index 89aea3c13..29d505464 100644
--- a/templates/print/marei/kiviletter.sty
+++ b/templates/print/marei/kiviletter.sty
@@ -209,14 +209,14 @@
         }
         \prop_if_in:cnTF {l_kivi_col_##1_prop} {colspec} {
           \kivi_if_Price_col:nTF {##1} {
-             \tl_gput_right:Nn \g_kivi_Pricing_colspec_tl {K}
+            \tl_gput_right:Nn \g_kivi_Pricing_colspec_tl {K}
           }{
-             \tl_gput_right:Nx \g_kivi_Pricing_colspec_tl {\prop_item:cn {l_kivi_col_##1_prop} {colspec}}
+            \tl_gput_right:Nx \g_kivi_Pricing_colspec_tl {\prop_item:cn {l_kivi_col_##1_prop} {colspec}}
           }
           \tl_gput_right:Nn \g_kivi_Pricing_colspec_tl {{\dim_use:c {l_kivi_tab_##1_dim}}}
-         } {
+        } {
           \tl_gput_right:Nn \g_kivi_Pricing_colspec_tl {K{\dim_use:c {l_kivi_tab_##1_dim}}}
-         }
+        }
         \kivi_if_Price_col:nT {##1} {\tl_gput_right:Nn \g_kivi_Pricing_colspec_tl {<{\__kivi_tab_column_currency:}}}
       }
     }
@@ -234,23 +234,23 @@
 \tcbuselibrary{breakable, skins}
 
 \tcb@new@skin{kivi@LT}{base@unbroken,%
-  frame~engine=empty,interior~titled~engine=empty,interior~engine=empty,segmentation~engine=empty,title~engine=empty,%
-  skin~first=kivi@LT@first,skin~middle=kivi@LT@middle,skin~last=kivi@LT@last,
-  underlay~first~and~middle={
-    \node[anchor=north]  at (interior.north)  {\csname box_use:c\endcsname  {g_kivi_LT@head_box}};
-    \node[anchor=south]  at (interior.south)  {\csname box_use:c\endcsname  {g_kivi_LT@foot_box}};
+frame~engine=empty,interior~titled~engine=empty,interior~engine=empty,segmentation~engine=empty,title~engine=empty,%
+skin~first=kivi@LT@first,skin~middle=kivi@LT@middle,skin~last=kivi@LT@last,
+underlay~first~and~middle={
+\node[anchor=north]  at (interior.north)  {\csname box_use:c\endcsname  {g_kivi_LT@head_box}};
+\node[anchor=south]  at (interior.south)  {\csname box_use:c\endcsname  {g_kivi_LT@foot_box}};
 },
-  underlay~unbroken~and~last={
-    \node[anchor=north]  at (interior.north)  {\csname box_use:c\endcsname  {g_kivi_LT@head_box}};
-    \node[anchor=south]  at (interior.south)  {\csname box_use:c\endcsname  {g_kivi_LT@lastfoot_box}};
-  },
-  boxsep=0pt,
-  boxrule=0pt,
-  left=0pt,
-  right=0pt,
-  bottom=\box_ht:N  \g_kivi_LT@foot_box+\box_dp:N  \g_kivi_LT@foot_box + \aboverulesep,
-  top=\box_ht:N  \g_kivi_LT@head_box+\box_dp:N  \g_kivi_LT@head_box +\belowrulesep,
-  parbox=false,
+underlay~unbroken~and~last={
+\node[anchor=north]  at (interior.north)  {\csname box_use:c\endcsname  {g_kivi_LT@head_box}};
+\node[anchor=south]  at (interior.south)  {\csname box_use:c\endcsname  {g_kivi_LT@lastfoot_box}};
+},
+boxsep=0pt,
+boxrule=0pt,
+left=0pt,
+right=0pt,
+bottom=\box_ht:N  \g_kivi_LT@foot_box+\box_dp:N  \g_kivi_LT@foot_box + \aboverulesep,
+top=\box_ht:N  \g_kivi_LT@head_box+\box_dp:N  \g_kivi_LT@head_box +\belowrulesep,
+parbox=false,
 }
 
 \tcb@new@skin{kivi@LT@first}{base@first,%
@@ -322,7 +322,7 @@
       {\nointerlineskip\kivi@tabcolorbox{\g__kivi_Tabular_rowcolor_even_tl}}
     }
     {
-     \parbox{\linewidth}{
+      \parbox{\linewidth}{
         \seq_set_split:Nnn  \l_kivi_columns_seq {&} {##1}
         \seq_gclear:N \g_kivi_extraDescription_seq
         \exp_args:Nnx \use:n {\tabular[t]}\g_kivi_Pricing_colspec_tl
@@ -332,27 +332,27 @@
           &\seq_item:Nn \l_kivi_columns_seq {####1}
         }
         \endtabular
-       }
       }
+    }
 
-        \seq_if_empty:NTF \g_kivi_extraDescription_seq
-        {\par}
-        {\par\nopagebreak
-            \bool_if:NT \g__kivi_Tabular_content_rowcolor_bool {
-              \int_if_odd:nTF {\g__kivi_PricingTable_rowcolor_int}
-              {\nointerlineskip\kivi@tabcolorbox{\g__kivi_Tabular_rowcolor_odd_tl}}
-              {\nointerlineskip\kivi@tabcolorbox{\g__kivi_Tabular_rowcolor_even_tl}}
-            }
-          {
-          \setlength{\leftskip}{\dim_eval:n {\bool_if:NT \g__kivi_Tabular_rowcolor_bool {-\tabcolsep} +\l_kivi_tab_desc_leftskip_dim}}
-          \setlength{\hsize}{\dim_eval:n {\l_kivi_tab_desc_dim+\leftskip}}
-          \setlength{\linewidth}{\hsize}
-          \addtolength{\leftmargini}{\l_kivi_tab_desc_leftskip_dim}
-          \usekomafont{extraDescription}
-          \seq_use:Nn \g_kivi_extraDescription_seq {\ifhmode\\\fi}
-          \par
-          }
-        }
+    \seq_if_empty:NTF \g_kivi_extraDescription_seq
+    {\par}
+    {\par\nopagebreak
+      \bool_if:NT \g__kivi_Tabular_content_rowcolor_bool {
+        \int_if_odd:nTF {\g__kivi_PricingTable_rowcolor_int}
+        {\nointerlineskip\kivi@tabcolorbox{\g__kivi_Tabular_rowcolor_odd_tl}}
+        {\nointerlineskip\kivi@tabcolorbox{\g__kivi_Tabular_rowcolor_even_tl}}
+      }
+      {
+        \setlength{\leftskip}{\dim_eval:n {\bool_if:NT \g__kivi_Tabular_rowcolor_bool {-\tabcolsep} +\l_kivi_tab_desc_leftskip_dim}}
+        \setlength{\hsize}{\dim_eval:n {\l_kivi_tab_desc_dim+\leftskip}}
+        \setlength{\linewidth}{\hsize}
+        \addtolength{\leftmargini}{\l_kivi_tab_desc_leftskip_dim}
+        \usekomafont{extraDescription}
+        \seq_use:Nn \g_kivi_extraDescription_seq {\ifhmode\\\fi}
+        \par
+      }
+    }
     \par
     \tl_if_empty:NF \l__kivi_Tabular_rowsep_tl {\nointerlineskip\l__kivi_Tabular_rowsep_tl}
   }
@@ -371,14 +371,14 @@
 
 \tl_new:N \g_kivi_Pricing_colspec_tl
 \tl_gset:Nn \g_kivi_Pricing_colspec_tl {
-  \bool_if:NF \g__kivi_Tabular_rowcolor_bool {@{}}
-  \bool_if:NT \l_kivi_col_pos_bool {p{\l_kivi_tab_pos_dim}}
-  \bool_if:NT \l_kivi_col_id_bool {p{\l_kivi_tab_id_dim}}
-  p{\l_kivi_tab_desc_dim}
-  \bool_if:NT \l_kivi_col_amount_bool {\exp_not:n {>{\raggedleft\arraybackslash}p{\l_kivi_tab_amount_dim}}}
-  \bool_if:NT \l_kivi_col_price_bool {\exp_not:n {>{\raggedleft\arraybackslash}p{\l_kivi_tab_price_dim}<{\__kivi_tab_column_currency:}}}
-  \bool_if:NT \l_kivi_col_pricetotal_bool {\exp_not:n {>{\raggedleft\arraybackslash}p{\l_kivi_tab_pricetotal_dim}<{\__kivi_tab_column_currency:}}}
-  \bool_if:NF \g__kivi_Tabular_rowcolor_bool {@{}}
+\bool_if:NF \g__kivi_Tabular_rowcolor_bool {@{}}
+\bool_if:NT \l_kivi_col_pos_bool {p{\l_kivi_tab_pos_dim}}
+\bool_if:NT \l_kivi_col_id_bool {p{\l_kivi_tab_id_dim}}
+p{\l_kivi_tab_desc_dim}
+\bool_if:NT \l_kivi_col_amount_bool {\exp_not:n {>{\raggedleft\arraybackslash}p{\l_kivi_tab_amount_dim}}}
+\bool_if:NT \l_kivi_col_price_bool {\exp_not:n {>{\raggedleft\arraybackslash}p{\l_kivi_tab_price_dim}<{\__kivi_tab_column_currency:}}}
+\bool_if:NT \l_kivi_col_pricetotal_bool {\exp_not:n {>{\raggedleft\arraybackslash}p{\l_kivi_tab_pricetotal_dim}<{\__kivi_tab_column_currency:}}}
+\bool_if:NF \g__kivi_Tabular_rowcolor_bool {@{}}
 }
 
 \cs_new_protected:Nn \__kivi_tab_column_currency: {\,\currency}
@@ -404,7 +404,7 @@
     }
   }
   \bool_if:nT {\g__kivi_Tabular_rowcolor_bool  && ! \g__kivi_Tabular_content_rowcolor_bool } {
-	\box_gset_dp:Nn \g_kivi_LT@head_box  {\box_dp:N \g_kivi_LT@head_box + \l__kivi_fboxsep_dim}
+    \box_gset_dp:Nn \g_kivi_LT@head_box  {\box_dp:N \g_kivi_LT@head_box + \l__kivi_fboxsep_dim}
   }
   \hbox_gset:Nn \g_kivi_LT@foot_box {
     \begin{tabular*}{\textwidth}[t]{@{\extracolsep{\fill}}r@{\bool_if:NT \g__kivi_Tabular_rowcolor_bool {\hskip\tabcolsep}}}
@@ -417,7 +417,7 @@
   \hbox_gset:Nn \g_kivi_LT@lastfoot_box {
     \raisebox{\dimexpr\depth+\baselineskip}[0pt][0pt]{
       \begin{tabular*}{\textwidth}{@{\bool_if:NT \g__kivi_Tabular_rowcolor_bool {\hskip\tabcolsep}\extracolsep{\fill}}r@{\bool_if:NT \g__kivi_Tabular_rowcolor_bool {\hskip\tabcolsep}}}
-      \bool_if:NF \g__kivi_Tabular_rowcolor_bool \bottomrule
+        \bool_if:NF \g__kivi_Tabular_rowcolor_bool \bottomrule
       \end{tabular*}
     }
   }
@@ -426,18 +426,18 @@
 
 %Macht es sinn hier eine Variante zu machen, in der alle Spalten Belegbar sind?
 \NewDocumentEnvironment{PricingTotal}{+b}{
-  \par\nointerlineskip
+\par\nointerlineskip
 }{
-  \bool_if:NT \g__kivi_Tabular_rowcolor_bool {\nointerlineskip\kivi@tabcolorbox{\g__kivi_Tabular_rowcolor_PricingTotal_tl}}
-  {
-    \tabular[t]{
-      @{\bool_if:NT \g__kivi_Tabular_rowcolor_bool {\hskip\tabcolsep}}
-      p{\dim_eval:n {\linewidth-\l_kivi_tab_pricetotal_dim-\bool_if:NTF \g__kivi_Tabular_rowcolor_bool {4}{2}\tabcolsep}}P{\l_kivi_tab_pricetotal_dim}@{\bool_if:NT \g__kivi_Tabular_rowcolor_bool {\hskip\tabcolsep}}
-    }
-    \l__kivi_Tabular_PricingTotal_topsep_tl
-    #1
-    \endtabular
-  }
+\bool_if:NT \g__kivi_Tabular_rowcolor_bool {\nointerlineskip\kivi@tabcolorbox{\g__kivi_Tabular_rowcolor_PricingTotal_tl}}
+{
+\tabular[t]{
+@{\bool_if:NT \g__kivi_Tabular_rowcolor_bool {\hskip\tabcolsep}}
+p{\dim_eval:n {\linewidth-\l_kivi_tab_pricetotal_dim-\bool_if:NTF \g__kivi_Tabular_rowcolor_bool {4}{2}\tabcolsep}}P{\l_kivi_tab_pricetotal_dim}@{\bool_if:NT \g__kivi_Tabular_rowcolor_bool {\hskip\tabcolsep}}
+}
+\l__kivi_Tabular_PricingTotal_topsep_tl
+#1
+\endtabular
+}
 }
 
 \tl_new:N \l__kivi_Tabular_PricingTotal_topsep_tl
@@ -502,16 +502,16 @@
 
 \keys_define:nn {kivi/Tabular} {
   color-rows .code:n = {
-		\bool_gset_eq:Nc \g__kivi_Tabular_rowcolor_bool {c_#1_bool}
-		\bool_gset_eq:Nc \g__kivi_Tabular_content_rowcolor_bool {c_#1_bool}
-	},
+      \bool_gset_eq:Nc \g__kivi_Tabular_rowcolor_bool {c_#1_bool}
+      \bool_gset_eq:Nc \g__kivi_Tabular_content_rowcolor_bool {c_#1_bool}
+    },
   color-rows .initial:n = false,
   color-rows .default:n = true,
   color-only-structure .code:n  = {
-		\bool_gset_eq:Nc \g__kivi_Tabular_rowcolor_bool {c_#1_bool}
-		\bool_gset_eq:Nc \g__kivi_Tabular_content_rowcolor_bool {c_#1_bool}
-		\bool_gset_inverse:N \g__kivi_Tabular_content_rowcolor_bool
-	},
+      \bool_gset_eq:Nc \g__kivi_Tabular_rowcolor_bool {c_#1_bool}
+      \bool_gset_eq:Nc \g__kivi_Tabular_content_rowcolor_bool {c_#1_bool}
+      \bool_gset_inverse:N \g__kivi_Tabular_content_rowcolor_bool
+    },
   color-only-structure .initial:n = false,
   color-only-structure .default:n = true,
   rowcolor-odd .tl_gset:N = \g__kivi_Tabular_rowcolor_odd_tl,
@@ -525,10 +525,10 @@
   rowsep .tl_set:N =\l__kivi_Tabular_rowsep_tl,
   rowsep .initial:n = ,
   hrule .meta:n = {
-    rowsep={
-      \vskip\aboverulesep
-      \leavevmode\hrule\@height\lightrulewidth
-      \vskip\belowrulesep}},
+      rowsep={
+          \vskip\aboverulesep
+          \leavevmode\hrule\@height\lightrulewidth
+          \vskip\belowrulesep}},
 }
 
 \newcommand*{\SetupSimpleTabular}[1]{\keys_set:nn {kivi/SimpleTabular} {#1}}
diff --git a/templates/print/marei/letter.tex b/templates/print/marei/letter.tex
index 1f29b1d6b..ea8d1cb71 100644
--- a/templates/print/marei/letter.tex
+++ b/templates/print/marei/letter.tex
@@ -34,19 +34,19 @@ $( IF letter.subject )$
 $( END )$
 
 \begin{letter}{
-$( KiviLatex.filter(customer.name) )$\strut\\
-$( KiviLatex.filter(letter.contact.formal_greeting) )$\strut\\
-$( KiviLatex.filter(customer.street) )$\strut\\
-$( KiviLatex.filter(customer.zipcode) )$ $( KiviLatex.filter(customer.city) )$\strut\\
-$( KiviLatex.filter(customer.country) )$%
-}
+    $( KiviLatex.filter(customer.name) )$\strut\\
+    $( KiviLatex.filter(letter.contact.formal_greeting) )$\strut\\
+    $( KiviLatex.filter(customer.street) )$\strut\\
+    $( KiviLatex.filter(customer.zipcode) )$ $( KiviLatex.filter(customer.city) )$\strut\\
+    $( KiviLatex.filter(customer.country) )$%
+  }
 
-\opening{$( KiviLatex.filter(letter.greeting) )$}
-\thispagestyle{kivitendo.letter.first}
+  \opening{$( KiviLatex.filter(letter.greeting) )$}
+  \thispagestyle{kivitendo.letter.first}
 
-$( KiviLatex.filter_html(letter.body) )$
+  $( KiviLatex.filter_html(letter.body) )$
 
-\closing{\gruesse}
+  \closing{\gruesse}
 
 \end{letter}
 
diff --git a/templates/print/marei/pick_list.tex b/templates/print/marei/pick_list.tex
index 23736b55b..3981ff513 100644
--- a/templates/print/marei/pick_list.tex
+++ b/templates/print/marei/pick_list.tex
@@ -15,7 +15,7 @@
 \setkomavar{firsthead}{
   \normalsize
   \noindent\begin{tabular}[t]{@{}l@{}}
-    <%company%>\strut\\
+    <%company%>\strut \\
     <%address%>
   \end{tabular}
   \hfill
@@ -28,60 +28,60 @@
 
 \makeatletter
 \setkomavar{location}{
-  \normalsize
-  <%shiptocontact%>%
-  <%if shiptophone%>%
+\normalsize
+<%shiptocontact%>%
+<%if shiptophone%>%
   \\\textTelefon : <%shiptophone%>
-  <%end shiptophone%>%
-  <%if shiptofax%>%
+<%end shiptophone%>%
+<%if shiptofax%>%
   \\\textFax : <%shiptofax%>
-  <%end shiptofax%>%
-  \\%
-  <%shiptoemail%>%
+<%end shiptofax%>%
+\\%
+<%shiptoemail%>%
 }
 \makeatother
 
 \setkomavar{backaddress}{\lieferanschrift}
 
 \begin{letter}{\strut%
-<%shiptoname%>\ifhmode\\\fi
-<%shiptostreet%>\ifhmode\\\fi
-<%shiptozipcode%>\ifhmode\\\fi
-<%shiptocity%>\ifhmode\\\fi
-<%shiptocountry%>%
-}
-
-\opening{}
-
-
-\begin{SimpleTabular}[colspec=*6X,headline={\bfseries\bestellnummer&\bfseries\datum&\bfseries\kontakt
-        <%if warehouse%>%
-        &\bfseries\lager%
-        <%end warehouse%>%
-        &\bfseries\lagerplatz&\bfseries\lieferungMit}]
-  <%ordnumber%>%
-  &%
-  <%if shippingdate%>%
-  <%shippingdate%>%
-  <%end shippingdate%>%
-  <%if not shippingdate%>%
-  <%orddate%>%
-  <%end shippingdate%>%
-  & <%employee%>%
-  <%if warehouse%>%
-  & <%warehouse%>%
-  <%end warehouse%>%
-  & <%shippingpoint%> & <%shipvia%> \\
-\end{SimpleTabular}
-
-\bigskip
-
-\begin{SimpleTabular}[colspec=rlXrcll,headline={\bfseries\position&\bfseries\nummer&\bfseries\beschreibung&\bfseries\menge&\bfseries\lagerausgang&&\bfseries\lagerplatz}]%
-  <%foreach number%>%
-  <%runningnumber%> & <%number%> & <%description%> &%
-  <%qty%> & [\hspace{1cm}] & <%unit%> & <%bin%> \\%
-  <%end number%>%
-\end{SimpleTabular}
+    <%shiptoname%>\ifhmode\\\fi
+    <%shiptostreet%>\ifhmode\\\fi
+    <%shiptozipcode%>\ifhmode\\\fi
+    <%shiptocity%>\ifhmode\\\fi
+    <%shiptocountry%>%
+  }
+
+  \opening{}
+
+
+  \begin{SimpleTabular}[colspec=*6X,headline={\bfseries\bestellnummer&\bfseries\datum&\bfseries\kontakt
+    <%if warehouse%>%
+      &\bfseries\lager%
+    <%end warehouse%>%
+    &\bfseries\lagerplatz&\bfseries\lieferungMit}]
+    <%ordnumber%>%
+    &%
+    <%if shippingdate%>%
+      <%shippingdate%>%
+    <%end shippingdate%>%
+    <%if not shippingdate%>%
+    <%orddate%>%
+    <%end shippingdate%>%
+    & <%employee%>%
+    <%if warehouse%>%
+      & <%warehouse%>%
+    <%end warehouse%>%
+    & <%shippingpoint%> & <%shipvia%> \\
+  \end{SimpleTabular}
+
+  \bigskip
+
+  \begin{SimpleTabular}[colspec=rlXrcll,headline={\bfseries\position&\bfseries\nummer&\bfseries\beschreibung&\bfseries\menge&\bfseries\lagerausgang&&\bfseries\lagerplatz}]%
+    <%foreach number%>%
+      <%runningnumber%> & <%number%> & <%description%> &%
+      <%qty%> & [\hspace{1cm}] & <%unit%> & <%bin%> \\%
+    <%end number%>%
+  \end{SimpleTabular}
 
 \end{letter}
 
diff --git a/templates/print/marei/proforma.tex b/templates/print/marei/proforma.tex
index 6f4c5d737..a75530b38 100644
--- a/templates/print/marei/proforma.tex
+++ b/templates/print/marei/proforma.tex
@@ -27,9 +27,9 @@
 \setkomavar{date}{<%orddate%>}
 \setkomavar{customer}{<%customernumber%>}
 <%if cusordnumber%>%
-\setkomavar*{yourref}{\ihreBestellnummer}
-\setkomavar{yourref}{<%cusordnumber%>}
-<%end if%>%
+  \setkomavar*{yourref}{\ihreBestellnummer}
+  \setkomavar{yourref}{<%cusordnumber%>}
+<%end cusordnumber%>%
 <%if quonumber%>\setkomavar{quote}{<%quonumber%>}<%end if%>%
 \setkomavar{fromname}{<%employee_name%>}
 \setkomavar{fromphone}{<%employee_tel%>}
@@ -37,104 +37,104 @@
 \setkomavar{transaction}{<%transaction_description%>}
 
 <%if shiptoname%>%
-\makeatletter
-\begin{lrbox}\shippingAddressBox
-  \parbox{\useplength{toaddrwidth}}{
-    \backaddr@format{\scriptsize\usekomafont{backaddress}%
-      \strut\abweichendeLieferadresse
+  \makeatletter
+  \begin{lrbox}\shippingAddressBox
+    \parbox{\useplength{toaddrwidth}}{
+      \backaddr@format{\scriptsize\usekomafont{backaddress}%
+        \strut\abweichendeLieferadresse
+      }
+      \par\smallskip
+      \setlength{\parskip}{\z@}
+      \par
+      \normalsize
+      <%shiptoname%>\par
+      <%if shiptocontact%> <%shiptocontact%><%end if%>\par
+      <%shiptodepartment_1%>\par
+      <%shiptodepartment_2%>\par
+      <%shiptostreet%>\par
+      <%shiptozipcode%> <%shiptocity%>%
     }
-    \par\smallskip
-    \setlength{\parskip}{\z@}
-    \par
-    \normalsize
-    <%shiptoname%>\par
-    <%if shiptocontact%> <%shiptocontact%><%end if%>\par
-    <%shiptodepartment_1%>\par
-    <%shiptodepartment_2%>\par
-    <%shiptostreet%>\par
-    <%shiptozipcode%> <%shiptocity%>%
-  }
-\end{lrbox}
-\makeatother
-<%end if%>%
+  \end{lrbox}
+  \makeatother
+<%end shiptoname%>%
 
 \begin{letter}{%
-<%if billing_address_id%>%
-	<%billing_address_name%> \strut\\%
-	<%if department_1%><%billing_address_department_1%>\\<%end if%>%
-	<%if department_2%><%billing_address_department_2%>\\<%end if%>%
-	<%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%
-	<%billing_address_street%>\strut\\%
-	<%billing_address_zipcode%> <%billing_address_city%> \strut\\%
-	<%billing_address_country%>\strut\\%
-<%else%>%
-	<%name%>\strut\\%
-	<%if department_1%><%department_1%>\\<%end if%>%
-	<%if department_2%><%department_2%>\\<%end if%>%
-	<%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%
-	<%street%>\strut\\%
-	<%zipcode%> <%city%>\strut\\%
-	<%country%>\strut%
-<%end if%>%
-}
+  <%if billing_address_id%>%
+    <%billing_address_name%> \strut\\%
+    <%if department_1%><%billing_address_department_1%>\\<%end if%>%
+    <%if department_2%><%billing_address_department_2%>\\<%end if%>%
+    <%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%
+    <%billing_address_street%>\strut\\%
+    <%billing_address_zipcode%> <%billing_address_city%> \strut\\%
+    <%billing_address_country%>\strut\\%
+  <%else%>%
+    <%name%>\strut\\%
+    <%if department_1%><%department_1%>\\<%end if%>%
+    <%if department_2%><%department_2%>\\<%end if%>%
+    <%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%
+    <%street%>\strut\\%
+    <%zipcode%> <%city%>\strut\\%
+    <%country%>\strut%
+  <%end billing_address_id%>%
+  }
 
-% Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
-% Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
-\opening{
-\Ifstr{<%cp_name%>}{}
-{<%if natural_person%><%greeting%> <%name%>,<%else%>\anrede<%end if%>}
-  {
-    \Ifstr{<%cp_gender%>}{f}
-        {\anredefrau}
-        {\anredeherr}
+  % Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
+  % Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
+  \opening{
+    \Ifstr{<%cp_name%>}{}
+    {<%if natural_person%><%greeting%> <%name%>,<%else%>\anrede}<%end if%>
+    {
+      \Ifstr{<%cp_gender%>}{f}
+      {\anredefrau}
+      {\anredeherr}
       <%cp_title%> <%cp_name%>,
     }
   }
-\thispagestyle{kivitendo.letter.first}
-
-\auftragsformel
-
-\begin{PricingTabular*}%
-  % eigentliche Tabelle
-  \FakeTable{%
-  <%foreach number%>%
-  <%runningnumber%> &%
-  <%number%> &%
-  \textbf{<%description%>}%
-  <%if longdescription%>\ExtraDescription{<%longdescription%>}<%end longdescription%>%
-  <%if reqdate%>\ExtraDescription{\lieferdatum: <%reqdate%>}<%end reqdate%>%
-  <%if serialnumber%>\ExtraDescription{\seriennummer: <%serialnumber%>}<%end serialnumber%>%
-  <%if ean%>\ExtraDescription{\ean: <%ean%>}<%end ean%>%
-  <%if projectnumber%>\ExtraDescription{\projektnummer: <%projectnumber%>}<%end projectnumber%>%
-  &%
-  <%qty%> <%unit%> &%
-  <%sellprice%>&%
-  \Ifstr{<%p_discount%>}{0}{}{\sffamily\scriptsize{(-<%p_discount%>\,\%)}}%
-    <%linetotal%>\tabularnewline%
+  \thispagestyle{kivitendo.letter.first}
+
+  \auftragsformel
+
+  \begin{PricingTabular*}%
+    % eigentliche Tabelle
+    \FakeTable{%
+    <%foreach number%>%
+      <%runningnumber%> &%
+      <%number%> &%
+      \textbf{<%description%>}%
+      <%if longdescription%>\ExtraDescription{<%longdescription%>}<%end longdescription%>%
+      <%if reqdate%>\ExtraDescription{\lieferdatum: <%reqdate%>}<%end reqdate%>%
+      <%if serialnumber%>\ExtraDescription{\seriennummer: <%serialnumber%>}<%end serialnumber%>%
+      <%if ean%>\ExtraDescription{\ean: <%ean%>}<%end ean%>%
+      <%if projectnumber%>\ExtraDescription{\projektnummer: <%projectnumber%>}<%end projectnumber%>%
+      &%
+      <%qty%> <%unit%> &%
+      <%sellprice%>&%
+      \Ifstr{<%p_discount%>}{0}{}{\sffamily\scriptsize{(-<%p_discount%>\,\%)}}%
+      <%linetotal%>\tabularnewline%
     <%end number%>%
-  }%
-  \begin{PricingTotal}%
-    % Tabellenende letzte Seite%
-    \nettobetrag & <%subtotal%>\\%
-    <%foreach tax%>%
-    <%taxdescription%> & <%tax%>\\%
-    <%end tax%>%
-    \bfseries\schlussbetrag &  \bfseries <%invtotal%>\\%
-  \end{PricingTotal}%
-\end{PricingTabular*}
-
-<%if notes%>%
-<%notes%>%
-\medskip
-<%end if%>%
-
-<%if reqdate%>%
-\lieferungErfolgtAm ~<%reqdate%>. \\
-<%end if%>%
-
-\textit{\auftragpruefen}
-
-\closing{\gruesse}
+    }%
+    \begin{PricingTotal}%
+      % Tabellenende letzte Seite%
+      \nettobetrag & <%subtotal%>\\%
+      <%foreach tax%>%
+        <%taxdescription%> & <%tax%>\\%
+      <%end tax%>%
+      \bfseries\schlussbetrag &  \bfseries <%invtotal%>\\%
+    \end{PricingTotal}%
+  \end{PricingTabular*}
+
+  <%if notes%>%
+    <%notes%>%
+    \medskip
+  <%end notes%>%
+
+  <%if reqdate%>%
+    \lieferungErfolgtAm ~<%reqdate%>. \\
+  <%end reqdate%>%
+
+  \textit{\auftragpruefen}
+
+  \closing{\gruesse}
 
 \end{letter}
 
diff --git a/templates/print/marei/purchase_delivery_order.tex b/templates/print/marei/purchase_delivery_order.tex
index 6648b07d7..9c744982b 100644
--- a/templates/print/marei/purchase_delivery_order.tex
+++ b/templates/print/marei/purchase_delivery_order.tex
@@ -26,11 +26,11 @@
 }
 <%if ordnumber%>
 	\setkomavar{orderID}{<%ordnumber%>}
-<%end if%>%
+<%end ordnumber%>%
 <%if cusordnumber%>%
 	\setkomavar*{yourref}{\unsereBestellnummer}
 	\setkomavar{yourref}{<%cusordnumber%>}
-<%end if%>%
+<%end cusordnumber%>%
 \setkomavar{transaction}{<%transaction_description%>}
 
 <%if globalprojectnumber%>%
@@ -59,59 +59,59 @@
 	}
 \end{lrbox}
 \makeatother
-<%end if%>%
+<%end shiptoname%>%
 
 
 \begin{document}
 
 
 \begin{letter}{
-	<%name%>\strut\\
-	<%if department_1%><%department_1%>\\<%end if%>%
-	<%if department_2%><%department_2%>\\<%end if%>%
+    <%name%>\strut\\
+    <%if department_1%><%department_1%>\\<%end if%>%
+    <%if department_2%><%department_2%>\\<%end if%>%
     <%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\
-	<%street%>\strut\\
-	<%zipcode%> <%city%>\strut\\
-	<%country%> \strut
-}
-
-
-\opening{}
-\thispagestyle{kivitendo.letter.first}
-
-\begin{PricingTabular*}[columns={pos,amount,desc}]
-% eigentliche Tabelle
-\FakeTable{
-<%foreach number%>%
-	<%runningnumber%> &
-	<%qty%> <%unit%> &
-	\textbf{<%description%>}
-		<%if longdescription%>\ExtraDescription{<%longdescription%>}<%end longdescription%>%
-		<%if reqdate%>\ExtraDescription{\lieferdatum: <%reqdate%>}<%end reqdate%>%
-		<%if serialnumber%>\ExtraDescription{\seriennummer: <%serialnumber%>}<%end serialnumber%>%
-		<%if ean%>\ExtraDescription{\ean: <%ean%>}<%end ean%>%
-		<%if projectnumber%>\ExtraDescription{\projektnummer: <%projectnumber%>}<%end projectnumber%>%
-		<%foreach si_number%>%
-			\ExtraDescription{<%if si_chargenumber%>\charge: <%si_chargenumber%>
+    <%street%>\strut\\
+    <%zipcode%> <%city%>\strut\\
+    <%country%> \strut
+  }
+
+
+  \opening{}
+  \thispagestyle{kivitendo.letter.first}
+
+  \begin{PricingTabular*}[columns={pos,amount,desc}]
+    % eigentliche Tabelle
+    \FakeTable{
+    <%foreach number%>%
+      <%runningnumber%> &
+      <%qty%> <%unit%> &
+      \textbf{<%description%>}
+      <%if longdescription%>\ExtraDescription{<%longdescription%>}<%end longdescription%>%
+      <%if reqdate%>\ExtraDescription{\lieferdatum: <%reqdate%>}<%end reqdate%>%
+      <%if serialnumber%>\ExtraDescription{\seriennummer: <%serialnumber%>}<%end serialnumber%>%
+      <%if ean%>\ExtraDescription{\ean: <%ean%>}<%end ean%>%
+      <%if projectnumber%>\ExtraDescription{\projektnummer: <%projectnumber%>}<%end projectnumber%>%
+      <%foreach si_number%>%
+      \ExtraDescription{<%if si_chargenumber%>\charge: <%si_chargenumber%>
         <%if si_bestbefore%> \mhd: <%si_bestbefore%><%end si_bestbefore%>~--~<%si_qty%>~<%si_unit%>
         <%end si_chargenumber%>%%
       }%
-		<%end si_number%>%
-	\tabularnewline
-<%end number%>%
-}
-\end{PricingTabular*}
-
-\medskip
-
-<%if notes%>%
-<%notes%>%
-\medskip
-<%end if%>%
-
-<%if delivery_term%>%
-  \lieferung ~<%delivery_term.description_long%>\\
-<%end delivery_term%>%
+      <%end si_number%>%
+      \tabularnewline
+    <%end number%>%
+    }
+  \end{PricingTabular*}
+
+  \medskip
+
+  <%if notes%>%
+    <%notes%>%
+    \medskip
+  <%end notes%>%
+
+  <%if delivery_term%>%
+    \lieferung ~<%delivery_term.description_long%>\\
+  <%end delivery_term%>%
 
 \end{letter}
 
diff --git a/templates/print/marei/purchase_order.tex b/templates/print/marei/purchase_order.tex
index 0c7537247..1e4cb2d8f 100644
--- a/templates/print/marei/purchase_order.tex
+++ b/templates/print/marei/purchase_order.tex
@@ -30,12 +30,12 @@
 <%if cusordnumber%>%
   \setkomavar*{yourref}{\unsereBestellnummer}
   \setkomavar{yourref}{<%cusordnumber%>}
-<%end if%>%
+<%end cusordnumber%>%
 \setkomavar{transaction}{<%transaction_description%>}
 
 <%if quonumber%>
   \setkomavar{quote}{<%quonumber%>}
-<%end if%>%
+<%end quonumber%>%
 
 <%if shiptoname%>%
 \makeatletter
@@ -57,75 +57,75 @@
   }
 \end{lrbox}
 \makeatother
-<%end if%>%
+<%end shiptoname%>%
 
 \begin{document}
 
 \begin{letter}{
-<%name%>\strut\\
-<%if department_1%><%department_1%>\\<%end if%>%
-<%if department_2%><%department_2%>\\<%end if%>%
-<%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\
-<%street%>\strut\\
-<%zipcode%> <%city%>\strut\\
-<%country%> \strut
-}
+    <%name%>\strut\\
+    <%if department_1%><%department_1%>\\<%end if%>%
+    <%if department_2%><%department_2%>\\<%end if%>%
+    <%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\
+    <%street%>\strut\\
+    <%zipcode%> <%city%>\strut\\
+    <%country%> \strut
+  }
 
-% Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
-% Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
-\opening{
-\Ifstr{<%cp_name%>}{}
-{<%if natural_person%><%greeting%> <%name%>,<%else%>\anrede<%end if%>}
-  {
-    \Ifstr{<%cp_gender%>}{f}
-        {\anredefrau}
-        {\anredeherr}
+  % Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
+  % Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
+  \opening{
+    \Ifstr{<%cp_name%>}{}
+    {<%if natural_person%><%greeting%> <%name%>,<%else%>\anrede}<%end if%>
+    {
+      \Ifstr{<%cp_gender%>}{f}
+      {\anredefrau}
+      {\anredeherr}
       <%cp_title%> <%cp_name%>,
     }
   }
-\thispagestyle{kivitendo.letter.first}
-
-\bestellformel
-
-\begin{PricingTabular*}
-  % eigentliche Tabelle
-  \FakeTable{
-  <%foreach number%>%
-  <%runningnumber%> &%
-  <%number%> &%
-  \textbf{<%description%>}%
-  <%if longdescription%>\ExtraDescription{<%longdescription%>}<%end longdescription%>%
-  <%if reqdate%>\ExtraDescription{\lieferdatum: <%reqdate%>}<%end reqdate%>%
-  <%if serialnumber%>\ExtraDescription{\seriennummer: <%serialnumber%>}<%end serialnumber%>%
-  <%if ean%>\ExtraDescription{\ean: <%ean%>}<%end ean%>%
-  <%if projectnumber%>\ExtraDescription{\projektnummer: <%projectnumber%>}<%end projectnumber%>%
-  &%
-  <%qty%> <%unit%> &%
-  <%sellprice%>&%
-  \Ifstr{<%p_discount%>}{0}{}{\sffamily\scriptsize{(-<%p_discount%>\,\%)}}%
-    <%linetotal%>\tabularnewline
+  \thispagestyle{kivitendo.letter.first}
+
+  \bestellformel
+
+  \begin{PricingTabular*}
+    % eigentliche Tabelle
+    \FakeTable{
+    <%foreach number%>%
+      <%runningnumber%> &%
+      <%number%> &%
+      \textbf{<%description%>}%
+      <%if longdescription%>\ExtraDescription{<%longdescription%>}<%end longdescription%>%
+      <%if reqdate%>\ExtraDescription{\lieferdatum: <%reqdate%>}<%end reqdate%>%
+      <%if serialnumber%>\ExtraDescription{\seriennummer: <%serialnumber%>}<%end serialnumber%>%
+      <%if ean%>\ExtraDescription{\ean: <%ean%>}<%end ean%>%
+      <%if projectnumber%>\ExtraDescription{\projektnummer: <%projectnumber%>}<%end projectnumber%>%
+      &%
+      <%qty%> <%unit%> &%
+      <%sellprice%>&%
+      \Ifstr{<%p_discount%>}{0}{}{\sffamily\scriptsize{(-<%p_discount%>\,\%)}}%
+      <%linetotal%>\tabularnewline
     <%end number%>%
-  }%
-  \begin{PricingTotal}%
-    % Tabellenende letzte Seite
-    \nettobetrag & <%subtotal%>\\%
-    <%foreach tax%>%
-    <%taxdescription%> & <%tax%>\\%
-    <%end tax%>%
-    \bfseries\schlussbetrag &  \bfseries <%ordtotal%>\\%
-  \end{PricingTotal}
-\end{PricingTabular*}
-
-<%if notes%>%
-<%notes%>%
-\medskip
-<%end if%>%
-
-<%if delivery_term%>%
-\lieferung ~<%delivery_term.description_long%>\\
-<%end delivery_term%>%
-
-\closing{\gruesse}
+    }%
+    \begin{PricingTotal}%
+      % Tabellenende letzte Seite
+      \nettobetrag & <%subtotal%>\\%
+      <%foreach tax%>%
+        <%taxdescription%> & <%tax%>\\%
+      <%end tax%>%
+      \bfseries\schlussbetrag &  \bfseries <%ordtotal%>\\%
+    \end{PricingTotal}
+  \end{PricingTabular*}
+
+  <%if notes%>%
+    <%notes%>%
+    \medskip
+  <%end notes%>%
+
+  <%if delivery_term%>%
+    \lieferung ~<%delivery_term.description_long%>\\
+  <%end delivery_term%>%
+
+  \closing{\gruesse}
 \end{letter}
 
 \end{document}
diff --git a/templates/print/marei/purchase_quotation_intake.tex b/templates/print/marei/purchase_quotation_intake.tex
index 85bb32069..a27dad4e4 100644
--- a/templates/print/marei/purchase_quotation_intake.tex
+++ b/templates/print/marei/purchase_quotation_intake.tex
@@ -51,75 +51,75 @@
   }
 \end{lrbox}
 \makeatother
-<%end if%>%
+<%end shiptoname%>%
 
 \begin{document}
 
 \begin{letter}{
-<%name%>\strut\\
-<%if department_1%><%department_1%>\\<%end if%>%
-<%if department_2%><%department_2%>\\<%end if%>%
-<%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\
-<%street%>\strut\\
-<%zipcode%> <%city%>\strut\\
-<%country%> \strut
-}
+    <%name%>\strut\\
+    <%if department_1%><%department_1%>\\<%end if%>%
+    <%if department_2%><%department_2%>\\<%end if%>%
+    <%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\
+    <%street%>\strut\\
+    <%zipcode%> <%city%>\strut\\
+    <%country%> \strut
+  }
 
-% Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
-% Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
-\opening{
-\Ifstr{<%cp_name%>}{}
-{<%if natural_person%><%greeting%> <%name%>,<%else%>\anrede<%end if%>}
-  {
-    \Ifstr{<%cp_gender%>}{f}
-        {\anredefrau}
-        {\anredeherr}
+  % Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
+  % Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
+  \opening{
+    \Ifstr{<%cp_name%>}{}
+    {<%if natural_person%><%greeting%> <%name%>,<%else%>\anrede}<%end if%>
+    {
+      \Ifstr{<%cp_gender%>}{f}
+      {\anredefrau}
+      {\anredeherr}
       <%cp_title%> <%cp_name%>,
     }
   }
-\thispagestyle{kivitendo.letter.first}
-
-\angebotseingangformel
-
-\begin{PricingTabular*}
-  % eigentliche Tabelle
-  \FakeTable{
-  <%foreach number%>%
-  <%runningnumber%> &%
-  <%number%> &%
-  \textbf{<%description%>}%
-  <%if longdescription%>\ExtraDescription{<%longdescription%>}<%end longdescription%>%
-  <%if reqdate%>\ExtraDescription{\lieferdatum: <%reqdate%>}<%end reqdate%>%
-  <%if serialnumber%>\ExtraDescription{\seriennummer: <%serialnumber%>}<%end serialnumber%>%
-  <%if ean%>\ExtraDescription{\ean: <%ean%>}<%end ean%>%
-  <%if projectnumber%>\ExtraDescription{\projektnummer: <%projectnumber%>}<%end projectnumber%>%
-  &%
-  <%qty%> <%unit%> &%
-  <%sellprice%>&%
-  \Ifstr{<%p_discount%>}{0}{}{\sffamily\scriptsize{(-<%p_discount%>\,\%)}}%
-    <%linetotal%>\tabularnewline
+  \thispagestyle{kivitendo.letter.first}
+
+  \angebotseingangformel
+
+  \begin{PricingTabular*}
+    % eigentliche Tabelle
+    \FakeTable{
+    <%foreach number%>%
+      <%runningnumber%> &%
+      <%number%> &%
+      \textbf{<%description%>}%
+      <%if longdescription%>\ExtraDescription{<%longdescription%>}<%end longdescription%>%
+      <%if reqdate%>\ExtraDescription{\lieferdatum: <%reqdate%>}<%end reqdate%>%
+      <%if serialnumber%>\ExtraDescription{\seriennummer: <%serialnumber%>}<%end serialnumber%>%
+      <%if ean%>\ExtraDescription{\ean: <%ean%>}<%end ean%>%
+      <%if projectnumber%>\ExtraDescription{\projektnummer: <%projectnumber%>}<%end projectnumber%>%
+      &%
+      <%qty%> <%unit%> &%
+      <%sellprice%>&%
+      \Ifstr{<%p_discount%>}{0}{}{\sffamily\scriptsize{(-<%p_discount%>\,\%)}}%
+      <%linetotal%>\tabularnewline
     <%end number%>%
-  }%
-  \begin{PricingTotal}%
-    % Tabellenende letzte Seite
-    \nettobetrag & <%subtotal%>\\%
-    <%foreach tax%>%
-    <%taxdescription%> & <%tax%>\\%
-    <%end tax%>%
-    \bfseries\schlussbetrag &  \bfseries <%quototal%>\\%
-  \end{PricingTotal}
-\end{PricingTabular*}
-
-<%if notes%>%
-<%notes%>%
-\medskip
-<%end if%>%
-
-<%if delivery_term%>%
-\lieferung ~<%delivery_term.description_long%>\\
-<%end delivery_term%>%
-
-\closing{\gruesse}
+    }%
+    \begin{PricingTotal}%
+      % Tabellenende letzte Seite
+      \nettobetrag & <%subtotal%>\\%
+      <%foreach tax%>%
+        <%taxdescription%> & <%tax%>\\%
+      <%end tax%>%
+      \bfseries\schlussbetrag &  \bfseries <%quototal%>\\%
+    \end{PricingTotal}
+  \end{PricingTabular*}
+
+  <%if notes%>%
+    <%notes%>%
+    \medskip
+  <%end notes%>%
+
+  <%if delivery_term%>%
+    \lieferung ~<%delivery_term.description_long%>\\
+  <%end delivery_term%>%
+
+  \closing{\gruesse}
 \end{letter}
 
 \end{document}
diff --git a/templates/print/marei/purchase_reclamation.tex b/templates/print/marei/purchase_reclamation.tex
index 5405af504..58847357c 100644
--- a/templates/print/marei/purchase_reclamation.tex
+++ b/templates/print/marei/purchase_reclamation.tex
@@ -63,84 +63,84 @@ $( END )$%
 \begin{document}
 
 \begin{letter}{
-    %TODO(Tamino): what name, street, ... ?
-    $( reclamation.customer.name )$\strut\\
-    $( IF (reclamation.customer.department_1) )$$( reclamation.customer.department_1 )$\\$( END )$%
-    $( IF (reclamation.customer.department_2) )$$( reclamation.customer.department_2 )$\\$( END )$%
-    $( reclamation.contact.cp_givenname )$ $( reclamation.contact.cp_name )$\strut\\
-    $( reclamation.customer.street )$\strut\\
-    $( reclamation.customer.zipcode )$ $( city )$\strut\\
-    $( reclamation.customer.country )$ \strut
-  }
+  %TODO(Tamino): what name, street, ... ?
+  $( reclamation.customer.name )$\strut\\
+  $( IF (reclamation.customer.department_1) )$$( reclamation.customer.department_1 )$\\$( END )$%
+  $( IF (reclamation.customer.department_2) )$$( reclamation.customer.department_2 )$\\$( END )$%
+  $( reclamation.contact.cp_givenname )$ $( reclamation.contact.cp_name )$\strut\\
+  $( reclamation.customer.street )$\strut\\
+  $( reclamation.customer.zipcode )$ $( city )$\strut\\
+  $( reclamation.customer.country )$ \strut
+    }
 
-% Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
-% Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
-\opening{
-  \Ifstr{$( KiviLatex.filter(reclamation.contact.cp_name) )$}{}{
-    $( IF (reclamation.customervendor.natural_person) )$
-      $( KiviLatex.filter(reclamation.customervendor.greeting) )$ $( KiviLatex.filter(reclamation.customervendor.name) )$,
-    $( ELSE )$
-      \anrede
-    $( END )$
-  }{
+    % Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
+    % Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
+    \opening{
+    \Ifstr{$( KiviLatex.filter(reclamation.contact.cp_name) )$}{}{
+  $( IF (reclamation.customervendor.natural_person) )$
+  $( KiviLatex.filter(reclamation.customervendor.greeting) )$ $( KiviLatex.filter(reclamation.customervendor.name) )$,
+  $( ELSE )$
+    \anrede
+  $( END )$
+    }{
     \Ifstr{$( KiviLatex.filter(reclamation.contact.cp_gender) )$}{f}
-      {\anredefrau}
-      {\anredeherr}
-      $( KiviLatex.filter(reclamation.contact.cp_title) )$ $( KiviLatex.filter(reclamation.contact.cp_name) )$,
-  }
-}
-\thispagestyle{kivitendo.letter.first}
-
-\ekreklamationsformel
-
-\begin{PricingTabular*}
-  % eigentliche Tabelle
-  \FakeTable{
-  $( FOREACH item = reclamation.items_sorted )$%
-    $( item.position )$ &%
-    $( item.part.partnumber )$ &%
-    \textbf{ $( KiviLatex.filter(item.description) )$ }%
-    $( IF (item.longdescription) )$\ExtraDescription{$( KiviLatex.filter_html(item.longdescription) )$}$( END )$%
-    $( IF (item.reqdate) )$\ExtraDescription{\lieferdatum: $( item.reqdate_as_date )$}$( END )$%
-    $( IF (item.serialnumber) )$\ExtraDescription{\seriennummer: $( KiviLatex.filter(item.serialnumber) )$}$( END )$%
-    $( IF (item.projectnumber) )$\ExtraDescription{\projektnummer: $( KiviLatex.filter(item.projectnumber) )$}$( END )$%
-    $( IF (item.reason.description) )$\ExtraDescription{\grund: $( KiviLatex.filter(item.reason.description) )$}$( END )$%
-    $( IF (item.reason_description_ext) )$\ExtraDescription{$( KiviLatex.filter(item.reason_description_ext) )$}$( END )$%
-    &%
-    $( item.qty_as_number )$ $( item.unit )$ &%
-    $( item.sellprice_as_number )$&%
-    % TODO(Tamino): discount in '%'
-    \Ifstr{$( item.discount_as_number )$}{0}{}{\sffamily\scriptsize{(-$( item.discount_as_percent )$\%)}}%
-    % TODO(Tamino): linetotal
-    \normalsize
-    $( LxERP.format_amount(item.linetotal, 2, 0) )$\tabularnewline
-  $( END )$%
-  }%
-  \begin{PricingTotal}%
-    % Tabellenende letzte Seite
-    \nettobetrag & $( reclamation.netamount_as_number )$\\%
-    $( FOREACH tax = reclamation.taxes )$%
-      $( KiviLatex.filter(tax.tax.taxdescription) )$ & $( LxERP.format_amount(tax.amount) )$\\%
-    $( END )$%
-    \bfseries\schlussbetrag &  \bfseries $( reclamation.amount_as_number )$\\%
-  \end{PricingTotal}
-\end{PricingTabular*}
-
-$( IF (reclamation.notes) )$%
+    {\anredefrau}
+    {\anredeherr}
+  $( KiviLatex.filter(reclamation.contact.cp_title) )$ $( KiviLatex.filter(reclamation.contact.cp_name) )$,
+    }
+    }
+    \thispagestyle{kivitendo.letter.first}
+
+    \ekreklamationsformel
+
+    \begin{PricingTabular*}
+      % eigentliche Tabelle
+      \FakeTable{
+        $( FOREACH item = reclamation.items_sorted )$%
+        $( item.position )$ &%
+        $( item.part.partnumber )$ &%
+        \textbf{ $( KiviLatex.filter(item.description) )$ }%
+        $( IF (item.longdescription) )$\ExtraDescription{$( KiviLatex.filter_html(item.longdescription) )$}$( END )$%
+        $( IF (item.reqdate) )$\ExtraDescription{\lieferdatum: $( item.reqdate_as_date )$}$( END )$%
+        $( IF (item.serialnumber) )$\ExtraDescription{\seriennummer: $( KiviLatex.filter(item.serialnumber) )$}$( END )$%
+        $( IF (item.projectnumber) )$\ExtraDescription{\projektnummer: $( KiviLatex.filter(item.projectnumber) )$}$( END )$%
+        $( IF (item.reason.description) )$\ExtraDescription{\grund: $( KiviLatex.filter(item.reason.description) )$}$( END )$%
+        $( IF (item.reason_description_ext) )$\ExtraDescription{$( KiviLatex.filter(item.reason_description_ext) )$}$( END )$%
+        &%
+        $( item.qty_as_number )$ $( item.unit )$ &%
+        $( item.sellprice_as_number )$&%
+        % TODO(Tamino): discount in '%'
+        \Ifstr{$( item.discount_as_number )$}{0}{}{\sffamily\scriptsize{(-$( item.discount_as_percent )$\%)}}%
+        % TODO(Tamino): linetotal
+        \normalsize
+        $( LxERP.format_amount(item.linetotal, 2, 0) )$\tabularnewline
+        $( END )$%
+      }%
+      \begin{PricingTotal}%
+        % Tabellenende letzte Seite
+        \nettobetrag & $( reclamation.netamount_as_number )$\\%
+        $( FOREACH tax = reclamation.taxes )$%
+        $( KiviLatex.filter(tax.tax.taxdescription) )$ & $( LxERP.format_amount(tax.amount) )$\\%
+        $( END )$%
+        \bfseries\schlussbetrag &  \bfseries $( reclamation.amount_as_number )$\\%
+      \end{PricingTotal}
+    \end{PricingTabular*}
+
+  $( IF (reclamation.notes) )$%
   $( KiviLatex.filter_html(reclamation.notes) )$%
-  \medskip
-$( END )$%
+    \medskip
+  $( END )$%
 
-$( IF (reclamation.delivery_term) )$%
-  \lieferung ~$( KiviLatex.filter(reclamation.delivery_term.description_long) )$\\
-$( END )$%
+  $( IF (reclamation.delivery_term) )$%
+    \lieferung ~$( KiviLatex.filter(reclamation.delivery_term.description_long) )$\\
+  $( END )$%
 
-$( IF (reclamation.reqdate) )$%
-  \lieferungErfolgtAm ~$( reclamation.reqdate_as_date )$.
-$( END )$%
+  $( IF (reclamation.reqdate) )$%
+    \lieferungErfolgtAm ~$( reclamation.reqdate_as_date )$.
+  $( END )$%
 
 
-%\closing{\gruesse}
+  %\closing{\gruesse}
 
 \end{letter}
 
diff --git a/templates/print/marei/receipt.tex b/templates/print/marei/receipt.tex
index ad428f7de..2eb86a24b 100644
--- a/templates/print/marei/receipt.tex
+++ b/templates/print/marei/receipt.tex
@@ -31,22 +31,22 @@
 \begin{document}
 
 \begin{letter}{
-<%name%>\ifhmode\\\fi
-<%street%>\ifhmode\\\fi
-<%zipcode%> <%city%>\ifhmode\\\fi
-<%country%>%
-}
-
-\opening{<%company%>}
-\pagestyle{empty}
-
-<%name%> \hfill <%datepaid%> \hfill <%source%>%
-
-\begin{SimpleTabular}[colspec=lXrr,headline={\bfseries\rechnung&\bfseries\ausgestellt&\bfseries\faellig&\bfseries\verrechnet}]
-  <%foreach invnumber%>%
-  <%invnumber%> & <%invdate%> & <%due%> & <%paid%> \\
-  <%end invnumber%>%
-\end{SimpleTabular}
+    <%name%>\ifhmode\\\fi
+    <%street%>\ifhmode\\\fi
+    <%zipcode%> <%city%>\ifhmode\\\fi
+    <%country%>%
+  }
+
+  \opening{<%company%>}
+  \pagestyle{empty}
+
+  <%name%> \hfill <%datepaid%> \hfill <%source%>%
+
+  \begin{SimpleTabular}[colspec=lXrr,headline={\bfseries\rechnung&\bfseries\ausgestellt&\bfseries\faellig&\bfseries\verrechnet}]
+    <%foreach invnumber%>%
+      <%invnumber%> & <%invdate%> & <%due%> & <%paid%> \\
+    <%end invnumber%>%
+  \end{SimpleTabular}
 
 \end{letter}
 
diff --git a/templates/print/marei/request_quotation.tex b/templates/print/marei/request_quotation.tex
index 415d6a1fa..0fbd0faaa 100644
--- a/templates/print/marei/request_quotation.tex
+++ b/templates/print/marei/request_quotation.tex
@@ -35,68 +35,68 @@
 \begin{document}
 
 \begin{letter}{
-<%name%>\strut\\
-<%if department_1%><%department_1%>\\<%end if%>%
-<%if department_2%><%department_2%>\\<%end if%>%
-<%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\
-<%street%>\strut\\
-<%zipcode%> <%city%>\strut\\
-<%country%> \strut
-}
+    <%name%>\strut\\
+    <%if department_1%><%department_1%>\\<%end if%>%
+    <%if department_2%><%department_2%>\\<%end if%>%
+    <%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\
+    <%street%>\strut\\
+    <%zipcode%> <%city%>\strut\\
+    <%country%> \strut
+  }
 
-% Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
-% Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
-\opening{
-\Ifstr{<%cp_name%>}{}
-{<%if natural_person%><%greeting%> <%name%>,<%else%>\anrede<%end if%>}
-  {
-    \Ifstr{<%cp_gender%>}{f}
-        {\anredefrau}
-        {\anredeherr}
+  % Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
+  % Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
+  \opening{
+    \Ifstr{<%cp_name%>}{}
+    {<%if natural_person%><%greeting%> <%name%>,<%else%>\anrede}<%end if%>
+    {
+      \Ifstr{<%cp_gender%>}{f}
+      {\anredefrau}
+      {\anredeherr}
       <%cp_title%> <%cp_name%>,
     }
   }
-\thispagestyle{kivitendo.letter.first}
-
-\anfrageformel
-
-\begin{PricingTabular*}[columns={pos,amount,desc}]
-  % eigentliche Tabelle
-  \FakeTable{
-  <%foreach number%>%
-  <%runningnumber%> &
-  <%qty%> <%unit%> &
-  \textbf{<%description%>}
-  <%if longdescription%>\ExtraDescription{<%longdescription%>}<%end longdescription%>%
-  <%if projectnumber%>\ExtraDescription{\projektnummer: <%projectnumber%>}<%end projectnumber%>%
-  <%if make%>%
-  <%foreach make%>%
-  \Ifstr{<%make%>}{<%name%>}{\ExtraDescription{\artikelnummer: <%model%>} \ExtraDescription{\bezeichnung: <%mm_part_description%>}}{}
-    <%end foreach%>%
-    <%end if%>%
-    \tabularnewline
+  \thispagestyle{kivitendo.letter.first}
+
+  \anfrageformel
+
+  \begin{PricingTabular*}[columns={pos,amount,desc}]
+    % eigentliche Tabelle
+    \FakeTable{
+    <%foreach number%>%
+      <%runningnumber%> &
+      <%qty%> <%unit%> &
+      \textbf{<%description%>}
+      <%if longdescription%>\ExtraDescription{<%longdescription%>}<%end longdescription%>%
+        <%if projectnumber%>\ExtraDescription{\projektnummer: <%projectnumber%>}<%end projectnumber%>%
+        <%if make%>%
+        <%foreach make%>%
+        \Ifstr{<%make%>}{<%name%>}{\ExtraDescription{\artikelnummer: <%model%>} \ExtraDescription{\bezeichnung: <%mm_part_description%>}}{}
+        <%end foreach%>%
+      <%end longdescription%>%
+      \tabularnewline
     <%end number%>%
-  }%
-\end{PricingTabular*}
+    }%
+  \end{PricingTabular*}
 
 
-<%if notes%>%
-<%notes%>%
-\medskip
-<%end if%>%
+  <%if notes%>%
+    <%notes%>%
+    \medskip
+  <%end notes%>%
 
 
-<%if delivery_term%>%
-\lieferung ~<%delivery_term.description_long%>\\
-<%end delivery_term%>%
+  <%if delivery_term%>%
+    \lieferung ~<%delivery_term.description_long%>\\
+  <%end delivery_term%>%
 
-<%if reqdate%>%
-\anfrageBenoetigtBis~<%reqdate%>.
-<%end if%>%
+  <%if reqdate%>%
+    \anfrageBenoetigtBis~<%reqdate%>.
+  <%end reqdate%>%
 
-\anfragedanke
+  \anfragedanke
 
-\closing{\gruesse}
+  \closing{\gruesse}
 
 \end{letter}
 
diff --git a/templates/print/marei/sales_delivery_order.tex b/templates/print/marei/sales_delivery_order.tex
index a2a60ece8..60d455303 100644
--- a/templates/print/marei/sales_delivery_order.tex
+++ b/templates/print/marei/sales_delivery_order.tex
@@ -26,11 +26,11 @@
 }
 <%if ordnumber%>
   \setkomavar{orderID}{<%ordnumber%>}
-<%end if%>%
+<%end ordnumber%>%
 <%if cusordnumber%>%
   \setkomavar*{yourref}{\unsereBestellnummer}
   \setkomavar{yourref}{<%cusordnumber%>}
-<%end if%>%
+<%end cusordnumber%>%
 \setkomavar{transaction}{<%transaction_description%>}
 
 <%if globalprojectnumber%>%
@@ -42,59 +42,59 @@
 \begin{document}
 
 \begin{letter}{
-\Ifstr{<%shiptoname%>}{}{ % KEINE ABWEICHENDE LIEFERADRESSE
-  <%name%>\strut\\
-  <%if department_1%><%department_1%>\\<%end if%>%
-  <%if department_2%><%department_2%>\\<%end if%>%
-  <%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\
-  <%street%>\strut\\
-  <%zipcode%> <%city%>\strut\\
-  <%country%> \strut
-}{ % ABWEICHENDE LIEFERADRESSE (Aus Stammdaten oder Beleg)
-  <%shiptoname%>\strut\\
-  <%if shiptocontact%> <%shiptocontact%><%end if%>\strut\\
-  <%shiptodepartment_1%>\strut\\
-  <%shiptodepartment_2%>\strut\\
-  <%shiptostreet%>\strut\\
-  <%shiptozipcode%> <%shiptocity%>\strut
-} % ende ifthenelse LIEFERADRESSE
-}
+    \Ifstr{<%shiptoname%>}{}{ % KEINE ABWEICHENDE LIEFERADRESSE
+      <%name%>\strut\\
+      <%if department_1%><%department_1%>\\<%end if%>%
+      <%if department_2%><%department_2%>\\<%end if%>%
+      <%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\
+      <%street%>\strut\\
+      <%zipcode%> <%city%>\strut\\
+      <%country%> \strut
+    }{ % ABWEICHENDE LIEFERADRESSE (Aus Stammdaten oder Beleg)
+      <%shiptoname%>\strut\\
+      <%if shiptocontact%> <%shiptocontact%><%end if%>\strut\\
+      <%shiptodepartment_1%>\strut\\
+      <%shiptodepartment_2%>\strut\\
+      <%shiptostreet%>\strut\\
+      <%shiptozipcode%> <%shiptocity%>\strut
+    } % ende ifthenelse LIEFERADRESSE
+  }
 
-\opening{}
-\thispagestyle{kivitendo.letter.first}
-
-\begin{PricingTabular*}[columns={pos, id, desc, amount}]
-  % eigentliche Tabelle
-  \FakeTable{
-  <%foreach number%>%
-  <%runningnumber%> &
-  <%number%> &
-  \textbf{<%description%>}
-    <%if longdescription%>\ExtraDescription{<%longdescription%>}<%end longdescription%>%
-    <%if reqdate%>\ExtraDescription{\lieferdatum: <%reqdate%>}<%end reqdate%>%
-    <%if serialnumber%>\ExtraDescription{\seriennummer: <%serialnumber%>}<%end serialnumber%>%
-    <%if ean%>\ExtraDescription{\ean: <%ean%>}<%end ean%>%
-    <%if projectnumber%>\ExtraDescription{\projektnummer: <%projectnumber%>}<%end projectnumber%>%
-    <%foreach si_number%>%
-    <%if si_chargenumber%>\ExtraDescription{\charge: <%si_chargenumber%> <%if si_bestbefore%> \mhd: <%si_bestbefore%><%end if%><%si_qty%>~<%si_unit%><%end si_chargenumber%>}%
-    <%end si_number%>%
-    &
-    <%qty%> <%unit%>%
-    \tabularnewline
+  \opening{}
+  \thispagestyle{kivitendo.letter.first}
+
+  \begin{PricingTabular*}[columns={pos, id, desc, amount}]
+    % eigentliche Tabelle
+    \FakeTable{
+    <%foreach number%>%
+      <%runningnumber%> &
+      <%number%> &
+      \textbf{<%description%>}
+      <%if longdescription%>\ExtraDescription{<%longdescription%>}<%end longdescription%>%
+      <%if reqdate%>\ExtraDescription{\lieferdatum: <%reqdate%>}<%end reqdate%>%
+      <%if serialnumber%>\ExtraDescription{\seriennummer: <%serialnumber%>}<%end serialnumber%>%
+      <%if ean%>\ExtraDescription{\ean: <%ean%>}<%end ean%>%
+      <%if projectnumber%>\ExtraDescription{\projektnummer: <%projectnumber%>}<%end projectnumber%>%
+      <%foreach si_number%>%
+      <%if si_chargenumber%>\ExtraDescription{\charge: <%si_chargenumber%> <%if si_bestbefore%> \mhd: <%si_bestbefore%>}<%si_qty%>~<%si_unit%><%end si_chargenumber%><%end if%>%
+      <%end si_number%>%
+      &
+      <%qty%> <%unit%>%
+      \tabularnewline
     <%end number%>%
-  }
-\end{PricingTabular*}
+    }
+  \end{PricingTabular*}
 
-\medskip
+  \medskip
 
-<%if notes%>%
-<%notes%>%
-\medskip
-<%end if%>%
+  <%if notes%>%
+    <%notes%>%
+    \medskip
+  <%end notes%>%
 
-<%if delivery_term%>%
-\lieferung ~<%delivery_term.description_long%>\\
-<%end delivery_term%>%
+  <%if delivery_term%>%
+    \lieferung ~<%delivery_term.description_long%>\\
+  <%end delivery_term%>%
 
 \end{letter}
 
diff --git a/templates/print/marei/sales_order.tex b/templates/print/marei/sales_order.tex
index d4afef920..41a5576e8 100644
--- a/templates/print/marei/sales_order.tex
+++ b/templates/print/marei/sales_order.tex
@@ -15,7 +15,7 @@
   \renewcommand{\auftragsbestaetigung}{\auftragseingang}
   \renewcommand{\auftragsnummer}{\auftragseingangnummer}
   \renewcommand{\auftragsformel}{\auftragseingangformel}
-<%end if%>
+<%end template_meta.formname == "sales_order_intake"%>
 
 % laufende Kopfzeile:
 \ourhead{\kundennummer}{<%customernumber%>}{\auftragsbestaetigung}{<%ordnumber%>}{<%orddate%>}
@@ -35,16 +35,16 @@
 <%if tax_point%>%
   \setkomavar*{taxpoint}{\leistungsdatum}
   \setkomavar{taxpoint}{<%tax_point%>}
-<%end if%>%
+<%end tax_point%>%
 <%if cusordnumber%>%
   \setkomavar*{yourref}{\ihreBestellnummer}
   \setkomavar{yourref}{<%cusordnumber%>}
-<%end if%>%
+<%end cusordnumber%>%
 \setkomavar{transaction}{<%transaction_description%>}
 
 <%if quonumber%>
   \setkomavar{quote}{<%quonumber%>}
-<%end if%>%
+<%end quonumber%>%
 
 <%if shiptoname%>%
 \makeatletter
@@ -66,81 +66,81 @@
   }
 \end{lrbox}
 \makeatother
-<%end if%>%
+<%end shiptoname%>%
 
 \begin{document}
 
 \begin{letter}{
-<%name%>\strut\\
-<%if department_1%><%department_1%>\\<%end if%>%
-<%if department_2%><%department_2%>\\<%end if%>%
-<%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\
-<%street%>\strut\\
-<%zipcode%> <%city%>\strut\\
-<%country%> \strut
-}
+    <%name%>\strut\\
+    <%if department_1%><%department_1%>\\<%end if%>%
+    <%if department_2%><%department_2%>\\<%end if%>%
+    <%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\
+    <%street%>\strut\\
+    <%zipcode%> <%city%>\strut\\
+    <%country%> \strut
+  }
 
-% Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
-% Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
-\opening{
-\Ifstr{<%cp_name%>}{}
-{<%if natural_person%><%greeting%> <%name%>,<%else%>\anrede<%end if%>}
-  {
-    \Ifstr{<%cp_gender%>}{f}
-        {\anredefrau}
-        {\anredeherr}
+  % Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
+  % Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
+  \opening{
+    \Ifstr{<%cp_name%>}{}
+    {<%if natural_person%><%greeting%> <%name%>,<%else%>\anrede}<%end if%>
+    {
+      \Ifstr{<%cp_gender%>}{f}
+      {\anredefrau}
+      {\anredeherr}
       <%cp_title%> <%cp_name%>,
     }
   }
-\thispagestyle{kivitendo.letter.first}
-
-\auftragsformel
-
-\begin{PricingTabular*}
-  % eigentliche Tabelle
-  \FakeTable{
-  <%foreach number%>%
-  <%runningnumber%> &%
-  <%number%> &%
-  \textbf{<%description%>}%
-  <%if longdescription%>\ExtraDescription{<%longdescription%>}<%end longdescription%>%
-  <%if reqdate%>\ExtraDescription{\lieferdatum: <%reqdate%>}<%end reqdate%>%
-  <%if serialnumber%>\ExtraDescription{\seriennummer: <%serialnumber%>}<%end serialnumber%>%
-  <%if ean%>\ExtraDescription{\ean: <%ean%>}<%end ean%>%
-  <%if projectnumber%>\ExtraDescription{\projektnummer: <%projectnumber%>}<%end projectnumber%>%
-  &%
-  <%qty%> <%unit%> &%
-  <%sellprice%>&%
-  \Ifstr{<%p_discount%>}{0}{}{\sffamily\scriptsize{(-<%p_discount%>\,\%)}}%
-    <%linetotal%>\tabularnewline
+  \thispagestyle{kivitendo.letter.first}
+
+  \auftragsformel
+
+  \begin{PricingTabular*}
+    % eigentliche Tabelle
+    \FakeTable{
+    <%foreach number%>%
+      <%runningnumber%> &%
+      <%number%> &%
+      \textbf{<%description%>}%
+      <%if longdescription%>\ExtraDescription{<%longdescription%>}<%end longdescription%>%
+      <%if reqdate%>\ExtraDescription{\lieferdatum: <%reqdate%>}<%end reqdate%>%
+      <%if serialnumber%>\ExtraDescription{\seriennummer: <%serialnumber%>}<%end serialnumber%>%
+      <%if ean%>\ExtraDescription{\ean: <%ean%>}<%end ean%>%
+      <%if projectnumber%>\ExtraDescription{\projektnummer: <%projectnumber%>}<%end projectnumber%>%
+      &%
+      <%qty%> <%unit%> &%
+      <%sellprice%>&%
+      \Ifstr{<%p_discount%>}{0}{}{\sffamily\scriptsize{(-<%p_discount%>\,\%)}}%
+      <%linetotal%>\tabularnewline
     <%end number%>%
-  }%
-  \begin{PricingTotal}%
-    % Tabellenende letzte Seite
-    \nettobetrag & <%subtotal%>\\%
-    <%foreach tax%>%
-    <%taxdescription%> & <%tax%>\\%
-    <%end tax%>%
-    \bfseries\schlussbetrag &  \bfseries <%ordtotal%>\\%
-  \end{PricingTotal}
-\end{PricingTabular*}
-
-<%if notes%>%
-<%notes%>%
-\medskip
-<%end if%>%
-
-<%if delivery_term%>%
-\lieferung ~<%delivery_term.description_long%>\\
-<%end delivery_term%>%
-
-<%if template_meta.formname != "sales_order_intake"%><%if reqdate%>
-\lieferungErfolgtAm ~<%reqdate%>.
-<%end if%><%end if%>
-
-\textit{\auftragpruefen}
-
-\closing{\gruesse}
+    }%
+    \begin{PricingTotal}%
+      % Tabellenende letzte Seite
+      \nettobetrag & <%subtotal%>\\%
+      <%foreach tax%>%
+        <%taxdescription%> & <%tax%>\\%
+      <%end tax%>%
+      \bfseries\schlussbetrag &  \bfseries <%ordtotal%>\\%
+    \end{PricingTotal}
+  \end{PricingTabular*}
+
+  <%if notes%>%
+    <%notes%>%
+    \medskip
+  <%end notes%>%
+
+  <%if delivery_term%>%
+    \lieferung ~<%delivery_term.description_long%>\\
+  <%end delivery_term%>%
+
+  <%if template_meta.formname != "sales_order_intake"%><%if reqdate%>
+    \lieferungErfolgtAm ~<%reqdate%>.
+  <%end template_meta.formname != "sales_order_intake"%><%end if%>
+
+  \textit{\auftragpruefen}
+
+  \closing{\gruesse}
 
 \end{letter}
 
diff --git a/templates/print/marei/sales_quotation.tex b/templates/print/marei/sales_quotation.tex
index fa547a2a2..850481604 100644
--- a/templates/print/marei/sales_quotation.tex
+++ b/templates/print/marei/sales_quotation.tex
@@ -39,111 +39,111 @@
 \setkomavar{transaction}{<%transaction_description%>}
 
 <%if shiptoname%>%
-\makeatletter
-\begin{lrbox}\shippingAddressBox
-  \parbox{\useplength{toaddrwidth}}{
-    \backaddr@format{\scriptsize\usekomafont{backaddress}%
-      \strut\abweichendeLieferadresse
+  \makeatletter
+  \begin{lrbox}\shippingAddressBox
+    \parbox{\useplength{toaddrwidth}}{
+      \backaddr@format{\scriptsize\usekomafont{backaddress}%
+        \strut\abweichendeLieferadresse
+      }
+      \par\smallskip
+      \setlength{\parskip}{\z@}
+      \par
+      \normalsize
+      <%shiptoname%>\par
+      <%if shiptocontact%> <%shiptocontact%><%end if%>\par
+      <%shiptodepartment_1%>\par
+      <%shiptodepartment_2%>\par
+      <%shiptostreet%>\par
+      <%shiptozipcode%> <%shiptocity%>%
     }
-    \par\smallskip
-    \setlength{\parskip}{\z@}
-    \par
-    \normalsize
-    <%shiptoname%>\par
-    <%if shiptocontact%> <%shiptocontact%><%end if%>\par
-    <%shiptodepartment_1%>\par
-    <%shiptodepartment_2%>\par
-    <%shiptostreet%>\par
-    <%shiptozipcode%> <%shiptocity%>%
-  }
-\end{lrbox}
-\makeatother
-<%end if%>%
+  \end{lrbox}
+  \makeatother
+<%end shiptoname%>%
 
 
 \begin{letter}{
-<%name%>\strut\\
-<%if department_1%><%department_1%>\\<%end if%>%
-<%if department_2%><%department_2%>\\<%end if%>%
-<%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\
-<%street%>\strut\\
-<%zipcode%> <%city%>\strut\\
-<%country%> \strut
-}
+    <%name%>\strut\\
+    <%if department_1%><%department_1%>\\<%end if%>%
+    <%if department_2%><%department_2%>\\<%end if%>%
+    <%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\
+    <%street%>\strut\\
+    <%zipcode%> <%city%>\strut\\
+    <%country%> \strut
+  }
 
-% Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
-% Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
-\opening{
-\Ifstr{<%cp_name%>}{}
-{<%if natural_person%><%greeting%> <%name%>,<%else%>\anrede<%end if%>}
-  {
-    \Ifstr{<%cp_gender%>}{f}
-        {\anredefrau}
-        {\anredeherr}
+  % Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
+  % Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
+  \opening{
+    \Ifstr{<%cp_name%>}{}
+    {<%if natural_person%><%greeting%> <%name%>,<%else%>\anrede}<%end if%>
+    {
+      \Ifstr{<%cp_gender%>}{f}
+      {\anredefrau}
+      {\anredeherr}
       <%cp_title%> <%cp_name%>,
     }
   }
-\thispagestyle{kivitendo.letter.first}
-
-\angebotsformel
-
-
-\begin{PricingTabular*}
-  % eigentliche Tabelle
-  \FakeTable{
-  <%foreach number%>%
-  <%runningnumber%> &%
-  <%number%> &%
-  \textbf{<%description%>}%
-  <%if longdescription%>\ExtraDescription{<%longdescription%>}<%end longdescription%>%
-  <%if reqdate%>\ExtraDescription{\lieferdatum: <%reqdate%>}<%end reqdate%>%
-  <%if serialnumber%>\ExtraDescription{\seriennummer: <%serialnumber%>}<%end serialnumber%>%
-  <%if ean%>\ExtraDescription{\ean: <%ean%>}<%end ean%>%
-  <%if projectnumber%>\ExtraDescription{\projektnummer: <%projectnumber%>}<%end projectnumber%>%
-  &%
-  <%qty%> <%unit%> &%
-  <%sellprice%>&%
-  \Ifstr{<%p_discount%>}{0}{}{\sffamily\scriptsize{(-<%p_discount%>\,\%)}}%
-    <%linetotal%>\tabularnewline
+  \thispagestyle{kivitendo.letter.first}
+
+  \angebotsformel
+
+
+  \begin{PricingTabular*}
+    % eigentliche Tabelle
+    \FakeTable{
+    <%foreach number%>%
+      <%runningnumber%> &%
+      <%number%> &%
+      \textbf{<%description%>}%
+      <%if longdescription%>\ExtraDescription{<%longdescription%>}<%end longdescription%>%
+      <%if reqdate%>\ExtraDescription{\lieferdatum: <%reqdate%>}<%end reqdate%>%
+      <%if serialnumber%>\ExtraDescription{\seriennummer: <%serialnumber%>}<%end serialnumber%>%
+      <%if ean%>\ExtraDescription{\ean: <%ean%>}<%end ean%>%
+      <%if projectnumber%>\ExtraDescription{\projektnummer: <%projectnumber%>}<%end projectnumber%>%
+      &%
+      <%qty%> <%unit%> &%
+      <%sellprice%>&%
+      \Ifstr{<%p_discount%>}{0}{}{\sffamily\scriptsize{(-<%p_discount%>\,\%)}}%
+      <%linetotal%>\tabularnewline
     <%end number%>%
-  }
-  \begin{PricingTotal}
-    % Tabellenende letzte Seite
-    \nettobetrag & <%subtotal%>\\
-    <%foreach tax%>%
-    <%taxdescription%> & <%tax%>\\
-    <%end tax%>%
-    \bfseries\schlussbetrag &  \bfseries <%ordtotal%>\\
-  \end{PricingTotal}
-\end{PricingTabular*}
-
-<%if notes%>%
-<%notes%>%
-\medskip
-<%end if%>%
-
-<%if delivery_term%>%
-\lieferung ~<%delivery_term.description_long%>\\
-<%end delivery_term%>%
-
-\angebotdanke\\
-<%if reqdate%>%
-\angebotgueltig~<%reqdate%>.
-<%end if%>%
-\angebotfragen
-
-
-\angebotagb
-
-\closing{\gruesse}
-
-\begin{minipage}{\textwidth}
-  \rule{\linewidth}{.2pt}\par
-  \auftragerteilt\par\bigskip
-  \nurort:\rule[-.5ex]{8cm}{.2pt}\ ,\den\ \rule[-.5ex]{5cm}{.2pt}\par\bigskip
-
-  \unterschrift/\stempel:\rule[-.5ex]{6cm}{.2pt}
-\end{minipage}
+    }
+    \begin{PricingTotal}
+      % Tabellenende letzte Seite
+      \nettobetrag & <%subtotal%>\\
+      <%foreach tax%>%
+        <%taxdescription%> & <%tax%>\\
+      <%end tax%>%
+      \bfseries\schlussbetrag &  \bfseries <%ordtotal%>\\
+    \end{PricingTotal}
+  \end{PricingTabular*}
+
+  <%if notes%>%
+    <%notes%>%
+    \medskip
+  <%end notes%>%
+
+  <%if delivery_term%>%
+    \lieferung ~<%delivery_term.description_long%>\\
+  <%end delivery_term%>%
+
+  \angebotdanke\\
+  <%if reqdate%>%
+    \angebotgueltig~<%reqdate%>.
+  <%end reqdate%>%
+  \angebotfragen
+
+
+  \angebotagb
+
+  \closing{\gruesse}
+
+  \begin{minipage}{\textwidth}
+    \rule{\linewidth}{.2pt}\par
+    \auftragerteilt\par\bigskip
+    \nurort:\rule[-.5ex]{8cm}{.2pt}\ ,\den\ \rule[-.5ex]{5cm}{.2pt}\par\bigskip
+
+    \unterschrift/\stempel:\rule[-.5ex]{6cm}{.2pt}
+  \end{minipage}
 
 
 \end{letter}
diff --git a/templates/print/marei/sales_reclamation.tex b/templates/print/marei/sales_reclamation.tex
index 379ea407d..d6babd013 100644
--- a/templates/print/marei/sales_reclamation.tex
+++ b/templates/print/marei/sales_reclamation.tex
@@ -63,84 +63,84 @@ $( END )$%
 \begin{document}
 
 \begin{letter}{
-    %TODO(Tamino): what name, street, ... ?
-    $( reclamation.customer.name )$\strut\\
-    $( IF (reclamation.customer.department_1) )$$( reclamation.customer.department_1 )$\\$( END )$%
-    $( IF (reclamation.customer.department_2) )$$( reclamation.customer.department_2 )$\\$( END )$%
-    $( reclamation.contact.cp_givenname )$ $( reclamation.contact.cp_name )$\strut\\
-    $( reclamation.customer.street )$\strut\\
-    $( reclamation.customer.zipcode )$ $( city )$\strut\\
-    $( reclamation.customer.country )$ \strut
-  }
+  %TODO(Tamino): what name, street, ... ?
+  $( reclamation.customer.name )$\strut\\
+  $( IF (reclamation.customer.department_1) )$$( reclamation.customer.department_1 )$\\$( END )$%
+  $( IF (reclamation.customer.department_2) )$$( reclamation.customer.department_2 )$\\$( END )$%
+  $( reclamation.contact.cp_givenname )$ $( reclamation.contact.cp_name )$\strut\\
+  $( reclamation.customer.street )$\strut\\
+  $( reclamation.customer.zipcode )$ $( city )$\strut\\
+  $( reclamation.customer.country )$ \strut
+    }
 
-% Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
-% Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
-\opening{
-  \Ifstr{$( KiviLatex.filter(reclamation.contact.cp_name) )$}{}{
-    $( IF (reclamation.customervendor.natural_person) )$
-      $( KiviLatex.filter(reclamation.customervendor.greeting) )$ $( KiviLatex.filter(reclamation.customervendor.name) )$,
-    $( ELSE )$
-      \anrede
-    $( END )$
-  }{
+    % Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
+    % Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
+    \opening{
+    \Ifstr{$( KiviLatex.filter(reclamation.contact.cp_name) )$}{}{
+  $( IF (reclamation.customervendor.natural_person) )$
+  $( KiviLatex.filter(reclamation.customervendor.greeting) )$ $( KiviLatex.filter(reclamation.customervendor.name) )$,
+  $( ELSE )$
+    \anrede
+  $( END )$
+    }{
     \Ifstr{$( KiviLatex.filter(reclamation.contact.cp_gender) )$}{f}
-      {\anredefrau}
-      {\anredeherr}
-      $( KiviLatex.filter(reclamation.contact.cp_title) )$ $( KiviLatex.filter(reclamation.contact.cp_name) )$,
-  }
-}
-\thispagestyle{kivitendo.letter.first}
-
-\vkreklamationsformel
-
-\begin{PricingTabular*}
-  % eigentliche Tabelle
-  \FakeTable{
-  $( FOREACH item = reclamation.items_sorted )$%
-    $( item.position )$ &%
-    $( item.part.partnumber )$ &%
-    \textbf{ $( KiviLatex.filter(item.description) )$ }%
-    $( IF (item.longdescription) )$\ExtraDescription{$( KiviLatex.filter_html(item.longdescription) )$}$( END )$%
-    $( IF (item.reqdate) )$\ExtraDescription{\lieferdatum: $( item.reqdate_as_date )$}$( END )$%
-    $( IF (item.serialnumber) )$\ExtraDescription{\seriennummer: $( KiviLatex.filter(item.serialnumber) )$}$( END )$%
-    $( IF (item.projectnumber) )$\ExtraDescription{\projektnummer: $( KiviLatex.filter(item.projectnumber) )$}$( END )$%
-    $( IF (item.reason.description) )$\ExtraDescription{\grund: $( KiviLatex.filter(item.reason.description) )$}$( END )$%
-    $( IF (item.reason_description_ext) )$\ExtraDescription{$( KiviLatex.filter(item.reason_description_ext) )$}$( END )$%
-    &%
-    $( item.qty_as_number )$ $( item.unit )$ &%
-    $( item.sellprice_as_number )$&%
-    % TODO(Tamino): discount in '%'
-    \Ifstr{$( item.discount_as_number )$}{0}{}{\sffamily\scriptsize{(-$( item.discount_as_percent )$\%)}}%
-    % TODO(Tamino): linetotal
-    \normalsize
-    $( LxERP.format_amount(item.linetotal, 2, 0) )$\tabularnewline
-  $( END )$%
-  }%
-  \begin{PricingTotal}%
-    % Tabellenende letzte Seite
-    \nettobetrag & $( reclamation.netamount_as_number )$\\%
-    $( FOREACH tax = reclamation.taxes )$%
-      $( KiviLatex.filter(tax.tax.taxdescription) )$ & $( LxERP.format_amount(tax.amount) )$\\%
-    $( END )$%
-    \bfseries\schlussbetrag &  \bfseries $( reclamation.amount_as_number )$\\%
-  \end{PricingTotal}
-\end{PricingTabular*}
-
-$( IF (reclamation.notes) )$%
+    {\anredefrau}
+    {\anredeherr}
+  $( KiviLatex.filter(reclamation.contact.cp_title) )$ $( KiviLatex.filter(reclamation.contact.cp_name) )$,
+    }
+    }
+    \thispagestyle{kivitendo.letter.first}
+
+    \vkreklamationsformel
+
+    \begin{PricingTabular*}
+      % eigentliche Tabelle
+      \FakeTable{
+        $( FOREACH item = reclamation.items_sorted )$%
+        $( item.position )$ &%
+        $( item.part.partnumber )$ &%
+        \textbf{ $( KiviLatex.filter(item.description) )$ }%
+        $( IF (item.longdescription) )$\ExtraDescription{$( KiviLatex.filter_html(item.longdescription) )$}$( END )$%
+        $( IF (item.reqdate) )$\ExtraDescription{\lieferdatum: $( item.reqdate_as_date )$}$( END )$%
+        $( IF (item.serialnumber) )$\ExtraDescription{\seriennummer: $( KiviLatex.filter(item.serialnumber) )$}$( END )$%
+        $( IF (item.projectnumber) )$\ExtraDescription{\projektnummer: $( KiviLatex.filter(item.projectnumber) )$}$( END )$%
+        $( IF (item.reason.description) )$\ExtraDescription{\grund: $( KiviLatex.filter(item.reason.description) )$}$( END )$%
+        $( IF (item.reason_description_ext) )$\ExtraDescription{$( KiviLatex.filter(item.reason_description_ext) )$}$( END )$%
+        &%
+        $( item.qty_as_number )$ $( item.unit )$ &%
+        $( item.sellprice_as_number )$&%
+        % TODO(Tamino): discount in '%'
+        \Ifstr{$( item.discount_as_number )$}{0}{}{\sffamily\scriptsize{(-$( item.discount_as_percent )$\%)}}%
+        % TODO(Tamino): linetotal
+        \normalsize
+        $( LxERP.format_amount(item.linetotal, 2, 0) )$\tabularnewline
+        $( END )$%
+      }%
+      \begin{PricingTotal}%
+        % Tabellenende letzte Seite
+        \nettobetrag & $( reclamation.netamount_as_number )$\\%
+        $( FOREACH tax = reclamation.taxes )$%
+        $( KiviLatex.filter(tax.tax.taxdescription) )$ & $( LxERP.format_amount(tax.amount) )$\\%
+        $( END )$%
+        \bfseries\schlussbetrag &  \bfseries $( reclamation.amount_as_number )$\\%
+      \end{PricingTotal}
+    \end{PricingTabular*}
+
+  $( IF (reclamation.notes) )$%
   $( KiviLatex.filter_html(reclamation.notes) )$%
-  \medskip
-$( END )$%
+    \medskip
+  $( END )$%
 
-$( IF (reclamation.delivery_term) )$%
-  \lieferung ~$( KiviLatex.filter(reclamation.delivery_term.description_long) )$\\
-$( END )$%
+  $( IF (reclamation.delivery_term) )$%
+    \lieferung ~$( KiviLatex.filter(reclamation.delivery_term.description_long) )$\\
+  $( END )$%
 
-$( IF (reclamation.reqdate) )$%
-  \lieferungErfolgtAm ~$( reclamation.reqdate_as_date )$.
-$( END )$%
+  $( IF (reclamation.reqdate) )$%
+    \lieferungErfolgtAm ~$( reclamation.reqdate_as_date )$.
+  $( END )$%
 
 
-%\closing{\gruesse}
+  %\closing{\gruesse}
 
 \end{letter}
 
diff --git a/templates/print/marei/statement.tex b/templates/print/marei/statement.tex
index 0c2b6eaf6..53dc07d3f 100644
--- a/templates/print/marei/statement.tex
+++ b/templates/print/marei/statement.tex
@@ -29,59 +29,59 @@
 \begin{document}
 
 \begin{letter}{%
-<%if billing_address_id%>%
-	<%billing_address_name%> \strut\\%
-	<%if department_1%><%billing_address_department_1%>\\<%end if%>%
-	<%if department_2%><%billing_address_department_2%>\\<%end if%>%
-	<%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%
-	<%billing_address_street%>\strut\\%
-	<%billing_address_zipcode%> <%billing_address_city%> \strut\\%
-	<%billing_address_country%>\strut\\%
-<%else%>%
-	<%name%>\strut\\%
-	<%if department_1%><%department_1%>\\<%end if%>%
-	<%if department_2%><%department_2%>\\<%end if%>%
-	<%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%
-	<%street%>\strut\\%
-	<%zipcode%> <%city%>\strut\\%
-	<%country%>\strut%
-<%end if%>%
-}
+  <%if billing_address_id%>%
+    <%billing_address_name%> \strut\\%
+    <%if department_1%><%billing_address_department_1%>\\<%end if%>%
+    <%if department_2%><%billing_address_department_2%>\\<%end if%>%
+    <%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%
+    <%billing_address_street%>\strut\\%
+    <%billing_address_zipcode%> <%billing_address_city%> \strut\\%
+    <%billing_address_country%>\strut\\%
+  <%else%>%
+    <%name%>\strut\\%
+    <%if department_1%><%department_1%>\\<%end if%>%
+    <%if department_2%><%department_2%>\\<%end if%>%
+    <%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%
+    <%street%>\strut\\%
+    <%zipcode%> <%city%>\strut\\%
+    <%country%>\strut%
+  <%end billing_address_id%>%
+  }
 
-% Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
-% Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
-\opening{
-\Ifstr{<%cp_name%>}{}
-{<%if natural_person%><%greeting%> <%name%>,<%else%>\anrede<%end if%>}
-  {
-    \Ifstr{<%cp_gender%>}{f}
-        {\anredefrau}
-        {\anredeherr}
+  % Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
+  % Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
+  \opening{
+    \Ifstr{<%cp_name%>}{}
+    {<%if natural_person%><%greeting%> <%name%>,<%else%>\anrede}<%end if%>
+    {
+      \Ifstr{<%cp_gender%>}{f}
+      {\anredefrau}
+      {\anredeherr}
       <%cp_title%> <%cp_name%>,
     }
   }
-\thispagestyle{kivitendo.letter.first}
-
-\sammelrechnungsformel
-
-\begin{SimpleTabular}[
-    colspec=l*6X,
-    headline={\bfseries\rechnung~\nr & \bfseries\datum & \bfseries\faellig &
-        \bfseries\aktuell & \bfseries\asDreissig & \bfseries\asSechzig & \bfseries\asNeunzig}
-  ]
-  % eigentliche Tabelle
-  <%foreach invnumber%>%
-  <%invnumber%> & <%invdate%> & <%duedate%> &
-  <%c0%> & <%c30%> & <%c60%> & <%c90%> \\
-  <%end invnumber%>%
-  % Tabellenende letzte Seite
-  \midrule[\heavyrulewidth]
-  \multicolumn{3}{@{}l}{\bfseries\zwischensumme} & \bfseries<%c0total%> & \bfseries<%c30total%> & \bfseries<%c60total%> & \bfseries<%c90total%>\\*
-  \midrule
-  \multicolumn{3}{@{}l}{\bfseries\schlussbetrag} & &&&\bfseries<%total%> \\
-\end{SimpleTabular}
-
-\closing{\gruesse}
+  \thispagestyle{kivitendo.letter.first}
+
+  \sammelrechnungsformel
+
+  \begin{SimpleTabular}[
+      colspec=l*6X,
+      headline={\bfseries\rechnung~\nr & \bfseries\datum & \bfseries\faellig &
+          \bfseries\aktuell & \bfseries\asDreissig & \bfseries\asSechzig & \bfseries\asNeunzig}
+    ]
+    % eigentliche Tabelle
+    <%foreach invnumber%>%
+      <%invnumber%> & <%invdate%> & <%duedate%> &
+      <%c0%> & <%c30%> & <%c60%> & <%c90%> \\
+    <%end invnumber%>%
+    % Tabellenende letzte Seite
+    \midrule[\heavyrulewidth]
+    \multicolumn{3}{@{}l}{\bfseries\zwischensumme} & \bfseries<%c0total%> & \bfseries<%c30total%> & \bfseries<%c60total%> & \bfseries<%c90total%>\\*
+    \midrule
+    \multicolumn{3}{@{}l}{\bfseries\schlussbetrag} & &&&\bfseries<%total%> \\
+  \end{SimpleTabular}
+
+  \closing{\gruesse}
 
 \end{letter}
 
diff --git a/templates/print/marei/supplier_delivery_order.tex b/templates/print/marei/supplier_delivery_order.tex
index 80c2db750..0c8020acb 100644
--- a/templates/print/marei/supplier_delivery_order.tex
+++ b/templates/print/marei/supplier_delivery_order.tex
@@ -30,11 +30,11 @@
 }
 <%if ordnumber%>
 	\setkomavar{orderID}{<%ordnumber%>}
-<%end if%>%
+<%end template_meta.formname == "rma_delivery_order"%>%
 <%if cusordnumber%>%
 	\setkomavar*{yourref}{\unsereBestellnummer}
 	\setkomavar{yourref}{<%cusordnumber%>}
-<%end if%>%
+<%end cusordnumber%>%
 \setkomavar{transaction}{<%transaction_description%>}
 
 <%if globalprojectnumber%>%
@@ -63,59 +63,59 @@
 	}
 \end{lrbox}
 \makeatother
-<%end if%>%
+<%end shiptoname%>%
 
 
 \begin{document}
 
 
 \begin{letter}{
-	<%name%>\strut\\
-	<%if department_1%><%department_1%>\\<%end if%>%
-	<%if department_2%><%department_2%>\\<%end if%>%
+    <%name%>\strut\\
+    <%if department_1%><%department_1%>\\<%end if%>%
+    <%if department_2%><%department_2%>\\<%end if%>%
     <%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\
-	<%street%>\strut\\
-	<%zipcode%> <%city%>\strut\\
-	<%country%> \strut
-}
-
-
-\opening{}
-\thispagestyle{kivitendo.letter.first}
-
-\begin{PricingTabular*}[columns={pos,amount,desc}]
-% eigentliche Tabelle
-\FakeTable{
-<%foreach number%>%
-	<%runningnumber%> &
-	<%qty%> <%unit%> &
-	\textbf{<%description%>}
-		<%if longdescription%>\ExtraDescription{<%longdescription%>}<%end longdescription%>%
-		<%if reqdate%>\ExtraDescription{\lieferdatum: <%reqdate%>}<%end reqdate%>%
-		<%if serialnumber%>\ExtraDescription{\seriennummer: <%serialnumber%>}<%end serialnumber%>%
-		<%if ean%>\ExtraDescription{\ean: <%ean%>}<%end ean%>%
-		<%if projectnumber%>\ExtraDescription{\projektnummer: <%projectnumber%>}<%end projectnumber%>%
-		<%foreach si_number%>%
-			\ExtraDescription{<%if si_chargenumber%>\charge: <%si_chargenumber%>
-      <%if si_bestbefore%> \mhd: <%si_bestbefore%><%end si_bestbefore%>~--~<%si_qty%>~<%si_unit%>
+    <%street%>\strut\\
+    <%zipcode%> <%city%>\strut\\
+    <%country%> \strut
+  }
+
+
+  \opening{}
+  \thispagestyle{kivitendo.letter.first}
+
+  \begin{PricingTabular*}[columns={pos,amount,desc}]
+    % eigentliche Tabelle
+    \FakeTable{
+    <%foreach number%>%
+      <%runningnumber%> &
+      <%qty%> <%unit%> &
+      \textbf{<%description%>}
+      <%if longdescription%>\ExtraDescription{<%longdescription%>}<%end longdescription%>%
+      <%if reqdate%>\ExtraDescription{\lieferdatum: <%reqdate%>}<%end reqdate%>%
+      <%if serialnumber%>\ExtraDescription{\seriennummer: <%serialnumber%>}<%end serialnumber%>%
+      <%if ean%>\ExtraDescription{\ean: <%ean%>}<%end ean%>%
+      <%if projectnumber%>\ExtraDescription{\projektnummer: <%projectnumber%>}<%end projectnumber%>%
+      <%foreach si_number%>%
+      \ExtraDescription{<%if si_chargenumber%>\charge: <%si_chargenumber%>
+        <%if si_bestbefore%> \mhd: <%si_bestbefore%><%end si_bestbefore%>~--~<%si_qty%>~<%si_unit%>
         <%end si_chargenumber%>%%
       }%
-		<%end si_number%>%
-	\tabularnewline
-<%end number%>%
-}
-\end{PricingTabular*}
-
-\medskip
-
-<%if notes%>%
-<%notes%>%
-\medskip
-<%end if%>%
-
-<%if delivery_term%>%
-  \lieferung ~<%delivery_term.description_long%>\\
-<%end delivery_term%>%
+      <%end si_number%>%
+      \tabularnewline
+    <%end number%>%
+    }
+  \end{PricingTabular*}
+
+  \medskip
+
+  <%if notes%>%
+    <%notes%>%
+    \medskip
+  <%end notes%>%
+
+  <%if delivery_term%>%
+    \lieferung ~<%delivery_term.description_long%>\\
+  <%end delivery_term%>%
 
 \end{letter}
 
diff --git a/templates/print/marei/zahlungserinnerung.tex b/templates/print/marei/zahlungserinnerung.tex
index 2beccf235..e693fca11 100644
--- a/templates/print/marei/zahlungserinnerung.tex
+++ b/templates/print/marei/zahlungserinnerung.tex
@@ -30,60 +30,60 @@
 \begin{document}
 
 \begin{letter}{%
-<%if billing_address_id%>%
-	<%billing_address_name%> \strut\\%
-	<%if department_1%><%billing_address_department_1%>\\<%end if%>%
-	<%if department_2%><%billing_address_department_2%>\\<%end if%>%
-	<%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%
-	<%billing_address_street%>\strut\\%
-	<%billing_address_zipcode%> <%billing_address_city%> \strut\\%
-	<%billing_address_country%>\strut\\%
-<%else%>%
-	<%name%>\strut\\%
-	<%if department_1%><%department_1%>\\<%end if%>%
-	<%if department_2%><%department_2%>\\<%end if%>%
-	<%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%
-	<%street%>\strut\\%
-	<%zipcode%> <%city%>\strut\\%
-	<%country%>\strut%
-<%end if%>%
-}
+  <%if billing_address_id%>%
+    <%billing_address_name%> \strut\\%
+    <%if department_1%><%billing_address_department_1%>\\<%end if%>%
+    <%if department_2%><%billing_address_department_2%>\\<%end if%>%
+    <%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%
+    <%billing_address_street%>\strut\\%
+    <%billing_address_zipcode%> <%billing_address_city%> \strut\\%
+    <%billing_address_country%>\strut\\%
+  <%else%>%
+    <%name%>\strut\\%
+    <%if department_1%><%department_1%>\\<%end if%>%
+    <%if department_2%><%department_2%>\\<%end if%>%
+    <%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%
+    <%street%>\strut\\%
+    <%zipcode%> <%city%>\strut\\%
+    <%country%>\strut%
+  <%end billing_address_id%>%
+  }
 
-% Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
-% Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
-\opening{
-\Ifstr{<%cp_name%>}{}
-{<%if natural_person%><%greeting%> <%name%>,<%else%>\anrede<%end if%>}
-  {
-    \Ifstr{<%cp_gender%>}{f}
-        {\anredefrau}
-        {\anredeherr}
+  % Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
+  % Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
+  \opening{
+    \Ifstr{<%cp_name%>}{}
+    {<%if natural_person%><%greeting%> <%name%>,<%else%>\anrede}<%end if%>
+    {
+      \Ifstr{<%cp_gender%>}{f}
+      {\anredefrau}
+      {\anredeherr}
       <%cp_title%> <%cp_name%>,
     }
   }
-\thispagestyle{kivitendo.letter.first}
+  \thispagestyle{kivitendo.letter.first}
 
-\mahnungsformel
+  \mahnungsformel
 
-\begin{SimpleTabular}[headline=\bfseries\rechnung~\nr&\bfseries\datum&\bfseries\betrag,colspec=rXr<{\tabcurrency}]
-  % eigentliche Tabelle
-  <%foreach dn_invnumber%>%
-  <%dn_invnumber%> & <%dn_transdate%> & <%dn_amount%> \\[0.1cm]
-  <%end dn_invnumber%>%
-\end{SimpleTabular}
+  \begin{SimpleTabular}[headline=\bfseries\rechnung~\nr&\bfseries\datum&\bfseries\betrag,colspec=rXr<{\tabcurrency}]
+    % eigentliche Tabelle
+    <%foreach dn_invnumber%>%
+      <%dn_invnumber%> & <%dn_transdate%> & <%dn_amount%> \\[0.1cm]
+    <%end dn_invnumber%>%
+  \end{SimpleTabular}
 
 
-\smallskip
+  \smallskip
 
-\bitteZahlenBis~<%dunning_duedate%>.
+  \bitteZahlenBis~<%dunning_duedate%>.
 
 
-\beruecksichtigtBis~<%dunning_date%>.
+  \beruecksichtigtBis~<%dunning_date%>.
 
 
-\schonGezahlt
+  \schonGezahlt
 
-\closing{\gruesse}
+  \closing{\gruesse}
 
 \end{letter}
 
diff --git a/templates/print/marei/zahlungserinnerung_invoice.tex b/templates/print/marei/zahlungserinnerung_invoice.tex
index 04145e7c8..5296ed244 100644
--- a/templates/print/marei/zahlungserinnerung_invoice.tex
+++ b/templates/print/marei/zahlungserinnerung_invoice.tex
@@ -36,53 +36,53 @@
 
 
 \begin{letter}{%
-<%if billing_address_id%>%
-	<%billing_address_name%> \strut\\%
-	<%if department_1%><%billing_address_department_1%>\\<%end if%>%
-	<%if department_2%><%billing_address_department_2%>\\<%end if%>%
-	<%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%
-	<%billing_address_street%>\strut\\%
-	<%billing_address_zipcode%> <%billing_address_city%> \strut\\%
-	<%billing_address_country%>\strut\\%
-<%else%>%
-	<%name%>\strut\\%
-	<%if department_1%><%department_1%>\\<%end if%>%
-	<%if department_2%><%department_2%>\\<%end if%>%
-	<%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%
-	<%street%>\strut\\%
-	<%zipcode%> <%city%>\strut\\%
-	<%country%>\strut%
-<%end if%>%
-}
+  <%if billing_address_id%>%
+    <%billing_address_name%> \strut\\%
+    <%if department_1%><%billing_address_department_1%>\\<%end if%>%
+    <%if department_2%><%billing_address_department_2%>\\<%end if%>%
+    <%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%
+    <%billing_address_street%>\strut\\%
+    <%billing_address_zipcode%> <%billing_address_city%> \strut\\%
+    <%billing_address_country%>\strut\\%
+  <%else%>%
+    <%name%>\strut\\%
+    <%if department_1%><%department_1%>\\<%end if%>%
+    <%if department_2%><%department_2%>\\<%end if%>%
+    <%cp_title%> <%cp_givenname%> <%cp_name%>\strut\\%
+    <%street%>\strut\\%
+    <%zipcode%> <%city%>\strut\\%
+    <%country%>\strut%
+  <%end billing_address_id%>%
+  }
 
-% Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
-% Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
-\opening{
-\Ifstr{<%cp_name%>}{}
-{<%if natural_person%><%greeting%> <%name%>,<%else%>\anrede<%end if%>}
-  {
-    \Ifstr{<%cp_gender%>}{f}
-        {\anredefrau}
-        {\anredeherr}
+  % Bei Kontaktperson Anrede nach Geschlecht unterscheiden.
+  % Bei natürlichen Personen persönliche Anrede, sonst allgemeine Anrede.
+  \opening{
+    \Ifstr{<%cp_name%>}{}
+    {<%if natural_person%><%greeting%> <%name%>,<%else%>\anrede}<%end if%>
+    {
+      \Ifstr{<%cp_gender%>}{f}
+      {\anredefrau}
+      {\anredeherr}
       <%cp_title%> <%cp_name%>,
     }
   }
-\thispagestyle{kivitendo.letter.first}
+  \thispagestyle{kivitendo.letter.first}
 
-\mahnungsrechnungsformel
+  \mahnungsrechnungsformel
 
-\begin{SimpleTabular}[colspec=Xr<{\tabcurrency},headline={\bfseries\posten& \bfseries\betrag}]
-  Mahngebühren & <%fee%> \\
-  Zinsen & <%interest%> \\
-  \midrule[\heavyrulewidth]
-  \multicolumn{1}{@{}l}{\schlussbetrag}& <%invamount%>\\
-\end{SimpleTabular}
+  \begin{SimpleTabular}[colspec=Xr<{\tabcurrency},headline={\bfseries\posten& \bfseries\betrag}]
+    Mahngebühren & <%fee%> \\
+    Zinsen & <%interest%> \\
+    \midrule[\heavyrulewidth]
+    \multicolumn{1}{@{}l}{\schlussbetrag}& <%invamount%>\\
+  \end{SimpleTabular}
 
-\smallskip
+  \smallskip
 
-\bitteZahlenBis~<%duedate%>.
+  \bitteZahlenBis~<%duedate%>.
 
-\closing{\gruesse}
+  \closing{\gruesse}
 
 \end{letter}
 
