teodoro 0.40.2 → 0.42.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 +4 -4
- data/lib/teodoro/arquivo_data.rb +1 -1
- data/lib/teodoro/arquivo_xml.rb +22 -4
- data/lib/teodoro/leiaute/arquivo_s2200.rb +18 -1
- data/lib/teodoro/leiaute/arquivo_s2300.rb +2 -0
- data/lib/teodoro.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff7a10b16c719d03280f985e4f568f30011a3287f41af809472a086be33aeaa0
|
4
|
+
data.tar.gz: b6325f4f0547cc746335649bb953570228e245608b956894eda9da8a40584107
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba569ea182197ba4682e0f7ae98453d44fa0b8a8c036c951349bd0a423466882788f496f85f523e99fc5ee97afe3c45e65b6ed1b0b315543c2acf54519deefec
|
7
|
+
data.tar.gz: 9a72ddcf141bb11c35b1129cbf5eabc67f2bbbad8c16eead6d42710261e0b5df5c2d7b9317ef3b5d4eff507e52eacae3cc8256f15544cd58d776cf5996c16852
|
data/lib/teodoro/arquivo_data.rb
CHANGED
data/lib/teodoro/arquivo_xml.rb
CHANGED
@@ -80,10 +80,14 @@ module Teodoro
|
|
80
80
|
Console.print "carregando #{nome}.xml..." do
|
81
81
|
evento, recibo = carregar_evento_e_recibo
|
82
82
|
|
83
|
-
@retificacao =
|
83
|
+
@retificacao = evento_retificavel? && evento['ideEvento/indRetif'] == '2'
|
84
84
|
@numero_do_recibo_a_retificar = evento['ideEvento/nrRecibo'] if retificacao?
|
85
85
|
@momento_de_processamento_pelo_e_social = recibo['processamento/dhProcessamento']
|
86
|
+
|
87
|
+
validar_carregamento
|
86
88
|
end
|
89
|
+
rescue StandardError => e
|
90
|
+
tratar_excecao(e)
|
87
91
|
end
|
88
92
|
|
89
93
|
def retificacao?
|
@@ -104,9 +108,7 @@ module Teodoro
|
|
104
108
|
processar_arquivo
|
105
109
|
end
|
106
110
|
rescue StandardError => e
|
107
|
-
|
108
|
-
puts e.message
|
109
|
-
raise e
|
111
|
+
tratar_excecao(e)
|
110
112
|
end
|
111
113
|
|
112
114
|
private
|
@@ -127,10 +129,20 @@ module Teodoro
|
|
127
129
|
File.read(caminho)
|
128
130
|
end
|
129
131
|
|
132
|
+
def evento_retificavel?
|
133
|
+
TIPOS_DE_EVENTO_RETIFICAVEIS.include?(tipo_de_evento)
|
134
|
+
end
|
135
|
+
|
130
136
|
def tipo_de_evento
|
131
137
|
@tipo_de_evento ||= nome[-6..].delete('-')
|
132
138
|
end
|
133
139
|
|
140
|
+
def validar_carregamento
|
141
|
+
return if momento_de_processamento_pelo_e_social
|
142
|
+
|
143
|
+
raise 'arquivo corrompido (sem data e horário do processamento do evento)'
|
144
|
+
end
|
145
|
+
|
134
146
|
def validar_versao_do_leiaute
|
135
147
|
raise unless %w[
|
136
148
|
02_04_01
|
@@ -186,5 +198,11 @@ module Teodoro
|
|
186
198
|
def xml_do_recibo
|
187
199
|
Nokogiri::XML(xml.css('/eSocial/retornoProcessamentoDownload/recibo/*/*').to_s)
|
188
200
|
end
|
201
|
+
|
202
|
+
def tratar_excecao(excecao)
|
203
|
+
puts caminho
|
204
|
+
puts excecao.message
|
205
|
+
raise excecao
|
206
|
+
end
|
189
207
|
end
|
190
208
|
end
|
@@ -395,7 +395,24 @@ module Teodoro
|
|
395
395
|
end
|
396
396
|
|
397
397
|
def opcao_pelo_fgts
|
398
|
-
@opcao_pelo_fgts ||=
|
398
|
+
@opcao_pelo_fgts ||= optante_pelo_fgts? ? 1 : 2
|
399
|
+
end
|
400
|
+
|
401
|
+
def optante_pelo_fgts?
|
402
|
+
data_de_admissao >= (empregado_domestico? ? '2015-10-01' : '1988-10-05') ||
|
403
|
+
evento['vinculo/infoRegimeTrab/infoCeletista/FGTS']
|
404
|
+
end
|
405
|
+
|
406
|
+
def data_de_admissao
|
407
|
+
evento['vinculo/infoRegimeTrab/infoCeletista/dtAdm']
|
408
|
+
end
|
409
|
+
|
410
|
+
def empregado_domestico?
|
411
|
+
categoria_do_trabalhador == '104'
|
412
|
+
end
|
413
|
+
|
414
|
+
def categoria_do_trabalhador
|
415
|
+
evento['vinculo/infoContrato/codCateg']
|
399
416
|
end
|
400
417
|
|
401
418
|
def data_de_opcao_pelo_fgts
|
@@ -27,6 +27,7 @@ module Teodoro
|
|
27
27
|
trabalhador: trabalhador,
|
28
28
|
categoria_do_trabalhador: evento['infoTSVInicio/codCateg'],
|
29
29
|
data_de_inicio: evento['infoTSVInicio/dtInicio'],
|
30
|
+
matricula: evento['infoTSVInicio/matricula'],
|
30
31
|
recibo: numero_do_recibo
|
31
32
|
)
|
32
33
|
end
|
@@ -222,6 +223,7 @@ module Teodoro
|
|
222
223
|
['EventoAdmissao_InformacoesInicio_InformacoesComplementares_InfoEstagiario_NrApoliceSeguro', evento['infoTSVInicio/infoComplementares/infoEstagiario/nrApol']],
|
223
224
|
['EventoAdmissao_InformacoesInicio_InformacoesComplementares_InfoEstagiario_ValorBolsa', evento['infoTSVInicio/infoComplementares/infoEstagiario/vlrBolsa'], :decimal],
|
224
225
|
['EventoAdmissao_InformacoesInicio_CodigoCategoria', inicio_de_contrato.categoria_do_trabalhador],
|
226
|
+
['EventoAdmissao_InformacoesInicio_Matricula', inicio_de_contrato.matricula],
|
225
227
|
['DescricaoProcEmi', processo_de_emissao_do_evento],
|
226
228
|
['IdEventoXml', id_do_evento],
|
227
229
|
['EventoAdmissao_InfoTrabalhador_InfoEndereco_EnderecoResidencialBR_Bairro', trabalhador.endereco.bairro],
|
data/lib/teodoro.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teodoro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.42.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clavius Tales
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|