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.
- checksums.yaml +7 -0
- data/bin/odorico +3 -0
- data/lib/odorico/arquivo_atestado_de_saude_ocupacional.rb +60 -0
- data/lib/odorico/arquivo_aviso_previo.rb +69 -0
- data/lib/odorico/arquivo_cargo.rb +60 -0
- data/lib/odorico/arquivo_comunicacao_de_acidente_de_trabalho.rb +86 -0
- data/lib/odorico/arquivo_condicao_ambiental_de_trabalho.rb +83 -0
- data/lib/odorico/arquivo_data.rb +251 -0
- data/lib/odorico/arquivo_empregado.rb +401 -0
- data/lib/odorico/arquivo_empregado_afastamento_inicio.rb +109 -0
- data/lib/odorico/arquivo_empregado_afastamento_termino.rb +102 -0
- data/lib/odorico/arquivo_empregado_desligamento.rb +237 -0
- data/lib/odorico/arquivo_empregado_historico_cadastral.rb +194 -0
- data/lib/odorico/arquivo_empregado_historico_contratual.rb +157 -0
- data/lib/odorico/arquivo_empresa.rb +158 -0
- data/lib/odorico/arquivo_estabelecimento.rb +138 -0
- data/lib/odorico/arquivo_horario.rb +69 -0
- data/lib/odorico/arquivo_lotacao.rb +60 -0
- data/lib/odorico/arquivo_trabalhador_sem_vinculo.rb +305 -0
- data/lib/odorico/arquivo_trabalhador_sem_vinculo_historico_contratual.rb +86 -0
- data/lib/odorico/arquivo_trabalhador_sem_vinculo_termino.rb +204 -0
- data/lib/odorico/console.rb +11 -0
- data/lib/odorico/gerador_de_arquivos.rb +126 -0
- data/lib/odorico/gerador_de_arquivos_csv.rb +25 -0
- data/lib/odorico/jornada.rb +21 -0
- data/lib/odorico/processamento.rb +375 -0
- data/lib/odorico/sistema_operacional.rb +33 -0
- data/lib/odorico/types.rb +203 -0
- data/lib/odorico/version.rb +3 -0
- data/lib/odorico.rb +115 -0
- metadata +184 -0
@@ -0,0 +1,158 @@
|
|
1
|
+
class ArquivoEmpresa
|
2
|
+
ATRIBUTOS = {
|
3
|
+
cnpj_empregador: { key: 'CnpjEmpregador', type: Types::String },
|
4
|
+
inicio_validade: { key: 'InicioValidade', type: Types::String },
|
5
|
+
classificacao_tributaria: { key: 'ClassificacaoTributaria', type: Types::ClassificacaoTributaria },
|
6
|
+
indicativo_construtora: { key: 'IndicativoConstrutora', type: Types::ZeroUmBool },
|
7
|
+
descricao_proc_emi: { key: 'DescricaoProcEmi', type: Types::String.optional },
|
8
|
+
grupo: { key: 'ESX_GRUPO', type: Types::Integer.optional }
|
9
|
+
}.freeze
|
10
|
+
|
11
|
+
ATRIBUTOS_NAO_SUPORTADOS = {
|
12
|
+
'Não suportamos empregadores pessoa fisica': %w[
|
13
|
+
CpfEmpregador
|
14
|
+
],
|
15
|
+
'Não suportamos empregadores pessoa física': %w[
|
16
|
+
IndicativoSituacaoPF
|
17
|
+
],
|
18
|
+
'Não suportamos encerramento de histórico de evento tabela': %w[
|
19
|
+
FimValidade
|
20
|
+
]
|
21
|
+
}.freeze
|
22
|
+
|
23
|
+
ATRIBUTOS_DESCARTADOS = {}.freeze
|
24
|
+
|
25
|
+
ATRIBUTOS_IGNORADOS = %w[
|
26
|
+
NaturezaJuridica
|
27
|
+
TipoInscricaoEmpregador
|
28
|
+
NomeEmpregador
|
29
|
+
ehOrgaoPublico
|
30
|
+
ehOrgaoPublicoUniao
|
31
|
+
ehOrgaoPublicoEstadualMunicipalDistrital
|
32
|
+
NomeRazaoSocial
|
33
|
+
IndicativoRegEletronico
|
34
|
+
IndicativoCooperativa
|
35
|
+
IndicativoDesoneracaoFolha
|
36
|
+
IndicativoEntidadeEducativa
|
37
|
+
IndicativoEmpresaTrabalhoTemporario
|
38
|
+
TelefoneFixo
|
39
|
+
TelefoneCelular
|
40
|
+
Email
|
41
|
+
NrReciboEventoOriginal
|
42
|
+
IdEventoXml
|
43
|
+
ESX_TABELARUBRICA
|
44
|
+
CnpjSoftwareHouse
|
45
|
+
Telefone
|
46
|
+
FapBdContrib
|
47
|
+
AlteracaoEmPeriodoExistente
|
48
|
+
EventoJaExiste
|
49
|
+
ContinuandoEdicao
|
50
|
+
EhRetificacao
|
51
|
+
EhInclusaoNovoPeriodo
|
52
|
+
RetornoAction
|
53
|
+
ExibeModoCompleto
|
54
|
+
ClassificacaoTributaria_TEXT
|
55
|
+
NaturezaJuridica_TEXT
|
56
|
+
IndicativoRegEletronico_TEXT
|
57
|
+
IndicativoCooperativa_TEXT
|
58
|
+
IndicativoConstrutora_TEXT
|
59
|
+
IndicativoDesoneracaoFolha
|
60
|
+
IndicativoDesoneracaoFolha_TEXT
|
61
|
+
IndicativoSituacaoPJ
|
62
|
+
IndicativoSituacaoPJ_TEXT
|
63
|
+
VerProc
|
64
|
+
InformacoesManutencao_Id
|
65
|
+
InformacoesManutencao_OpcaoPermitida
|
66
|
+
SoftwareHouseTela_CnpjSoftwareHouse
|
67
|
+
SoftwareHouseTela_NomeRazaoSocial
|
68
|
+
SoftwareHouseTela_NomeContato
|
69
|
+
SoftwareHouseTela_Telefone
|
70
|
+
SoftwareHouseTela_Email
|
71
|
+
IndicativoSituacaoPF_TEXT
|
72
|
+
CheckModoCompleto
|
73
|
+
checkbox_preencher_grupo0
|
74
|
+
checkbox_preencher_grupo1
|
75
|
+
checkbox_preencher_grupo2
|
76
|
+
checkbox_preencher_grupo3
|
77
|
+
IndicativoMicroempresa
|
78
|
+
RazaoSocialRecuperadoIntegracao
|
79
|
+
CpfContato
|
80
|
+
NomeContato
|
81
|
+
].freeze
|
82
|
+
|
83
|
+
include ArquivoData
|
84
|
+
|
85
|
+
private
|
86
|
+
|
87
|
+
def initialize(caminho_do_arquivo_data, grupo_informado)
|
88
|
+
@caminho_do_arquivo_data = caminho_do_arquivo_data
|
89
|
+
@grupo_informado = grupo_informado
|
90
|
+
end
|
91
|
+
|
92
|
+
attr_reader :grupo_informado
|
93
|
+
|
94
|
+
public
|
95
|
+
|
96
|
+
def grupo_da_empresa
|
97
|
+
atributos[:grupo]
|
98
|
+
end
|
99
|
+
|
100
|
+
private
|
101
|
+
|
102
|
+
def ajustar_atributos
|
103
|
+
processa_grupo
|
104
|
+
end
|
105
|
+
|
106
|
+
def processa_grupo
|
107
|
+
raise GrupoDaEmpresaNaoDefinido unless grupo_definido?
|
108
|
+
raise GrupoDetectadoDiferenteDoGrupoInformado if grupo_detectado_diferente_do_grupo_informado?
|
109
|
+
|
110
|
+
atributos[:grupo] = grupo_detectado || grupo_informado
|
111
|
+
end
|
112
|
+
|
113
|
+
def grupo_definido?
|
114
|
+
grupo_detectado || grupo_informado
|
115
|
+
end
|
116
|
+
|
117
|
+
def grupo_detectado
|
118
|
+
atributos[:grupo]
|
119
|
+
end
|
120
|
+
|
121
|
+
def grupo_detectado_diferente_do_grupo_informado?
|
122
|
+
grupo_detectado && grupo_detectado != grupo_informado
|
123
|
+
end
|
124
|
+
|
125
|
+
def regras_que_podem_gerar_erros
|
126
|
+
{
|
127
|
+
'Não aceitamos construtoras' => eh_construtora?
|
128
|
+
}
|
129
|
+
end
|
130
|
+
|
131
|
+
def regras_que_podem_gerar_alertas
|
132
|
+
{}
|
133
|
+
end
|
134
|
+
|
135
|
+
def eh_construtora?
|
136
|
+
atributos[:indicativo_construtora]
|
137
|
+
end
|
138
|
+
|
139
|
+
def identificador
|
140
|
+
'empresa'
|
141
|
+
end
|
142
|
+
|
143
|
+
class GrupoDetectadoDiferenteDoGrupoInformado < StandardError
|
144
|
+
private
|
145
|
+
|
146
|
+
def initialize
|
147
|
+
super('Grupo detectado diferente do grupo informado')
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
class GrupoDaEmpresaNaoDefinido < StandardError
|
152
|
+
private
|
153
|
+
|
154
|
+
def initialize
|
155
|
+
super('Grupo da empresa no eSocial não definido')
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
class ArquivoEstabelecimento
|
2
|
+
ATRIBUTOS = {
|
3
|
+
numero_inscricao_estabelecimento: { key: 'NumeroInscricaoEstabelecimento', type: Types::String },
|
4
|
+
inicio_validade: { key: 'InicioValidade', type: Types::String },
|
5
|
+
cnae_preponderante: { key: 'CnaePreponderante', type: Types::String },
|
6
|
+
fap: { key: 'Fap', type: Types::String.optional },
|
7
|
+
tipo_registro_ponto: { key: 'TipoRegistroPonto', type: Types::Integer.optional },
|
8
|
+
descricao_proc_emi: { key: 'DescricaoProcEmi', type: Types::String.optional }
|
9
|
+
}.freeze
|
10
|
+
|
11
|
+
ATRIBUTOS_DESCARTADOS = {}.freeze
|
12
|
+
|
13
|
+
ATRIBUTOS_IGNORADOS = %w[
|
14
|
+
IdEventoXml
|
15
|
+
TipoInscricaoEmpregador
|
16
|
+
TipoInscricaoEstabelecimento
|
17
|
+
NomeEstabelecimento
|
18
|
+
AliquotaRat
|
19
|
+
AliquotaRatAjustada
|
20
|
+
IndicativoContratacaoDeficiencia
|
21
|
+
NrReciboEventoOriginal
|
22
|
+
ContratoAprendizEntidade
|
23
|
+
RequestVerificationToken
|
24
|
+
SomenteVisualizacao
|
25
|
+
BloquearCodigo
|
26
|
+
BloquearAntigoPeriodoValidade
|
27
|
+
TipoEmpregador
|
28
|
+
ClassificacaoTributariaEmpregador
|
29
|
+
ContinuandoEdicao
|
30
|
+
TipoInscricaoEstabelecimento_TEXT
|
31
|
+
CnaePreponderanteCodigoDescricaoAutoComplete
|
32
|
+
CnaePreponderantePreenchido
|
33
|
+
AliquotaRat_TEXT
|
34
|
+
FapRecuperado
|
35
|
+
AliquotaRatRecuperada
|
36
|
+
DesejaIncluirProcessoAdminJudRat
|
37
|
+
DesejaIncluirProcessoAdminJudFap
|
38
|
+
DesejaIncluirInfoAliquotaGilrat
|
39
|
+
DesejaIncluirEntidadesEducativas
|
40
|
+
TipoRegistroPonto_TEXT
|
41
|
+
IndicativoContratacaoAprendiz_TEXT
|
42
|
+
checkbox_preencher_grupo0
|
43
|
+
IndicativoContratacaoDeficiencia_TEXT
|
44
|
+
EntidadeEducativaTela_CnpjEntidadeEducativa
|
45
|
+
VerProc
|
46
|
+
IndicativoSubstituicaoPatronalObra_TEXT
|
47
|
+
ExibeModoCompleto
|
48
|
+
checkbox_preencher_grupo1
|
49
|
+
IndicativoContratacaoAprendiz
|
50
|
+
CodigoDoProcessoAdministrativo
|
51
|
+
].freeze
|
52
|
+
|
53
|
+
ATRIBUTOS_NAO_SUPORTADOS = {
|
54
|
+
'Não suportamos obras': %w[
|
55
|
+
IndicativoSubstituicaoPatronalObra
|
56
|
+
],
|
57
|
+
'Não suportamos empregadores pessoa física': %w[
|
58
|
+
TipoCaepf
|
59
|
+
],
|
60
|
+
'Não suportamos encerramento de histórico de evento tabela': %w[
|
61
|
+
FimValidade
|
62
|
+
],
|
63
|
+
'Não suportamos entidades educativas para menores aprendizes': %w[
|
64
|
+
ListaEntidadeEducativa_0_CnpjEntidadeEducativa
|
65
|
+
ListaEntidadeEducativa_0_RazaoSocial
|
66
|
+
]
|
67
|
+
}.freeze
|
68
|
+
|
69
|
+
include ArquivoData
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def initialize(caminho_do_arquivo_data)
|
74
|
+
@caminho_do_arquivo_data = caminho_do_arquivo_data
|
75
|
+
end
|
76
|
+
|
77
|
+
def ajustar_atributos; end
|
78
|
+
|
79
|
+
def regras_que_podem_gerar_erros
|
80
|
+
{
|
81
|
+
'Não suportamos estabelecimentos com FAP no leiaute simplificado' => fap_presente_no_leiaute_simplificado?,
|
82
|
+
'FAP é obrigatório no leiaute v2.5' => fap_ausente_no_leiaute_v2_5?
|
83
|
+
}
|
84
|
+
end
|
85
|
+
|
86
|
+
def fap_presente_no_leiaute_simplificado?
|
87
|
+
leiaute_simplificado? && tem_fap? && tem_processo_administrativo?
|
88
|
+
end
|
89
|
+
|
90
|
+
def leiaute_simplificado?
|
91
|
+
@leiaute_simplificado ||=
|
92
|
+
verificar_se_eh_leiaute_simplificado?(
|
93
|
+
atributos_especificos_do_leiaute_simplificado,
|
94
|
+
atributos_inexistentes_no_leiaute_simplificado
|
95
|
+
)
|
96
|
+
end
|
97
|
+
|
98
|
+
def tem_fap?
|
99
|
+
!atributos[:fap].nil?
|
100
|
+
end
|
101
|
+
|
102
|
+
def tem_processo_administrativo?
|
103
|
+
# FIXME. CodigoDoProcessoAdministrativo eh um nome FAKE criado para essa implementacao. Usar nome que o robô AINDA
|
104
|
+
# VAI DEFINIR
|
105
|
+
tem_o_atributo?('CodigoDoProcessoAdministrativo')
|
106
|
+
end
|
107
|
+
|
108
|
+
def atributos_especificos_do_leiaute_simplificado
|
109
|
+
[]
|
110
|
+
end
|
111
|
+
|
112
|
+
def atributos_inexistentes_no_leiaute_simplificado
|
113
|
+
%w[
|
114
|
+
AliquotaRatAjustada
|
115
|
+
TipoRegistroPonto
|
116
|
+
IndicativoContratacaoAprendiz
|
117
|
+
ContratoAprendizEntidade
|
118
|
+
IndicativoContratacaoDeficiencia
|
119
|
+
]
|
120
|
+
end
|
121
|
+
|
122
|
+
def fap_ausente_no_leiaute_v2_5?
|
123
|
+
!tem_fap? && leiaute_v2_5?
|
124
|
+
end
|
125
|
+
|
126
|
+
def leiaute_v2_5?
|
127
|
+
!leiaute_simplificado?
|
128
|
+
end
|
129
|
+
|
130
|
+
def regras_que_podem_gerar_alertas
|
131
|
+
{
|
132
|
+
}
|
133
|
+
end
|
134
|
+
|
135
|
+
def identificador
|
136
|
+
'estabelecimento'
|
137
|
+
end
|
138
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
class ArquivoHorario
|
4
|
+
ATRIBUTOS = {
|
5
|
+
codigo_horario_contratual: { key: 'CodigoHorarioContratual', type: Types::String },
|
6
|
+
dados_horario_hora_entrada: { key: 'DadosHorario_HoraEntrada', type: Types::String },
|
7
|
+
dados_horario_hora_saida: { key: 'DadosHorario_HoraSaida', type: Types::String },
|
8
|
+
dados_horario_periodo_horario_flexivel: { key: 'DadosHorario_PeriodoHorarioFlexivel', type: Types::SNBool },
|
9
|
+
descricao_proc_emi: { key: 'DescricaoProcEmi', type: Types::String.optional },
|
10
|
+
intervalos: { key: 'DadosHorario_ListaHorarioIntervalo', attributes: {
|
11
|
+
duracao_intervalo: { key: 'DuracaoIntervalo', type: Types::Integer },
|
12
|
+
inicio_intervalo: { key: 'InicioIntervalo', type: Types::String.optional },
|
13
|
+
termino_intervalo: { key: 'TerminoIntervalo', type: Types::String.optional },
|
14
|
+
tipo_intervalo: { key: 'TipoIntervalo', type: Types::TipoIntervalo }
|
15
|
+
} }
|
16
|
+
}.freeze
|
17
|
+
|
18
|
+
ATRIBUTOS_IGNORADOS = %w[
|
19
|
+
IdEventoXml
|
20
|
+
NrReciboEventoOriginal
|
21
|
+
InicioValidade
|
22
|
+
DadosHorario_DuracaoJornada
|
23
|
+
DesejaIncluirIntervalo
|
24
|
+
RequestVerificationToken
|
25
|
+
SomenteVisualizacao
|
26
|
+
TelaHorarioIntervalo_DuracaoIntervalo
|
27
|
+
TelaHorarioIntervalo_TerminoIntervalo
|
28
|
+
TelaHorarioIntervalo_InicioIntervalo
|
29
|
+
TelaHorarioIntervalo_TipoIntervalo
|
30
|
+
TelaHorarioIntervalo_TipoIntervalo_TEXT
|
31
|
+
BloquearCodigo
|
32
|
+
BloquearAntigoPeriodoValidade
|
33
|
+
VerProc
|
34
|
+
].freeze
|
35
|
+
|
36
|
+
ATRIBUTOS_NAO_SUPORTADOS = {
|
37
|
+
'Não suportamos encerramento de histórico de evento tabela': %w[
|
38
|
+
FimValidade
|
39
|
+
]
|
40
|
+
}.freeze
|
41
|
+
|
42
|
+
ATRIBUTOS_DESCARTADOS = {}.freeze
|
43
|
+
|
44
|
+
include ArquivoData
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def initialize(caminho_do_arquivo_data)
|
49
|
+
@caminho_do_arquivo_data = caminho_do_arquivo_data
|
50
|
+
end
|
51
|
+
|
52
|
+
def ajustar_atributos
|
53
|
+
atributos[:intervalos] = atributos[:intervalos].to_json
|
54
|
+
end
|
55
|
+
|
56
|
+
def regras_que_podem_gerar_erros
|
57
|
+
{
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
def regras_que_podem_gerar_alertas
|
62
|
+
{
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
def identificador
|
67
|
+
'horario'
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
class ArquivoLotacao
|
2
|
+
ATRIBUTOS = {
|
3
|
+
id_evento_xml: { key: 'IdEventoXml', type: Types::String },
|
4
|
+
inicio_validade: { key: 'InicioValidade', type: Types::String },
|
5
|
+
nr_recibo_evento_original: { key: 'NrReciboEventoOriginal', type: Types::String },
|
6
|
+
codigo_lotacao: { key: 'CodigoLotacao', type: Types::String },
|
7
|
+
tipo_lotacao: { key: 'TipoLotacao', type: Types::TipoLotacao },
|
8
|
+
tipo_inscricao_estab: { key: 'TipoInscricaoEstab', type: Types::TipoInscricaoLotacao.optional },
|
9
|
+
numero_inscricao_estab: { key: 'NumeroInscricaoEstab', type: Types::String.optional },
|
10
|
+
fpas: { key: 'Fpas', type: Types::String },
|
11
|
+
codigo_convenio_terceiros: { key: 'CodigoConvenioTerceiros', type: Types::String },
|
12
|
+
descricao_proc_emi: { key: 'DescricaoProcEmi', type: Types::String.optional }
|
13
|
+
}.freeze
|
14
|
+
|
15
|
+
ATRIBUTOS_IGNORADOS = %w[
|
16
|
+
Tipo
|
17
|
+
RequestVerificationToken
|
18
|
+
CodigoConvenioTerceirosHidden
|
19
|
+
VerProc
|
20
|
+
IdEvento
|
21
|
+
SomenteVisualizacao
|
22
|
+
Fpas_TEXT
|
23
|
+
TipoInscricaoEstab_TEXT
|
24
|
+
TipoLotacao_TEXT
|
25
|
+
BloquearAntigoPeriodoValidade
|
26
|
+
BloquearCodigo
|
27
|
+
].freeze
|
28
|
+
|
29
|
+
ATRIBUTOS_NAO_SUPORTADOS = {
|
30
|
+
'Não suportamos encerramento de histórico de evento tabela': %w[
|
31
|
+
FimValidade
|
32
|
+
]
|
33
|
+
}.freeze
|
34
|
+
|
35
|
+
ATRIBUTOS_DESCARTADOS = {}.freeze
|
36
|
+
|
37
|
+
include ArquivoData
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def initialize(caminho_do_arquivo_data)
|
42
|
+
@caminho_do_arquivo_data = caminho_do_arquivo_data
|
43
|
+
end
|
44
|
+
|
45
|
+
def ajustar_atributos; end
|
46
|
+
|
47
|
+
def regras_que_podem_gerar_erros
|
48
|
+
{
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
def regras_que_podem_gerar_alertas
|
53
|
+
{
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
def identificador
|
58
|
+
'lotacao'
|
59
|
+
end
|
60
|
+
end
|