formatos-febraban 0.1.0
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.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +1 -0
- data/base/format_section.rb +79 -0
- data/base/position.rb +88 -0
- data/base/section.rb +41 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/formatos-febraban.gemspec +24 -0
- data/formats/febraban150/febraban_150.rb +505 -0
- data/formats/febraban150/febraban_150_a.rb +210 -0
- data/formats/febraban150/febraban_150_b.rb +132 -0
- data/formats/febraban150/febraban_150_c.rb +149 -0
- data/formats/febraban150/febraban_150_d.rb +149 -0
- data/formats/febraban150/febraban_150_e.rb +226 -0
- data/formats/febraban150/febraban_150_f.rb +271 -0
- data/formats/febraban150/febraban_150_h.rb +149 -0
- data/formats/febraban150/febraban_150_i.rb +151 -0
- data/formats/febraban150/febraban_150_j.rb +130 -0
- data/formats/febraban150/febraban_150_k.rb +188 -0
- data/formats/febraban150/febraban_150_l.rb +114 -0
- data/formats/febraban150/febraban_150_t.rb +74 -0
- data/formats/febraban150/febraban_150_x.rb +214 -0
- data/formats/febraban150/febraban_150_z.rb +74 -0
- data/lib/formatos/febraban.rb +7 -0
- data/lib/formatos/febraban/version.rb +5 -0
- metadata +103 -0
@@ -0,0 +1,149 @@
|
|
1
|
+
|
2
|
+
#-------------------------------------------------------------------
|
3
|
+
#-------------------------------------------------------------------
|
4
|
+
# Ocorrência da Alteração Cliente/Empresa - Banco
|
5
|
+
class Febraban150H < FormatSection
|
6
|
+
def initialize master
|
7
|
+
super(master, true, false)
|
8
|
+
|
9
|
+
@section = Section.new({
|
10
|
+
0 => Position.new(1, 1, false, "H", true), # Código do Registro
|
11
|
+
1 => Position.new(2, 25, false), # Identificação do Cliente Empresa Old
|
12
|
+
2 => Position.new(3, 4, false), # Agência para Débito
|
13
|
+
3 => Position.new(4, 14, false), # Identificação Cliente Banco
|
14
|
+
4 => Position.new(5, 25, false), # Identificação do Cliente Empresa New
|
15
|
+
5 => Position.new(6, 58, false), # Ocorrência
|
16
|
+
6 => Position.new(7, 22, false), # Reservado pelo Sistema
|
17
|
+
7 => Position.new(8, 1, true) # Código de Movimento (Seção D)
|
18
|
+
})
|
19
|
+
end
|
20
|
+
|
21
|
+
#-------------------------------------------------------------------
|
22
|
+
#-------------------------------------------------------------------
|
23
|
+
# Gerais
|
24
|
+
def process_section file
|
25
|
+
self.set_id_cliente_empresa_old file[1..25]
|
26
|
+
self.set_agencia_debito file[26..29]
|
27
|
+
self.set_id_cliente_banco file[30..43]
|
28
|
+
self.set_id_cliente_empresa_new file[44..68]
|
29
|
+
self.set_ocorrencia file[69..128]
|
30
|
+
self.set_reservado file[129..148]
|
31
|
+
self.set_cod_movimento file[149..149]
|
32
|
+
end
|
33
|
+
|
34
|
+
#-------------------------------------------------------------------
|
35
|
+
#-------------------------------------------------------------------
|
36
|
+
# Validações
|
37
|
+
def is_valid?
|
38
|
+
result = (self.get_id_cliente_empresa_old.length > 0 and
|
39
|
+
self.get_agencia_debito.length > 0 and
|
40
|
+
self.get_id_cliente_banco.length > 0 and
|
41
|
+
self.get_id_cliente_empresa_new.length > 0 and
|
42
|
+
self.get_ocorrencia.length > 0 and
|
43
|
+
(self.get_cod_movimento == 0 or
|
44
|
+
self.get_cod_movimento == 1))
|
45
|
+
end
|
46
|
+
|
47
|
+
#-------------------------------------------------------------------
|
48
|
+
#-------------------------------------------------------------------
|
49
|
+
# Getters
|
50
|
+
def get_id_cliente_empresa_old
|
51
|
+
self.get_section_value(1)
|
52
|
+
end
|
53
|
+
|
54
|
+
def get_agencia_debito
|
55
|
+
self.get_section_value(2)
|
56
|
+
end
|
57
|
+
|
58
|
+
def get_id_cliente_banco
|
59
|
+
self.get_section_value(3)
|
60
|
+
end
|
61
|
+
|
62
|
+
def get_id_cliente_empresa_new
|
63
|
+
self.get_section_value(4)
|
64
|
+
end
|
65
|
+
|
66
|
+
def get_ocorrencia
|
67
|
+
self.get_section_value(5)
|
68
|
+
end
|
69
|
+
|
70
|
+
def get_cod_movimento
|
71
|
+
self.get_section_value(7).to_i
|
72
|
+
end
|
73
|
+
|
74
|
+
#-------------------------------------------------------------------
|
75
|
+
#-------------------------------------------------------------------
|
76
|
+
# Setters
|
77
|
+
def set_id_cliente_empresa_old id_cliente_empresa
|
78
|
+
id_cliente_empresa = id_cliente_empresa.to_s
|
79
|
+
|
80
|
+
if id_cliente_empresa.length > 0
|
81
|
+
self.set_section_value(1, id_cliente_empresa)
|
82
|
+
else
|
83
|
+
raise "#{self.get_id}: Identificação do Cliente da Empresa Anterior não pode estar vazio
|
84
|
+
Valor: #{id_cliente_empresa}"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def set_agencia_debito agencia_debito
|
89
|
+
agencia_debito = agencia_debito.to_s
|
90
|
+
|
91
|
+
if agencia_debito.length > 0
|
92
|
+
self.set_section_value(2, agencia_debito)
|
93
|
+
else
|
94
|
+
raise "#{self.get_id}: Agência do Débito não pode estar vazia
|
95
|
+
Valor: #{agencia_debito}"
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def set_id_cliente_banco id_cliente_banco
|
100
|
+
id_cliente_banco = id_cliente_banco.to_s
|
101
|
+
|
102
|
+
if id_cliente_banco.length > 0
|
103
|
+
self.set_section_value(3, id_cliente_banco)
|
104
|
+
else
|
105
|
+
raise "#{self.get_id}: Identificação do Cliente do Banco não pode estar vazio
|
106
|
+
Valor: #{id_cliente_banco}"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def set_id_cliente_empresa_new id_cliente_empresa
|
111
|
+
id_cliente_empresa = id_cliente_empresa.to_s
|
112
|
+
|
113
|
+
if id_cliente_empresa.length > 0
|
114
|
+
self.set_section_value(4, id_cliente_empresa)
|
115
|
+
else
|
116
|
+
raise "#{self.get_id}: Identificação do Cliente da Empresa Novo não pode estar vazio
|
117
|
+
Valor: #{id_cliente_empresa}"
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def set_ocorrencia ocorrencia
|
122
|
+
ocorrencia = ocorrencia.to_s
|
123
|
+
|
124
|
+
if ocorrencia.length > 0
|
125
|
+
self.set_section_value(5, ocorrencia)
|
126
|
+
else
|
127
|
+
raise "#{self.get_id}: Motivo de Alteração não pode estar vazio
|
128
|
+
Valor: #{ocorrencia}"
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def set_reservado reservado
|
133
|
+
reservado = reservado.to_s
|
134
|
+
self.set_section_value(6, reservado)
|
135
|
+
end
|
136
|
+
|
137
|
+
def set_cod_movimento cod_movimento
|
138
|
+
cod_movimento = cod_movimento.to_i
|
139
|
+
|
140
|
+
if cod_movimento == 0 or cod_movimento == 1
|
141
|
+
self.set_section_value(7, cod_movimento)
|
142
|
+
else
|
143
|
+
raise "#{self.get_id}: Código de Movimentação deve ser de Exclusão ou Inclusão:
|
144
|
+
0 = Alteração da Identificação do Cliente na Empresa
|
145
|
+
1 = Exclusão de optante do Débito Automático, solicitado pela Empresa
|
146
|
+
Valor: #{cod_movimento}"
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
@@ -0,0 +1,151 @@
|
|
1
|
+
|
2
|
+
#-------------------------------------------------------------------
|
3
|
+
#-------------------------------------------------------------------
|
4
|
+
# Incentivo de Débito Automático - Empresa
|
5
|
+
class Febraban150I < FormatSection
|
6
|
+
def initialize master
|
7
|
+
super(master, false, true)
|
8
|
+
|
9
|
+
@section = Section.new({
|
10
|
+
0 => Position.new(1, 1, false, "I", true), # Código do Registro
|
11
|
+
1 => Position.new(2, 25, false), # Identificação do Cliente Empresa
|
12
|
+
2 => Position.new(3, 1, false), # Tipo de Identificação (1-CPF, 2-CNPJ)
|
13
|
+
3 => Position.new(4, 14, true), # Identificação
|
14
|
+
4 => Position.new(5, 40, false), # Nome do Consumidor
|
15
|
+
5 => Position.new(6, 30, false), # Cidade do Consumidor
|
16
|
+
6 => Position.new(7, 2, false), # Estado do Consumidor
|
17
|
+
7 => Position.new(8, 37, false) # Reservado pelo Sistema
|
18
|
+
}, true)
|
19
|
+
end
|
20
|
+
|
21
|
+
#-------------------------------------------------------------------
|
22
|
+
#-------------------------------------------------------------------
|
23
|
+
# Gerais
|
24
|
+
def process_section file
|
25
|
+
self.set_id_cliente_empresa file[1..25]
|
26
|
+
self.set_tipo_id_cliente file[26..26]
|
27
|
+
self.set_id_cliente file[27..40]
|
28
|
+
self.set_nome file[41..80]
|
29
|
+
self.set_cidade file[81..110]
|
30
|
+
self.set_estado file[111..112]
|
31
|
+
self.set_reservado file[113..149]
|
32
|
+
end
|
33
|
+
|
34
|
+
#-------------------------------------------------------------------
|
35
|
+
#-------------------------------------------------------------------
|
36
|
+
# Validações
|
37
|
+
def is_valid?
|
38
|
+
result = (self.get_id_cliente_empresa.length > 0 and
|
39
|
+
(self.get_tipo_id_cliente == 1 or
|
40
|
+
self.get_tipo_id_cliente == 2) and
|
41
|
+
self.get_id_cliente.length == 15 and
|
42
|
+
self.get_nome.length > 0 and
|
43
|
+
self.get_cidade.length > 0 and
|
44
|
+
self.get_estado.length > 0)
|
45
|
+
end
|
46
|
+
|
47
|
+
#-------------------------------------------------------------------
|
48
|
+
#-------------------------------------------------------------------
|
49
|
+
# Getters
|
50
|
+
def get_id_cliente_empresa
|
51
|
+
self.get_section_value(1)
|
52
|
+
end
|
53
|
+
|
54
|
+
def get_tipo_id_cliente
|
55
|
+
self.get_section_value(2).to_i
|
56
|
+
end
|
57
|
+
|
58
|
+
def get_id_cliente
|
59
|
+
self.get_section_value(3).to_i
|
60
|
+
end
|
61
|
+
|
62
|
+
def get_nome
|
63
|
+
self.get_section_value(4)
|
64
|
+
end
|
65
|
+
|
66
|
+
def get_cidade
|
67
|
+
self.get_section_value(5)
|
68
|
+
end
|
69
|
+
|
70
|
+
def get_estado
|
71
|
+
self.get_section_value(6)
|
72
|
+
end
|
73
|
+
|
74
|
+
#-------------------------------------------------------------------
|
75
|
+
#-------------------------------------------------------------------
|
76
|
+
# Setters
|
77
|
+
def set_id_cliente_empresa id_cliente_empresa
|
78
|
+
id_cliente_empresa = id_cliente_empresa.to_s
|
79
|
+
|
80
|
+
if id_cliente_empresa.length > 0
|
81
|
+
self.set_section_value(1, id_cliente_empresa)
|
82
|
+
else
|
83
|
+
raise "#{self.get_id}: Identificação do Cliente da Empresa não pode estar vazio
|
84
|
+
Valor: #{id_cliente_empresa}"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def set_tipo_id_cliente tipo_id_cliente
|
89
|
+
tipo_id_cliente = tipo_id_cliente.to_i
|
90
|
+
|
91
|
+
if tipo_id_cliente == 1 or tipo_id_cliente == 2
|
92
|
+
self.set_section_value(2, tipo_id_cliente)
|
93
|
+
else
|
94
|
+
raise "#{self.get_id}: Tipo de Identificação do Cliente deve ser:
|
95
|
+
1 - CNPJ; 2 - CPF
|
96
|
+
Valor: #{tipo_id_cliente}"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def set_id_cliente id_cliente
|
101
|
+
id_cliente = id_cliente.to_s
|
102
|
+
id_cliente.to_i
|
103
|
+
|
104
|
+
if id_cliente.length == 15
|
105
|
+
self.set_section_value(9, id_cliente)
|
106
|
+
else
|
107
|
+
raise "#{self.get_id}: Identificação do Cliente deve ser CPF ou CNPJ:
|
108
|
+
CNPJ: 999999999 = Número, 9999 = Filial, e 99 = DV
|
109
|
+
CPF: 0000999999999 = Número, 99 = DV
|
110
|
+
Valor: #{id_cliente}"
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def set_nome nome
|
115
|
+
nome = nome.to_s
|
116
|
+
|
117
|
+
if nome.length > 0
|
118
|
+
self.set_section_value(4, nome)
|
119
|
+
else
|
120
|
+
raise "#{self.get_id}: Nome do Cliente não pode estar em branco
|
121
|
+
Valor: #{nome}"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def set_cidade cidade
|
126
|
+
cidade = cidade.to_s
|
127
|
+
|
128
|
+
if cidade.length > 0
|
129
|
+
self.set_section_value(5, cidade)
|
130
|
+
else
|
131
|
+
raise "#{self.get_id}: Cidade do Cliente não pode estar em branco
|
132
|
+
Valor: #{cidade}"
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def set_estado estado
|
137
|
+
estado = estado.to_s
|
138
|
+
|
139
|
+
if estado.length > 0
|
140
|
+
self.set_section_value(6, estado)
|
141
|
+
else
|
142
|
+
raise "#{self.get_id}: Estado do Cliente não pode estar em branco
|
143
|
+
Valor: #{estado}"
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
def set_reservado reservado
|
148
|
+
reservado = reservado.to_s
|
149
|
+
self.set_section_value(7, reservado)
|
150
|
+
end
|
151
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
|
2
|
+
#-------------------------------------------------------------------
|
3
|
+
#-------------------------------------------------------------------
|
4
|
+
# Confirmação de Processamento - Empresa/Banco
|
5
|
+
class Febraban150J < FormatSection
|
6
|
+
def initialize master
|
7
|
+
super(master, true, true)
|
8
|
+
|
9
|
+
@section = Section.new({
|
10
|
+
0 => Position.new(1, 1, false, "J", true), # Código do Registro
|
11
|
+
1 => Position.new(2, 6, true), # Número Sequencial
|
12
|
+
2 => Position.new(3, 8, true), # Data de Geração
|
13
|
+
3 => Position.new(4, 6, true), # Total de Registros Processados
|
14
|
+
4 => Position.new(5, 17, true), # Valor total
|
15
|
+
5 => Position.new(6, 8, true), # Data de processamento
|
16
|
+
6 => Position.new(7, 104, false) # Reservado pelo Sistema
|
17
|
+
}, true)
|
18
|
+
end
|
19
|
+
|
20
|
+
#-------------------------------------------------------------------
|
21
|
+
#-------------------------------------------------------------------
|
22
|
+
# Gerais
|
23
|
+
def process_section file
|
24
|
+
self.set_numero_sequencial file[1..6]
|
25
|
+
self.set_data_geracao file[7..14]
|
26
|
+
self.set_total_processados file[15..20]
|
27
|
+
self.set_valor_total file[21..37]
|
28
|
+
self.set_data_processamento file[38..45]
|
29
|
+
self.set_reservado file[46..149]
|
30
|
+
end
|
31
|
+
|
32
|
+
#-------------------------------------------------------------------
|
33
|
+
#-------------------------------------------------------------------
|
34
|
+
# Validações
|
35
|
+
def is_valid?
|
36
|
+
result = (self.get_numero_sequencial > 0 and
|
37
|
+
!self.get_data_geracao.nil? and
|
38
|
+
self.get_total_processados >= 0 and
|
39
|
+
self.get_valor_total >= 0 and
|
40
|
+
!self.get_data_processamento.nil?)
|
41
|
+
end
|
42
|
+
|
43
|
+
#-------------------------------------------------------------------
|
44
|
+
#-------------------------------------------------------------------
|
45
|
+
# Getters
|
46
|
+
def get_numero_sequencial
|
47
|
+
self.set_section_value(1).to_i
|
48
|
+
end
|
49
|
+
|
50
|
+
def get_data_geracao
|
51
|
+
data = self.set_section_value(2)
|
52
|
+
Date.new(data[0..3].to_i, data[4..5].to_i, data[6..7].to_i)
|
53
|
+
end
|
54
|
+
|
55
|
+
def get_total_processados
|
56
|
+
self.set_section_value(3).to_i
|
57
|
+
end
|
58
|
+
|
59
|
+
def get_valor_total
|
60
|
+
self.set_section_value(4).to_i
|
61
|
+
end
|
62
|
+
|
63
|
+
def get_data_processamento
|
64
|
+
data = self.set_section_value(5)
|
65
|
+
Date.new(data[0..3].to_i, data[4..5].to_i, data[6..7].to_i)
|
66
|
+
end
|
67
|
+
|
68
|
+
#-------------------------------------------------------------------
|
69
|
+
#-------------------------------------------------------------------
|
70
|
+
# Setters
|
71
|
+
def set_numero_sequencial numero
|
72
|
+
numero = numero.to_i
|
73
|
+
|
74
|
+
if numero > 0
|
75
|
+
self.set_section_value(1, numero)
|
76
|
+
else
|
77
|
+
raise "#{self.get_id}: Número Sequencial deve ser positivo e maior que 0
|
78
|
+
Valor: #{numero}"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def set_data_geracao data
|
83
|
+
data = data.to_i
|
84
|
+
|
85
|
+
if data > 0
|
86
|
+
self.set_section_value(2, data)
|
87
|
+
else
|
88
|
+
raise "#{self.get_id}: Data de Geração não pode estar vazia
|
89
|
+
Valor: #{data}"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def set_total_processados total
|
94
|
+
total = total.to_i
|
95
|
+
|
96
|
+
if total >= 0
|
97
|
+
self.set_section_value(3, total)
|
98
|
+
else
|
99
|
+
raise "#{self.get_id}: Total de Arquivos Processados deve ser positivo ou 0
|
100
|
+
Valor: #{total}"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def set_valor_total valor
|
105
|
+
valor = valor.to_i
|
106
|
+
|
107
|
+
if valor >= 0
|
108
|
+
self.set_section_value(4, valor)
|
109
|
+
else
|
110
|
+
raise "#{self.get_id}: Valor Total dos Arquivos Processados deve ser positivo ou 0
|
111
|
+
Valor: #{valor}"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def set_data_processamento data
|
116
|
+
data = data.to_i
|
117
|
+
|
118
|
+
if data >= 0
|
119
|
+
self.set_section_value(5, data)
|
120
|
+
else
|
121
|
+
raise "#{self.get_id}: Data de Processamento não pode estar vazia
|
122
|
+
Valor: #{data}"
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def set_reservado reservado
|
127
|
+
reservado = reservado.to_s
|
128
|
+
self.set_section_value(6, reservado)
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,188 @@
|
|
1
|
+
|
2
|
+
#-------------------------------------------------------------------
|
3
|
+
#-------------------------------------------------------------------
|
4
|
+
# Lei 10833, Cobrança não-cumulativa COFINS - Empresa
|
5
|
+
# http://www.planalto.gov.br/ccivil_03/leis/2003/L10.833compilado.htm
|
6
|
+
class Febraban150K < FormatSection
|
7
|
+
def initialize master
|
8
|
+
super(master, false, true)
|
9
|
+
|
10
|
+
@section = Section.new({
|
11
|
+
0 => Position.new(1, 1, false, "K", true), # Código do Registro
|
12
|
+
1 => Position.new(2, 25, false), # Identificação do Cliente Empresa
|
13
|
+
2 => Position.new(3, 4, false), # Agência para Débito
|
14
|
+
3 => Position.new(4, 14, false), # Identificação do Cliente Banco
|
15
|
+
4 => Position.new(5, 2, true), # Tipo de Tratamento
|
16
|
+
5 => Position.new(6, 15, true), # Valor Débito
|
17
|
+
6 => Position.new(7, 4, false), # Código Receita
|
18
|
+
7 => Position.new(8, 1, true), # Tipo de Identificação (1-CPF, 2-CNPJ)
|
19
|
+
8 => Position.new(9, 15, true), # Identificação
|
20
|
+
9 => Position.new(10, 69, false) # Reservado pelo Sistema
|
21
|
+
}, true)
|
22
|
+
end
|
23
|
+
|
24
|
+
#-------------------------------------------------------------------
|
25
|
+
#-------------------------------------------------------------------
|
26
|
+
# Gerais
|
27
|
+
def process_section file
|
28
|
+
self.set_id_cliente_empresa file[1..25]
|
29
|
+
self.set_agencia_debito file[26..29]
|
30
|
+
self.set_id_cliente_banco file[30..43]
|
31
|
+
self.set_tipo_tratamento file[41..45]
|
32
|
+
self.set_valor_debitado file[46..60]
|
33
|
+
self.set_codigo_receita file[61..64]
|
34
|
+
self.set_tipo_id_cliente file[65..65]
|
35
|
+
self.set_id_cliente file[66..80]
|
36
|
+
self.set_reservado file[81..149]
|
37
|
+
end
|
38
|
+
|
39
|
+
#-------------------------------------------------------------------
|
40
|
+
#-------------------------------------------------------------------
|
41
|
+
# Validações
|
42
|
+
def is_valid?
|
43
|
+
result = (self.get_id_cliente_empresa.length > 0 and
|
44
|
+
self.get_agencia_debito.length > 0 and
|
45
|
+
self.get_id_cliente_banco.length > 0 and
|
46
|
+
self.get_tipo_tratamento > 0 and
|
47
|
+
self.get_valor_debitado > 0 and
|
48
|
+
self.get_codigo_receita.length > 0 and
|
49
|
+
(self.get_tipo_id_cliente == 1 or
|
50
|
+
self.get_tipo_id_cliente == 2) and
|
51
|
+
self.get_id_cliente.length == 15)
|
52
|
+
end
|
53
|
+
|
54
|
+
#-------------------------------------------------------------------
|
55
|
+
#-------------------------------------------------------------------
|
56
|
+
# Getters
|
57
|
+
def get_id_cliente_empresa
|
58
|
+
self.get_section_value(1)
|
59
|
+
end
|
60
|
+
|
61
|
+
def get_agencia_debito
|
62
|
+
self.get_section_value(2)
|
63
|
+
end
|
64
|
+
|
65
|
+
def get_id_cliente_banco
|
66
|
+
self.get_section_value(3)
|
67
|
+
end
|
68
|
+
|
69
|
+
def get_tipo_tratamento
|
70
|
+
self.get_section_value(4).to_i
|
71
|
+
end
|
72
|
+
|
73
|
+
def get_valor_debitado
|
74
|
+
self.get_section_value(5).to_i
|
75
|
+
end
|
76
|
+
|
77
|
+
def get_codigo_receita
|
78
|
+
self.get_section_value(6)
|
79
|
+
end
|
80
|
+
|
81
|
+
def get_tipo_id_cliente
|
82
|
+
self.get_section_value(7).to_i
|
83
|
+
end
|
84
|
+
|
85
|
+
def get_id_cliente
|
86
|
+
self.get_section_value(8).to_i
|
87
|
+
end
|
88
|
+
|
89
|
+
#-------------------------------------------------------------------
|
90
|
+
#-------------------------------------------------------------------
|
91
|
+
# Setters
|
92
|
+
def set_id_cliente_empresa id_cliente_empresa
|
93
|
+
id_cliente_empresa = id_cliente_empresa.to_s
|
94
|
+
|
95
|
+
if id_cliente_empresa.length > 0
|
96
|
+
self.set_section_value(1, id_cliente_empresa)
|
97
|
+
else
|
98
|
+
raise "#{self.get_id}: Identificação do Cliente da Empresa não pode estar vazio
|
99
|
+
Valor: #{id_cliente_empresa}"
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def set_agencia_debito agencia_debito
|
104
|
+
agencia_debito = agencia_debito.to_s
|
105
|
+
|
106
|
+
if agencia_debito.length > 0
|
107
|
+
self.set_section_value(2, agencia_debito)
|
108
|
+
else
|
109
|
+
raise "#{self.get_id}: Agência do Débito não pode estar vazia
|
110
|
+
Valor: #{agencia_debito}"
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def set_id_cliente_banco id_cliente_banco
|
115
|
+
id_cliente_banco = id_cliente_banco.to_s
|
116
|
+
|
117
|
+
if id_cliente_banco.length > 0
|
118
|
+
self.set_section_value(3, id_cliente_banco)
|
119
|
+
else
|
120
|
+
raise "#{self.get_id}: Identificação do Cliente do Banco não pode estar vazio
|
121
|
+
Valor: #{id_cliente_banco}"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def set_tipo_tratamento tratamento
|
126
|
+
tratamento = tratamento.to_i
|
127
|
+
|
128
|
+
if tratamento > 0
|
129
|
+
self.set_section_value(4, tratamento)
|
130
|
+
else
|
131
|
+
raise "#{self.get_id}: Tipo de Tratamento não pode estar vazio
|
132
|
+
Valor: #{tratamento}"
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def set_valor_debitado valor
|
137
|
+
valor = valor.to_i
|
138
|
+
|
139
|
+
if valor > 0
|
140
|
+
self.set_section_value(5, valor)
|
141
|
+
else
|
142
|
+
raise "#{self.get_id}: Valor a ser Debitado deve ser positivo ou 0
|
143
|
+
Valor: #{valor}"
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
def set_codigo_receita codigo
|
148
|
+
codigo = codigo.to_s
|
149
|
+
|
150
|
+
if codigo.length > 0
|
151
|
+
self.set_section_value(6, codigo)
|
152
|
+
else
|
153
|
+
raise "#{self.get_id}: Valor a ser Debitado deve ser positivo ou 0
|
154
|
+
Valor: #{codigo}"
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
def set_tipo_id_cliente tipo_id_cliente
|
159
|
+
tipo_id_cliente = tipo_id_cliente.to_i
|
160
|
+
|
161
|
+
if tipo_id_cliente == 1 or tipo_id_cliente == 2
|
162
|
+
self.set_section_value(7, tipo_id_cliente)
|
163
|
+
else
|
164
|
+
raise "#{self.get_id}: Tipo de Identificação do Cliente deve ser:
|
165
|
+
1 - CNPJ; 2 - CPF
|
166
|
+
Valor: #{tipo_id_cliente}"
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
def set_id_cliente id_cliente
|
171
|
+
id_cliente = id_cliente.to_s
|
172
|
+
id_cliente.to_i
|
173
|
+
|
174
|
+
if id_cliente.length == 15
|
175
|
+
self.set_section_value(9, id_cliente)
|
176
|
+
else
|
177
|
+
raise "#{self.get_id}: Identificação do Cliente deve ser CPF ou CNPJ:
|
178
|
+
CNPJ: 999999999 = Número, 9999 = Filial, e 99 = DV
|
179
|
+
CPF: 0000999999999 = Número, 99 = DV
|
180
|
+
Valor: #{id_cliente}"
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
def set_reservado reservado
|
185
|
+
reservado = reservado.to_s
|
186
|
+
self.set_section_value(9, reservado)
|
187
|
+
end
|
188
|
+
end
|