teodoro 0.67.5 → 0.68.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4ee7a153ac651112474512126250876b521337691cfc6cde6c1b7e21ec8406f5
4
- data.tar.gz: ea1446776df2141c465375809d71461f6fe19ebcaed03cdb596f21c05f79dbd8
3
+ metadata.gz: eda7d180a042287a49871240fc0e9d9db2136f41cb3123990b86f8807ca9b819
4
+ data.tar.gz: 0d116308a76214f289f3dc0e78fdb41d341d921aeea9a6daeed8213957774415
5
5
  SHA512:
6
- metadata.gz: 7ed7302e969cc272c66ec666b794b6efa01309505b88d79cbd4c75c61bac0e8a80183d1bc96c8e5e1a1a086dff8e25424f3246529bcbf417d99ecd810d69aaa3
7
- data.tar.gz: c594a1430bfdbe605c4db1d70b95a64dc56480925686e5a01382033bd5185f13c733c69440beae852b732f474fb1c6b0f9b7152e03215eecaef6de65f8974a6e
6
+ metadata.gz: 487f8d794bcf7cc7696858732eff57ce720b28a075a9ed4e93b34f01e526cb71ff63d84a5ebeedbb4de57dbc8ba9e252fadff7a86a316b77e51f0dbb609b1cbd
7
+ data.tar.gz: 1c725c679f53b68be3b4b64e7609e8c7756d83740ce70c3a0b3711c295d58acb47540b79c13945482002e7b872130935c87c36fc7ead33b909d31acc52bf305e
@@ -0,0 +1,26 @@
1
+ module Teodoro
2
+ class Empresa
3
+ class ArquivoDataPRE
4
+ private
5
+
6
+ def initialize(caminho)
7
+ @caminho = caminho
8
+ end
9
+
10
+ attr_reader :caminho
11
+
12
+ public
13
+
14
+ def inserir_matricula_do_trabalhador(matricula_do_trabalhador)
15
+ File
16
+ .readlines(caminho)
17
+ .then do |linhas_originais|
18
+ File.open(caminho, 'w') do |file|
19
+ (linhas_originais + ["Matricula=#{matricula_do_trabalhador}"])
20
+ .then { file.puts(_1) }
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -16,7 +16,7 @@ module Teodoro
16
16
  def_delegators :cargos, :each
17
17
 
18
18
  def [](nome:, cbo:)
19
- indice[nome: nome, cbo: cbo] ||= Cargo.new(empresa: empresa, dados: Obj.new(nome: nome, cbo: cbo)) if nome
19
+ indice[{ nome: nome, cbo: cbo }] ||= Cargo.new(empresa: empresa, dados: Obj.new(nome: nome, cbo: cbo)) if nome
20
20
  end
21
21
 
22
22
  private
@@ -16,7 +16,7 @@ module Teodoro
16
16
  def_delegators :funcoes, :each
17
17
 
18
18
  def [](nome:, cbo:)
19
- indice[nome: nome, cbo: cbo] ||= Funcao.new(empresa: empresa, dados: Obj.new(nome: nome, cbo: cbo)) if nome
19
+ indice[{ nome: nome, cbo: cbo }] ||= Funcao.new(empresa: empresa, dados: Obj.new(nome: nome, cbo: cbo)) if nome
20
20
  end
21
21
 
22
22
  private
@@ -2,6 +2,7 @@ require_relative 'arquivo_de_origem'
2
2
  require_relative 'arquivo_xml'
3
3
  require_relative 'empresa/arquivos_data'
4
4
  require_relative 'empresa/arquivo_data_emp'
5
+ require_relative 'empresa/arquivo_data_pre'
5
6
  require_relative 'empresa/arquivo_data_rub'
6
7
  require_relative 'empresa/arquivo_de_dados_gerais'
7
8
  require_relative 'empresa/cargos_gerados'
@@ -9,6 +9,9 @@ module Teodoro
9
9
  super
10
10
 
11
11
  registrar_admissao
12
+
13
+ inserir_matricula_do_trabalhador_no_arquivo_data_de_pre_admissao if
14
+ inserir_matricula_do_trabalhador_no_arquivo_data_de_pre_admissao?
12
15
  end
13
16
 
14
17
  def registrar_admissao
@@ -136,6 +139,34 @@ module Teodoro
136
139
  end
137
140
  end
138
141
 
142
+ def inserir_matricula_do_trabalhador_no_arquivo_data_de_pre_admissao?
143
+ faz_referencia_a_uma_pre_admissao?
144
+ end
145
+
146
+ def faz_referencia_a_uma_pre_admissao?
147
+ evento['vinculo/nrRecInfPrelim']
148
+ end
149
+
150
+ def inserir_matricula_do_trabalhador_no_arquivo_data_de_pre_admissao
151
+ arquivo_data_de_pre_admissao.inserir_matricula_do_trabalhador(admissao.matricula_do_trabalhador)
152
+ end
153
+
154
+ def arquivo_data_de_pre_admissao
155
+ Empresa::ArquivoDataPRE.new(caminho_do_arquivo_data_de_pre_admissao)
156
+ end
157
+
158
+ def caminho_do_arquivo_data_de_pre_admissao
159
+ File.join(destino_dos_arquivos_data, nome_do_arquivo_data_de_pre_admissao)
160
+ end
161
+
162
+ def destino_dos_arquivos_data
163
+ empresa.destino_dos_arquivos_data
164
+ end
165
+
166
+ def nome_do_arquivo_data_de_pre_admissao
167
+ "PRE[#{trabalhador.cpf}][#{admissao.data_de_admissao.delete('-')}][].data"
168
+ end
169
+
139
170
  def dados_dos_arquivos_data # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
140
171
  [
141
172
  Obj.new(
@@ -1,3 +1,3 @@
1
1
  module Teodoro
2
- VERSION = '0.67.5'.freeze
2
+ VERSION = '0.68.0'.freeze
3
3
  end
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.67.5
4
+ version: 0.68.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fortes Tecnologia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-06 00:00:00.000000000 Z
11
+ date: 2024-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -90,6 +90,7 @@ files:
90
90
  - lib/teodoro/console.rb
91
91
  - lib/teodoro/empresa.rb
92
92
  - lib/teodoro/empresa/arquivo_data_emp.rb
93
+ - lib/teodoro/empresa/arquivo_data_pre.rb
93
94
  - lib/teodoro/empresa/arquivo_data_rub.rb
94
95
  - lib/teodoro/empresa/arquivo_de_dados_gerais.rb
95
96
  - lib/teodoro/empresa/arquivos_data.rb