Module: Magelex::AccountNumber
- Defined in:
- lib/magelex/lexware_account.rb
Class Method Summary collapse
-
.for(bill, tax_kind) ⇒ Object
get tax for :total_0, :total_7 or :total_19.
- .for_0(bill) ⇒ Object
- .for_19(bill) ⇒ Object
- .for_7(bill) ⇒ Object
- .for_customer(bill) ⇒ Object
Class Method Details
.for(bill, tax_kind) ⇒ Object
get tax for :total_0, :total_7 or :total_19
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/magelex/lexware_account.rb', line 16 def self.for(bill, tax_kind) if tax_kind == :total_0 return for_0 bill elsif tax_kind == :total_7 return for_7 bill elsif tax_kind == :total_19 return for_19 bill else raise "unknown tax_kind" end end |
.for_0(bill) ⇒ Object
36 37 38 |
# File 'lib/magelex/lexware_account.rb', line 36 def self.for_0 bill '8120' end |
.for_19(bill) ⇒ Object
32 33 34 |
# File 'lib/magelex/lexware_account.rb', line 32 def self.for_19 bill bill.in_eu? ? '8315' : '8400' end |
.for_7(bill) ⇒ Object
28 29 30 |
# File 'lib/magelex/lexware_account.rb', line 28 def self.for_7 bill bill.in_eu? ? '8310' : '8300' end |
.for_customer(bill) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/magelex/lexware_account.rb', line 3 def self.for_customer bill first_letter = bill.customer_lastname[0].upcase first_letter.gsub!(/[ÖÜÄ]/, 'Ä' => 'A', 'Ö' => 'O', 'Ü' => 'U') return 12300 if first_letter == "Y" return 12300 if first_letter == "Z" # A is 0 ord = first_letter.ord - "A".ord# + 1 10000 + ord * 100 end |