Improved VAT addition: only apply when VAT number is set.

This commit is contained in:
Paul van Tilburg 2011-11-10 15:22:13 +01:00
parent 6079d90b7a
commit 75e9d3b235
2 changed files with 7 additions and 7 deletions

View File

@ -43,7 +43,7 @@ unless defined? PUBLIC_DIR
# FIXME: this should be configurable.
HourlyRate = 20.0
VATRate = 0.0
VATRate = 19
end
module StopTime
@ -1124,7 +1124,7 @@ module StopTime::Views
end
subtotal += line[2]
end
if VATRate.zero?
if @company.vatno.blank?
vat = 0
else
tr do
@ -1133,9 +1133,9 @@ module StopTime::Views
td ""
td.right { "€ %.2f" % subtotal }
end
vat = subtotal * VATRate/100
vat = subtotal * VATRate/100.0
tr do
td { i "VAT #{VATRate}%" }
td { i "VAT %d%%" % VATRate }
td ""
td ""
td.right { "€ %.2f" % vat }

View File

@ -78,7 +78,7 @@
\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{\ihvat}[1]{\textit{Btw-heffing <%= "%d\\%%" % VATRate %>}&&&\currency~#1\\}
\newcommand{\ihtotal}[1]{\cmidrule[.05em]{4-4}%
\textbf{\Totaltext}&&&\textbf{\currency~#1}}
@ -101,11 +101,11 @@
end
subtotal += line[2]
end
if VATRate.zero?
if @company.vatno.blank?
vat = 0 %>
\ihnosubtotal{} <%
else
vat = subtotal * VATRate/100 %>
vat = subtotal * VATRate/100.0 %>
\ihsubtotal{<%= number_with_precision(subtotal) %>}
\ihvat{<%= number_with_precision(vat) %>}<%
end %>