diff --git a/stoptime.rb b/stoptime.rb index d3ee304..bc4f34c 100644 --- a/stoptime.rb +++ b/stoptime.rb @@ -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 } diff --git a/templates/invoice.tex.erb b/templates/invoice.tex.erb index 15279a3..7cab371 100644 --- a/templates/invoice.tex.erb +++ b/templates/invoice.tex.erb @@ -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 %>