% Standard Finnish Invoice Template v0.4
% Copyright 2008 Jaakko Heusala <jheusala@iki.fi>
% 
% See README in finnish for instructions.
% 
% $Id: invoice.tex 4581 2008-02-24 18:59:30Z jheusala $
% [The zlib/libpng License]
% 
% This software is provided 'as-is', without any express or implied
% warranty. In no event will the authors be held liable for any damages
% arising from the use of this software.
% 
% Permission is granted to anyone to use this software for any purpose,
% including commercial applications, and to alter it and redistribute it
% freely, subject to the following restrictions:
%
%    1. The origin of this software must not be misrepresented; you must not
%    claim that you wrote the original software. If you use this software
%    in a product, an acknowledgment in the product documentation would be
%    appreciated but is not required.
%
%    2. Altered source versions must be plainly marked as such, and must not be
%    misrepresented as being the original software.
%
%    3. This notice may not be removed or altered from any source
%    distribution.
% 

\documentclass[a4paper,10pt]{letter}
\title{#title#}
\date{#date#}
\usepackage{pslatex}
\usepackage[utf8]{inputenc}
\usepackage[finnish]{babel}
\pagestyle{empty}
\usepackage[left=0cm,top=0cm,right=0cm,bottom=0cm,nohead,nofoot]{geometry}
\usepackage[gen]{eurosym}
\usepackage{color}
%\usepackage{pstricks}
\usepackage{rotating}
\usepackage[T1]{fontenc} % Fixes scandinavian character problem
\begin{document}

\setlength{\unitlength}{1mm}
\begin{picture}(210,297)(0,0)

%% Document Header
\fontsize{12pt}{14pt}
\selectfont
\put(20,277){
  \begin{tabular}[t]{@{}p{8.5cm}@{}p{8.5cm}@{}r}
    \parbox[t]{9.5cm}{
      \fontsize{16pt}{18pt}
      \selectfont
      \textsc{#company#} \\
      \fontsize{12pt}{14pt}
      \selectfont
      #companyperson# \\
      #companyaddr# \\
      #companypostcode# #companypostoffice# \\
      \\
      \\
      #payee# \\
      #payeeaddr# \\
      #payeepostcode# #payeepostoffice#
    }
    &
    \parbox[t]{8.5cm}{
      LASKU \\
      \\
      #date#
      \\
      \\
      \\
      \framebox{
        \fontsize{10pt}{11pt}
        \selectfont
        \begin{tabular}[t]{@{}l@{}l@{}}
          \begin{tabular}[t]{@{}ll}
          Laskun numero:  & #invoicenumber#        \\
          Asiakasnumero:  & #payeenumber#        \\
          Päivämäärä:     & #date#  \\
          Maksuehdot:     & #terms# \\
          Eräpäivä:       & #duedate#  \\
          \end{tabular}
        &
          \begin{tabular}[t]{@{}ll}
          Maksettava:     & #amount# \euro \\
          Huomautusaika:  & #noticeperiod# \\
          Viivästyskorko: & #latepercent#\%     \\
          Muistutusmaksu: & #remindfee# \euro  \\
          Viitteenne:     & #payeereference#  \\
          \end{tabular}
        \end{tabular}
      }
    } & 1 (1) \\
  \end{tabular}
}


\fontsize{8pt}{9pt}
\selectfont
\put(10,222){

\begin{tabular}[t]{@{}rlrrrrrrr@{}}
 \parbox[t]{0.50cm}{\raggedleft Rivi\\nro} &
 \parbox[t]{5.5cm}{Tuote/palvelu} &
 \parbox[t]{0.50cm}{\raggedleft KPL} &
 \parbox[t]{1.5cm}{\raggedleft A-hinta\\veroton} &
 \parbox[t]{1.5cm}{\raggedleft A-hinta\\verollinen} &
 \parbox[t]{1.5cm}{\raggedleft ALV-\%} &
 \parbox[t]{1.5cm}{\raggedleft Veroton\\yhteensä} &
 \parbox[t]{1.5cm}{\raggedleft ALV\\yhteensä} &
 \parbox[t]{1.5cm}{\raggedleft Verollinen\\yhteensä} \\[2.5ex]
\hline
#itemtext#
\hline
& Yhteensä & & & & & #totalraw# & #totalvat# & #totalsum# \\
\end{tabular}
}



%% Additional info
\put(10,120){ \parbox[t]{200cm}{Muistutuksesta perimme #remindfee# euron muistutusmaksun.} }


%% Company Contact Info
\fontsize{8pt}{8.5pt}
\selectfont
\put(10,110){
  \begin{tabular}{p{3cm}p{3cm}p{4cm}p{4cm}p{3.25cm}@{}}
  \hline
  \\
  \parbox[t]{3cm}{
    \textbf{#company#}\\
    \mbox{#companyaddr#}\\
    \mbox{#companypostcode# #companypostoffice#}
  } &
  \parbox[t]{3cm}{
    Y-tunnus: \mbox{#companycode#} \\
    Kotipaikka: #companytown# \\
    {\tt \mbox{#companyurl#}}
  } &
  \parbox[t]{4cm}{
    Sähköposti: {\tt \mbox{#companyemail#}}\\
    Puhelin: \mbox{#companyphone#}
  } &
  \parbox[t]{4cm}{
    Tilinumero:\\
    IBAN: {\tt \mbox{#companyiban#}}
  } &
  \parbox[t]{3.25cm}{
    Viitenumero: {\tt \mbox{#invoicerefcode#}} \\
%    VAT: {\tt \mbox{#companyvat#}}
  } \\
  \end{tabular}
}

%% Standard Finnish Bank Transfer Form
\linethickness{0.5mm}

%% For debug
%\color{red}
%\put(0,0){\circle{10}}
%\put(210,0){\circle{10}}
%\put(0,101.6){\circle{10}}
%\put(210,101.6){\circle{10}}
%
%% For debug
%\put(5,5){\makebox(0,0){0,0}}
%\put(200,5){\makebox(0,0){210,0}}
%\put(7,99){\makebox(0,0){0,101.6}}
%\put(200,99){\makebox(0,0){210,101.6}}

% Bold Vertical lines
\color{blue}
%\put(20.32,69.85){\circle{10}}
\put(20.32,69.85){\line(0,1){31.75}}
%\put(111.76,27.5166667){\circle{10}}
\put(111.76,27.5166667){\line(0,1){74.0833333}}
%\put(124.46,27.5166667){\circle{10}}
\put(124.46,27.5166667){\line(0,1){16.9333333}}
%\put(157.48,27.5166667){\circle{10}}
\put(157.48,27.5166667){\line(0,1){8.46666667}}

% Bold Horizontal lines
%\put(111.76,84.6666667){\circle{10}}
\put(111.76,84.6666667){\line(-1,0){106.68}}
\put(111.76,84.6666667){\line(1,0){91.44}}

%\put(111.76,69.85){\circle{10}}
\put(111.76,69.85){\line(-1,0){106.68}}

%\put(111.76,44.45){\circle{10}}
\put(111.76,44.45){\line(1,0){91.44}}

%\put(111.76,35.9833333){\circle{10}}
\put(111.76,35.9833333){\line(-1,0){106.68}}
\put(111.76,35.9833333){\line(1,0){91.44}}

%\put(111.76,27.5166667){\circle{10}}
\put(111.76,27.5166667){\line(-1,0){106.68}}
\put(111.76,27.5166667){\line(1,0){91.44}}

%\put(52.49333333,29.6333333){\line(1,0){1.69333333}} % Tilinumeron viiva

%\put(20.32,27.5166667){\circle{10}}
\put(20.32,27.5166667){\line(0,1){8.46666667}}

% Normal lines
\linethickness{0.13mm}

%% Debug line
%\color{red}
%\put(0,101.6){\line(1,0){210}}
%\color{blue}

% Normal Vertical Lines
%\put(20.32,27.5166667){\circle{10}}
%\put(20.32,27.5166667){\line(0,1){8.46666667}}
%\put(25.40,27.5166667){\line(0,1){2.11666667}} % 01
%\put(30.48,27.5166667){\line(0,1){2.11666667}} % 02
%\put(35.56,27.5166667){\line(0,1){2.11666667}} % 03
%\put(40.64,27.5166667){\line(0,1){2.11666667}} % 04
%\put(45.72,27.5166667){\line(0,1){2.11666667}} % 05
%\put(50.80,27.5166667){\line(0,1){2.11666667}} % 06
%\put(55.88,27.5166667){\line(0,1){2.11666667}} % 07
%\put(60.96,27.5166667){\line(0,1){2.11666667}} % 08
%\put(66.04,27.5166667){\line(0,1){2.11666667}} % 09
%\put(71.12,27.5166667){\line(0,1){2.11666667}} % 10
%\put(76.20,27.5166667){\line(0,1){2.11666667}} % 11
%\put(81.28,27.5166667){\line(0,1){2.11666667}} % 12
%\put(86.36,27.5166667){\line(0,1){2.11666667}} % 13
%\put(91.44,27.5166667){\line(0,1){2.11666667}} % 14
%\put(96.52,27.5166667){\line(0,1){2.11666667}} % 15

%\put(161.29,84.6666667){\circle{10}}
\put(161.29,84.6666667){\line(0,1){16.9333333}}

% Normal Horizontal lines
%\put(20.02,40.2166667){\circle{10}}
\put(20.02,40.2166667){\line(1,0){91.44}}     % 20.02 should be 20.32 (8/10 inches)

% Texts

% Tilinumero
\put(0,84.6666667){
 \makebox(19,16.9333333)[r]{
 \begin{minipage}[r]{19mm}
  \fontsize{7pt}{8pt}
  \selectfont
  \begin{flushright}
   Saajan\\
   tilinumero\\
   Mottagarens\\
   kontonummer
  \end{flushright}
 \end{minipage}
 }
}

% Saaja
\put(0,69.85){
 \makebox(19,14.8166667)[r]{
 \begin{minipage}[r]{19mm}
  \fontsize{7pt}{8pt}
  \selectfont
  \begin{flushright}
   Saaja\\
   Mottagare
  \end{flushright}
 \end{minipage}
 }
}

% Maksaja
\put(0,52){
 \makebox(19,14.8166667)[r]{
 \begin{minipage}[r]{19mm}
  \fontsize{7pt}{8pt}
  \selectfont
  \begin{flushright}
   Maksajan\\
   nimi ja\\
   osoite \\
   Betalarens \\
   namn och \\
   adress
  \end{flushright}
 \end{minipage}
 }
}

% Allekirjoitus
\put(0,35.9833333){
 \makebox(19,14.8166667)[r]{
 \begin{minipage}[r]{19mm}
  \fontsize{7pt}{8pt}
  \selectfont
  \begin{flushright}
   Alle-\\
   kirjoitus\\
   Underskrift
  \end{flushright}
 \end{minipage}
 }
}

% Tililtä nro
\put(0,27.5166667){
 \makebox(19,8.46666667)[r]{
 \begin{minipage}[r]{19mm}
  \fontsize{7pt}{8pt}
  \selectfont
  \begin{flushright}
   Tililtä nro\\
   Från konto nr
  \end{flushright}
 \end{minipage}
 }
}

% Viitenumero
\put(111.5,35.9833333){
 \makebox(12.7,8.46666667)[l]{
 \begin{minipage}[l]{12.7mm}
  \fontsize{7pt}{8pt}
  \selectfont
   Viitenro\\
   Ref.nr
 \end{minipage}
 }
}

% Eräpäivä
\put(111.5,27.5166667){
 \makebox(12.7,8.46666667)[l]{
 \begin{minipage}[l]{12.7mm}
  \fontsize{7pt}{8pt}
  \selectfont
   Eräpäivä\\
   Förf.dag
 \end{minipage}
 }
}

% Euro
\put(157,26.5){
 \makebox(12.7,8.46666667)[tl]{
 \begin{minipage}[tl]{12.7mm}
  \fontsize{7pt}{8pt}
  \selectfont
   Euro
 \end{minipage}
 }
}


% Tilisiirtoteksti
\put(4.5,37){
 \begin{sideways}
  \fontsize{8pt}{8.5pt}
  \selectfont
  \textbf{TILISIIRTO GIRERING}
 \end{sideways}
}

% Maksu välitetään -teksti
%\put(150,5){\circle{10}}
\put(150,5){
 \makebox(52,12)[t]{
 \begin{minipage}[t]{52mm}
  \fontsize{5pt}{5.5pt}
  \selectfont
   Maksu välitetään saajalle vain Suomessa Kotimaan maksujenvälityksen yleisten
   ehtojen mukaisesti ja vain maksajan ilmoittaman tilinumeron perusteella. \\
   Betalningen förmedlas till mottagare endast i Finland enligt Allmänna villkor för
   inrikes betalningsförmedling och endast till det kontonummer betalaren angivit.
 \end{minipage}
 }
}


\color{black}
\fontsize{9pt}{10pt}
\selectfont

% Saajan tilinumero
%\put(20.32,86.5){\circle{10}}
\put(20.32,86.5){
 \makebox(91.44,16.9333333)[bl]{
 \begin{minipage}[bl]{91.44mm}
  \fontsize{9pt}{10pt}
  \selectfont
   #companyiban#
 \end{minipage}
 }
}

% Saaja

\put(20.32,68.25){
 \makebox(91.44,13.7)[tl]{
 \begin{minipage}[tl]{91.44mm}
  \fontsize{9pt}{10pt}
  \selectfont
  #company# \\
  #companyaddr# \\
  #companypostcode# #companypostoffice#
 \end{minipage}
 }
}

% Maksaja
\put(20.32,35.9833333){
 \makebox(91.44,29.6333333)[tl]{
 \begin{minipage}[tl]{91.44mm}
  \fontsize{9pt}{10pt}
  \selectfont
  #payee# \\
  #payeeaddr# \\
  #payeepostcode# #payeepostoffice#
 \end{minipage}
 }
}

% Viestiosa
\put(114.3,44.45){
 \makebox(81.28,38)[tl]{
 \begin{minipage}[tl]{81.28mm}
  \fontsize{9pt}{10pt}
  \selectfont
  Laskunumero: #invoicenumber# \\
  Asiakasnumero: #payeenumber# \\
  \\
  \\
  \\
  \\
  \\
  Viitenumero mainittava maksaessa!
 \end{minipage}
 }
}

% Viitenumero
\put(132.08,39){ #invoicerefcode# } % Viitenumero
\put(132.08,30){ #duedate# } % Eräpäivä
\put(168,30){ #amount# } % Summa


%% Viivakoodi
%\put(20.32,3){ 
% \X=.25mm
% \barheight=12mm
% \code{2574136020371846000964220000000000512301010508081000001}
%}

% Pankki-teksti
\color{blue}
\fontsize{6pt}{10pt}
\selectfont
\put(185,2){ PANKKI BANKEN }

\end{picture}
\end{document}
