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,40 +1,39 @@
|
|
1
1
|
module Cnab240::V87
|
2
2
|
class SegmentoB < BinData::Record
|
3
|
-
|
4
3
|
include Cnab240::DefaultMixin
|
5
4
|
include Cnab240::SegmentoMixin
|
6
5
|
|
7
|
-
lstring :controle_banco, :
|
8
|
-
lstring :controle_lote, :
|
9
|
-
lstring :controle_registro, :
|
10
|
-
|
11
|
-
lstring :servico_numero_registro, :
|
12
|
-
string :servico_codigo_segmento, :
|
13
|
-
|
14
|
-
string :cnab240_g004_1, :
|
15
|
-
|
16
|
-
lstring :favorecido_inscricao_tipo, :
|
17
|
-
lstring :favorecido_inscricao_numero, :
|
18
|
-
string :favorecido_endereco_logradouro, :
|
19
|
-
lstring :favorecido_endereco_numero, :
|
20
|
-
string :favorecido_endereco_complemento, :
|
21
|
-
string :favorecido_endereco_bairro, :
|
22
|
-
string :favorecido_endereco_cidade, :
|
23
|
-
lstring :favorecido_endereco_cep, :
|
24
|
-
string :favorecido_endereco_cep_complemento, :
|
25
|
-
string :favorecido_endereco_estado, :
|
26
|
-
|
27
|
-
lstring :pagamento_data_vencimento, :
|
28
|
-
lstring :pagamento_valor_documento, :
|
29
|
-
lstring :pagamento_valor_abatimento, :
|
30
|
-
lstring :pagamento_valor_desconto, :
|
31
|
-
lstring :pagamento_valor_mora, :
|
32
|
-
lstring :pagamento_valor_multa, :
|
33
|
-
|
34
|
-
string :codigo_documento_favorecido, :
|
35
|
-
lstring :aviso, :
|
36
|
-
lstring :codigo_ug, :
|
37
|
-
|
38
|
-
string :cnab_g004_2, :
|
6
|
+
lstring :controle_banco, length: 3, pad_byte: '0'
|
7
|
+
lstring :controle_lote, length: 4, pad_byte: '0'
|
8
|
+
lstring :controle_registro, length: 1, initial_value: '3', pad_byte: '0'
|
9
|
+
|
10
|
+
lstring :servico_numero_registro, length: 5, pad_byte: '0'
|
11
|
+
string :servico_codigo_segmento, length: 1, initial_value: 'B', pad_byte: ' '
|
12
|
+
|
13
|
+
string :cnab240_g004_1, length: 3, pad_byte: ' '
|
14
|
+
|
15
|
+
lstring :favorecido_inscricao_tipo, length: 1, pad_byte: '0'
|
16
|
+
lstring :favorecido_inscricao_numero, length: 14, pad_byte: '0'
|
17
|
+
string :favorecido_endereco_logradouro, length: 30, pad_byte: ' '
|
18
|
+
lstring :favorecido_endereco_numero, length: 5, pad_byte: '0'
|
19
|
+
string :favorecido_endereco_complemento, length: 15, pad_byte: ' '
|
20
|
+
string :favorecido_endereco_bairro, length: 15, pad_byte: ' '
|
21
|
+
string :favorecido_endereco_cidade, length: 20, pad_byte: ' '
|
22
|
+
lstring :favorecido_endereco_cep, length: 5, pad_byte: '0'
|
23
|
+
string :favorecido_endereco_cep_complemento, length: 3, pad_byte: '0'
|
24
|
+
string :favorecido_endereco_estado, length: 2, pad_byte: ' '
|
25
|
+
|
26
|
+
lstring :pagamento_data_vencimento, length: 8, pad_byte: '0'
|
27
|
+
lstring :pagamento_valor_documento, length: 15, pad_byte: '0'
|
28
|
+
lstring :pagamento_valor_abatimento, length: 15, pad_byte: '0'
|
29
|
+
lstring :pagamento_valor_desconto, length: 15, pad_byte: '0'
|
30
|
+
lstring :pagamento_valor_mora, length: 15, pad_byte: '0'
|
31
|
+
lstring :pagamento_valor_multa, length: 15, pad_byte: '0'
|
32
|
+
|
33
|
+
string :codigo_documento_favorecido, length: 15, pad_byte: ' '
|
34
|
+
lstring :aviso, length: 1, pad_byte: '0'
|
35
|
+
lstring :codigo_ug, length: 6, pad_byte: '0'
|
36
|
+
|
37
|
+
string :cnab_g004_2, length: 8, pad_byte: ' '
|
39
38
|
end
|
40
|
-
end
|
39
|
+
end
|
@@ -1,32 +1,31 @@
|
|
1
1
|
module Cnab240::V87
|
2
2
|
class SegmentoC < BinData::Record
|
3
|
-
|
4
3
|
include Cnab240::DefaultMixin
|
5
4
|
include Cnab240::SegmentoMixin
|
6
5
|
|
7
|
-
lstring :controle_banco, :
|
8
|
-
lstring :controle_lote, :
|
9
|
-
string :controle_registro, :
|
6
|
+
lstring :controle_banco, length: 3, pad_byte: '0'
|
7
|
+
lstring :controle_lote, length: 4, pad_byte: '0'
|
8
|
+
string :controle_registro, length: 1, initial_value: '3', pad_byte: '0'
|
10
9
|
|
11
|
-
lstring :servico_numero_registro, :
|
12
|
-
string :servico_codigo_segmento, :
|
10
|
+
lstring :servico_numero_registro, length: 5, pad_byte: '0'
|
11
|
+
string :servico_codigo_segmento, length: 1, initial_value: 'C', pad_byte: ' '
|
13
12
|
|
14
|
-
string :cnab240_g004_1, :
|
13
|
+
string :cnab240_g004_1, length: 3, pad_byte: ' '
|
15
14
|
|
16
|
-
lstring :complementar_valor_ir, :
|
17
|
-
lstring :complementar_valor_iss, :
|
18
|
-
lstring :complementar_valor_iof, :
|
19
|
-
lstring :complementar_valor_outras_deducoes, :
|
20
|
-
lstring :complementar_valor_outros_acrescimos, :
|
15
|
+
lstring :complementar_valor_ir, length: 15, pad_byte: '0'
|
16
|
+
lstring :complementar_valor_iss, length: 15, pad_byte: '0'
|
17
|
+
lstring :complementar_valor_iof, length: 15, pad_byte: '0'
|
18
|
+
lstring :complementar_valor_outras_deducoes, length: 15, pad_byte: '0'
|
19
|
+
lstring :complementar_valor_outros_acrescimos, length: 15, pad_byte: '0'
|
21
20
|
|
22
|
-
lstring :substituta_agencia, :
|
23
|
-
string :substituta_agencia_dv, :
|
24
|
-
lstring :substituta_numero_cc, :
|
25
|
-
string :substituta_conta_dv, :
|
26
|
-
string :substituta_agencia_conta_dv, :
|
21
|
+
lstring :substituta_agencia, length: 5, pad_byte: '0'
|
22
|
+
string :substituta_agencia_dv, length: 1, pad_byte: ' '
|
23
|
+
lstring :substituta_numero_cc, length: 12, pad_byte: '0'
|
24
|
+
string :substituta_conta_dv, length: 1, pad_byte: ' '
|
25
|
+
string :substituta_agencia_conta_dv, length: 1, pad_byte: ' '
|
27
26
|
|
28
|
-
lstring :valor_inss, :
|
27
|
+
lstring :valor_inss, length: 15, pad_byte: '0'
|
29
28
|
|
30
|
-
string :cnab_g004_2, :
|
29
|
+
string :cnab_g004_2, length: 113, pad_byte: ' '
|
31
30
|
end
|
32
|
-
end
|
31
|
+
end
|
@@ -1,33 +1,32 @@
|
|
1
1
|
module Cnab240::V87
|
2
2
|
class SegmentoJ < BinData::Record
|
3
|
-
|
4
3
|
include Cnab240::DefaultMixin
|
5
4
|
include Cnab240::SegmentoMixin
|
6
5
|
|
7
|
-
lstring :controle_banco, :
|
8
|
-
lstring :controle_lote, :
|
9
|
-
lstring :controle_registro, :
|
6
|
+
lstring :controle_banco, length: 3, pad_byte: '0'
|
7
|
+
lstring :controle_lote, length: 4, pad_byte: '0'
|
8
|
+
lstring :controle_registro, length: 1, initial_value: '3', pad_byte: '0'
|
10
9
|
|
11
|
-
lstring :servico_numero_registro, :
|
12
|
-
string :servico_codigo_segmento, :
|
13
|
-
lstring :servico_tipo_movimento, :
|
14
|
-
lstring :servico_codigo_movimento, :
|
10
|
+
lstring :servico_numero_registro, length: 5, pad_byte: '0'
|
11
|
+
string :servico_codigo_segmento, length: 1, initial_value: 'J', pad_byte: ' '
|
12
|
+
lstring :servico_tipo_movimento, length: 1, pad_byte: '0'
|
13
|
+
lstring :servico_codigo_movimento, length: 2, pad_byte: '0'
|
15
14
|
|
16
|
-
string :codigo_barras, :
|
17
|
-
string :nome_cedente, :
|
18
|
-
lstring :data_vencimento, :
|
19
|
-
lstring :valor_titulo, :
|
20
|
-
lstring :valor_desconto_abatimento, :
|
21
|
-
lstring :valor_mora_juros, :
|
22
|
-
lstring :data_pagamento, :
|
23
|
-
lstring :valor_pagamento, :
|
24
|
-
lstring :quantidade_moeda, :
|
25
|
-
string :referencia_sacado, :
|
15
|
+
string :codigo_barras, length: 44, pad_byte: ' '
|
16
|
+
string :nome_cedente, length: 30, pad_byte: ' '
|
17
|
+
lstring :data_vencimento, length: 8, pad_byte: '0'
|
18
|
+
lstring :valor_titulo, length: 15, pad_byte: '0'
|
19
|
+
lstring :valor_desconto_abatimento, length: 15, pad_byte: '0'
|
20
|
+
lstring :valor_mora_juros, length: 15, pad_byte: '0'
|
21
|
+
lstring :data_pagamento, length: 8, pad_byte: '0'
|
22
|
+
lstring :valor_pagamento, length: 15, pad_byte: '0'
|
23
|
+
lstring :quantidade_moeda, length: 15, pad_byte: '0'
|
24
|
+
string :referencia_sacado, length: 20, pad_byte: ' '
|
26
25
|
|
27
|
-
string :nosso_numero, :
|
28
|
-
lstring :codigo_moeda, :
|
26
|
+
string :nosso_numero, length: 20, pad_byte: ' '
|
27
|
+
lstring :codigo_moeda, length: 2, pad_byte: '0'
|
29
28
|
|
30
|
-
string :cnab_g004_1, :
|
31
|
-
string :ocorrencias, :
|
29
|
+
string :cnab_g004_1, length: 6, pad_byte: ' '
|
30
|
+
string :ocorrencias, length: 10, pad_byte: ' '
|
32
31
|
end
|
33
|
-
end
|
32
|
+
end
|
@@ -1,32 +1,31 @@
|
|
1
1
|
module Cnab240::V87
|
2
2
|
class SegmentoJ52 < BinData::Record
|
3
|
-
|
4
3
|
include Cnab240::DefaultMixin
|
5
4
|
include Cnab240::SegmentoMixin
|
6
5
|
|
7
|
-
lstring :controle_banco, :
|
8
|
-
lstring :controle_lote, :
|
9
|
-
string :controle_registro, :
|
6
|
+
lstring :controle_banco, length: 3, pad_byte: '0'
|
7
|
+
lstring :controle_lote, length: 4, pad_byte: '0'
|
8
|
+
string :controle_registro, length: 1, initial_value: '3', pad_byte: '0'
|
10
9
|
|
11
|
-
lstring :servico_numero_registro, :
|
12
|
-
string :servico_codigo_segmento, :
|
13
|
-
lstring :servico_tipo_movimento, :
|
14
|
-
lstring :servico_codigo_movimento, :
|
10
|
+
lstring :servico_numero_registro, length: 5, pad_byte: '0'
|
11
|
+
string :servico_codigo_segmento, length: 1, initial_value: 'J', pad_byte: ' '
|
12
|
+
lstring :servico_tipo_movimento, length: 1, pad_byte: '0'
|
13
|
+
lstring :servico_codigo_movimento, length: 2, pad_byte: '0'
|
15
14
|
|
16
|
-
string :cod_registro_opcional, :
|
15
|
+
string :cod_registro_opcional, length: 2, initial_value: '52'
|
17
16
|
|
18
|
-
lstring :sacado_tipo_inscricao, :
|
19
|
-
lstring :sacado_numero_inscricao, :
|
20
|
-
string :sacado_nome, :
|
17
|
+
lstring :sacado_tipo_inscricao, length: 1, pad_byte: '0'
|
18
|
+
lstring :sacado_numero_inscricao, length: 15, pad_byte: '0'
|
19
|
+
string :sacado_nome, length: 40, pad_byte: ' '
|
21
20
|
|
22
|
-
lstring :cedente_tipo_inscricao, :
|
23
|
-
lstring :cedente_numero_inscricao, :
|
24
|
-
string :cedente_nome, :
|
21
|
+
lstring :cedente_tipo_inscricao, length: 1, pad_byte: '0'
|
22
|
+
lstring :cedente_numero_inscricao, length: 15, pad_byte: '0'
|
23
|
+
string :cedente_nome, length: 40, pad_byte: ' '
|
25
24
|
|
26
|
-
lstring :sacador_tipo_inscricao, :
|
27
|
-
lstring :sacador_numero_inscricao, :
|
28
|
-
string :sacador_nome, :
|
25
|
+
lstring :sacador_tipo_inscricao, length: 1, pad_byte: '0'
|
26
|
+
lstring :sacador_numero_inscricao, length: 15, pad_byte: '0'
|
27
|
+
string :sacador_nome, length: 40, pad_byte: ' '
|
29
28
|
|
30
|
-
string :cnab_g004_1, :
|
29
|
+
string :cnab_g004_1, length: 53, pad_byte: ' '
|
31
30
|
end
|
32
|
-
end
|
31
|
+
end
|
@@ -1,27 +1,26 @@
|
|
1
1
|
module Cnab240::V87
|
2
2
|
class SegmentoN < BinData::Record
|
3
|
-
|
4
3
|
include Cnab240::DefaultMixin
|
5
4
|
include Cnab240::SegmentoMixin
|
6
5
|
|
7
|
-
lstring :controle_banco, :
|
8
|
-
lstring :controle_lote, :
|
9
|
-
string :controle_registro, :
|
6
|
+
lstring :controle_banco, length: 3, pad_byte: '0'
|
7
|
+
lstring :controle_lote, length: 4, pad_byte: '0'
|
8
|
+
string :controle_registro, length: 1, initial_value: '3', pad_byte: '0'
|
10
9
|
|
11
|
-
lstring :servico_numero_registro, :
|
12
|
-
string :servico_codigo_segmento, :
|
13
|
-
lstring :servico_tipo_movimento, :
|
14
|
-
lstring :servico_codigo_movimento, :
|
10
|
+
lstring :servico_numero_registro, length: 5, pad_byte: '0'
|
11
|
+
string :servico_codigo_segmento, length: 1, initial_value: 'N', pad_byte: ' '
|
12
|
+
lstring :servico_tipo_movimento, length: 1, pad_byte: '0'
|
13
|
+
lstring :servico_codigo_movimento, length: 2, pad_byte: '0'
|
15
14
|
|
16
|
-
string :seu_numero, :
|
17
|
-
string :nosso_numero, :
|
18
|
-
string :contribuinte, :
|
19
|
-
lstring :data_pagamento, :
|
20
|
-
lstring :valor_pagamento, :
|
15
|
+
string :seu_numero, length: 20, pad_byte: ' '
|
16
|
+
string :nosso_numero, length: 20, pad_byte: ' '
|
17
|
+
string :contribuinte, length: 30, pad_byte: ' '
|
18
|
+
lstring :data_pagamento, length: 8, pad_byte: '0'
|
19
|
+
lstring :valor_pagamento, length: 15, pad_byte: '0'
|
21
20
|
|
22
21
|
# string :informacoes_complementares, :length => 120, :pad_byte => ' '
|
23
|
-
choice :n_complemento, :
|
24
|
-
string 0, :
|
22
|
+
choice :n_complemento, selection: :get_n do
|
23
|
+
string 0, length: 120, pad_byte: ' '
|
25
24
|
segmento_n1 1
|
26
25
|
segmento_n1 2
|
27
26
|
segmento_n3 3
|
@@ -32,7 +31,7 @@ module Cnab240::V87
|
|
32
31
|
segmento_n8 8
|
33
32
|
end
|
34
33
|
|
35
|
-
string :ocorrencias, :
|
34
|
+
string :ocorrencias, length: 10, pad_byte: ' '
|
36
35
|
|
37
36
|
def get_n
|
38
37
|
servico_forma_nX = {
|
@@ -53,7 +52,7 @@ module Cnab240::V87
|
|
53
52
|
rescue
|
54
53
|
servico_forma = '00'
|
55
54
|
end
|
56
|
-
|
55
|
+
servico_forma_nX[servico_forma]
|
57
56
|
end
|
58
57
|
end
|
59
|
-
end
|
58
|
+
end
|
@@ -1,19 +1,18 @@
|
|
1
1
|
module Cnab240::V87
|
2
2
|
class SegmentoN1 < BinData::Record
|
3
|
-
|
4
3
|
include Cnab240::DefaultMixin
|
5
4
|
include Cnab240::SegmentoMixin
|
6
5
|
|
7
|
-
string :receita, :
|
8
|
-
lstring :tipo_identificacao_contribuinte, :
|
9
|
-
lstring :identificacao_contribuinte, :
|
10
|
-
string :identificacao_tributo, :
|
6
|
+
string :receita, length: 6, pad_byte: ' '
|
7
|
+
lstring :tipo_identificacao_contribuinte, length: 2, pad_byte: '0'
|
8
|
+
lstring :identificacao_contribuinte, length: 14, pad_byte: '0'
|
9
|
+
string :identificacao_tributo, length: 2, pad_byte: ' '
|
11
10
|
|
12
|
-
lstring :mes_ano_competencia, :
|
13
|
-
lstring :valor_tributo, :
|
14
|
-
lstring :valor_outras_entidades, :
|
15
|
-
lstring :atualizacao_monetaria, :
|
11
|
+
lstring :mes_ano_competencia, length: 6, pad_byte: '0'
|
12
|
+
lstring :valor_tributo, length: 15, pad_byte: '0'
|
13
|
+
lstring :valor_outras_entidades, length: 15, pad_byte: '0'
|
14
|
+
lstring :atualizacao_monetaria, length: 15, pad_byte: '0'
|
16
15
|
|
17
|
-
string :cnab, :
|
16
|
+
string :cnab, length: 45, pad_byte: ' '
|
18
17
|
end
|
19
|
-
end
|
18
|
+
end
|
@@ -1,21 +1,20 @@
|
|
1
1
|
module Cnab240::V87
|
2
2
|
class SegmentoN2 < BinData::Record
|
3
|
-
|
4
3
|
include Cnab240::DefaultMixin
|
5
4
|
include Cnab240::SegmentoMixin
|
6
5
|
|
7
|
-
string :receita, :
|
8
|
-
lstring :tipo_identificacao_contribuinte, :
|
9
|
-
lstring :identificacao_contribuinte, :
|
10
|
-
string :identificacao_tributo, :
|
6
|
+
string :receita, length: 6, pad_byte: ' '
|
7
|
+
lstring :tipo_identificacao_contribuinte, length: 2, pad_byte: '0'
|
8
|
+
lstring :identificacao_contribuinte, length: 14, pad_byte: '0'
|
9
|
+
string :identificacao_tributo, length: 2, pad_byte: ' '
|
11
10
|
|
12
|
-
lstring :periodo_apuracao, :
|
13
|
-
lstring :numero_referencia, :
|
14
|
-
lstring :valor_principal, :
|
15
|
-
lstring :valor_multa, :
|
16
|
-
lstring :valor_juros_encargos, :
|
17
|
-
lstring :data_vencimento, :
|
11
|
+
lstring :periodo_apuracao, length: 8, pad_byte: '0'
|
12
|
+
lstring :numero_referencia, length: 17, pad_byte: '0'
|
13
|
+
lstring :valor_principal, length: 15, pad_byte: '0'
|
14
|
+
lstring :valor_multa, length: 15, pad_byte: '0'
|
15
|
+
lstring :valor_juros_encargos, length: 15, pad_byte: '0'
|
16
|
+
lstring :data_vencimento, length: 8, pad_byte: '0'
|
18
17
|
|
19
|
-
string :cnab, :
|
18
|
+
string :cnab, length: 18, pad_byte: ' '
|
20
19
|
end
|
21
|
-
end
|
20
|
+
end
|
@@ -1,21 +1,20 @@
|
|
1
1
|
module Cnab240::V87
|
2
2
|
class SegmentoN3 < BinData::Record
|
3
|
-
|
4
3
|
include Cnab240::DefaultMixin
|
5
4
|
include Cnab240::SegmentoMixin
|
6
5
|
|
7
|
-
string :receita, :
|
8
|
-
lstring :tipo_identificacao_contribuinte, :
|
9
|
-
lstring :identificacao_contribuinte, :
|
10
|
-
string :identificacao_tributo, :
|
6
|
+
string :receita, length: 6, pad_byte: ' '
|
7
|
+
lstring :tipo_identificacao_contribuinte, length: 2, pad_byte: '0'
|
8
|
+
lstring :identificacao_contribuinte, length: 14, pad_byte: '0'
|
9
|
+
string :identificacao_tributo, length: 2, pad_byte: ' '
|
11
10
|
|
12
|
-
lstring :periodo_apuracao, :
|
13
|
-
lstring :receita_bruta, :
|
14
|
-
lstring :percentual, :
|
15
|
-
lstring :valor_principal, :
|
16
|
-
lstring :valor_multa, :
|
17
|
-
lstring :valor_juros_encargos, :
|
11
|
+
lstring :periodo_apuracao, length: 8, pad_byte: '0'
|
12
|
+
lstring :receita_bruta, length: 15, pad_byte: '0'
|
13
|
+
lstring :percentual, length: 7, pad_byte: '0'
|
14
|
+
lstring :valor_principal, length: 15, pad_byte: '0'
|
15
|
+
lstring :valor_multa, length: 15, pad_byte: '0'
|
16
|
+
lstring :valor_juros_encargos, length: 15, pad_byte: '0'
|
18
17
|
|
19
|
-
string :cnab, :
|
18
|
+
string :cnab, length: 21, pad_byte: ' '
|
20
19
|
end
|
21
|
-
end
|
20
|
+
end
|
@@ -1,23 +1,22 @@
|
|
1
1
|
module Cnab240::V87
|
2
2
|
class SegmentoN4 < BinData::Record
|
3
|
-
|
4
3
|
include Cnab240::DefaultMixin
|
5
4
|
include Cnab240::SegmentoMixin
|
6
5
|
|
7
|
-
string :receita, :
|
8
|
-
lstring :tipo_identificacao_contribuinte, :
|
9
|
-
lstring :identificacao_contribuinte, :
|
10
|
-
string :identificacao_tributo, :
|
6
|
+
string :receita, length: 6, pad_byte: ' '
|
7
|
+
lstring :tipo_identificacao_contribuinte, length: 2, pad_byte: '0'
|
8
|
+
lstring :identificacao_contribuinte, length: 14, pad_byte: '0'
|
9
|
+
string :identificacao_tributo, length: 2, pad_byte: ' '
|
11
10
|
|
12
|
-
lstring :vencimento, :
|
13
|
-
lstring :ie_munic_declar, :
|
14
|
-
lstring :divida_ativa_etiqueta, :
|
15
|
-
lstring :periodo_referencia, :
|
16
|
-
lstring :numero_parcela_notificacao, :
|
17
|
-
lstring :valor_receita, :
|
18
|
-
lstring :valor_juros_encargos, :
|
19
|
-
lstring :valor_multa, :
|
11
|
+
lstring :vencimento, length: 8, pad_byte: '0'
|
12
|
+
lstring :ie_munic_declar, length: 12, pad_byte: '0'
|
13
|
+
lstring :divida_ativa_etiqueta, length: 13, pad_byte: '0'
|
14
|
+
lstring :periodo_referencia, length: 6, pad_byte: '0'
|
15
|
+
lstring :numero_parcela_notificacao, length: 13, pad_byte: '0'
|
16
|
+
lstring :valor_receita, length: 15, pad_byte: '0'
|
17
|
+
lstring :valor_juros_encargos, length: 14, pad_byte: '0'
|
18
|
+
lstring :valor_multa, length: 14, pad_byte: '0'
|
20
19
|
|
21
|
-
string :cnab, :
|
20
|
+
string :cnab, length: 1, pad_byte: ' '
|
22
21
|
end
|
23
|
-
end
|
22
|
+
end
|
@@ -1,21 +1,20 @@
|
|
1
1
|
module Cnab240::V87
|
2
2
|
class SegmentoN5 < BinData::Record
|
3
|
-
|
4
3
|
include Cnab240::DefaultMixin
|
5
4
|
include Cnab240::SegmentoMixin
|
6
5
|
|
7
|
-
string :receita, :
|
8
|
-
lstring :tipo_identificacao_contribuinte, :
|
9
|
-
lstring :identificacao_contribuinte, :
|
10
|
-
string :identificacao_tributo, :
|
6
|
+
string :receita, length: 6, pad_byte: ' '
|
7
|
+
lstring :tipo_identificacao_contribuinte, length: 2, pad_byte: '0'
|
8
|
+
lstring :identificacao_contribuinte, length: 14, pad_byte: '0'
|
9
|
+
string :identificacao_tributo, length: 2, pad_byte: ' '
|
11
10
|
|
12
|
-
lstring :exercicio, :
|
13
|
-
lstring :renavam, :
|
14
|
-
string :uf, :
|
15
|
-
lstring :municipio, :
|
16
|
-
string :placa, :
|
17
|
-
string :opcao_pagamento, :
|
11
|
+
lstring :exercicio, length: 4, pad_byte: '0'
|
12
|
+
lstring :renavam, length: 9, pad_byte: '0'
|
13
|
+
string :uf, length: 2, pad_byte: ' '
|
14
|
+
lstring :municipio, length: 5, pad_byte: '0'
|
15
|
+
string :placa, length: 7, pad_byte: ' '
|
16
|
+
string :opcao_pagamento, length: 1, pad_byte: ' '
|
18
17
|
|
19
|
-
string :cnab, :
|
18
|
+
string :cnab, length: 68, pad_byte: ' '
|
20
19
|
end
|
21
|
-
end
|
20
|
+
end
|