Class: BciXls

Inherits:
Object
  • Object
show all
Defined in:
lib/bci_xls.rb

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ BciXls

Returns a new instance of BciXls.



6
7
8
# File 'lib/bci_xls.rb', line 6

def initialize(file)
  @file = file
end

Instance Method Details

#parseObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bci_xls.rb', line 10

def parse
  spreadsheet = Spreadsheet.open(@file.path)
  book = spreadsheet.worksheet(0)
  numero_cartola = book.rows[4][12].to_i
  desde = book.rows[16][6].to_s[0..9]
  hasta = book.rows[16][6].to_s[14..23]
  cuenta_corriente = book.rows[7][6].to_s
  movimientos = fill_list(book)
  saldo_inicial = book.rows[22 + movimientos.size][3].to_f
  saldo_final = book.rows[22 + movimientos.size][9].to_f
  total_cargos = book.rows[22 + movimientos.size][5].to_f
  total_abonos = book.rows[22 + movimientos.size][7].to_f
  Bci.new(
      numero_cartola,desde,hasta,cuenta_corriente,movimientos,
      saldo_inicial, saldo_final, total_cargos, total_abonos
  )
end