Add VAT rate specific summaries to the template and invoice_form view
This commit is contained in:
parent
8b9aa51bde
commit
b44b6ca77a
16
stoptime.rb
16
stoptime.rb
|
@ -1049,6 +1049,7 @@ module StopTime::Controllers
|
||||||
|
|
||||||
@company = @invoice.company_info
|
@company = @invoice.company_info
|
||||||
@tasks = @invoice.summary
|
@tasks = @invoice.summary
|
||||||
|
@vat = @invoice.vat_summary
|
||||||
@period = @invoice.period
|
@period = @invoice.period
|
||||||
|
|
||||||
if @format == "html"
|
if @format == "html"
|
||||||
|
@ -1824,28 +1825,29 @@ module StopTime::Views
|
||||||
end
|
end
|
||||||
end unless task.fixed_cost?
|
end unless task.fixed_cost?
|
||||||
end
|
end
|
||||||
if @company.vatno.blank?
|
vattotal = 0.0
|
||||||
vat = 0
|
if @company.vatno.present?
|
||||||
else
|
|
||||||
tr.total do
|
tr.total do
|
||||||
td { i "Sub-total" }
|
td { i "Sub-total" }
|
||||||
td ""
|
td ""
|
||||||
td ""
|
td ""
|
||||||
td.right { "€ %.2f" % subtotal }
|
td.right { "€ %.2f" % subtotal }
|
||||||
end
|
end
|
||||||
vat = subtotal * @config["vat_rate"]/100.0
|
@vat.keys.sort.each do |rate|
|
||||||
|
vattotal += @vat[rate]
|
||||||
tr do
|
tr do
|
||||||
td { i "VAT %d%%" % @config["vat_rate"] }
|
td { i "VAT %d%%" % rate }
|
||||||
td ""
|
td ""
|
||||||
td ""
|
td ""
|
||||||
td.right { "€ %.2f" % vat }
|
td.right { "€ %.2f" % @vat[rate] }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
tr.total do
|
tr.total do
|
||||||
td { b "Total" }
|
td { b "Total" }
|
||||||
td ""
|
td ""
|
||||||
td ""
|
td ""
|
||||||
td.right { "€ %.2f" % (subtotal + vat) }
|
td.right { "€ %.2f" % (subtotal + vattotal) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,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 <%= "%d\\%%" % @config["vat_rate"] %>}&&&\currency~#1\\}
|
\newcommand{\ihvat}[2]{\textit{Btw-heffing #1}&&&\currency~#2\\}
|
||||||
\newcommand{\ihtotal}[1]{\cmidrule[.05em]{4-4}%
|
\newcommand{\ihtotal}[1]{\cmidrule[.05em]{4-4}%
|
||||||
\textbf{\Totaltext}&&&\textbf{\currency~#1}}
|
\textbf{\Totaltext}&&&\textbf{\currency~#1}}
|
||||||
|
|
||||||
|
@ -108,15 +108,17 @@
|
||||||
<% end
|
<% end
|
||||||
subtotal += line[2]
|
subtotal += line[2]
|
||||||
end
|
end
|
||||||
|
vattotal = 0.0
|
||||||
if @company.vatno.blank?
|
if @company.vatno.blank?
|
||||||
vat = 0
|
|
||||||
%> \ihnosubtotal{} <%
|
%> \ihnosubtotal{} <%
|
||||||
else
|
else
|
||||||
vat = subtotal * @config["vat_rate"]/100.0 %>
|
%> \ihsubtotal{<%= number_with_precision(subtotal) %>}<%
|
||||||
\ihsubtotal{<%= number_with_precision(subtotal) %>}
|
@vat.keys.sort.each do |rate|
|
||||||
\ihvat{<%= number_with_precision(vat) %>}<%
|
vattotal += @vat[rate] %>
|
||||||
|
\ihvat{<%= "%d\\%%" % rate %>}{<%= number_with_precision(@vat[rate]) %>}<%
|
||||||
|
end
|
||||||
end %>
|
end %>
|
||||||
\ihtotal{<%= number_with_precision(subtotal + vat) %>}
|
\ihtotal{<%= number_with_precision(subtotal + vattotal) %>}
|
||||||
\end{ihtable}
|
\end{ihtable}
|
||||||
\vspace{2em}
|
\vspace{2em}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue