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

View File

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