odorico 1.0.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.
Files changed (31) hide show
  1. checksums.yaml +7 -0
  2. data/bin/odorico +3 -0
  3. data/lib/odorico/arquivo_atestado_de_saude_ocupacional.rb +60 -0
  4. data/lib/odorico/arquivo_aviso_previo.rb +69 -0
  5. data/lib/odorico/arquivo_cargo.rb +60 -0
  6. data/lib/odorico/arquivo_comunicacao_de_acidente_de_trabalho.rb +86 -0
  7. data/lib/odorico/arquivo_condicao_ambiental_de_trabalho.rb +83 -0
  8. data/lib/odorico/arquivo_data.rb +251 -0
  9. data/lib/odorico/arquivo_empregado.rb +401 -0
  10. data/lib/odorico/arquivo_empregado_afastamento_inicio.rb +109 -0
  11. data/lib/odorico/arquivo_empregado_afastamento_termino.rb +102 -0
  12. data/lib/odorico/arquivo_empregado_desligamento.rb +237 -0
  13. data/lib/odorico/arquivo_empregado_historico_cadastral.rb +194 -0
  14. data/lib/odorico/arquivo_empregado_historico_contratual.rb +157 -0
  15. data/lib/odorico/arquivo_empresa.rb +158 -0
  16. data/lib/odorico/arquivo_estabelecimento.rb +138 -0
  17. data/lib/odorico/arquivo_horario.rb +69 -0
  18. data/lib/odorico/arquivo_lotacao.rb +60 -0
  19. data/lib/odorico/arquivo_trabalhador_sem_vinculo.rb +305 -0
  20. data/lib/odorico/arquivo_trabalhador_sem_vinculo_historico_contratual.rb +86 -0
  21. data/lib/odorico/arquivo_trabalhador_sem_vinculo_termino.rb +204 -0
  22. data/lib/odorico/console.rb +11 -0
  23. data/lib/odorico/gerador_de_arquivos.rb +126 -0
  24. data/lib/odorico/gerador_de_arquivos_csv.rb +25 -0
  25. data/lib/odorico/jornada.rb +21 -0
  26. data/lib/odorico/processamento.rb +375 -0
  27. data/lib/odorico/sistema_operacional.rb +33 -0
  28. data/lib/odorico/types.rb +203 -0
  29. data/lib/odorico/version.rb +3 -0
  30. data/lib/odorico.rb +115 -0
  31. metadata +184 -0
