cnab240 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/cnab240.gemspec +10 -12
- data/lib/cnab240.rb +108 -91
- data/lib/cnab240/arquivo/arquivo.rb +6 -9
- data/lib/cnab240/arquivo/builder.rb +111 -90
- data/lib/cnab240/arquivo/estrutura.rb +161 -99
- data/lib/cnab240/arquivo/v40/header.rb +27 -29
- data/lib/cnab240/arquivo/v40/trailer.rb +8 -10
- data/lib/cnab240/arquivo/v60/header.rb +38 -0
- data/lib/cnab240/arquivo/v60/trailer.rb +17 -0
- data/lib/cnab240/arquivo/v80/header.rb +23 -26
- data/lib/cnab240/arquivo/v80/trailer.rb +8 -9
- data/lib/cnab240/arquivo/v81/header.rb +37 -0
- data/lib/cnab240/arquivo/v81/trailer.rb +17 -0
- data/lib/cnab240/arquivo/v83/header.rb +25 -26
- data/lib/cnab240/arquivo/v83/trailer.rb +9 -9
- data/lib/cnab240/arquivo/v86/header.rb +25 -26
- data/lib/cnab240/arquivo/v86/trailer.rb +9 -10
- data/lib/cnab240/arquivo/v87/header.rb +25 -26
- data/lib/cnab240/arquivo/v87/trailer.rb +9 -10
- data/lib/cnab240/ext/attribute_accessors.rb +4 -4
- data/lib/cnab240/ext/bindata.rb +4 -4
- data/lib/cnab240/ext/default_mixin.rb +2 -4
- data/lib/cnab240/ext/filler.rb +1 -3
- data/lib/cnab240/ext/lstring.rb +9 -10
- data/lib/cnab240/ext/segmento_mixin.rb +1 -3
- data/lib/cnab240/helper/boleto_bancoob.rb +60 -0
- data/lib/cnab240/helper/helper.rb +1 -1
- data/lib/cnab240/helper/pagamento_bb.rb +7 -9
- data/lib/cnab240/helper/pagamento_bradesco.rb +6 -8
- data/lib/cnab240/helper/pagamento_itau.rb +6 -8
- data/lib/cnab240/helper/transferencia_citibank.rb +56 -0
- data/lib/cnab240/helper/{pagamento_sicoob.rb → transferencia_sicoob.rb} +8 -15
- data/lib/cnab240/{arquivo/lote.rb → lote.rb} +29 -14
- data/lib/cnab240/lote/v40/boletos/header.rb +46 -0
- data/lib/cnab240/lote/v40/boletos/trailer.rb +29 -0
- data/lib/cnab240/pagamentos/v40/header.rb +30 -32
- data/lib/cnab240/pagamentos/v40/trailer.rb +10 -11
- data/lib/cnab240/pagamentos/v60/header.rb +43 -0
- data/lib/cnab240/pagamentos/v60/trailer.rb +17 -0
- data/lib/cnab240/pagamentos/v80/header.rb +35 -37
- data/lib/cnab240/pagamentos/v80/trailer.rb +10 -11
- data/lib/cnab240/pagamentos/v83/header.rb +33 -35
- data/lib/cnab240/pagamentos/v83/trailer.rb +11 -12
- data/lib/cnab240/pagamentos/v86/header.rb +34 -36
- data/lib/cnab240/pagamentos/v86/titulos/header.rb +28 -30
- data/lib/cnab240/pagamentos/v86/titulos/trailer.rb +11 -12
- data/lib/cnab240/pagamentos/v86/trailer.rb +11 -12
- data/lib/cnab240/pagamentos/v86/tributos/header.rb +35 -37
- data/lib/cnab240/pagamentos/v86/tributos/trailer.rb +9 -10
- data/lib/cnab240/pagamentos/v87/header.rb +34 -36
- data/lib/cnab240/pagamentos/v87/titulos/header.rb +28 -30
- data/lib/cnab240/pagamentos/v87/titulos/trailer.rb +11 -12
- data/lib/cnab240/pagamentos/v87/trailer.rb +11 -12
- data/lib/cnab240/pagamentos/v87/tributos/header.rb +35 -37
- data/lib/cnab240/pagamentos/v87/tributos/trailer.rb +9 -10
- data/lib/cnab240/segmentos/v40/segmento_a.rb +40 -41
- data/lib/cnab240/segmentos/v60/segmento_a.rb +43 -0
- data/lib/cnab240/segmentos/v60/segmento_b.rb +38 -0
- data/lib/cnab240/segmentos/v60/segmento_j.rb +32 -0
- data/lib/cnab240/segmentos/v80/agencia_itau.rb +8 -9
- data/lib/cnab240/segmentos/v80/agencia_outros.rb +6 -7
- data/lib/cnab240/segmentos/v80/segmento_a.rb +30 -32
- data/lib/cnab240/segmentos/v81/segmento_p.rb +79 -0
- data/lib/cnab240/segmentos/v81/segmento_q.rb +36 -0
- data/lib/cnab240/segmentos/v81/segmento_r.rb +49 -0
- data/lib/cnab240/segmentos/v81/segmento_s.rb +37 -0
- data/lib/cnab240/segmentos/v83/segmento_a.rb +35 -36
- data/lib/cnab240/segmentos/v83/segmento_b.rb +33 -34
- data/lib/cnab240/segmentos/v83/segmento_j.rb +22 -23
- data/lib/cnab240/segmentos/v83/segmento_z.rb +10 -11
- data/lib/cnab240/segmentos/v86/segmento_a.rb +37 -38
- data/lib/cnab240/segmentos/v86/segmento_b.rb +33 -34
- data/lib/cnab240/segmentos/v86/segmento_c.rb +19 -20
- data/lib/cnab240/segmentos/v86/segmento_j.rb +22 -23
- data/lib/cnab240/segmentos/v86/segmento_j52.rb +19 -20
- data/lib/cnab240/segmentos/v86/segmento_n.rb +17 -18
- data/lib/cnab240/segmentos/v86/segmento_n1.rb +10 -11
- data/lib/cnab240/segmentos/v86/segmento_n2.rb +12 -13
- data/lib/cnab240/segmentos/v86/segmento_n3.rb +12 -13
- data/lib/cnab240/segmentos/v86/segmento_n4.rb +14 -15
- data/lib/cnab240/segmentos/v86/segmento_n5.rb +12 -13
- data/lib/cnab240/segmentos/v86/segmento_n6.rb +12 -13
- data/lib/cnab240/segmentos/v86/segmento_n7.rb +13 -14
- data/lib/cnab240/segmentos/v86/segmento_n8.rb +12 -14
- data/lib/cnab240/segmentos/v86/segmento_o.rb +17 -18
- data/lib/cnab240/segmentos/v86/segmento_w.rb +12 -13
- data/lib/cnab240/segmentos/v86/segmento_w1.rb +9 -10
- data/lib/cnab240/segmentos/v86/segmento_z.rb +10 -11
- data/lib/cnab240/segmentos/v87/segmento_a.rb +37 -38
- data/lib/cnab240/segmentos/v87/segmento_b.rb +33 -34
- data/lib/cnab240/segmentos/v87/segmento_c.rb +19 -20
- data/lib/cnab240/segmentos/v87/segmento_j.rb +22 -23
- data/lib/cnab240/segmentos/v87/segmento_j52.rb +19 -20
- data/lib/cnab240/segmentos/v87/segmento_n.rb +17 -18
- data/lib/cnab240/segmentos/v87/segmento_n1.rb +10 -11
- data/lib/cnab240/segmentos/v87/segmento_n2.rb +12 -13
- data/lib/cnab240/segmentos/v87/segmento_n3.rb +12 -13
- data/lib/cnab240/segmentos/v87/segmento_n4.rb +14 -15
- data/lib/cnab240/segmentos/v87/segmento_n5.rb +12 -13
- data/lib/cnab240/segmentos/v87/segmento_n6.rb +12 -13
- data/lib/cnab240/segmentos/v87/segmento_n7.rb +13 -14
- data/lib/cnab240/segmentos/v87/segmento_n8.rb +12 -14
- data/lib/cnab240/segmentos/v87/segmento_o.rb +17 -18
- data/lib/cnab240/segmentos/v87/segmento_w.rb +12 -13
- data/lib/cnab240/segmentos/v87/segmento_w1.rb +9 -10
- data/lib/cnab240/segmentos/v87/segmento_z.rb +10 -11
- data/lib/cnab240/version.rb +1 -1
- metadata +30 -40
@@ -1,6 +1,5 @@
|
|
1
1
|
module Cnab240
|
2
2
|
class Lote
|
3
|
-
|
4
3
|
attr_accessor :header
|
5
4
|
attr_accessor :segmentos
|
6
5
|
attr_accessor :trailer
|
@@ -17,7 +16,7 @@ module Cnab240
|
|
17
16
|
@fallback ||= options[:fallback]
|
18
17
|
@versao ||= 'V86'
|
19
18
|
|
20
|
-
|
19
|
+
fail "Operacao '#{operacao}' nao suportada na versao #{@versao}" if ESTRUTURA[@versao][operacao].nil?
|
21
20
|
|
22
21
|
estrutura = ESTRUTURA[@versao][operacao]
|
23
22
|
|
@@ -27,27 +26,27 @@ module Cnab240
|
|
27
26
|
yield self if block_given?
|
28
27
|
end
|
29
28
|
|
30
|
-
def read_segmento(s,
|
29
|
+
def read_segmento(s, _line)
|
31
30
|
versao = arquivo.versao unless arquivo.nil?
|
32
31
|
versao ||= @versao
|
33
|
-
segmentos << seg = eval("Cnab240::#{versao}::Segmento#{s.to_s.upcase}.read(
|
32
|
+
segmentos << seg = eval("Cnab240::#{versao}::Segmento#{s.to_s.upcase}.read(_line)")
|
34
33
|
end
|
35
34
|
|
36
35
|
def <<(s)
|
37
36
|
versao = arquivo.versao unless arquivo.nil?
|
38
37
|
versao ||= @versao
|
39
38
|
case s
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
when Symbol, String
|
40
|
+
segmentos << seg = eval("Cnab240::#{versao}::Segmento#{s.to_s.upcase}.new")
|
41
|
+
else
|
42
|
+
segmentos << seg = s
|
44
43
|
end
|
45
44
|
seg.lote = self
|
46
45
|
seg
|
47
46
|
end
|
48
47
|
|
49
48
|
def linhas
|
50
|
-
|
49
|
+
auto_fill if Cnab240.auto_fill_enabled
|
51
50
|
seg_array = []
|
52
51
|
seg_array << @header.linha
|
53
52
|
segmentos.each do |s|
|
@@ -58,14 +57,30 @@ module Cnab240
|
|
58
57
|
end
|
59
58
|
|
60
59
|
def string
|
61
|
-
linhas.join("\
|
60
|
+
linhas.join("\n")
|
62
61
|
end
|
63
62
|
|
64
63
|
def auto_fill
|
65
64
|
trailer.totais_qtde_registros = (segmentos.length + 2).to_s
|
66
|
-
|
67
|
-
|
68
|
-
|
65
|
+
|
66
|
+
if trailer.respond_to?(:totais_valor)
|
67
|
+
_total = 0
|
68
|
+
segmentos.each { |seg| _total += seg[:credito_valor_pagamento].to_i }
|
69
|
+
trailer.totais_valor = _total.to_s
|
70
|
+
end
|
71
|
+
|
72
|
+
# Quando o lote é de boletos
|
73
|
+
if trailer.respond_to?(:qtde_cobranca_simples)
|
74
|
+
_total = 0
|
75
|
+
_qtde = 0
|
76
|
+
segmentos.each do |seg|
|
77
|
+
next unless seg.class.to_s =~ /SegmentoP/
|
78
|
+
_qtde += 1
|
79
|
+
_total += seg[:valor].to_i
|
80
|
+
end
|
81
|
+
trailer.qtde_cobranca_simples = _qtde.to_s
|
82
|
+
trailer.total_cobranca_simples = _total.to_s
|
83
|
+
end
|
69
84
|
end
|
70
85
|
end
|
71
|
-
end
|
86
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Cnab240
|
2
|
+
class Lote
|
3
|
+
module V40
|
4
|
+
module Boletos
|
5
|
+
class Header < BinData::Record
|
6
|
+
include Cnab240::DefaultMixin
|
7
|
+
|
8
|
+
lstring :controle_banco, length: 3, pad_byte: '0'
|
9
|
+
lstring :controle_lote, length: 4, pad_byte: '0'
|
10
|
+
lstring :controle_registro, length: 1, initial_value: '1', pad_byte: '0'
|
11
|
+
|
12
|
+
string :servico_operacao, length: 1, initial_value: 'R', pad_byte: ' '
|
13
|
+
lstring :servico_tipo, length: 2, pad_byte: '0', initial_value: '01'
|
14
|
+
lstring :servico_forma, length: 2, pad_byte: ' '
|
15
|
+
lstring :servico_layout, length: 3, initial_value: '040', pad_byte: '0'
|
16
|
+
string :cnab_g004_1, length: 1, pad_byte: ' '
|
17
|
+
|
18
|
+
lstring :empresa_tipo, length: 1, pad_byte: '0' #'1'= CPF, '2'= CGC/CNPJ
|
19
|
+
lstring :empresa_numero, length: 15, pad_byte: '0'
|
20
|
+
lstring :empresa_convenio, length: 20, pad_byte: ' '
|
21
|
+
|
22
|
+
lstring :empresa_agencia_codigo, length: 5, pad_byte: '0'
|
23
|
+
string :empresa_agencia_dv, length: 1, pad_byte: ' '
|
24
|
+
lstring :empresa_conta_numero, length: 12, pad_byte: '0'
|
25
|
+
string :empresa_conta_dv, length: 1, pad_byte: ' '
|
26
|
+
string :empresa_agencia_conta_dv, length: 1, pad_byte: ' '
|
27
|
+
string :empresa_nome, length: 30, pad_byte: ' '
|
28
|
+
|
29
|
+
string :informacao_1, length: 40, pad_byte: ' '
|
30
|
+
string :informacao_2, length: 40, pad_byte: ' '
|
31
|
+
|
32
|
+
lstring :controle_cobranca, length: 8, pad_byte: '0'
|
33
|
+
lstring :data_geracao, length: 8, pad_byte: '0'
|
34
|
+
lstring :data_credito, length: 8, pad_byte: '0'
|
35
|
+
|
36
|
+
string :cnab_g004_2, length: 33, pad_byte: ' '
|
37
|
+
|
38
|
+
protected
|
39
|
+
|
40
|
+
def auto_fill
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Cnab240
|
2
|
+
class Lote
|
3
|
+
module V40
|
4
|
+
module Boletos
|
5
|
+
class Trailer < BinData::Record
|
6
|
+
include Cnab240::DefaultMixin
|
7
|
+
|
8
|
+
lstring :controle_banco, length: 3, pad_byte: '0'
|
9
|
+
lstring :controle_lote, length: 4, pad_byte: '0'
|
10
|
+
lstring :controle_registro, length: 1, initial_value: '5', pad_byte: '0'
|
11
|
+
|
12
|
+
lstring :cnab_g004_1, length: 9, pad_byte: ' '
|
13
|
+
lstring :totais_qtde_registros, length: 6, pad_byte: '0'
|
14
|
+
lstring :qtde_cobranca_simples, length: 6, pad_byte: '0'
|
15
|
+
lstring :total_cobranca_simples, length: 17, pad_byte: '0'
|
16
|
+
lstring :qtde_cobranca_vinculada, length: 6, pad_byte: '0'
|
17
|
+
lstring :total_cobranca_vinculada, length: 17, pad_byte: '0'
|
18
|
+
lstring :qtde_cobranca_caucionada, length: 6, pad_byte: '0'
|
19
|
+
lstring :total_cobranca_caucionada, length: 17, pad_byte: '0'
|
20
|
+
lstring :qtde_cobranca_descontada, length: 6, pad_byte: '0'
|
21
|
+
lstring :total_cobranca_descontada, length: 17, pad_byte: '0'
|
22
|
+
|
23
|
+
string :aviso, length: 8, pad_byte: ' '
|
24
|
+
string :cnab_g004_2, length: 117, pad_byte: ' '
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -1,53 +1,51 @@
|
|
1
1
|
module Cnab240::V40::Pagamentos
|
2
2
|
class Header < BinData::Record
|
3
|
-
|
4
3
|
include Cnab240::DefaultMixin
|
5
4
|
|
6
|
-
lstring :controle_banco, :
|
7
|
-
lstring :controle_lote, :
|
8
|
-
lstring :controle_registro, :
|
5
|
+
lstring :controle_banco, length: 3, pad_byte: '0'
|
6
|
+
lstring :controle_lote, length: 4, pad_byte: '0'
|
7
|
+
lstring :controle_registro, length: 1, initial_value: '1', pad_byte: '0'
|
9
8
|
|
10
|
-
string :servico_operacao, :
|
11
|
-
lstring :servico_tipo, :
|
12
|
-
lstring :servico_forma, :
|
13
|
-
lstring :servico_layout, :
|
14
|
-
string :cnab_g004_1, :
|
9
|
+
string :servico_operacao, length: 1, initial_value: 'D', pad_byte: ' '
|
10
|
+
lstring :servico_tipo, length: 2, pad_byte: '0'
|
11
|
+
lstring :servico_forma, length: 2, pad_byte: '0'
|
12
|
+
lstring :servico_layout, length: 3, initial_value: '030', pad_byte: '0'
|
13
|
+
string :cnab_g004_1, length: 1, pad_byte: ' '
|
15
14
|
|
16
|
-
lstring :empresa_tipo, :
|
17
|
-
lstring :empresa_numero, :
|
18
|
-
string :empresa_convenio, :
|
15
|
+
lstring :empresa_tipo, length: 1, pad_byte: '0'
|
16
|
+
lstring :empresa_numero, length: 14, pad_byte: '0'
|
17
|
+
string :empresa_convenio, length: 13, pad_byte: ' '
|
19
18
|
|
20
|
-
string :brancos_1, :
|
21
|
-
lstring :brancos_2, :
|
19
|
+
string :brancos_1, length: 7, pad_byte: ' '
|
20
|
+
lstring :brancos_2, length: 1, pad_byte: '0'
|
22
21
|
|
23
|
-
lstring :empresa_agencia_codigo, :
|
22
|
+
lstring :empresa_agencia_codigo, length: 4, pad_byte: '0'
|
24
23
|
|
25
|
-
string :brancos_3, :
|
26
|
-
lstring :brancos_4, :
|
24
|
+
string :brancos_3, length: 1, pad_byte: ' '
|
25
|
+
lstring :brancos_4, length: 7, pad_byte: '0'
|
27
26
|
|
28
|
-
lstring :empresa_conta_numero, :
|
27
|
+
lstring :empresa_conta_numero, length: 5, pad_byte: '0'
|
29
28
|
|
30
|
-
string :brancos_5, :
|
29
|
+
string :brancos_5, length: 1, pad_byte: ' '
|
31
30
|
|
32
|
-
string :empresa_agencia_conta_dv, :
|
33
|
-
string :empresa_nome, :
|
31
|
+
string :empresa_agencia_conta_dv, length: 1, pad_byte: '0'
|
32
|
+
string :empresa_nome, length: 30, pad_byte: ' '
|
34
33
|
|
35
|
-
string :informacao_1, :
|
34
|
+
string :informacao_1, length: 40, pad_byte: ' '
|
36
35
|
|
37
|
-
string :endereco_logradouro, :
|
38
|
-
lstring :endereco_numero, :
|
39
|
-
string :endereco_complemento, :
|
40
|
-
string :endereco_cidade, :
|
41
|
-
lstring :endereco_cep, :
|
42
|
-
string :endereco_estado, :
|
36
|
+
string :endereco_logradouro, length: 30, pad_byte: ' '
|
37
|
+
lstring :endereco_numero, length: 5, pad_byte: '0'
|
38
|
+
string :endereco_complemento, length: 15, pad_byte: ' '
|
39
|
+
string :endereco_cidade, length: 20, pad_byte: ' '
|
40
|
+
lstring :endereco_cep, length: 8, pad_byte: '0'
|
41
|
+
string :endereco_estado, length: 2, pad_byte: ' '
|
43
42
|
|
44
|
-
string :cnab_g004_2, :
|
45
|
-
string :ocorrencias, :
|
43
|
+
string :cnab_g004_2, length: 8, pad_byte: ' '
|
44
|
+
string :ocorrencias, length: 10, pad_byte: ' '
|
46
45
|
|
47
46
|
protected
|
48
47
|
|
49
48
|
def auto_fill
|
50
|
-
|
51
49
|
end
|
52
50
|
end
|
53
|
-
end
|
51
|
+
end
|
@@ -1,18 +1,17 @@
|
|
1
1
|
module Cnab240::V40::Pagamentos
|
2
2
|
class Trailer < BinData::Record
|
3
|
-
|
4
3
|
include Cnab240::DefaultMixin
|
5
4
|
|
6
|
-
lstring :controle_banco, :
|
7
|
-
lstring :controle_lote, :
|
8
|
-
lstring :controle_registro, :
|
5
|
+
lstring :controle_banco, length: 3, pad_byte: '0'
|
6
|
+
lstring :controle_lote, length: 4, pad_byte: '0'
|
7
|
+
lstring :controle_registro, length: 1, initial_value: '5', pad_byte: '0'
|
9
8
|
|
10
|
-
lstring :cnab_g004_1, :
|
11
|
-
lstring :totais_qtde_registros, :
|
12
|
-
lstring :totais_valor, :
|
13
|
-
lstring :totais_qtde_moeda, :
|
9
|
+
lstring :cnab_g004_1, length: 9, pad_byte: '0'
|
10
|
+
lstring :totais_qtde_registros, length: 6, pad_byte: '0'
|
11
|
+
lstring :totais_valor, length: 18, pad_byte: '0'
|
12
|
+
lstring :totais_qtde_moeda, length: 18, pad_byte: '0'
|
14
13
|
|
15
|
-
string :cnab_g004_2, :
|
16
|
-
string :ocorrencias, :
|
14
|
+
string :cnab_g004_2, length: 171, pad_byte: ' '
|
15
|
+
string :ocorrencias, length: 10, pad_byte: ' '
|
17
16
|
end
|
18
|
-
end
|
17
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Cnab240::V60::Pagamentos
|
2
|
+
class Header < BinData::Record
|
3
|
+
include Cnab240::DefaultMixin
|
4
|
+
|
5
|
+
lstring :controle_banco, length: 3, pad_byte: '0'
|
6
|
+
lstring :controle_lote, length: 4, pad_byte: '0'
|
7
|
+
lstring :controle_registro, length: 1, initial_value: '1', pad_byte: '0'
|
8
|
+
|
9
|
+
string :servico_operacao, length: 1, initial_value: 'C', pad_byte: ' '
|
10
|
+
lstring :servico_tipo, length: 2, pad_byte: '0'
|
11
|
+
lstring :servico_forma, length: 2, pad_byte: '0'
|
12
|
+
lstring :servico_layout, length: 3, initial_value: '031', pad_byte: '0'
|
13
|
+
string :cnab_g004_1, length: 1, pad_byte: ' '
|
14
|
+
|
15
|
+
lstring :empresa_tipo, length: 1, pad_byte: '0'
|
16
|
+
lstring :empresa_numero, length: 14, pad_byte: '0'
|
17
|
+
string :empresa_convenio, length: 20, pad_byte: ' '
|
18
|
+
|
19
|
+
lstring :empresa_agencia_codigo, length: 5, pad_byte: '0'
|
20
|
+
string :empresa_agencia_dv, length: 1, pad_byte: ' '
|
21
|
+
lstring :empresa_conta_numero, length: 12, pad_byte: ' '
|
22
|
+
string :empresa_conta_dv, length: 1, pad_byte: ' '
|
23
|
+
string :empresa_agencia_conta_dv, length: 1, pad_byte: ' '
|
24
|
+
string :empresa_nome, length: 30, pad_byte: ' '
|
25
|
+
|
26
|
+
string :mensagem, length: 40, pad_byte: ' '
|
27
|
+
|
28
|
+
string :endereco_logradouro, length: 30, pad_byte: ' '
|
29
|
+
lstring :endereco_numero, length: 5, pad_byte: '0'
|
30
|
+
string :endereco_complemento, length: 15, pad_byte: ' '
|
31
|
+
string :endereco_cidade, length: 20, pad_byte: ' '
|
32
|
+
lstring :endereco_cep, length: 8, pad_byte: '0'
|
33
|
+
string :endereco_estado, length: 2, pad_byte: ' '
|
34
|
+
|
35
|
+
string :brancos_4, length: 8, pad_byte: ' '
|
36
|
+
string :ocorrencias, length: 10, pad_byte: ' '
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def auto_fill
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Cnab240::V60::Pagamentos
|
2
|
+
class Trailer < BinData::Record
|
3
|
+
include Cnab240::DefaultMixin
|
4
|
+
|
5
|
+
lstring :controle_banco, length: 3, pad_byte: '0'
|
6
|
+
lstring :controle_lote, length: 4, pad_byte: '0'
|
7
|
+
lstring :controle_registro, length: 1, initial_value: '5', pad_byte: '0'
|
8
|
+
|
9
|
+
string :cnab_g004_1, length: 9, pad_byte: ' '
|
10
|
+
lstring :totais_qtde_registros, length: 6, pad_byte: '0'
|
11
|
+
lstring :totais_valor, length: 18, pad_byte: '0'
|
12
|
+
lstring :totais_moedas, length: 18, pad_byte: '0'
|
13
|
+
lstring :totais_avisos_debitos, length: 6, pad_byte: '0'
|
14
|
+
string :cnab_g004_2, length: 165, pad_byte: ' '
|
15
|
+
string :ocorrencias, length: 10, pad_byte: ' '
|
16
|
+
end
|
17
|
+
end
|
@@ -1,47 +1,45 @@
|
|
1
1
|
module Cnab240::V80::Pagamentos
|
2
2
|
class Header < BinData::Record
|
3
|
-
|
4
3
|
include Cnab240::DefaultMixin
|
5
4
|
|
6
|
-
lstring :controle_banco, :
|
7
|
-
lstring :controle_lote, :
|
8
|
-
lstring :controle_registro, :
|
9
|
-
|
10
|
-
string :servico_operacao, :
|
11
|
-
lstring :servico_tipo, :
|
12
|
-
lstring :servico_forma, :
|
13
|
-
lstring :servico_layout, :
|
14
|
-
string :cnab_g004_1, :
|
15
|
-
|
16
|
-
lstring :empresa_tipo, :
|
17
|
-
lstring :empresa_numero, :
|
18
|
-
string :identificacao_lancamento, :
|
19
|
-
string :brancos_1, :
|
20
|
-
|
21
|
-
lstring :empresa_agencia_codigo, :
|
22
|
-
string :brancos_2, :
|
23
|
-
lstring :empresa_conta_numero, :
|
24
|
-
string :brancos_3, :
|
25
|
-
string :empresa_agencia_conta_dv, :
|
26
|
-
string :empresa_nome, :
|
27
|
-
|
28
|
-
string :finalidade_lote, :
|
29
|
-
string :historico_cc, :
|
30
|
-
|
31
|
-
string :endereco_logradouro, :
|
32
|
-
lstring :endereco_numero, :
|
33
|
-
string :endereco_complemento, :
|
34
|
-
string :endereco_cidade, :
|
35
|
-
lstring :endereco_cep, :
|
36
|
-
string :endereco_estado, :
|
37
|
-
|
38
|
-
string :brancos_4, :
|
39
|
-
string :ocorrencias, :
|
5
|
+
lstring :controle_banco, length: 3, pad_byte: '0'
|
6
|
+
lstring :controle_lote, length: 4, pad_byte: '0'
|
7
|
+
lstring :controle_registro, length: 1, initial_value: '1', pad_byte: '0'
|
8
|
+
|
9
|
+
string :servico_operacao, length: 1, initial_value: 'C', pad_byte: ' '
|
10
|
+
lstring :servico_tipo, length: 2, pad_byte: '0'
|
11
|
+
lstring :servico_forma, length: 2, pad_byte: '0'
|
12
|
+
lstring :servico_layout, length: 3, initial_value: '040', pad_byte: '0'
|
13
|
+
string :cnab_g004_1, length: 1, pad_byte: ' '
|
14
|
+
|
15
|
+
lstring :empresa_tipo, length: 1, pad_byte: '0'
|
16
|
+
lstring :empresa_numero, length: 14, pad_byte: '0'
|
17
|
+
string :identificacao_lancamento, length: 4, pad_byte: ' '
|
18
|
+
string :brancos_1, length: 16, pad_byte: ' '
|
19
|
+
|
20
|
+
lstring :empresa_agencia_codigo, length: 5, pad_byte: '0'
|
21
|
+
string :brancos_2, length: 1, pad_byte: ' '
|
22
|
+
lstring :empresa_conta_numero, length: 12, pad_byte: '0'
|
23
|
+
string :brancos_3, length: 1, pad_byte: ' '
|
24
|
+
string :empresa_agencia_conta_dv, length: 1, pad_byte: '0'
|
25
|
+
string :empresa_nome, length: 30, pad_byte: ' '
|
26
|
+
|
27
|
+
string :finalidade_lote, length: 30, pad_byte: ' '
|
28
|
+
string :historico_cc, length: 10, pad_byte: ' '
|
29
|
+
|
30
|
+
string :endereco_logradouro, length: 30, pad_byte: ' '
|
31
|
+
lstring :endereco_numero, length: 5, pad_byte: '0'
|
32
|
+
string :endereco_complemento, length: 15, pad_byte: ' '
|
33
|
+
string :endereco_cidade, length: 20, pad_byte: ' '
|
34
|
+
lstring :endereco_cep, length: 8, pad_byte: '0'
|
35
|
+
string :endereco_estado, length: 2, pad_byte: ' '
|
36
|
+
|
37
|
+
string :brancos_4, length: 8, pad_byte: ' '
|
38
|
+
string :ocorrencias, length: 10, pad_byte: ' '
|
40
39
|
|
41
40
|
private
|
42
41
|
|
43
42
|
def auto_fill
|
44
|
-
|
45
43
|
end
|
46
44
|
end
|
47
|
-
end
|
45
|
+
end
|
@@ -1,17 +1,16 @@
|
|
1
1
|
module Cnab240::V80::Pagamentos
|
2
2
|
class Trailer < BinData::Record
|
3
|
-
|
4
3
|
include Cnab240::DefaultMixin
|
5
4
|
|
6
|
-
lstring :controle_banco, :
|
7
|
-
lstring :controle_lote, :
|
8
|
-
lstring :controle_registro, :
|
5
|
+
lstring :controle_banco, length: 3, pad_byte: '0'
|
6
|
+
lstring :controle_lote, length: 4, pad_byte: '0'
|
7
|
+
lstring :controle_registro, length: 1, initial_value: '5', pad_byte: '0'
|
9
8
|
|
10
|
-
string :cnab_g004_1, :
|
11
|
-
lstring :totais_qtde_registros, :
|
12
|
-
lstring :totais_valor, :
|
13
|
-
lstring :zeros, :
|
14
|
-
string :cnab_g004_2, :
|
15
|
-
string :ocorrencias, :
|
9
|
+
string :cnab_g004_1, length: 9, pad_byte: ' '
|
10
|
+
lstring :totais_qtde_registros, length: 6, pad_byte: '0'
|
11
|
+
lstring :totais_valor, length: 18, pad_byte: '0'
|
12
|
+
lstring :zeros, length: 18, pad_byte: '0'
|
13
|
+
string :cnab_g004_2, length: 171, pad_byte: ' '
|
14
|
+
string :ocorrencias, length: 10, pad_byte: ' '
|
16
15
|
end
|
17
|
-
end
|
16
|
+
end
|