Class: Invoicing::Countries::UK::VAT
- Inherits:
-
Object
- Object
- Invoicing::Countries::UK::VAT
- Defined in:
- lib/invoicing/countries/uk.rb
Overview
Extremely simplistic implementation of UK VAT. This needs to be fixed.
Instance Method Summary collapse
- #apply_tax(params) ⇒ Object
- #remove_tax(params) ⇒ Object
- #tax_details(params) ⇒ Object
- #tax_factor(params) ⇒ Object
- #tax_info(params) ⇒ Object
- #tax_percent(params) ⇒ Object
- #tax_rate(params) ⇒ Object
Instance Method Details
#apply_tax(params) ⇒ Object
18 19 20 |
# File 'lib/invoicing/countries/uk.rb', line 18 def apply_tax(params) params[:value] * tax_factor(params) end |
#remove_tax(params) ⇒ Object
22 23 24 |
# File 'lib/invoicing/countries/uk.rb', line 22 def remove_tax(params) params[:value] / tax_factor(params) end |
#tax_details(params) ⇒ Object
30 31 32 |
# File 'lib/invoicing/countries/uk.rb', line 30 def tax_details(params) "(including VAT at #{tax_percent(params).to_s}%)" end |
#tax_factor(params) ⇒ Object
10 11 12 |
# File 'lib/invoicing/countries/uk.rb', line 10 def tax_factor(params) BigDecimal('1') + tax_rate(params).rate end |
#tax_info(params) ⇒ Object
26 27 28 |
# File 'lib/invoicing/countries/uk.rb', line 26 def tax_info(params) "(inc. VAT)" end |
#tax_percent(params) ⇒ Object
14 15 16 |
# File 'lib/invoicing/countries/uk.rb', line 14 def tax_percent(params) BigDecimal('100') * tax_rate(params).rate end |
#tax_rate(params) ⇒ Object
6 7 8 |
# File 'lib/invoicing/countries/uk.rb', line 6 def tax_rate(params) params[:model_object].send(:tax_rate) end |