Show the total amount in invoices list
This commit is contained in:
parent
606b3a4d88
commit
22299c2d6e
14
stoptime.rb
14
stoptime.rb
|
@ -343,6 +343,17 @@ module StopTime::Models
|
||||||
end
|
end
|
||||||
return p
|
return p
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Returns the total amount (including VAT).
|
||||||
|
def total_amount
|
||||||
|
subtotal = summary.inject(0.0) { |tot, (task, summ)| tot + summ[2] }
|
||||||
|
if company_info.vatno.blank?
|
||||||
|
subtotal
|
||||||
|
else
|
||||||
|
config = Config.instance
|
||||||
|
subtotal * (1 + config["vat_rate"]/100.0)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# == The company information class
|
# == The company information class
|
||||||
|
@ -1967,11 +1978,13 @@ module StopTime::Views
|
||||||
col.number {}
|
col.number {}
|
||||||
col.date {}
|
col.date {}
|
||||||
col.period {}
|
col.period {}
|
||||||
|
col.amount {}
|
||||||
col.flag {}
|
col.flag {}
|
||||||
tr do
|
tr do
|
||||||
th "Number"
|
th "Number"
|
||||||
th "Date"
|
th "Date"
|
||||||
th "Period"
|
th "Period"
|
||||||
|
th.right "Amount"
|
||||||
th "Paid?"
|
th "Paid?"
|
||||||
end
|
end
|
||||||
invoices.each do |invoice|
|
invoices.each do |invoice|
|
||||||
|
@ -1984,6 +1997,7 @@ module StopTime::Views
|
||||||
td { invoice.created_at.to_formatted_s(:date_only) }
|
td { invoice.created_at.to_formatted_s(:date_only) }
|
||||||
td { _format_period(invoice.period) }
|
td { _format_period(invoice.period) }
|
||||||
# FIXME: really retrieve the paid flag.
|
# FIXME: really retrieve the paid flag.
|
||||||
|
td.right { "€ %.2f" % invoice.total_amount }
|
||||||
td do
|
td do
|
||||||
_form_input_checkbox("paid_#{invoice.number}", invoice.paid?,
|
_form_input_checkbox("paid_#{invoice.number}", invoice.paid?,
|
||||||
:disabled => true)
|
:disabled => true)
|
||||||
|
|
Loading…
Reference in New Issue