Modify Invoice#total_amount to take different VAT rates into account
This commit is contained in:
parent
cd29a51680
commit
537b0d47ea
10
stoptime.rb
10
stoptime.rb
|
@ -393,12 +393,16 @@ module StopTime::Models
|
||||||
|
|
||||||
# Returns the total amount (including VAT).
|
# Returns the total amount (including VAT).
|
||||||
def total_amount
|
def total_amount
|
||||||
subtotal = summary.inject(0.0) { |tot, (task, summ)| tot + summ[2] }
|
subtotal, vattotal = summary.inject([0.0, 0.0]) do |tot, (task, summ)|
|
||||||
|
tot[0] += summ[2]
|
||||||
|
tot[1] += summ[3]
|
||||||
|
tot
|
||||||
|
end
|
||||||
|
|
||||||
if company_info.vatno.blank?
|
if company_info.vatno.blank?
|
||||||
subtotal
|
subtotal
|
||||||
else
|
else
|
||||||
config = Config.instance
|
subtotal + vattotal
|
||||||
subtotal * (1 + config["vat_rate"]/100.0)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue