\input{inheaders.tex}


% Variablen, die in settings verwendet werden
\newcommand{\lxlangcode} {<%template_meta.language.template_code%>}
\newcommand{\lxmedia} {<%media%>}
\newcommand{\lxcurrency} {<%currency%>}
\newcommand{\kivicompany} {<%employee_company%>}

% settings: Einstellungen, Logo, Briefpapier, Kopfzeile, Fusszeile
\input{insettings.tex}


% laufende Kopfzeile:
\ourhead{\kundennummer}{<%customernumber%>}{\angebot}{<%quonumber%>}{<%transdate%>}


\begin{document}

\setkomavar{signature}{
<%employee_company%>\ifhmode\\\fi<%salesman_name%>
}

\begin{minipage}[t]{8cm}
  \scriptsize

  {\color{gray}\underline{\firma\ $\cdot$ \strasse\ $\cdot$ \ort}}
  \normalsize

  \vspace*{0.3cm}

  <%name%>

  <%if department_1%><%department_1%><%end if%>

  <%if department_2%><%department_2%><%end if%>

  <%cp_givenname%> <%cp_name%>

  <%street%>

  ~

  <%zipcode%> <%city%>

  <%country%>
\end{minipage}
\hfill
\begin{minipage}[t]{6cm}
  \hfill{\LARGE\textbf{\angebot}}

  \vspace*{0.2cm}

  \hfill{\large\textbf{\nr ~<%quonumber%>}}

  \vspace*{0.2cm}

  \datum:\hfill <%transdate%>

  \kundennummer:\hfill <%customernumber%>

  \ansprechpartner:\hfill <%employee_name%>

  \textTelefon \hfill <%employee_tel%>

  \textEmail \hfill <%employee_email%>

\end{minipage}

<%if shiptoname%>
  \vspace{0.8cm}
  \scriptsize \underline{\abweichendeLieferadresse:}\\
  \normalsize    <%shiptoname%>

                 <%if shiptocontact%> <%shiptocontact%><%end if%>

                 <%shiptodepartment_1%>

                  <%shiptodepartment_2%>

                  <%shiptostreet%>

                  <%shiptozipcode%> <%shiptocity%>
<%end if%>
\vspace*{1.5cm}

\hfill


\begin{letter}{
  <%name%>\\
  <%if department_1%><%department_1%><%end if%>\\
  <%if department_2%><%department_2%><%end if%>\\
  <%cp_givenname%> <%cp_name%>\\
  <%street%>\\
  <%zipcode%> <%city%>\\
  <%country%>
}

% Anrede nach Geschlecht unterscheiden
\opening{
	\ifstr{<%cp_name%>}{}
		{\anrede}
		{
		\ifstr{<%cp_gender%>}{f}
			{\anredefrau}
			{\anredeherr}
			<%cp_title%> <%cp_name%>,
		}
}
\thispagestyle{kivitendo.letter.first}

\angebotsformel\\


\begin{PricingTabular}
	% Tabellenende letzte Seite
	\midrule
	\multicolumn{5}{@{}l}{\nettobetrag} & <%subtotal%>\\
	<%foreach tax%>
	\multicolumn{5}{@{}l}{<%taxdescription%>} & <%tax%>\\
	<%end tax%>
	\multicolumn{5}{@{}l}{\bfseries\schlussbetrag} &  \textbf{<%ordtotal%>}\\
	\bottomrule
	\endlastfoot
% eigentliche Tabelle
<%foreach number%>
<%runningnumber%> &
<%number%> &
\textbf{<%description%>}
	<%if longdescription%> \newline\scriptsize <%longdescription%><%end longdescription%>
	<%if serialnumber%> \newline\scriptsize \seriennummer: <%serialnumber%><%end serialnumber%>
	<%if ean%> \newline\scriptsize \ean: <%ean%><%end ean%>
	<%if projectnumber%>\newline\scriptsize \projektnummer: <%projectnumber%><%end projectnumber%>
	&
	<%qty%> <%unit%> &
	<%sellprice%>&
	\ifstr{<%p_discount%>}{0}{}{\sffamily\scriptsize{(-<%p_discount%>\,\%)}}
			<%linetotal%>\\
<%end number%>
\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}
\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}
\end{document}
