Class: Abank::Folha
Constant Summary
Constants inherited from Big
Instance Attribute Summary collapse
- #mvvls ⇒ Array, String readonly
- #rowfc ⇒ Array, String readonly
Attributes inherited from Big
#bqnrs, #bqres, #ctpos, #job, #mvpos, #opcao
Instance Method Summary collapse
-
#initialize(opcoes = {}) ⇒ Folha
constructor
acesso a folha calculo & base dados abank no bigquery.
-
#processa_xls ⇒ Object
carrega/mostra folha calculo.
Methods inherited from Big
#cc_apaga, #cc_cria, #cc_show, #ct_apaga, #ct_cria, #ct_dados, #ct_mostra, #mc_show, #mv_classifica, #mv_delete, #mv_insert, #re_atualiza, #re_insert
Constructor Details
#initialize(opcoes = {}) ⇒ Folha
acesso a folha calculo & base dados abank no bigquery
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/abank/folha.rb', line 21 def initialize(opcoes = {}) super @opcao = opcao.merge( s: opcoes.fetch(:s, false), e: opcoes.fetch(:e, false), i: opcoes.fetch(:i, false), n: opcoes.fetch(:n, 0), v: opcoes.fetch(:v, ''), g: opcoes.fetch(:g, ''), k: +'', f: opcoes[:f] ) @mvvls = [] end |
Instance Attribute Details
#mvvls ⇒ Array, String (readonly)
9 10 11 |
# File 'lib/abank/folha.rb', line 9 def mvvls @mvvls end |
#rowfc ⇒ Array, String (readonly)
9 10 11 |
# File 'lib/abank/folha.rb', line 9 def rowfc @rowfc end |
Instance Method Details
#processa_xls ⇒ Object
carrega/mostra folha calculo
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/abank/folha.rb', line 37 def processa_xls puts("\n#{opcao[:f]}") mvs = sql("select * from #{BD}.gmv where nc=@nc", nc: conta).group_by { |m| [m[:dl], m[:vl].to_f] } folha.sheet(0).parse(header_search: ['Data Lanc.', 'Data Valor', 'Descrição', 'Valor']) do |r| next unless valid?(r.values) @bqres = mvs[[rowfc[0], rowfc[3]]] || [] if bqres.empty? puts(lnexi) elsif bqres.one? && bqres.first[:ds].strip == rowfc[2] puts(lexis) elsif bqres.one? puts(lsiml) else puts(lmult) end end return unless opcao[:i] # para nao apagar movimentos duma conta, por aqui somente com keys opcao[:k] opcao[:n] = 0 mv_delete.mv_insert.ct_dados.re_insert end |