@@ -0,0 +1,401 @@
1
+ require_relative 'jornada'
2
+
3
+ class ArquivoEmpregado
4
+ ATRIBUTOS = {
5
+ cpf: { key: 'EventoAdmissao_InfoTrabalhador_Cpf', type: Types::String },
6
+ nis: { key: 'EventoAdmissao_InfoTrabalhador_Nis', type: Types::String.optional },
7
+ nome: { key: 'EventoAdmissao_InfoTrabalhador_Nome', type: Types::String },
8
+ sexo: { key: 'EventoAdmissao_InfoTrabalhador_Sexo', type: Types::String },
9
+ matricula: { key: 'EventoAdmissao_InfoVinculo_Matricula', type: Types::String },
10
+ raca_cor: { key: 'EventoAdmissao_InfoTrabalhador_RacaCor', type: Types::Integer },
11
+ grau_instrucao: { key: 'EventoAdmissao_InfoTrabalhador_GrauInstrucao', type: Types::String },
12
+ primeiro_emprego: { key: 'EventoAdmissao_InfoTrabalhador_PrimeiroEmprego', type: Types::SNBool.optional },
13
+ data_de_nascimento: { key: 'EventoAdmissao_InfoTrabalhador_Nascimento_DataNascimento', type: Types::Date },
14
+ nascimento_pais_codigo: { key: 'EventoAdmissao_InfoTrabalhador_Nascimento_PaisNascimento', type: Types::String },
15
+ nacionalidade_pais_codigo: { key: 'EventoAdmissao_InfoTrabalhador_Nascimento_PaisNacionalidade',
16
+ type: Types::String },
17
+ nacionalidade_municipio_codigo: { key: 'EventoAdmissao_InfoTrabalhador_Nascimento_CodigoMunicipio',
18
+ type: Types::String.optional },
19
+ nome_mae: { key: 'EventoAdmissao_InfoTrabalhador_Nascimento_NomeMae', type: Types::String.optional },
20
+ endereco_br_cep: { key: 'EventoAdmissao_EnderecoResidencialBR_Cep', type: Types::String.optional },
21
+ endereco_br_tipo_logradouro: { key: 'EventoAdmissao_EnderecoResidencialBR_TipoLogradouro',
22
+ type: Types::String.optional },
23
+ endereco_br_descricao_logradouro: { key: 'EventoAdmissao_EnderecoResidencialBR_DescricaoLogradouro',
24
+ type: Types::String.optional },
25
+ endereco_br_numero_logradouro: { key: 'EventoAdmissao_EnderecoResidencialBR_NumeroLogradouro',
26
+ type: Types::String.optional },
27
+ endereco_br_bairro: { key: 'EventoAdmissao_EnderecoResidencialBR_Bairro', type: Types::String.optional },
28
+ endereco_br_complemento: { key: 'EventoAdmissao_EnderecoResidencialBR_Complemento', type: Types::String.optional },
29
+ endereco_br_codigo_municipio: { key: 'EventoAdmissao_EnderecoResidencialBR_CodigoMunicipio',
30
+ type: Types::String.optional },
31
+ reside_exterior: { key: 'ResideExterior', type: Types::False },
32
+ deficiencia_fisica: { key: 'EventoAdmissao_InfoTrabalhador_Deficiencia_DeficienciaFisica',
33
+ type: Types::SNBool.optional },
34
+ deficiencia_visual: { key: 'EventoAdmissao_InfoTrabalhador_Deficiencia_DeficienciaVisual',
35
+ type: Types::SNBool.optional },
36
+ deficiencia_auditiva: { key: 'EventoAdmissao_InfoTrabalhador_Deficiencia_DeficienciaAuditiva',
37
+ type: Types::SNBool.optional },
38
+ deficiencia_mental: { key: 'EventoAdmissao_InfoTrabalhador_Deficiencia_DeficienciaMental',
39
+ type: Types::SNBool.optional },
40
+ deficiencia_intelectual: { key: 'EventoAdmissao_InfoTrabalhador_Deficiencia_DeficienciaIntelectual',
41
+ type: Types::SNBool.optional },
42
+ deficiencia_reabilitado_ou_readaptado: { key: 'EventoAdmissao_InfoTrabalhador_Deficiencia_ReabilitadoOuReadaptado',
43
+ type: Types::SNBool.optional },
44
+ deficiencia_info_cota: { key: 'EventoAdmissao_InfoTrabalhador_Deficiencia_InfoCota', type: Types::SNBool.optional },
45
+ data_admissao_celetista: {
46
+ key: 'EventoAdmissao_InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_DataAdmissao',
47
+ type: Types::Date
48
+ },
49
+ tipo_regime_trabalhista: { key: 'EventoAdmissao_InfoVinculo_TipoRegimeTrabalhista',
50
+ type: Types::TipoRegimeTrabalhista },
51
+ tipo_regime_previdenciario: { key: 'EventoAdmissao_InfoVinculo_TipoRegimePrevidenciario',
52
+ type: Types::TipoRegimePrevidenciario },
53
+ tipo_regime_jornada: {
54
+ key: 'EventoAdmissao_InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_TipoRegimeJornada',
55
+ type: Types::TipoRegimeJornada
56
+ },
57
+ optante_fgts: {
58
+ key: 'EventoAdmissao_InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_InfoFgts_OptanteFGTS', # rubocop:disable Layout/LineLength
59
+ type: Types::OpcaoFgts.optional
60
+ },
61
+ data_opcao_fgts: {
62
+ key: 'EventoAdmissao_InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_InfoFgts_DataOpcaoFGTS', # rubocop:disable Layout/LineLength
63
+ type: Types::Date.optional
64
+ },
65
+ cargo_codigo: { key: 'EventoAdmissao_InfoVinculo_InfoContrato_CodigoCargo', type: Types::String.optional },
66
+ unidade_salario_fixo: { key: 'EventoAdmissao_InfoVinculo_InfoContrato_Remuneracao_UnidadeSalarioFixo',
67
+ type: Types::UnidadeSalarial },
68
+ valor_salario_fixo: { key: 'EventoAdmissao_InfoVinculo_InfoContrato_Remuneracao_ValorSalarioFixo',
69
+ type: Types::Decimal },
70
+ tipo_contrato: { key: 'EventoAdmissao_InfoVinculo_InfoContrato_Duracao_TipoContrato', type: Types::TipoContrato },
71
+ data_termino: { key: 'EventoAdmissao_InfoVinculo_InfoContrato_Duracao_DataTermino', type: Types::Date.optional },
72
+ clausula_assecuratoria: { key: 'EventoAdmissao_InfoVinculo_InfoContrato_Duracao_ClausulaAssecuratoria',
73
+ type: Types::SNBool.optional },
74
+ local_trabalho_geral_tipo_inscricao: {
75
+ key: 'EventoAdmissao_InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoGeral_TipoInscricao',
76
+ type: Types::TipoInscricaoLocalTrabalho.optional
77
+ },
78
+ local_trabalho_geral_numero_inscricao: {
79
+ key: 'EventoAdmissao_InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoGeral_NumeroInscricao',
80
+ type: Types::String.optional
81
+ },
82
+ quantidade_horas_semanal: {
83
+ key: 'EventoAdmissao_InfoVinculo_InfoContrato_HorarioContratual_QuantidadeHorasSemanal',
84
+ type: Types::Decimal.optional
85
+ },
86
+ tipo_jornada: { key: 'EventoAdmissao_InfoVinculo_InfoContrato_HorarioContratual_TipoJornada',
87
+ type: Types::TipoJornada.optional },
88
+ descricao_tipo_jornada: {
89
+ key: 'EventoAdmissao_InfoVinculo_InfoContrato_HorarioContratual_DescricaoJornada', type: Types::String.optional
90
+ },
91
+ descricao_tipo_jornada_2_5: {
92
+ key: 'EventoAdmissao_InfoVinculo_InfoContrato_HorarioContratual_DescricaoTipoJornada',
93
+ type: Types::String.optional
94
+ },
95
+ horario_noturno: { key: 'EventoAdmissao_InfoVinculo_InfoContrato_HorarioContratual_HorarioNoturno',
96
+ type: Types::SNBool.optional },
97
+ codigo_categoria: { key: 'EventoAdmissao_InfoVinculo_InfoContrato_CodigoCategoria',
98
+ type: Types::CategoriaTrabalhador },
99
+ nr_recibo_evento_original: { key: 'NrReciboEventoOriginal', type: Types::String.optional },
100
+ ctps_numero: { key: 'EventoAdmissao_InfoTrabalhador_Documentos_Ctps_NumeroCtps', type: Types::String.optional },
101
+ ctps_serie: { key: 'EventoAdmissao_InfoTrabalhador_Documentos_Ctps_SerieCtps', type: Types::String.optional },
102
+ ctps_uf: { key: 'EventoAdmissao_InfoTrabalhador_Documentos_Ctps_UfCtps', type: Types::String.optional },
103
+ sindicato_cnpj: {
104
+ key: 'EventoAdmissao_InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_CnpjSindicatoCategoriaProfissional', # rubocop:disable Layout/LineLength
105
+ type: Types::String
106
+ },
107
+ data_de_transferencia: { key: 'EventoAdmissao_InfoVinculo_SucessaoVinculo_DataTransferencia',
108
+ type: Types::Date.optional },
109
+ cnpj_do_empregador_anterior: { key: 'EventoAdmissao_InfoVinculo_SucessaoVinculo_CnpjEmpregadorAnterior',
110
+ type: Types::String.optional },
111
+ matricula_no_empregador_anterior: { key: 'EventoAdmissao_InfoVinculo_SucessaoVinculo_MatriculaAnterior',
112
+ type: Types::String.optional },
113
+ estrangeiro_data_de_chegada_ao_brasil: { key: 'EventoAdmissao_InfoTrabalhador_TrabalhadorEstrangeiro_DataChegada',
114
+ type: Types::Date.optional },
115
+ estrangeiro_classificacao_do_ingresso_no_brasil: {
116
+ key: 'EventoAdmissao_InfoTrabalhador_TrabalhadorEstrangeiro_ClassificacaoCondicao', type: Types::Integer.optional
117
+ },
118
+ estrangeiro_casado_com_brasileiro: {
119
+ key: 'EventoAdmissao_InfoTrabalhador_TrabalhadorEstrangeiro_CasadoComBrasileiro', type: Types::SNBool.optional
120
+ },
121
+ estrangeiro_tem_filhos_brasileiros: {
122
+ key: 'EventoAdmissao_InfoTrabalhador_TrabalhadorEstrangeiro_FilhosBrasileiros', type: Types::SNBool.optional
123
+ },
124
+ descricao_proc_emi: { key: 'DescricaoProcEmi', type: Types::String.optional },
125
+ data_inicio_afastamento: { key: 'EventoAdmissao_InfoVinculo_DataInicioAfastamento', type: Types::Date.optional },
126
+ motivo_afastamento: { key: 'EventoAdmissao_InfoVinculo_CodigoMotivoAfastamento', type: Types::String.optional },
127
+ dependentes: { key: 'EventoAdmissao_Dependente', attributes: {
128
+ nome: { key: 'NomeDependente', type: Types::String },
129
+ data_de_nascimento: { key: 'DataNascimento', type: Types::Date },
130
+ incapacidade: { key: 'IncapacidadeDependente', type: Types::SNBool },
131
+ cpf: { key: 'CPFDependente', type: Types::String.optional },
132
+ tipo: { key: 'TipoDependente', type: Types::String },
133
+ dependente_de_IRRF: { key: 'DependenteIRRF', type: Types::SNBool },
134
+ dependente_de_SF: { key: 'DependenteSF', type: Types::String },
135
+ data_nascimento_formatada: { key: 'DataNascimentoFormatada', type: Types::String }
136
+ } },
137
+ horarios: { key: 'Horarios', attributes: {
138
+ dia: { key: 'Dia', type: Types::Integer },
139
+ codigo_horario_contratual: { key: 'CodigoHorarioContratual', type: Types::String }
140
+ } },
141
+ treinamentos_capacitacoes: { key: 'treiCap', attributes: {
142
+ codigo: { key: 'codTreiCap', type: Types::String }
143
+ } }
144
+ }.freeze
145
+
146
+ ATRIBUTOS_NAO_SUPORTADOS = {
147
+ 'Não suportamos a inclusão no eSocial de empregados já demitidos': %w[
148
+ EventoAdmissao_InfoVinculo_DataDesligamento
149
+ ]
150
+ }.freeze
151
+
152
+ ATRIBUTOS_DESCARTADOS = {
153
+ 'Data Base': %w[
154
+ EventoAdmissao_InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_DataBase
155
+ ],
156
+ Nascimento: %w[
157
+ EventoAdmissao_InfoTrabalhador_Nascimento_Uf
158
+ EventoAdmissao_InfoTrabalhador_Nascimento_NomePai
159
+ ],
160
+ 'Nome Social': %w[
161
+ EventoAdmissao_InfoTrabalhador_NomeSocial
162
+ ],
163
+ 'Estado Civil': %w[
164
+ EventoAdmissao_InfoTrabalhador_EstadoCivil
165
+ ],
166
+ CNH: %w[
167
+ EventoAdmissao_InfoTrabalhador_Documentos_Cnh_NumeroCnh
168
+ EventoAdmissao_InfoTrabalhador_Documentos_Cnh_DataExpedicao
169
+ EventoAdmissao_InfoTrabalhador_Documentos_Cnh_DataPrimeiraHabilitacao
170
+ EventoAdmissao_InfoTrabalhador_Documentos_Cnh_DataValidade
171
+ EventoAdmissao_InfoTrabalhador_Documentos_Cnh_UfCnh
172
+ EventoAdmissao_InfoTrabalhador_Documentos_Cnh_CategoriaCnh
173
+ ],
174
+ 'Orgão de Classe': %w[
175
+ EventoAdmissao_InfoTrabalhador_Documentos_Oc_NumeroOc
176
+ EventoAdmissao_InfoTrabalhador_Documentos_Oc_OrgaoEmissor
177
+ EventoAdmissao_InfoTrabalhador_Documentos_Oc_DataExpedicao
178
+ EventoAdmissao_InfoTrabalhador_Documentos_Oc_DataValidade
179
+ ],
180
+ Identidade: %w[
181
+ EventoAdmissao_InfoTrabalhador_Documentos_Rg_NumeroRg
182
+ EventoAdmissao_InfoTrabalhador_Documentos_Rg_OrgaoEmissor
183
+ EventoAdmissao_InfoTrabalhador_Documentos_Rg_DataExpedicao
184
+ ],
185
+ 'Registro Nacional de Estrangeiro': %w[
186
+ EventoAdmissao_InfoTrabalhador_Documentos_Rne_DataExpedicao
187
+ EventoAdmissao_InfoTrabalhador_Documentos_Rne_NumerorRne
188
+ EventoAdmissao_InfoTrabalhador_Documentos_Rne_OrgaoEmissor
189
+ ],
190
+ 'Descrição Complementar de Local de Trabalho': %w[
191
+ EventoAdmissao_InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoGeral_DescricaoComplementar
192
+ ],
193
+ 'Informação Complementar de Endereço': %w[
194
+ EventoAdmissao_InfoTrabalhador_InfoEndereco_EnderecoResidencialBR_Complemento
195
+ ],
196
+ 'Informação do contato do trabalhador': %w[
197
+ EventoAdmissao_InfoTrabalhador_Contato_TelefonePrincipal
198
+ EventoAdmissao_Contato_TelefonePrincipal
199
+ EventoAdmissao_Contato_TelefoneAlternativo
200
+ ],
201
+ 'Informação das observações de trabalhador': %w[
202
+ EventoAdmissao_InfoVinculo_InfoContrato_Observacao_0_ConteudoObservacao
203
+ ]
204
+ }.freeze
205
+
206
+ ATRIBUTOS_IGNORADOS = %w[
207
+ IdEventoXml
208
+ EventoAdmissao_EnderecoResidencialBR_Uf
209
+ EventoAdmissao_InfoVinculo_IndicativoCadastramentoInicial
210
+ EventoAdmissao_InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_TipoAdmissao
211
+ EventoAdmissao_InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_NaturezaAtividade
212
+ EventoAdmissao_InfoVinculo_InfoContrato_HorarioContratual_JornadaTempoParcial
213
+ EventoAdmissao_InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_IndicativoAdmissao
214
+ TrabalhadorAfastadoINSS
215
+ EventoAdmissao_TipoEventoEnviado
216
+ EventoAdmissao_IndRetificacao
217
+ EventoAdmissao_NrRecibo
218
+ SomenteLeitura
219
+ IdEvento
220
+ DataAdmissaoReferencia
221
+ EventoAdmissao_InfoTrabalhador_Sexo_TEXT
222
+ EventoAdmissao_InfoTrabalhador_RacaCor_TEXT
223
+ EventoAdmissao_InfoTrabalhador_EstadoCivil_TEXT
224
+ EventoAdmissao_InfoTrabalhador_GrauInstrucao_TEXT
225
+ EventoAdmissao_InfoTrabalhador_Nascimento_PaisNascimento_TEXT
226
+ EventoAdmissao_InfoTrabalhador_Nascimento_PaisNacionalidade_TEXT
227
+ EventoAdmissao_InfoTrabalhador_Nascimento_Uf_TEXT
228
+ EventoAdmissao_InfoTrabalhador_Nascimento_CodigoMunicipio_TEXT
229
+ EventoAdmissao_InfoTrabalhador_Documentos_Ctps_UfCtps_TEXT
230
+ EventoAdmissao_EnderecoResidencialBR_Uf_TEXT
231
+ EventoAdmissao_EnderecoResidencialBR_TipoLogradouro_TEXT
232
+ EventoAdmissao_EnderecoResidencialBR_CodigoMunicipio_TEXT
233
+ SemNumeroLogradouroEnderecoBR
234
+ SemNumeroLogradouroEnderecoEX
235
+ VerProc
236
+ TipoInscricaoEmpregador
237
+ EventoAdmissao_InfoVinculo_InfoContrato_FiliacaoSindical_0_CnpjSindicatoTrabalhador
238
+ EventoAdmissao_InfoVinculo_IndicativoCadastramentoInicial_TEXT
239
+ EventoAdmissao_InfoVinculo_TipoRegimeTrabalhista_TEXT
240
+ EventoAdmissao_InfoVinculo_InfoContrato_CodigoCategoria_TEXT
241
+ EventoAdmissao_InfoVinculo_TipoRegimePrevidenciario_TEXT
242
+ EventoAdmissao_InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_TipoAdmissao_TEXT
243
+ EventoAdmissao_InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_IndicativoAdmissao_TEXT
244
+ EventoAdmissao_InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_TipoRegimeJornada_TEXT
245
+ EventoAdmissao_InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_NaturezaAtividade_TEXT
246
+ EventoAdmissao_InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_DataBase_TEXT
247
+ EventoAdmissao_InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_InfoFgts_OptanteFGTS_TEXT
248
+ FiltroCargo
249
+ CodigoCBO
250
+ EventoAdmissao_InfoVinculo_InfoContrato_Remuneracao_UnidadeSalarioFixo_TEXT
251
+ EventoAdmissao_InfoVinculo_InfoContrato_Duracao_TipoContrato_TEXT
252
+ EventoAdmissao_InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoGeral_TipoInscricao_TEXT
253
+ NomeEstabelecimento
254
+ EventoAdmissao_InfoVinculo_InfoContrato_HorarioContratual_TipoJornada_TEXT
255
+ EventoAdmissao_InfoVinculo_InfoContrato_HorarioContratual_JornadaTempoParcial_TEXT
256
+ HorarioTela_Dia_TEXT
257
+ EventoAdmissao_InfoTrabalhador_InfoEndereco_EnderecoResidencialBR_Uf_TEXT
258
+ EventoAdmissao_InfoTrabalhador_InfoEndereco_EnderecoResidencialBR_TipoLogradouro_TEXT
259
+ EventoAdmissao_InfoTrabalhador_InfoEndereco_EnderecoResidencialBR_CodigoMunicipio_TEXT
260
+ checkbox_preencher_grupo0
261
+ checkbox_preencher_grupo1
262
+ checkbox_preencher_grupo2
263
+ checkbox_preencher_grupo3
264
+ checkbox_preencher_grupo4
265
+ checkbox_preencher_grupo5
266
+ checkbox_preencher_grupo6
267
+ checkbox_preencher_grupo8
268
+ EventoAdmissao_InformacoesInicio_IndicativoCadastramentoInicial
269
+ EventoAdmissao_InformacoesInicio_IndicativoCadastramentoInicial_TEXT
270
+ EventoAdmissao_InformacoesInicio_CodigoCategoria_TEXT
271
+ EventoAdmissao_InformacoesInicio_InformacoesComplementares_Remuneracao_UnidadeSalarioFixo_TEXT
272
+ checkbox_preencher_grupo10
273
+ checkbox_preencher_grupo11
274
+ checkbox_preencher_grupo12
275
+ checkbox_preencher_grupo13
276
+ checkbox_preencher_grupo14
277
+ EventoAdmissao_InfoTrabalhador_Documentos_Cnh_CategoriaCnh_TEXT
278
+ EventoAdmissao_InfoTrabalhador_Documentos_Cnh_UfCnh_TEXT
279
+ EventoAdmissao_InfoVinculo_CodigoMotivoAfastamento_TEXT
280
+ EventoAdmissao_InformacoesInicio_InformacoesComplementares_InfoFgts_OptanteFGTS_TEXT
281
+ autocomplete_EventoAdmissao_InfoTrabalhador_Nascimento_PaisNascimento
282
+ autocomplete_EventoAdmissao_InfoTrabalhador_Nascimento_PaisNacionalidade
283
+ CodigoCNAE
284
+ chkHorarioContratual
285
+ HorarioTela_Dia
286
+ ESX_CPF
287
+ ESX_MATRICULA
288
+ ESX_DATAADMISSAO
289
+ ESX_SEMVINCULO
290
+ IdContratoReferenciado
291
+ checkbox_preencher_grupo9
292
+ ESX_CATEGORIA
293
+ IdContrato
294
+ TelefoneCelular
295
+ autocomplete_EventoAdmissao_InformacoesInicio_CodigoCategoria
296
+ EventoAdmissao_InformacoesInicio_DataInicio
297
+ EventoAdmissao_InfoVinculo_InfoContrato_Remuneracao_DescricaoSalarioVariavel
298
+ CheckModoCompleto
299
+ EventoAdmissao_Contato_EmailPrincipal
300
+ EventoAdmissao_Contato_EmailAlternativo
301
+ EventoAdmissao_InfoVinculo_NumeroReciboAdmissaoPreliminar
302
+ EventoAdmissao_InfoTrabalhador_Documentos_Ric_NumeroRic
303
+ EventoAdmissao_InfoTrabalhador_Documentos_Ric_OrgaoEmissor
304
+ EventoAdmissao_InfoTrabalhador_Documentos_Ric_DataExpedicao
305
+ EventoAdmissao_InfoTrabalhador_TrabalhadorEstrangeiro_ClassificacaoCondicao_TEXT
306
+ FiltroFuncao
307
+ EventoAdmissao_InfoVinculo_InfoContrato_CodigoFuncao
308
+ EventoAdmissao_InfoVinculo_SucessaoVinculo_TipoInscricaoAnterior
309
+ EventoAdmissao_InfoVinculo_SucessaoVinculo_TipoInscricaoAnterior_TEXT
310
+ EventoAdmissao_InfoVinculo_SucessaoVinculo_Observacao
311
+ EventoAdmissao_InfoVinculo_InfoContrato_NomeCargo
312
+ EventoAdmissao_InfoVinculo_InfoContrato_CBOCargo
313
+ EventoAdmissao_InfoVinculo_InfoContrato_CBOCargo_TEXT
314
+ EventoAdmissao_InfoVinculo_InfoContrato_NomeFuncao
315
+ EventoAdmissao_InfoVinculo_InfoContrato_CBOFuncao
316
+ EventoAdmissao_InfoVinculo_InfoContrato_CBOFuncao_TEXT
317
+ EventoAdmissao_InfoVinculo_InfoContrato_CargoAcumulavel
318
+ HorarioNoturno
319
+ ].freeze
320
+
321
+ include ArquivoData
322
+
323
+ private
324
+
325
+ def initialize(caminho_do_arquivo_data)
326
+ @caminho_do_arquivo_data = caminho_do_arquivo_data
327
+ end
328
+
329
+ def ajustar_atributos
330
+ atributos[:leiaute_simplificado] =
331
+ verificar_se_eh_leiaute_simplificado?(atributos_especificos_do_leiaute_simplificado)
332
+ atributos[:ctps_numero] = atributos[:ctps_numero].to_i.to_s.rjust(7, '0')
333
+ atributos[:dependentes] = atributos[:dependentes].to_json
334
+ atributos[:descricao_tipo_jornada] =
335
+ atributos.delete(:descricao_tipo_jornada_2_5) || atributos[:descricao_tipo_jornada]
336
+
337
+ setar_optante_fgts if atributos[:optante_fgts].nil?
338
+ end
339
+
340
+ def setar_optante_fgts
341
+ if atributos[:data_admissao_celetista] > Date.new(1988, 10, 4)
342
+ atributos[:optante_fgts] = 1
343
+ atributos[:data_opcao_fgts] = atributos[:data_admissao_celetista]
344
+ else
345
+ atributos[:optante_fgts] = 2
346
+ end
347
+ end
348
+
349
+ def atributos_especificos_do_leiaute_simplificado
350
+ %w[
351
+ EventoAdmissao_InfoVinculo_InfoContrato_HorarioContratual_HorarioNoturno
352
+ EventoAdmissao_InfoVinculo_InfoContrato_HorarioContratual_DescricaoJornada
353
+ ]
354
+ end
355
+
356
+ def regras_que_podem_gerar_erros
357
+ {
358
+ "O trabalhador com CPF #{atributos[:cpf]} possui Número de CTPS com mais de 7 dígitos: " \
359
+ "#{atributos[:ctps_numero]}" =>
360
+ atributos[:ctps_numero] && atributos[:ctps_numero].size > 7,
361
+ 'Endereço sem município' =>
362
+ atributos[:endereco_br_codigo_municipio].nil?,
363
+ 'Data de chegada ao Brasil é obrigatória' =>
364
+ estrangeiro_sem_data_de_chegada?,
365
+ 'Não é suportado contrato de prazo determinado para a categoria' =>
366
+ atributos[:tipo_contrato] != '1' && !%w[101 103 105].include?(atributos[:codigo_categoria])
367
+ }
368
+ end
369
+
370
+ def estrangeiro_sem_data_de_chegada?
371
+ [
372
+ atributos[:estrangeiro_classificacao_do_ingresso_no_brasil],
373
+ atributos[:estrangeiro_classificacao_do_ingresso_no_brasil] != 6,
374
+ atributos[:estrangeiro_data_de_chegada_ao_brasil].nil?
375
+ ].all?
376
+ end
377
+
378
+ def regras_que_podem_gerar_alertas
379
+ {
380
+ 'Suportamos apenas logradouros do tipo Via' => !logradouro_eh_via?,
381
+ 'Tipo de jornada inconsistente em relação aos horários informados.' => !jornada_consistente?,
382
+ 'Não garantimos a correta importação deste tipo de jornada.' => !jornada_reconstruivel?
383
+ }
384
+ end
385
+
386
+ def jornada_consistente?
387
+ Jornada.consistente?(atributos[:tipo_jornada], atributos[:horarios])
388
+ end
389
+
390
+ def jornada_reconstruivel?
391
+ Jornada.reconstrucao_fiel?(atributos[:tipo_jornada])
392
+ end
393
+
394
+ def logradouro_eh_via?
395
+ atributos[:endereco_br_tipo_logradouro].to_s == 'V'
396
+ end
397
+
398
+ def identificador
399
+ 'empregado'
400
+ end
401
+ end
@@ -0,0 +1,109 @@
1
+ class ArquivoEmpregadoAfastamentoInicio
2
+ ATRIBUTOS = {
3
+ id_evento_xml: { key: 'IdEventoXml', type: Types::String.optional },
4
+ nr_recibo_evento_original: { key: 'NrReciboEventoOriginal', type: Types::String.optional },
5
+ cpf: { key: 'ESX_CPF', type: Types::String },
6
+ matricula: { key: 'ESX_MATRICULA', type: Types::String },
7
+ codigo_motivo: { key: 'IniAfastamento_CodMotivoAfastamento', type: Types::MotivosAfastamento.optional },
8
+ data_inicio_afastamento: { key: 'ESX_INICIO', type: Types::AnoMesDia },
9
+ observacao_inicio_de_afastamento: { key: 'IniAfastamento_Observacao', type: Types::String.optional },
10
+ mesmo_motivo: { key: 'IniAfastamento_InfoMesmoMotivo', type: Types::SNBool.optional },
11
+ descricao_proc_emi: { key: 'DescricaoProcEmi', type: Types::String.optional }
12
+ }.freeze
13
+
14
+ ATRIBUTOS_NAO_SUPORTADOS = {}.freeze
15
+
16
+ ATRIBUTOS_DESCARTADOS = {
17
+ 'Tipo de acidente de trânsito': %w[
18
+ IniAfastamento_TipoAcidenteTransito
19
+ ],
20
+ Atestado: (0..8).flat_map do |indice|
21
+ [
22
+ "IniAfastamento_ListaInfoAtestado_#{indice}_CodigoCID",
23
+ "IniAfastamento_ListaInfoAtestado_#{indice}_QuantidadeDiasAfastados",
24
+ "IniAfastamento_ListaInfoAtestado_#{indice}_Emitente_NomeEmitente",
25
+ "IniAfastamento_ListaInfoAtestado_#{indice}_Emitente_IdOrgaoClasse",
26
+ "IniAfastamento_ListaInfoAtestado_#{indice}_Emitente_NumeroOrgaoClasse",
27
+ "IniAfastamento_ListaInfoAtestado_#{indice}_Emitente_UFOrgaoClasse",
28
+ "IniAfastamento_ListaInfoAtestado_#{indice}_Emitente_DescricaoOrgaoClasse"
29
+ ]
30
+ end
31
+ }.freeze
32
+
33
+ ATRIBUTOS_IGNORADOS = %w[
34
+ RequestVerificationToken
35
+ ExibirBotoes
36
+ IniAfastamento_DataInicioAfastamento
37
+ IniAfastamento_InfoMesmoMotivo
38
+ IniAfastamento_CodMotivoAfastamento
39
+ IniAfastamento_CodMotivoAfastamento_TEXT
40
+ CheckPreencherAcidenteTransito
41
+ IniAfastamento_Observacao
42
+ DesejaIncluirInfoAtestado
43
+ checkbox_preencher_grupo0
44
+ VerProc
45
+ IdContrato
46
+ IndicadorRetificacao
47
+ PreencherCID
48
+ PreencherAcidenteTransito
49
+ PreencherEmpregadoCedido
50
+ PreencherMandatoSindical
51
+ SomenteLeitura
52
+ UrlRetorno
53
+ DataTerminoAfastamentoInformada
54
+ ContratoSemVinculo
55
+ CodMotivoAfastamentoRetif
56
+ ESX_DATAADMISSAO
57
+ ESX_SEMVINCULO
58
+ TipoEventoCadastro
59
+ IdEventoAfastamento
60
+ DataInicio
61
+ CodigoMotivo
62
+ Motivo
63
+ IniAfastamento_TipoAcidenteTransito_TEXT
64
+ IniAfastamento_PeriodoAquisitivo_DataInicio
65
+ InfoRetificacao_IdOrigRetif
66
+ InfoRetificacao_IdOrigRetif_TEXT
67
+ DataLimitePeriodoAquis
68
+ RegraFeriasCategoria
69
+ PreencherMandatoEletivo
70
+ ExibirInformacaoAtestadoMedico
71
+ IdEvento
72
+ ].freeze
73
+
74
+ include ArquivoData
75
+
76
+ private
77
+
78
+ def initialize(caminho_do_arquivo_data)
79
+ @caminho_do_arquivo_data = caminho_do_arquivo_data
80
+ end
81
+
82
+ def ajustar_atributos; end
83
+
84
+ def regras_que_podem_gerar_erros
85
+ {
86
+ }
87
+ end
88
+
89
+ def regras_que_podem_gerar_alertas
90
+ {
91
+ 'Campo id_evento_xml não informado. Para continuar, certifique que este afastamento (matrícula: ' \
92
+ "#{atributos[:matricula]} - Início: " \
93
+ "#{atributos[:data_inicio_afastamento]}) foi ajustado com os dados vindos da admissão" =>
94
+ atributos[:id_evento_xml].nil?,
95
+ 'Campo nr_recibo_evento_original não informado. Para continuar, certifique que este afastamento (matrícula: ' \
96
+ "#{atributos[:matricula]} - Início: " \
97
+ "#{atributos[:data_inicio_afastamento]}) foi ajustado com os dados vindos da admissão" =>
98
+ atributos[:nr_recibo_evento_original].nil?,
99
+ 'Campo codigo_motivo não informado. Para continuar, certifique que este afastamento (matrícula: ' \
100
+ "#{atributos[:matricula]} - Início: " \
101
+ "#{atributos[:data_inicio_afastamento]}) foi ajustado com os dados vindos da admissão" =>
102
+ atributos[:codigo_motivo].nil?
103
+ }
104
+ end
105
+
106
+ def identificador
107
+ 'empregado_afastamento_inicio'
108
+ end
109
+ end
@@ -0,0 +1,102 @@
1
+ class ArquivoEmpregadoAfastamentoTermino
2
+ ATRIBUTOS = {
3
+ nr_recibo_evento_original: { key: 'NrReciboEventoOriginal', type: Types::String },
4
+ cpf: { key: 'ESX_CPF', type: Types::String },
5
+ matricula: { key: 'ESX_MATRICULA', type: Types::String },
6
+ cod_motivo_afastamento_antigo: { key: 'IniAfastamento_CodMotivoAfastamento',
7
+ type: Types::MotivosAfastamento.optional },
8
+ codigo_motivo: { key: 'CodigoMotivo', type: Types::MotivosAfastamento.optional },
9
+ codigo_motivo_retificacao: { key: 'CodMotivoAfastamentoRetif', type: Types::String.optional },
10
+ data_inicio_afastamento: { key: 'ESX_INICIO', type: Types::AnoMesDia },
11
+ observacao_inicio_de_afastamento: { key: 'IniAfastamento_Observacao', type: Types::String.optional },
12
+ mesmo_motivo: { key: 'IniAfastamento_InfoMesmoMotivo', type: Types::SNBool.optional },
13
+ data_termino_afastamento: { key: 'ESX_TERMINO', type: Types::AnoMesDia },
14
+ inicio_termino_enviados_juntos: { key: 'DataTerminoAfastamentoInformada', type: Types::TrueFalseBool.optional },
15
+ descricao_proc_emi: { key: 'DescricaoProcEmi', type: Types::String.optional }
16
+ }.freeze
17
+
18
+ ATRIBUTOS_NAO_SUPORTADOS = {}.freeze
19
+
20
+ ATRIBUTOS_DESCARTADOS = {
21
+ 'Tipo de acidente de trânsito': %w[
22
+ IniAfastamento_TipoAcidenteTransito
23
+ ]
24
+ }.freeze
25
+
26
+ ATRIBUTOS_DOS_ATESTADOS = (0..8).flat_map do |indice|
27
+ [
28
+ "IniAfastamento_ListaInfoAtestado_#{indice}_CodigoCID",
29
+ "IniAfastamento_ListaInfoAtestado_#{indice}_QuantidadeDiasAfastados",
30
+ "IniAfastamento_ListaInfoAtestado_#{indice}_Emitente_NomeEmitente",
31
+ "IniAfastamento_ListaInfoAtestado_#{indice}_Emitente_IdOrgaoClasse",
32
+ "IniAfastamento_ListaInfoAtestado_#{indice}_Emitente_NumeroOrgaoClasse",
33
+ "IniAfastamento_ListaInfoAtestado_#{indice}_Emitente_UFOrgaoClasse",
34
+ "IniAfastamento_ListaInfoAtestado_#{indice}_Emitente_DescricaoOrgaoClasse"
35
+ ]
36
+ end.freeze
37
+
38
+ ATRIBUTOS_IGNORADOS = ATRIBUTOS_DOS_ATESTADOS + %w[
39
+ IdEventoXml
40
+ ExibirBotoes
41
+ IniAfastamento_CodMotivoAfastamento_TEXT
42
+ CheckPreencherAcidenteTransito
43
+ checkbox_preencher_grupo0
44
+ VerProc
45
+ IdContrato
46
+ IndicadorRetificacao
47
+ PreencherCID
48
+ PreencherAcidenteTransito
49
+ PreencherEmpregadoCedido
50
+ PreencherMandatoSindical
51
+ SomenteLeitura
52
+ UrlRetorno
53
+ ContratoSemVinculo
54
+ PreencherDataFimAfastamento
55
+ ESX_DATAADMISSAO
56
+ ESX_SEMVINCULO
57
+ DesejaIncluirInfoAtestado
58
+ RequestVerificationToken
59
+ TipoEventoCadastro
60
+ IdEventoAfastamento
61
+ CodigoMotivo
62
+ Motivo
63
+ DataInicio
64
+ DataFim
65
+ IniAfastamento_DataInicioAfastamento
66
+ FimAfastamento_DataTerminoAfastamento
67
+ IniAfastamento_TipoAcidenteTransito_TEXT
68
+ DataLimitePeriodoAquis
69
+ RegraFeriasCategoria
70
+ PreencherMandatoEletivo
71
+ IdEvento
72
+ ].freeze
73
+
74
+ include ArquivoData
75
+
76
+ private
77
+
78
+ def initialize(caminho_do_arquivo_data)
79
+ @caminho_do_arquivo_data = caminho_do_arquivo_data
80
+ end
81
+
82
+ def ajustar_atributos; end
83
+
84
+ def regras_que_podem_gerar_erros
85
+ {
86
+ 'Motivo não localizado para o afastamento' => motivo_indefinido?
87
+ }
88
+ end
89
+
90
+ def regras_que_podem_gerar_alertas
91
+ {
92
+ }
93
+ end
94
+
95
+ def motivo_indefinido?
96
+ atributos[:cod_motivo_afastamento_antigo].nil? && atributos[:codigo_motivo].nil?
97
+ end
98
+
99
+ def identificador
100
+ 'empregado_afastamento_termino'
101
+ end
102
+ end