Added support for not adding VAT in views and template.
This commit is contained in:
parent
69d6424462
commit
ee58b00d2c
30
stoptime.rb
30
stoptime.rb
|
@ -35,7 +35,7 @@ unless defined? PUBLIC_DIR
|
||||||
|
|
||||||
# FIXME: this should be configurable.
|
# FIXME: this should be configurable.
|
||||||
HourlyRate = 20.0
|
HourlyRate = 20.0
|
||||||
VATRate = 19.0
|
VATRate = 0.0
|
||||||
end
|
end
|
||||||
|
|
||||||
module StopTime
|
module StopTime
|
||||||
|
@ -872,18 +872,22 @@ module StopTime::Views
|
||||||
end
|
end
|
||||||
subtotal += line[2]
|
subtotal += line[2]
|
||||||
end
|
end
|
||||||
tr do
|
if VATRate.zero?
|
||||||
td { i "Sub-total" }
|
vat = 0
|
||||||
td ""
|
else
|
||||||
td ""
|
tr do
|
||||||
td { "€ %.2f" % subtotal }
|
td { i "Sub-total" }
|
||||||
end
|
td ""
|
||||||
vat = subtotal * VATRate/100
|
td ""
|
||||||
tr do
|
td { "€ %.2f" % subtotal }
|
||||||
td { i "VAT #{VATRate}%" }
|
end
|
||||||
td ""
|
vat = subtotal * VATRate/100
|
||||||
td ""
|
tr do
|
||||||
td { "€ %.2f" % vat }
|
td { i "VAT #{VATRate}%" }
|
||||||
|
td ""
|
||||||
|
td ""
|
||||||
|
td { "€ %.2f" % vat }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
tr do
|
tr do
|
||||||
td { b "Total amount" }
|
td { b "Total amount" }
|
||||||
|
|
|
@ -82,17 +82,28 @@
|
||||||
\invoice{
|
\invoice{
|
||||||
\hypersetup{pdftitle=\invoicetext\ naar\ \toname\ gedateerd \date\ (\ourref)}
|
\hypersetup{pdftitle=\invoicetext\ naar\ \toname\ gedateerd \date\ (\ourref)}
|
||||||
|
|
||||||
|
% FIXME: localise the dot/comma stuff in numbers.
|
||||||
\begin{ihtable}
|
\begin{ihtable}
|
||||||
<% subtotal = 0.0 %>
|
<% subtotal = 0.0
|
||||||
<% tasks.each do |task, line| %>
|
@tasks.each do |task, line|
|
||||||
\ihitem{<%= task.name %>}{<%= "%.2f" % line[0] %>}%
|
if line[0].nil? and line[1].nil?
|
||||||
{<%= "%.2f" % line[1] %>}{<%= "%.2f" % line[2] %>}
|
%> \ifcitem{<%= task %>}%
|
||||||
<% subtotal += line[2] %>
|
{<%= "%.2f" % line[2] %>}<%
|
||||||
<% end %>
|
else
|
||||||
|
%> \ihitem{<%= task %>}%
|
||||||
|
{<%= "%.2f" % line[0] %>}{<%= "%.2f" % line[1] %>}%
|
||||||
|
{<%= "%.2f" % line[2] %>}<%
|
||||||
|
end
|
||||||
|
subtotal += line[2]
|
||||||
|
end
|
||||||
|
if VATRate.zero?
|
||||||
|
vat = 0 %>
|
||||||
|
\ihnosubtotal{} <%
|
||||||
|
else
|
||||||
|
vat = subtotal * VATRate/100 %>
|
||||||
\ihsubtotal{<%= "%.2f" % subtotal %>}
|
\ihsubtotal{<%= "%.2f" % subtotal %>}
|
||||||
%\inosubtotal
|
\ihvat{<%= "%.2f" % vat %>} <%
|
||||||
<% vat = subtotal * VATRate/100 %>
|
end %>
|
||||||
\ihvat{<%= "%.2f" % vat %>}
|
|
||||||
\ihtotal{<%= "%.2f" % (subtotal + vat) %>}
|
\ihtotal{<%= "%.2f" % (subtotal + vat) %>}
|
||||||
\end{ihtable}
|
\end{ihtable}
|
||||||
\vspace{2em}
|
\vspace{2em}
|
||||||
|
|
Loading…
Reference in New Issue