%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%                                           %%%
%%%      Faktura - LaTeX sablona v. 1.01      %%%
%%%  Peter Mészáros -- peterm@insypo.sk       %%%
%%%                                           %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
%%% 27.4.2009
%%%
%%%


\documentclass[twoside]{article}
%\documentclass[twoside]{scrartcl}
% \usepackage[frame]{xy}
\usepackage{tabularx}
%\usepackage{graphicx}
\usepackage[utf8]{inputenc}



\setlength{\voffset}{-0.5cm}
\setlength{\hoffset}{-2.5cm}
\setlength{\topmargin}{0cm}
\setlength{\headheight}{0.5cm}
\setlength{\headsep}{1cm}
\setlength{\topskip}{0pt}
\setlength{\oddsidemargin}{1.0cm}
\setlength{\evensidemargin}{1.0cm}
\setlength{\textwidth}{19.2cm}
\setlength{\textheight}{24.5cm}
\setlength{\footskip}{1cm}
\setlength{\parindent}{0pt}
\renewcommand{\baselinestretch}{1}


\newcommand{\PAR}[1]{\texttt{\upshape <\%#1\%>}\typeout{#1}}


\begin{document}
\newlength{\descrwidth}\setlength{\descrwidth}{10cm}


\newsavebox{\headright}
\sbox{\headright}{
  \fontfamily{cmss}\fontsize{10pt}{12pt}\selectfont
  \parbox{\textwidth}{
   \begin{center}
%     \includegraphics[scale=1.0]{/tmp/logo_04.eps} \\[.3cm]
     {\large\bfseries FAKTÚRA} \\
   \end{center}

   \mbox{}\hfill <%copysum%>  \\
   \mbox{}\hfill <%copynumber%>
  }
}

\newsavebox{\headleft}
\sbox{\headleft}{
  \fontfamily{cmss}\fontsize{10pt}{12pt}\selectfont
  \parbox{\textwidth}{
%  \includegraphics[scale=.5]{/tmp/logo_04.eps} 
  \hfill <%invnumber%>\\[-3mm]
  \rule{\textwidth}{.5pt}
  }
}



\markboth{}{\usebox{\headright}}

\pagestyle{myheadings}

\fontfamily{cmss}\fontsize{10pt}{12pt}\fontshape{n}\selectfont


<%pagebreak 65 27 48%>
\end{tabularx}
}

\rule{\textwidth}{1.5pt}
  
  \hfill
  \begin{tabularx}{7cm}{X@{ }r@{}}
  \textbf{Medzisúčet} & <%sumcarriedforward%> \cr
  \end{tabularx}

\newpage

\markboth{\usebox{\headleft}}{\usebox{\headleft}}

\mbox{}\vspace{.5cm}

\rule{\textwidth}{1.5pt}

\vspace{.3cm}

{\scriptsize
\begin{tabularx}{\textwidth}{>{\hsize=0.4cm\centering}X@{\ }
            >{\hsize=0.9cm\raggedleft}X@{\ }
            >{\hsize=1.9cm\raggedleft}X@{\ }
            >{\hsize=2.9cm\raggedleft}X@{\ }
            >{\hsize=1.9cm\centering}X@{\ }
            >{\hsize=0.9cm\centering}X@{\ }
            >{\hsize=0.5cm\centering}X@{\ }
            >{\hsize=2.0cm\raggedleft}X@{\ }
            >{\hsize=2.0cm\raggedleft}X@{\ }
            >{\hsize=0.8cm\raggedleft}X@{\ }
            >{\hsize=2.0cm\raggedleft}X@{\ }
            >{\hsize=2.0cm\raggedleft}X@{}
           }
  \textbf{pol} & \textbf{Skup} & \textbf{Číslo} & \centering\textbf{Popis} &
  \textbf{Regál} & \textbf{Mno�.} & \textbf{MJ} & 
  \textbf{Cena bez DPH} & \textbf{Suma bez DPH} & \textbf{DPH\%} & 
  \textbf{Suma DPH} & \textbf{Suma}
  \cr
  & & \textbf{predch.strana} &
  & & &
  & & & 
  & & <%sumcarriedforward%>
  \cr
<%end pagebreak%>

\mbox{}\vspace{3.5cm}

\rule{\textwidth}{1.5pt}

\vspace{3mm}

\hbox to\hsize{
\begin{minipage}[t]{9.5cm}
\textbf{Predávajúci:} \\
<%company%>\\
<%address%>\\
IČ DPH: <%businessnumber%>\\
tel: <%tel%>\\
fax: <%fax%>
\end{minipage}
\hfill \
\begin{minipage}[t]{9.5cm}
\textbf{Kupujúci:} \\
<%name%>\\
<%address1%>\\
<%if address2%>
<%address2%>
<%end address2%>\\
<%city%> <%state%> <%zipcode%>\\
<%if country%>
<%country%>
<%end country%>
\end{minipage}
}


\vspace{5mm}

\rule{\textwidth}{1.5pt}

\vspace{3mm}

\hspace{-3mm}
\begin{tabularx}{\textwidth}{>{\hsize=2.1cm\centering}X@{\ }
                             >{\hsize=2.8cm\centering}X@{\ }
                             >{\hsize=2.8cm\centering}X@{\ }
                             >{\hsize=2.8cm\centering}X@{\ }
                             >{\hsize=3.4cm\centering}X@{\ }
                             >{\hsize=2.5cm\centering}X@{\ }
                             >{\hsize=2.0cm\raggedleft}X@{}}
  \textbf{Miesto dodania} & \textbf{Dátum} & \textbf{ } &
  \textbf{Splatnosť} & \textbf{Č.objednávky} & \textbf{Vystavil} & \textbf{Č.faktúry} 
  \cr
  <%shippingpoint%> & <%invdate%> & <%crdate%> &
  <%duedate%> & <%ordnumber%> & <%employee%> & <%invnumber%>
\end{tabularx}


\vspace{5mm}

\rule{\textwidth}{1.5pt}

\vspace{3mm}

\hspace{-3mm}
{\scriptsize

\begin{tabularx}{\textwidth}{@{}rlXlrlrrr@{}}
  \textbf{Pol.} & \textbf{Číslo} & \textbf{Popis} & & \textbf{Množstvo} &
    \textbf{MJ} & \textbf{Cena} & \textbf{Zľava \%} & \textbf{Suma} \\ [0.5em]
<%foreach number%>
  <%runningnumber%> & <%number%> & <%description%> & <%deliverydate%> &
  <%qty%> & <%unit%> & <%sellprice%> & <%discountrate%> & <%linetotal%> \\
<%end number%>
\end{tabularx}


\rule{\textwidth}{1.5pt}

\hbox to\hsize{
\hspace{8.4cm}
\begin{minipage}[t]{11cm}

\rule{10.6cm}{1.5pt}

\vspace{.2cm}

\begin{tabularx}{10cm}{>{\hsize=7cm\raggedleft}X>{\hsize=3cm\raggedleft}X}
%\textbf{Total} & <%invtotal%> \cr
\textbf{Suma celkom} & <%subtotal%> \cr
<%foreach tax%>
\textbf{Základ:} <%taxbase%> \textbf{DPH:} <%taxrate%> & <%tax%> \cr
<%end tax%>
<%if paid%>
\textbf{Zaplatené:} & -<%paid%>
<%end paid%>
\end{tabularx}

\rule{10.6cm}{1.5pt}
\begin{tabularx}{10cm}{>{\hsize=7cm\raggedleft}X>{\hsize=3cm\raggedleft}X}
\textbf{K úhrade} & <%total%> \textbf{EUR}
\end{tabularx}

\end{minipage}
}


\vfill
\vspace{1cm}
<%if notes%>
\textbf{Poznámka:} <%notes%>
\vspace{1cm}
<%end if%>


<%if paid%>
\textbf{Platby:}

\rule{12cm}{1.5pt}

\vspace{.2cm}

\begin{tabularx}{12cm}{@{}>{\hsize=2.9cm\centering}X@{\ }
                       >{\hsize=2.9cm\centering}X@{\ }
                       >{\hsize=2.9cm\centering}X@{\ }
                       >{\hsize=2.9cm\raggedleft}X@{}}
  \textbf{Dátum} & \textbf{Účet} & \textbf{Č.dokladu} & \textbf{Suma} 
  \cr
<%end paid%>
<%foreach payment%>
  <%paymentdate%> & <%paymentaccount%> & <%paymentsource%> & <%payment%> 
  \cr
<%end payment%>  
<%if paid%>
\end{tabularx}
<%end paid%>  

\vspace{1cm}

<%intnotes%>

\end{document}


























