Class: ProcessDeclIva::ProcessExpenses::EFatura

Inherits:
Object
  • Object
show all
Defined in:
lib/process_decl_iva/process_expenses/e_fatura.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(csv) ⇒ EFatura

Returns a new instance of EFatura.



31
32
33
34
35
36
37
38
39
# File 'lib/process_decl_iva/process_expenses/e_fatura.rb', line 31

def initialize(csv)
  @csv = CSV.parse(
    csv,
    headers: true,
    converters: %i[numeric_with_currency numeric],
    liberal_parsing: true,
    col_sep: ";"
  )
end

Instance Attribute Details

#csvObject (readonly)

Returns the value of attribute csv.



41
42
43
# File 'lib/process_decl_iva/process_expenses/e_fatura.rb', line 41

def csv
  @csv
end

#totalObject

Returns the value of attribute total.



42
43
44
# File 'lib/process_decl_iva/process_expenses/e_fatura.rb', line 42

def total
  @total
end

#total_vatObject

Returns the value of attribute total_vat.



42
43
44
# File 'lib/process_decl_iva/process_expenses/e_fatura.rb', line 42

def total_vat
  @total_vat
end

Instance Method Details

#callObject



44
45
46
47
48
49
# File 'lib/process_decl_iva/process_expenses/e_fatura.rb', line 44

def call
  transform_credit_notes

  @total = sum_by("Total")
  @total_vat = sum_by("IVA")
end