Calculate and add VAT (fixed rate for now).

This commit is contained in:
Paul van Tilburg 2011-11-03 22:17:18 +01:00
parent d1c1b252a7
commit 0489d7e3cd
3 changed files with 25 additions and 12 deletions

1
TODO
View File

@ -5,7 +5,6 @@ ToDo
* handmatige entries (gekocht item/opdrachtbasis) op factuur
* factureervlag per entry
* factuur vastleggen, met samenvatting commentaar
* btw berekenen
* uurtarief per project (inherit klant)
* (configureerbare) factuurnummering (op jaarbasis)

View File

@ -35,9 +35,9 @@ unless defined? PUBLIC_DIR
# FIXME: this should be configurable.
HourlyRate = 20.00
VATRate = 19.0
end
module StopTime
def self.create
@ -476,7 +476,7 @@ module StopTime::Views
th { "Hourly rate" }
th { "Amount" }
end
total = 0.0
subtotal = 0.0
@tasks.each do |task, line|
tr do
td { task.name }
@ -484,13 +484,26 @@ module StopTime::Views
td { "€ %.2f" % line[1] }
td { "€ %.2f" % line[2] }
end
total += line[2]
subtotal += line[2]
end
tr do
td { i "Sub-total" }
td ""
td ""
td { "€ %.2f" % subtotal }
end
vat = subtotal * VATRate/100
tr do
td { i "VAT #{VATRate}%" }
td ""
td ""
td { "€ %.2f" % vat }
end
tr do
td { b "Total amount" }
td ""
td ""
td { "€ %.2f" % total }
td { "€ %.2f" % (subtotal + vat) }
end
end
end

View File

@ -69,7 +69,7 @@
\newcommand{\ihsubtotal}[1]{\cmidrule[.0em]{4-4}%
\textit{Subtotaal}&&&\currency~#1\\}
\newcommand{\inosubtotal}{&&&\\}
\newcommand{\ihvat}[1]{\textit{Btw-heffing 19\%}&&&\currency~#1\\}
\newcommand{\ihvat}[1]{\textit{Btw-heffing <%= VATRate %>\%}&&&\currency~#1\\}
\newcommand{\ihtotal}[1]{\cmidrule[.05em]{4-4}%
\textbf{\Totaltext}&&&\textbf{\currency~#1}}
@ -79,16 +79,17 @@
\hypersetup{pdftitle=\invoicetext\ naar\ \toname\ gedateerd \date\ (\ourref)}
\begin{ihtable}
<% total = 0.0 %>
<% subtotal = 0.0 %>
<% tasks.each do |task, line| %>
\ihitem{<%= task.name %>}{<%= "%.2f" % line[0] %>}%
{<%= "%.2f" % line[1] %>}{<%= "%.2f" % line[2] %>}
<% total += line[2] %>
<% subtotal += line[2] %>
<% end %>
%\ihsubtotal{...}
\inosubtotal
%\ihvat{...}
\ihtotal{<%= "%.2f" % total %>}
\ihsubtotal{<%= "%.2f" % subtotal %>}
%\inosubtotal
<% vat = subtotal * VATRate/100 %>
\ihvat{<%= "%.2f" % vat %>}
\ihtotal{<%= "%.2f" % (subtotal + vat) %>}
\end{ihtable}
\vspace{2em}