cnab240 0.0.17 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/cnab240.gemspec +2 -1
- data/lib/cnab240/arquivo/arquivo.rb +89 -60
- data/lib/cnab240/arquivo/builder.rb +162 -154
- data/lib/cnab240/arquivo/estrutura.rb +159 -95
- data/lib/cnab240/arquivo/lote.rb +57 -57
- data/lib/cnab240/arquivo/v40/header.rb +30 -30
- data/lib/cnab240/arquivo/v40/trailer.rb +11 -11
- data/lib/cnab240/arquivo/v80/header.rb +28 -27
- data/lib/cnab240/arquivo/v80/trailer.rb +11 -11
- data/lib/cnab240/arquivo/v83/header.rb +38 -0
- data/lib/cnab240/arquivo/v83/trailer.rb +17 -0
- data/lib/cnab240/arquivo/v86/header.rb +27 -28
- data/lib/cnab240/arquivo/v86/trailer.rb +12 -12
- data/lib/cnab240/arquivo/v87/header.rb +38 -0
- data/lib/cnab240/arquivo/v87/trailer.rb +18 -0
- data/lib/cnab240/ext/attribute_accessors.rb +2 -2
- data/lib/cnab240/ext/bindata.rb +9 -9
- data/lib/cnab240/ext/default_mixin.rb +11 -12
- data/lib/cnab240/ext/filler.rb +16 -16
- data/lib/cnab240/ext/lstring.rb +5 -5
- data/lib/cnab240/ext/segmento_mixin.rb +4 -4
- data/lib/cnab240/helper/helper.rb +15 -0
- data/lib/cnab240/helper/pagamento_bb.rb +51 -0
- data/lib/cnab240/helper/pagamento_bradesco.rb +49 -0
- data/lib/cnab240/helper/pagamento_itau.rb +34 -49
- data/lib/cnab240/helper/pagamento_sicoob.rb +55 -0
- data/lib/cnab240/pagamentos/v40/header.rb +35 -37
- data/lib/cnab240/pagamentos/v40/trailer.rb +13 -13
- data/lib/cnab240/pagamentos/v80/header.rb +45 -45
- data/lib/cnab240/pagamentos/v80/trailer.rb +13 -13
- data/lib/cnab240/pagamentos/v83/header.rb +45 -0
- data/lib/cnab240/pagamentos/v83/trailer.rb +18 -0
- data/lib/cnab240/pagamentos/v86/header.rb +44 -44
- data/lib/cnab240/pagamentos/v86/titulos/header.rb +44 -44
- data/lib/cnab240/pagamentos/v86/titulos/trailer.rb +14 -14
- data/lib/cnab240/pagamentos/v86/trailer.rb +14 -14
- data/lib/cnab240/pagamentos/v86/tributos/header.rb +45 -45
- data/lib/cnab240/pagamentos/v86/tributos/trailer.rb +12 -12
- data/lib/cnab240/pagamentos/v87/header.rb +46 -0
- data/lib/cnab240/pagamentos/v87/titulos/header.rb +46 -0
- data/lib/cnab240/pagamentos/v87/titulos/trailer.rb +18 -0
- data/lib/cnab240/pagamentos/v87/trailer.rb +18 -0
- data/lib/cnab240/pagamentos/v87/tributos/header.rb +47 -0
- data/lib/cnab240/pagamentos/v87/tributos/trailer.rb +17 -0
- data/lib/cnab240/segmentos/v40/segmento_a.rb +45 -48
- data/lib/cnab240/segmentos/v80/agencia_itau.rb +11 -12
- data/lib/cnab240/segmentos/v80/agencia_outros.rb +9 -10
- data/lib/cnab240/segmentos/v80/segmento_a.rb +59 -61
- data/lib/cnab240/segmentos/v83/segmento_a.rb +42 -0
- data/lib/cnab240/segmentos/v83/segmento_b.rb +40 -0
- data/lib/cnab240/segmentos/v83/segmento_j.rb +33 -0
- data/lib/cnab240/segmentos/v83/segmento_z.rb +19 -0
- data/lib/cnab240/segmentos/v86/segmento_a.rb +42 -45
- data/lib/cnab240/segmentos/v86/segmento_b.rb +38 -39
- data/lib/cnab240/segmentos/v86/segmento_c.rb +23 -24
- data/lib/cnab240/segmentos/v86/segmento_j.rb +25 -26
- data/lib/cnab240/segmentos/v86/segmento_j52.rb +22 -24
- data/lib/cnab240/segmentos/v86/segmento_n.rb +50 -51
- data/lib/cnab240/segmentos/v86/segmento_n1.rb +13 -15
- data/lib/cnab240/segmentos/v86/segmento_n2.rb +15 -17
- data/lib/cnab240/segmentos/v86/segmento_n3.rb +15 -17
- data/lib/cnab240/segmentos/v86/segmento_n4.rb +17 -19
- data/lib/cnab240/segmentos/v86/segmento_n5.rb +15 -17
- data/lib/cnab240/segmentos/v86/segmento_n6.rb +15 -17
- data/lib/cnab240/segmentos/v86/segmento_n7.rb +16 -18
- data/lib/cnab240/segmentos/v86/segmento_n8.rb +15 -18
- data/lib/cnab240/segmentos/v86/segmento_o.rb +20 -21
- data/lib/cnab240/segmentos/v86/segmento_w.rb +16 -17
- data/lib/cnab240/segmentos/v86/segmento_w1.rb +12 -13
- data/lib/cnab240/segmentos/v86/segmento_z.rb +14 -14
- data/lib/cnab240/segmentos/v87/segmento_a.rb +44 -0
- data/lib/cnab240/segmentos/v87/segmento_b.rb +40 -0
- data/lib/cnab240/segmentos/v87/segmento_c.rb +32 -0
- data/lib/cnab240/segmentos/v87/segmento_j.rb +33 -0
- data/lib/cnab240/segmentos/v87/segmento_j52.rb +32 -0
- data/lib/cnab240/segmentos/v87/segmento_n.rb +59 -0
- data/lib/cnab240/segmentos/v87/segmento_n1.rb +19 -0
- data/lib/cnab240/segmentos/v87/segmento_n2.rb +21 -0
- data/lib/cnab240/segmentos/v87/segmento_n3.rb +21 -0
- data/lib/cnab240/segmentos/v87/segmento_n4.rb +23 -0
- data/lib/cnab240/segmentos/v87/segmento_n5.rb +21 -0
- data/lib/cnab240/segmentos/v87/segmento_n6.rb +21 -0
- data/lib/cnab240/segmentos/v87/segmento_n7.rb +21 -0
- data/lib/cnab240/segmentos/v87/segmento_n8.rb +22 -0
- data/lib/cnab240/segmentos/v87/segmento_o.rb +27 -0
- data/lib/cnab240/segmentos/v87/segmento_w.rb +24 -0
- data/lib/cnab240/segmentos/v87/segmento_w1.rb +16 -0
- data/lib/cnab240/segmentos/v87/segmento_z.rb +19 -0
- data/lib/cnab240/version.rb +1 -2
- data/lib/cnab240.rb +54 -24
- metadata +64 -133
- data/.gitignore +0 -19
- data/.rspec +0 -2
- data/.travis.yml +0 -4
- data/Gemfile +0 -6
- data/LICENSE +0 -22
- data/README.md +0 -135
- data/docs/vendor/febraban/subcpadr12_layout_padrao_V86.pdf +0 -0
- data/docs/vendor/itau/SISPAG_CNAB_240.pdf +0 -0
- data/docs/vendor/itau/sisdeb_cnab_240.pdf +0 -0
- data/spec/arquivo/arquivo_spec.rb +0 -95
- data/spec/arquivo/v40/header_spec.rb +0 -68
- data/spec/arquivo/v40/trailer_spec.rb +0 -25
- data/spec/arquivo/v80/header_spec.rb +0 -60
- data/spec/arquivo/v80/trailer_spec.rb +0 -26
- data/spec/arquivo/v86/header_spec.rb +0 -89
- data/spec/arquivo/v86/trailer_spec.rb +0 -27
- data/spec/bindata/bindata_spec.rb +0 -55
- data/spec/cnab240_spec.rb +0 -22
- data/spec/helper/pagamento_itau_spec.rb +0 -83
- data/spec/hom/hom_spec.rb +0 -65
- data/spec/hom/retorno/SB22112AIT.RET +0 -5
- data/spec/hom/retorno/SB23112AIT.RET +0 -5
- data/spec/pagamentos/v40/header_spec.rb +0 -59
- data/spec/pagamentos/v40/lote_spec.rb +0 -25
- data/spec/pagamentos/v40/trailer_spec.rb +0 -28
- data/spec/pagamentos/v80/header_spec.rb +0 -52
- data/spec/pagamentos/v80/lote_spec.rb +0 -25
- data/spec/pagamentos/v80/trailer_spec.rb +0 -28
- data/spec/pagamentos/v86/header_spec.rb +0 -53
- data/spec/pagamentos/v86/lote_spec.rb +0 -38
- data/spec/pagamentos/v86/titulos/header_spec.rb +0 -51
- data/spec/pagamentos/v86/titulos/lote_spec.rb +0 -37
- data/spec/pagamentos/v86/titulos/trailer_spec.rb +0 -30
- data/spec/pagamentos/v86/trailer_spec.rb +0 -30
- data/spec/pagamentos/v86/tributos/header_spec.rb +0 -53
- data/spec/pagamentos/v86/tributos/lote_spec.rb +0 -43
- data/spec/pagamentos/v86/tributos/trailer_spec.rb +0 -27
- data/spec/segmentos/v40/segmento_a_spec.rb +0 -70
- data/spec/segmentos/v80/segmento_a_spec.rb +0 -70
- data/spec/segmentos/v86/segmento_a_spec.rb +0 -65
- data/spec/segmentos/v86/segmento_b_spec.rb +0 -67
- data/spec/segmentos/v86/segmento_c_spec.rb +0 -51
- data/spec/segmentos/v86/segmento_j52_spec.rb +0 -55
- data/spec/segmentos/v86/segmento_j_spec.rb +0 -55
- data/spec/segmentos/v86/segmento_n1_spec.rb +0 -43
- data/spec/segmentos/v86/segmento_n2_spec.rb +0 -46
- data/spec/segmentos/v86/segmento_n3_spec.rb +0 -45
- data/spec/segmentos/v86/segmento_n4_spec.rb +0 -47
- data/spec/segmentos/v86/segmento_n5_spec.rb +0 -45
- data/spec/segmentos/v86/segmento_n6_spec.rb +0 -45
- data/spec/segmentos/v86/segmento_n7_spec.rb +0 -46
- data/spec/segmentos/v86/segmento_n8_spec.rb +0 -45
- data/spec/segmentos/v86/segmento_n_spec.rb +0 -73
- data/spec/segmentos/v86/segmento_o_spec.rb +0 -50
- data/spec/segmentos/v86/segmento_spec.rb +0 -12
- data/spec/segmentos/v86/segmento_w_spec.rb +0 -51
- data/spec/segmentos/v86/segmento_z_spec.rb +0 -42
- data/spec/spec_helper.rb +0 -10
- data/spec/tmp/.gitkeep +0 -0
@@ -1,98 +1,162 @@
|
|
1
1
|
module Cnab240
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
3
|
+
ESTRUTURA_V80 = {
|
4
|
+
:segmentos_implementados => [:a],
|
5
|
+
:pagamento => {
|
6
|
+
:header => Cnab240::V80::Pagamentos::Header,
|
7
|
+
:trailer => Cnab240::V80::Pagamentos::Trailer,
|
8
|
+
:segmentos => [:a],
|
9
|
+
:a => {
|
10
|
+
:remessa => true,
|
11
|
+
:retorno => true
|
12
|
+
}
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
16
|
+
ESTRUTURA_V40 = {
|
17
|
+
:segmentos_implementados => [:a],
|
18
|
+
:pagamento => {
|
19
|
+
:header => Cnab240::V40::Pagamentos::Header,
|
20
|
+
:trailer => Cnab240::V40::Pagamentos::Trailer,
|
21
|
+
:segmentos => [:a],
|
22
|
+
:a => {
|
23
|
+
:remessa => true,
|
24
|
+
:retorno => true
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
ESTRUTURA_V86 = {
|
30
|
+
:segmentos_implementados => [:a, :b, :c, :j, :j52, :o, :n, :w, :z],
|
31
|
+
:pagamento => {
|
32
|
+
|
33
|
+
:header => Cnab240::V86::Pagamentos::Header,
|
34
|
+
:trailer => Cnab240::V86::Pagamentos::Trailer,
|
35
|
+
|
36
|
+
:segmentos => [:a, :b, :c],
|
37
|
+
:a => {
|
38
|
+
:remessa => true,
|
39
|
+
:retorno => true
|
40
|
+
},
|
41
|
+
:b => {
|
42
|
+
:remessa => true,
|
43
|
+
:retorno => true
|
44
|
+
},
|
45
|
+
:c => {
|
46
|
+
:remessa => false,
|
47
|
+
:retorno => false
|
48
|
+
}
|
49
|
+
},
|
50
|
+
|
51
|
+
:pagamento_titulo_cobranca => {
|
52
|
+
|
53
|
+
:header => Cnab240::V86::PagamentosTitulos::Header,
|
54
|
+
:trailer => Cnab240::V86::PagamentosTitulos::Trailer,
|
55
|
+
|
56
|
+
:segmentos => [:j, :j52],
|
57
|
+
:j => {
|
58
|
+
:remessa => true,
|
59
|
+
:retorno => true
|
60
|
+
},
|
61
|
+
:j52 => {
|
62
|
+
:remessa => false,
|
63
|
+
:retorno => false
|
64
|
+
}
|
65
|
+
},
|
66
|
+
|
67
|
+
:pagamento_titulo_tributos => {
|
68
|
+
|
69
|
+
:header => Cnab240::V86::PagamentosTributos::Header,
|
70
|
+
:trailer => Cnab240::V86::PagamentosTributos::Trailer,
|
71
|
+
|
72
|
+
:segmentos => [:o, :n, :w, :z],
|
73
|
+
:o => {
|
74
|
+
:remessa => true,
|
75
|
+
:retorno => true
|
76
|
+
},
|
77
|
+
:n => {
|
78
|
+
:remessa => true,
|
79
|
+
:retorno => true
|
80
|
+
},
|
81
|
+
:w => {
|
82
|
+
:remessa => false,
|
83
|
+
:retorno => false
|
84
|
+
},
|
85
|
+
:z => {
|
86
|
+
:remessa => false,
|
87
|
+
:retorno => false
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
ESTRUTURA_V87 = {
|
93
|
+
:segmentos_implementados => [:a, :b, :c, :j, :j52, :o, :n, :w, :z],
|
94
|
+
:pagamento => {
|
95
|
+
|
96
|
+
:header => Cnab240::V87::Pagamentos::Header,
|
97
|
+
:trailer => Cnab240::V87::Pagamentos::Trailer,
|
98
|
+
|
99
|
+
:segmentos => [:a, :b, :c],
|
100
|
+
:a => {
|
101
|
+
:remessa => true,
|
102
|
+
:retorno => true
|
103
|
+
},
|
104
|
+
:b => {
|
105
|
+
:remessa => true,
|
106
|
+
:retorno => true
|
107
|
+
},
|
108
|
+
:c => {
|
109
|
+
:remessa => false,
|
110
|
+
:retorno => false
|
111
|
+
}
|
112
|
+
},
|
113
|
+
|
114
|
+
:pagamento_titulo_cobranca => {
|
115
|
+
|
116
|
+
:header => Cnab240::V87::PagamentosTitulos::Header,
|
117
|
+
:trailer => Cnab240::V87::PagamentosTitulos::Trailer,
|
118
|
+
|
119
|
+
:segmentos => [:j, :j52],
|
120
|
+
:j => {
|
121
|
+
:remessa => true,
|
122
|
+
:retorno => true
|
123
|
+
},
|
124
|
+
:j52 => {
|
125
|
+
:remessa => false,
|
126
|
+
:retorno => false
|
127
|
+
}
|
128
|
+
},
|
129
|
+
|
130
|
+
:pagamento_titulo_tributos => {
|
131
|
+
|
132
|
+
:header => Cnab240::V87::PagamentosTributos::Header,
|
133
|
+
:trailer => Cnab240::V87::PagamentosTributos::Trailer,
|
134
|
+
|
135
|
+
:segmentos => [:o, :n, :w, :z],
|
136
|
+
:o => {
|
137
|
+
:remessa => true,
|
138
|
+
:retorno => true
|
139
|
+
},
|
140
|
+
:n => {
|
141
|
+
:remessa => true,
|
142
|
+
:retorno => true
|
143
|
+
},
|
144
|
+
:w => {
|
145
|
+
:remessa => false,
|
146
|
+
:retorno => false
|
147
|
+
},
|
148
|
+
:z => {
|
149
|
+
:remessa => false,
|
150
|
+
:retorno => false
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
155
|
+
ESTRUTURA = {
|
156
|
+
'V40' => ESTRUTURA_V40,
|
157
|
+
'V80' => ESTRUTURA_V80,
|
158
|
+
'V86' => ESTRUTURA_V86,
|
159
|
+
'V87' => ESTRUTURA_V87
|
160
|
+
}
|
161
|
+
|
98
162
|
end
|
data/lib/cnab240/arquivo/lote.rb
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
module Cnab240
|
2
|
-
|
2
|
+
class Lote
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
attr_accessor :header
|
5
|
+
attr_accessor :segmentos
|
6
|
+
attr_accessor :trailer
|
7
|
+
attr_accessor :operacao
|
8
|
+
attr_accessor :tipo
|
9
|
+
attr_accessor :arquivo
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
@operacao ||= options[:operacao]
|
15
|
-
@tipo ||= options[:tipo]
|
16
|
-
@versao ||= options[:versao]
|
17
|
-
@fallback ||= options[:fallback]
|
18
|
-
@versao ||= 'V86'
|
11
|
+
def initialize(options = {})
|
12
|
+
@segmentos = []
|
19
13
|
|
20
|
-
|
14
|
+
@operacao ||= options[:operacao]
|
15
|
+
@tipo ||= options[:tipo]
|
16
|
+
@versao ||= options[:versao]
|
17
|
+
@fallback ||= options[:fallback]
|
18
|
+
@versao ||= 'V86'
|
21
19
|
|
22
|
-
|
20
|
+
raise "Operacao nao suportada: #{operacao}" if ESTRUTURA[@versao][operacao].nil?
|
23
21
|
|
24
|
-
|
25
|
-
@trailer = estrutura[:trailer].new
|
22
|
+
estrutura = ESTRUTURA[@versao][operacao]
|
26
23
|
|
27
|
-
|
28
|
-
|
24
|
+
@header = estrutura[:header].new
|
25
|
+
@trailer = estrutura[:trailer].new
|
29
26
|
|
30
|
-
|
31
|
-
|
32
|
-
versao ||= @versao
|
33
|
-
segmentos << seg = eval("Cnab240::#{versao}::Segmento#{s.to_s.upcase}.read(line)")
|
34
|
-
end
|
27
|
+
yield self if block_given?
|
28
|
+
end
|
35
29
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
segmentos << seg = eval("Cnab240::#{versao}::Segmento#{s.to_s.upcase}.new")
|
42
|
-
else
|
43
|
-
segmentos << seg = s
|
44
|
-
end
|
45
|
-
seg.lote = self
|
46
|
-
seg
|
47
|
-
end
|
30
|
+
def read_segmento(s, line)
|
31
|
+
versao = arquivo.versao unless arquivo.nil?
|
32
|
+
versao ||= @versao
|
33
|
+
segmentos << seg = eval("Cnab240::#{versao}::Segmento#{s.to_s.upcase}.read(line)")
|
34
|
+
end
|
48
35
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
36
|
+
def <<(s)
|
37
|
+
versao = arquivo.versao unless arquivo.nil?
|
38
|
+
versao ||= @versao
|
39
|
+
case s
|
40
|
+
when Symbol, String
|
41
|
+
segmentos << seg = eval("Cnab240::#{versao}::Segmento#{s.to_s.upcase}.new")
|
42
|
+
else
|
43
|
+
segmentos << seg = s
|
44
|
+
end
|
45
|
+
seg.lote = self
|
46
|
+
seg
|
47
|
+
end
|
60
48
|
|
61
|
-
|
62
|
-
|
63
|
-
|
49
|
+
def linhas
|
50
|
+
self.auto_fill if Cnab240.auto_fill_enabled
|
51
|
+
seg_array = []
|
52
|
+
seg_array << @header.linha
|
53
|
+
segmentos.each do |s|
|
54
|
+
seg_array << s.linha
|
55
|
+
end
|
56
|
+
seg_array << @trailer.linha
|
57
|
+
seg_array
|
58
|
+
end
|
64
59
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
end
|
60
|
+
def string
|
61
|
+
linhas.join("\r\n")
|
62
|
+
end
|
69
63
|
|
70
|
-
|
64
|
+
def auto_fill
|
65
|
+
trailer.totais_qtde_registros = (segmentos.length + 2).to_s
|
66
|
+
_total = 0
|
67
|
+
segmentos.each { |seg| _total += seg[:credito_valor_pagamento].to_i }
|
68
|
+
trailer.totais_valor =_total.to_s
|
69
|
+
end
|
70
|
+
end
|
71
71
|
end
|
@@ -1,46 +1,46 @@
|
|
1
1
|
module Cnab240::V40::Arquivo
|
2
|
-
|
3
|
-
|
4
|
-
include Cnab240::DefaultMixin
|
2
|
+
class Header < BinData::Record
|
5
3
|
|
6
|
-
|
7
|
-
lstring :controle_lote, :length => 4, :initial_value => '0000', :pad_byte => '0'
|
8
|
-
lstring :controle_registro, :length => 1, :initial_value => '0', :pad_byte => '0'
|
4
|
+
include Cnab240::DefaultMixin
|
9
5
|
|
10
|
-
|
6
|
+
string :controle_banco, :length => 3, :pad_byte => '0'
|
7
|
+
lstring :controle_lote, :length => 4, :initial_value => '0000', :pad_byte => '0'
|
8
|
+
lstring :controle_registro, :length => 1, :initial_value => '0', :pad_byte => '0'
|
11
9
|
|
12
|
-
|
13
|
-
lstring :empresa_numero, :length => 14, :pad_byte => '0'
|
14
|
-
string :empresa_convenio, :length => 13, :pad_byte => ' '
|
10
|
+
string :cnab_g004_1, :length => 9, :initial_value => ' ', :pad_byte => ' '
|
15
11
|
|
16
|
-
|
17
|
-
|
12
|
+
lstring :empresa_tipo, :length => 1, :pad_byte => '0'
|
13
|
+
lstring :empresa_numero, :length => 14, :pad_byte => '0'
|
14
|
+
string :empresa_convenio, :length => 13, :pad_byte => ' '
|
18
15
|
|
19
|
-
|
16
|
+
string :brancos_1, :length => 7, :pad_byte => ' '
|
17
|
+
lstring :brancos_2, :length => 1, :pad_byte => '0'
|
20
18
|
|
21
|
-
|
22
|
-
lstring :brancos_4, :length => 7, :pad_byte => '0'
|
19
|
+
lstring :empresa_agencia_codigo, :length => 4, :pad_byte => '0'
|
23
20
|
|
24
|
-
|
25
|
-
|
21
|
+
string :brancos_3, :length => 1, :pad_byte => ' '
|
22
|
+
lstring :brancos_4, :length => 7, :pad_byte => '0'
|
26
23
|
|
27
|
-
|
28
|
-
|
24
|
+
lstring :empresa_conta_numero, :length => 5, :pad_byte => '0'
|
25
|
+
string :brancos_5, :length => 1, :pad_byte => ' '
|
29
26
|
|
30
|
-
|
27
|
+
string :empresa_agencia_conta_dv, :length => 1, :pad_byte => '0'
|
28
|
+
string :empresa_nome, :length => 30, :pad_byte => ' '
|
31
29
|
|
32
|
-
|
30
|
+
string :banco_nome, :length => 30, :pad_byte => ' '
|
33
31
|
|
34
|
-
|
35
|
-
lstring :arquivo_data_geracao, :length => 8, :pad_byte => '0'
|
36
|
-
lstring :arquivo_hora_geracao,:length => 6, :pad_byte => '0'
|
37
|
-
lstring :arquivo_sequencia, :length => 6, :pad_byte => '0'
|
38
|
-
lstring :arquivo_layout, :length => 3, :initial_value => '040'
|
39
|
-
lstring :arquivo_densidade, :length => 5, :pad_byte => '0'
|
32
|
+
string :cnab_g004_2, :length => 10, :pad_byte => ' '
|
40
33
|
|
41
|
-
|
34
|
+
lstring :arquivo_codigo, :length => 1, :pad_byte => '0'
|
35
|
+
lstring :arquivo_data_geracao, :length => 8, :pad_byte => '0'
|
36
|
+
lstring :arquivo_hora_geracao, :length => 6, :pad_byte => '0'
|
37
|
+
lstring :arquivo_sequencia, :length => 6, :pad_byte => '0'
|
38
|
+
lstring :arquivo_layout, :length => 3, :initial_value => '040'
|
39
|
+
lstring :arquivo_densidade, :length => 5, :pad_byte => '0'
|
42
40
|
|
43
|
-
|
41
|
+
string :reservado_banco, :length => 20, :pad_byte => ' '
|
44
42
|
|
45
|
-
|
43
|
+
string :cnab_g004_3, :length => 49, :pad_byte => ' '
|
44
|
+
|
45
|
+
end
|
46
46
|
end
|
@@ -1,18 +1,18 @@
|
|
1
1
|
module Cnab240::V40::Arquivo
|
2
|
-
|
3
|
-
|
4
|
-
include Cnab240::DefaultMixin
|
2
|
+
class Trailer < BinData::Record
|
5
3
|
|
6
|
-
|
7
|
-
lstring :controle_lote, :length => 4, :initial_value => '9999', :pad_byte => '0'
|
8
|
-
lstring :controle_registro, :length => 1, :initial_value => '9', :pad_byte => '0'
|
4
|
+
include Cnab240::DefaultMixin
|
9
5
|
|
10
|
-
|
6
|
+
string :controle_banco, :length => 3, :pad_byte => '0'
|
7
|
+
lstring :controle_lote, :length => 4, :initial_value => '9999', :pad_byte => '0'
|
8
|
+
lstring :controle_registro, :length => 1, :initial_value => '9', :pad_byte => '0'
|
11
9
|
|
12
|
-
|
13
|
-
lstring :totais_qtde_registros, :length => 6, :pad_byte => '0'
|
10
|
+
string :cnab_g004_1, :length => 9, :pad_byte => ' '
|
14
11
|
|
15
|
-
|
12
|
+
lstring :totais_qtde_lotes, :length => 6, :pad_byte => '0'
|
13
|
+
lstring :totais_qtde_registros, :length => 6, :pad_byte => '0'
|
16
14
|
|
17
|
-
|
15
|
+
string :cnab_g004_2, :length => 211, :pad_byte => ' '
|
16
|
+
|
17
|
+
end
|
18
18
|
end
|
@@ -1,38 +1,39 @@
|
|
1
1
|
module Cnab240::V80::Arquivo
|
2
|
-
|
3
|
-
|
4
|
-
include Cnab240::DefaultMixin
|
2
|
+
class Header < BinData::Record
|
5
3
|
|
6
|
-
|
7
|
-
lstring :controle_lote, :length => 4, :initial_value => '0000', :pad_byte => '0'
|
8
|
-
lstring :controle_registro, :length => 1, :initial_value => '0', :pad_byte => '0'
|
4
|
+
include Cnab240::DefaultMixin
|
9
5
|
|
10
|
-
|
11
|
-
|
6
|
+
lstring :controle_banco, :length => 3, :pad_byte => '0'
|
7
|
+
lstring :controle_lote, :length => 4, :initial_value => '0000', :pad_byte => '0'
|
8
|
+
lstring :controle_registro, :length => 1, :initial_value => '0', :pad_byte => '0'
|
12
9
|
|
13
|
-
|
14
|
-
|
10
|
+
string :brancos_1, :length => 6, :initial_value => ' ', :pad_byte => ' '
|
11
|
+
string :arquivo_layout, :length => 3, :initial_value => '080'
|
15
12
|
|
16
|
-
|
13
|
+
lstring :empresa_tipo, :length => 1, :pad_byte => '0'
|
14
|
+
lstring :empresa_numero, :length => 14, :pad_byte => '0'
|
17
15
|
|
18
|
-
|
19
|
-
string :brancos_3, :length => 1, :initial_value => ' ', :pad_byte => ' '
|
20
|
-
lstring :empresa_conta_numero, :length => 12, :pad_byte => '0'
|
21
|
-
string :brancos_4, :length => 1, :initial_value => ' ', :pad_byte => ' '
|
22
|
-
string :empresa_agencia_conta_dv, :length => 1, :pad_byte => '0'
|
23
|
-
string :empresa_nome, :length => 30, :pad_byte => ' '
|
24
|
-
string :banco_nome, :length => 30, :pad_byte => ' '
|
25
|
-
string :brancos_5, :length => 10, :initial_value => ' ', :pad_byte => ' '
|
16
|
+
string :brancos_2, :length => 20, :initial_value => ' ', :pad_byte => ' '
|
26
17
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
18
|
+
lstring :empresa_agencia_codigo, :length => 5, :pad_byte => '0'
|
19
|
+
string :brancos_3, :length => 1, :initial_value => ' ', :pad_byte => ' '
|
20
|
+
lstring :empresa_conta_numero, :length => 12, :pad_byte => '0'
|
21
|
+
string :brancos_4, :length => 1, :initial_value => ' ', :pad_byte => ' '
|
22
|
+
string :empresa_agencia_conta_dv, :length => 1, :pad_byte => '0'
|
23
|
+
string :empresa_nome, :length => 30, :pad_byte => ' '
|
24
|
+
string :banco_nome, :length => 30, :pad_byte => ' '
|
25
|
+
string :brancos_5, :length => 10, :initial_value => ' ', :pad_byte => ' '
|
32
26
|
|
33
|
-
|
27
|
+
lstring :arquivo_codigo, :length => 1, :pad_byte => '0'
|
28
|
+
lstring :arquivo_data_geracao, :length => 8, :pad_byte => '0'
|
29
|
+
lstring :arquivo_hora_geracao, :length => 6, :pad_byte => '0'
|
34
30
|
|
35
|
-
|
31
|
+
#string :brancos_6, :length => 9, :initial_value => ' ', :pad_byte => '0'
|
32
|
+
lstring :zeros_6, :length => 9, :pad_byte => '0'
|
36
33
|
|
37
|
-
|
34
|
+
lstring :arquivo_densidade, :length => 5, :pad_byte => '0'
|
35
|
+
|
36
|
+
string :brancos_7, :length => 69, :pad_byte => ' '
|
37
|
+
|
38
|
+
end
|
38
39
|
end
|
@@ -1,17 +1,17 @@
|
|
1
1
|
module Cnab240::V80::Arquivo
|
2
|
-
|
3
|
-
|
4
|
-
include Cnab240::DefaultMixin
|
2
|
+
class Trailer < BinData::Record
|
5
3
|
|
6
|
-
|
7
|
-
string :controle_lote, :length => 4, :initial_value => '9999', :pad_byte => '0'
|
8
|
-
string :controle_registro, :length => 1, :initial_value => '9', :pad_byte => '0'
|
4
|
+
include Cnab240::DefaultMixin
|
9
5
|
|
10
|
-
|
6
|
+
string :controle_banco, :length => 3, :pad_byte => '0'
|
7
|
+
string :controle_lote, :length => 4, :initial_value => '9999', :pad_byte => '0'
|
8
|
+
string :controle_registro, :length => 1, :initial_value => '9', :pad_byte => '0'
|
11
9
|
|
12
|
-
|
13
|
-
lstring :totais_qtde_registros, :length => 6, :pad_byte => '0'
|
10
|
+
string :cnab_g004_1, :length => 9, :pad_byte => ' '
|
14
11
|
|
15
|
-
|
16
|
-
|
12
|
+
lstring :totais_qtde_lotes, :length => 6, :pad_byte => '0'
|
13
|
+
lstring :totais_qtde_registros, :length => 6, :pad_byte => '0'
|
14
|
+
|
15
|
+
string :cnab_g004_2, :length => 211, :pad_byte => ' '
|
16
|
+
end
|
17
17
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Cnab240::V83::Arquivo
|
2
|
+
class Header < BinData::Record
|
3
|
+
|
4
|
+
include Cnab240::DefaultMixin
|
5
|
+
|
6
|
+
lstring :controle_banco, :length => 3, :pad_byte => '0'
|
7
|
+
lstring :controle_lote, :length => 4, :initial_value => '0000', :pad_byte => '0'
|
8
|
+
lstring :controle_registro, :length => 1, :initial_value => '0', :pad_byte => '0'
|
9
|
+
|
10
|
+
string :cnab_g004_1, :length => 9, :initial_value => ' ', :pad_byte => ' '
|
11
|
+
|
12
|
+
lstring :empresa_tipo, :length => 1, :pad_byte => '0'
|
13
|
+
lstring :empresa_numero, :length => 14, :pad_byte => '0'
|
14
|
+
string :empresa_convenio, :length => 20, :pad_byte => ' '
|
15
|
+
lstring :empresa_agencia_codigo, :length => 5, :pad_byte => '0'
|
16
|
+
string :empresa_agencia_dv, :length => 1, :pad_byte => ' '
|
17
|
+
lstring :empresa_conta_numero, :length => 12, :pad_byte => '0'
|
18
|
+
string :empresa_conta_dv, :length => 1, :pad_byte => ' '
|
19
|
+
string :empresa_agencia_conta_dv, :length => 1, :pad_byte => ' '
|
20
|
+
string :empresa_nome, :length => 30, :pad_byte => ' '
|
21
|
+
|
22
|
+
string :banco_nome, :length => 30, :pad_byte => ' '
|
23
|
+
|
24
|
+
string :cnab_g004_2, :length => 10, :pad_byte => ' '
|
25
|
+
|
26
|
+
lstring :arquivo_codigo, :length => 1, :pad_byte => '0'
|
27
|
+
lstring :arquivo_data_geracao, :length => 8, :pad_byte => '0'
|
28
|
+
lstring :arquivo_hora_geracao, :length => 6, :pad_byte => '0'
|
29
|
+
lstring :arquivo_sequencia, :length => 6, :pad_byte => '0'
|
30
|
+
string :arquivo_layout, :length => 3, :initial_value => '060'
|
31
|
+
lstring :arquivo_densidade, :length => 5, :pad_byte => '0'
|
32
|
+
|
33
|
+
string :reservado_banco, :length => 20, :pad_byte => ' '
|
34
|
+
string :reservado_empresa, :length => 20, :pad_byte => ' '
|
35
|
+
|
36
|
+
string :cnab_g004_3, :length => 29, :pad_byte => ' '
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Cnab240::V83::Arquivo
|
2
|
+
class Trailer < BinData::Record
|
3
|
+
|
4
|
+
include Cnab240::DefaultMixin
|
5
|
+
|
6
|
+
string :controle_banco, :length => 3, :pad_byte => '0'
|
7
|
+
string :controle_lote, :length => 4, :initial_value => '9999', :pad_byte => '0'
|
8
|
+
string :controle_registro, :length => 1, :initial_value => '9', :pad_byte => '0'
|
9
|
+
|
10
|
+
string :cnab_g004_1, :length => 9, :pad_byte => ' '
|
11
|
+
|
12
|
+
lstring :totais_qtde_lotes, :length => 6, :pad_byte => '0'
|
13
|
+
lstring :totais_qtde_registros, :length => 6, :pad_byte => '0'
|
14
|
+
|
15
|
+
string :cnab_g004_2, :length => 211, :pad_byte => ' '
|
16
|
+
end
|
17
|
+
end
|