cnab240 0.0.11 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -47,6 +47,7 @@ module Cnab240::Arquivo
47
47
  Cnab240::Builder.new(filename).arquivos
48
48
  end
49
49
 
50
+
50
51
  def auto_fill
51
52
  trailer.totais_qtde_lotes = lotes.length.to_s
52
53
  qtd_registros = lotes.length * 2 # header e trailer de cada lote
@@ -45,7 +45,8 @@ module Cnab240
45
45
  end
46
46
 
47
47
  def linhas
48
- seg_array = Array.new
48
+ self.auto_fill if Cnab240.auto_fill_enabled
49
+ seg_array = []
49
50
  estrutura = ESTRUTURA[@versao][operacao]
50
51
  seg_array << @header.linha
51
52
  segmentos.each do |s|
@@ -59,5 +60,10 @@ module Cnab240
59
60
  linhas.join("\r\n")
60
61
  end
61
62
 
63
+ def auto_fill
64
+ # totais_qtde_registros
65
+
66
+ end
67
+
62
68
  end
63
69
  end
@@ -31,7 +31,12 @@ module Cnab240
31
31
 
32
32
  campos[:controle_banco] ||= '341'
33
33
  campos[:controle_lote] ||= @arquivo.lotes.length.to_s
34
- campos[:servico_numero_registro] ||= lote.segmentos.length.to_s
34
+ campos[:servico_numero_registro] ||= (lote.segmentos.length+1).to_s
35
+ puts "lote #{campos[:servico_numero_registro]}"
36
+ puts "lote #{campos[:servico_numero_registro]}"
37
+ puts "lote #{campos[:servico_numero_registro]}"
38
+ puts "lote #{campos[:servico_numero_registro]}"
39
+ puts "lote #{campos[:servico_numero_registro]}"
35
40
  campos[:servico_tipo_movimento] ||= '000'
36
41
  campos[:credito_moeda_tipo] ||= 'REA'
37
42
  campos[:totais_qtde_registros] ||= (lote.segmentos.length + 2).to_s
@@ -1,4 +1,4 @@
1
1
  module Cnab240
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
4
4
 
@@ -55,6 +55,8 @@ describe PagamentoItau do
55
55
 
56
56
  pagamento.arquivo.header.banco_nome.strip.should eq 'BANCO ITAU'
57
57
 
58
+
59
+
58
60
  pagamento.save_to_file("spec/tmp/arquivo_itau.test")
59
61
 
60
62
  pagamento.string
data/spec/hom/hom_spec.rb CHANGED
@@ -12,7 +12,7 @@ describe "HomSpec" do
12
12
  :empresa_nome => 'REDE DE CONVENIOS DO BRASIL',
13
13
  :empresa_agencia_codigo => '663',
14
14
  :empresa_conta_numero => '01540',
15
- :empresa_agencia_conta_dv => '0',
15
+ :empresa_agencia_conta_dv => '2',
16
16
  :arquivo_sequencia => '1',
17
17
 
18
18
  :endereco_logradouro => 'RUA GETULIO VARGAS',
@@ -22,21 +22,24 @@ describe "HomSpec" do
22
22
  :endereco_estado => 'RO',
23
23
  :servico_tipo => '98', # pagamentos - diversos
24
24
  :servico_forma => '41', # doc, ted, etc
25
+
26
+ :totais_valor => '600000',
27
+ :totais_qtde_registros => '3'
25
28
  })
26
29
 
27
30
  pagamento << {
28
31
  :favorecido_banco => '001',
29
32
  :favorecido_agencia => '2290',
30
- :favorecido_conta => '335959',
33
+ :favorecido_conta => '33595',
31
34
  :favorecido_agencia_conta_dv => '9',
32
35
  :credito_seu_numero => '1',
33
- :credito_data_pagamento => '03082012',
34
- :credito_valor_pagamento => '500000',
36
+ :credito_data_pagamento => '03092012',
37
+ :credito_valor_pagamento => '600000',
35
38
  :numero_inscricao => '69375208168',
36
39
  :favorecido_nome => 'JOSE EDUARDO MOURAO'
37
40
  }
38
41
 
39
- pagamento.save_to_file("spec/tmp/itau24.rem")
42
+ pagamento.save_to_file("spec/tmp/itau46.rem")
40
43
  end
41
44
 
42
45
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cnab240
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 11
10
- version: 0.0.11
9
+ - 12
10
+ version: 0.0.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Eduardo Mourao
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-08-15 00:00:00 -04:00
18
+ date: 2012-09-10 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency