stoptime/templates/invoice.tex.erb

123 lines
4.3 KiB
Plaintext

\documentclass[a4paper,12pt,oneside,dutch]{isodoc}
% rubber: clean <%= @number %>.out
\usepackage{array}
\usepackage[utf8]{inputenc}
\setupdocument{
%% Language and style,
dutch,
fill,
fontpackage=pxfonts,
%% Company info.
company=<%= @company.name %>,
who=<%= @company.contact_name %>,
street=<%= @company.address_street %>,
zip=<%= @company.address_postal_code %>,
city=<%= @company.address_city %>,
country=<%= @company.country %>,
countrycode=<%= @company.country_code %>,
logoaddress={\hspace{-4.4em}
\begin{tabular}{l@{\ }l}
<% if @company.name.blank? %> \addresstext: & \who\\
<% else %> \addresstext: & \company \\
<% unless @company.contact_name.blank? %> \addresswhotext: & \who \\
<% end %><% end %> & \street\\
& \zip\ \city\\[.2em]
<% unless @company.phone.blank? %> \phonetext: & \lead\phone\\
<% end %><% unless @company.cell.blank? %> \cellphonetext: & \lead\cellphone\\
<% end %><% unless @company.email.blank? %> \emailtext: & \email\\[.2em]
<% end %><% unless @company.chamber.blank? %> \chambertext: & \chamber\\
<% end %><% unless @company.vatno.blank? %> \vatnotext: & \vatno
<% end %> \end{tabular}},
%% Footer.
<% unless @company.website.blank? %> footer,<%
end %> areacode=31,
phone=<%= @company.phone %>,
cellphone=<%= @company.cell %>,
email=<%= @company.email %>,
website=<%= @company.website %>,
%% Addressee info.
%foreign,
to={<%= @customer.name %>\\<%= @customer.address_street%>\\
<%= @customer.address_postal_code %> <%= @customer.address_city %>},
% Headlines.
date=<%= @invoice.created_at.to_formatted_s(:day_code) %>,
ourref=<%= @number %>,
<% period = @period.map { |p| I18n.l p, :format => :month_and_year }.uniq
case period.length
when 1 %> subject=Factuur <%= period.first %>,<%
when 2 %> subject=Factuur <%= period.join(" t/m ") %>,<%
end %>
yourref=,
%% Payment data.
term=30,
accountno=<%= @company.accountno %>,
accountname=<%= @company.accountname %>,
<% unless @company.vatno.blank? %> vatno=<%= @company.vatno %>,
<% end %><% unless @company.chamber.blank? %> chamber=<%= @company.chamber %>
<% end %>}
\newcommand{\addresstext}{adres}
\newcommand{\addresswhotext}{t.n.v.}
\renewcommand{\chambertext}{KvK-nr}
\renewcommand{\datetext}{Factuurdatum}
\renewcommand{\emailtext}{e-mail}
\renewcommand{\invoicetext}{\Large\textbf{Factuur}}
\renewcommand{\ourreftext}{Factuurnummer}
\renewcommand{\referencetext}{factuurnummer}
\renewcommand{\vatnotext}{btw-nr}
\renewcommand{\websitetext}{website}
\newenvironment{ihtable}%
{\vskip1em\tabularx{\linewidth}{@{}X|@{\quad}r|@{\quad}r|@{\quad}r@{}}
\descriptiontext&Aantal uur&Uurtarief&\amounttext\ML}%
{\endtabularx}
\newcommand{\ihitem}[4]{#1&#2&\currency~#3&\currency~#4\\}
\newcommand{\ifcitem}[2]{#1&--&--&\currency~#2\\}
\newcommand{\ihsubtotal}[1]{\cmidrule[.0em]{4-4}%
\textit{Subtotaal}&&&\currency~#1\\}
\newcommand{\ihnosubtotal}[1]{\cmidrule[.0em]{4-4}&&&\\}
\newcommand{\ihvat}[1]{\textit{Btw-heffing <%= VATRate %>\%}&&&\currency~#1\\}
\newcommand{\ihtotal}[1]{\cmidrule[.05em]{4-4}%
\textbf{\Totaltext}&&&\textbf{\currency~#1}}
\begin{document}
\invoice{
\hypersetup{pdftitle=\invoicetext\ naar\ \toname\ gedateerd \date\ (\ourref)}
% FIXME: localise the dot/comma stuff in numbers.
\begin{ihtable}
<% subtotal = 0.0
@tasks.each do |task, line|
if line[0].nil? and line[1].nil?
%> \ifcitem{<%= task %>}%
{<%= number_with_precision(line[2]) %>}<%
else
%> \ihitem{<%= task %>}%
{<%= number_with_precision(line[0]) %>}{<%= number_with_precision(line[1]) %>}%
{<%= number_with_precision(line[2]) %>}<%
end
subtotal += line[2]
end
if VATRate.zero?
vat = 0 %>
\ihnosubtotal{} <%
else
vat = subtotal * VATRate/100 %>
\ihsubtotal{<%= number_with_precision(subtotal) %>}
\ihvat{<%= number_with_precision(vat) %>}<%
end %>
\ihtotal{<%= number_with_precision(subtotal + vat) %>}
\end{ihtable}
\vspace{2em}
Ik verzoek u vriendelijk het verschuldigde bedrag binnen 30 dagen na
factuurdatum over te maken onder vermelding van het factuurnummer. \\
\accountdata
}
\end{document}