sticutils 0.1.4 → 0.1.5

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: ee61f240e41891fabcd80f1eaccf0c4fcb6bda14ac292cb266dabfe41c565b39
4
- data.tar.gz: 2c209335970e872da524df0d8b911c2a9f1cc11392dab6d2d6ee3c81e6beb9da
3
+ metadata.gz: 44fcd28b7d5d87a0923b29f353ed27db2ecf559aa343499bfa6ee48d312c640c
4
+ data.tar.gz: a0ec4dbd85f09f7971c8416c58fdf85c6f6821ead41a3d70d153001facf01c65
5
5
  SHA512:
6
- metadata.gz: cbaf5ddea94e8ac11baa0e8ec430daddc607d25645c7a65e27a05d3d5ebad62773c12a415a2babd207e5575584b672c5d61e5a904149ffea1964eab0e7704292
7
- data.tar.gz: 8bba235efffd6079eba8d5748bfd8f2b1ff1750d285897a476ca04eb7009c216dd33d2f4fe51f2b61a56fc131462f1287ae358bdf6901b3ec0358d5b03ee354a
6
+ metadata.gz: 6e59b272f9e248d4b2d5977d752a3e08efda499e9c7e814ea06f383988597e88543816efbe81453595c24b6e31ccc3636b6197cbd860d708cae7d573159383b9
7
+ data.tar.gz: a5e4f8617e1c896e05753dce518f0435175d0e2484bce1f571f5da928f69150563d79c0d1cc91b47aa00f552a072f3370737337dfa280f68c19e859725e7a29c
@@ -0,0 +1,3 @@
1
+ class Gestorh::Banco < Gestorh::GestorhRecord
2
+ self.table_name = 'gestor_rh.cdbanco'
3
+ end
@@ -0,0 +1,6 @@
1
+ class Gestorh::Folha < Gestorh::GestorhRecord
2
+ self.table_name = 'gestor_rh.cdfolha'
3
+
4
+ has_many :movimento_acumulados, foreign_key: :mv_regfolha, primary_key: :fp_registro
5
+ has_many :funcionarios, through: :movimento_acumulados
6
+ end
@@ -0,0 +1,83 @@
1
+ class Gestorh::FolhaAgrupada < Gestorh::GestorhRecord
2
+ self.table_name = 'public.folhas_agrupadas_gestorh'
3
+
4
+ belongs_to :funcionario, foreign_key: :matricula, primary_key: :fn_matricula
5
+
6
+ belongs_to :vinculo, foreign_key: :mvps_vinculo, primary_key: :vc_codigo
7
+ belongs_to :funcao, foreign_key: :mvps_funcao, primary_key: :fc_codigo
8
+ belongs_to :cargo, foreign_key: :mvps_cargo, primary_key: :fc_codigo, class_name: Gestorh::Funcao
9
+ belongs_to :lotacao, foreign_key: :mvps_reglotacao, primary_key: :lt_registro
10
+ belongs_to :nivel_salario, foreign_key: :mvps_nivelsalario, primary_key: :ns_registro
11
+
12
+ def liquido_total
13
+ self.rendimento_total - self.desconto_total
14
+ end
15
+
16
+ def eventos_e_valores
17
+ Gestorh::MovimentoAcumulado.where(mv_regfolha: self.folhas, mv_matricula: self.matricula)
18
+ .joins(:evento_folha_pagamento)
19
+ .where.not('evento_folha_pagamentos.tipo': 'DESCONTO_PREVIDENCIA_PUBLICA_IAPEP')
20
+ .select('mv_regfolha as folha_id', 'mv_verba as codigo_evento',
21
+ 'evento_folha_pagamentos.descricao as nome_evento',
22
+ 'mv_dc as status', 'mv_total as valor', 'evento_folha_pagamentos.tipo')
23
+ .to_a
24
+ end
25
+
26
+ def remuneracao_paradigma
27
+ if Date.new(ano, mes, 1) < Date.new(2013,7,1)
28
+ self.eventos_e_valores.select{|x| x.tipo == 'RENDIMENTO_REMUNERACAO' && x.status == 'C'}
29
+ else
30
+ []
31
+ end
32
+ end
33
+
34
+ def vantagens_pessoais
35
+ self.eventos_e_valores.select{|x| x.tipo == 'RENDIMENTO_VANTAGENS_PESSOAIS' && x.status == 'C'}
36
+ end
37
+
38
+ def subsidios
39
+ if Date.new(ano, mes, 1) < Date.new(2013,7,1)
40
+ []
41
+ else
42
+ self.eventos_e_valores.select{|x| (x.tipo == 'RENDIMENTO_SUBSIDIO_DIFERENCA_FUNCAO' || x.tipo == 'RENDIMENTO_REMUNERACAO') && x.status == 'C'}
43
+ end
44
+ end
45
+
46
+ def indenizacoes
47
+ self.eventos_e_valores.select{|x| x.tipo == 'RENDIMENTO_INDENIZACOES' && x.status == 'C' }
48
+ end
49
+
50
+ def vantagens_eventuais
51
+ self.eventos_e_valores.select{|x| x.tipo == 'RENDIMENTO_VANTAGENS_EVENTUAIS' && x.status == 'C'}
52
+ end
53
+
54
+ def gratificacoes
55
+ self.eventos_e_valores.select{|x| x.tipo == 'RENDIMENTO_GRATIFICACOES' && x.status == 'C'}
56
+ end
57
+
58
+ # sobrou da show
59
+ def subsidio_vantagens_pessoais
60
+ self.eventos_e_valores.select{|x| x.tipo == 'RENDIMENTO_VANTAGENS_EVENTUAIS' || x.tipo == 'RENDIMENTO_VANTAGENS_PESSOAIS'}
61
+ end
62
+
63
+ def subsidio_vantagens_pessoais_eventuais
64
+ self.eventos_e_valores.select{|x| x.tipo == 'RENDIMENTO_SUBSIDIO_DIFERENCA_FUNCAO' ||
65
+ x.tipo == 'RENDIMENTO_VANTAGENS_PESSOAIS' || (x.tipo == 'RENDIMENTO_VANTAGENS_EVENTUAIS' && x.status == 'C')}
66
+ end
67
+
68
+ # diarias
69
+ def diarias
70
+ self.daily_rates.where(date: [Date.new(self.ano, self.mes)..Date.new(self.ano, self.mes).at_end_of_month])
71
+ .sum(:pago)
72
+ end
73
+
74
+ def diarias_positivas
75
+ self.daily_rates.where(pago: [0..Float::INFINITY], date: [Date.new(self.ano, self.mes)..Date.new(self.ano, self.mes).at_end_of_month])
76
+ .sum(:pago)
77
+ end
78
+
79
+ def diarias_negativas
80
+ self.daily_rates.where(pago: [-Float::INFINITY..0], date: [Date.new(self.ano, self.mes)..Date.new(self.ano, self.mes).at_end_of_month])
81
+ .sum(:pago)
82
+ end
83
+ end
@@ -0,0 +1,3 @@
1
+ class Gestorh::FolhaAgrupadaTotal < Gestorh::GestorhRecord
2
+ self.table_name = 'public.folhas_agrupadas_total_gestorh'
3
+ end
@@ -0,0 +1,3 @@
1
+ class Gestorh::Funcao < Gestorh::GestorhRecord
2
+ self.table_name = 'gestor_rh.cdfuncao'
3
+ end
@@ -0,0 +1,6 @@
1
+ class Gestorh::Funcionario < Gestorh::GestorhRecord
2
+ self.table_name = 'gestor_rh.cdfuncionario'
3
+
4
+ has_many :movimento_acumulados, foreign_key: :mv_matricula, primary_key: :fn_matricula
5
+ has_many :folhas, through: :movimento_acumulados
6
+ end
@@ -0,0 +1,4 @@
1
+ class Gestorh::GestorhRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ self.establish_connection :transparencia
4
+ end
@@ -0,0 +1,3 @@
1
+ class Gestorh::Lotacao < Gestorh::GestorhRecord
2
+ self.table_name = 'gestor_rh.cdlotacao'
3
+ end
@@ -0,0 +1,3 @@
1
+ class Gestorh::Movimento < Gestorh::GestorhRecord
2
+ self.table_name = 'gestor_rh.cdmovto'
3
+ end
@@ -0,0 +1,9 @@
1
+ class Gestorh::MovimentoAcumulado < Gestorh::GestorhRecord
2
+ self.table_name = 'gestor_rh.cdmovtoacumulado'
3
+
4
+ belongs_to :verba, foreign_key: :mv_verba, primary_key: :vb_codigo
5
+ belongs_to :funcionario, foreign_key: :mv_matricula, primary_key: :fn_matricula
6
+ belongs_to :folha, foreign_key: :mv_regfolha, primary_key: :fp_registro
7
+
8
+ belongs_to :evento_folha_pagamento, foreign_key: :mv_verba, primary_key: :codigo, class_name: Transparencia::EventoFolhaPagamento
9
+ end
@@ -0,0 +1,9 @@
1
+ class Gestorh::MovimentoPosicao < Gestorh::GestorhRecord
2
+ self.table_name = 'gestor_rh.cdmovtoposicao'
3
+
4
+ belongs_to :vinculo, foreign_key: :mvps_vinculo, primary_key: :vc_codigo
5
+ belongs_to :funcao, foreign_key: :mvps_funcao, primary_key: :fc_codigo
6
+ belongs_to :cargo, foreign_key: :mvps_cargo, primary_key: :fc_codigo, class_name: Gestorh::Funcao
7
+ belongs_to :lotacao, foreign_key: :mvps_reglotacao, primary_key: :lt_registro
8
+ belongs_to :nivel_salario, foreign_key: :mvps_nivelsalario, primary_key: :ns_registro
9
+ end
@@ -0,0 +1,7 @@
1
+ class Gestorh::NivelSalario < Gestorh::GestorhRecord
2
+ self.table_name = 'gestor_rh.cdnivelsalario'
3
+
4
+ def nivel_referencia
5
+ "#{self.ns_nivel}#{'-' unless self.ns_nivel.blank? || self.ns_referencia.blank?}#{self.ns_referencia}"
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ class Gestorh::Verba < Gestorh::GestorhRecord
2
+ self.table_name = 'gestor_rh.cdverba'
3
+ end
@@ -0,0 +1,3 @@
1
+ class Gestorh::Vinculo < Gestorh::GestorhRecord
2
+ self.table_name = 'gestor_rh.cdvinculo'
3
+ end
@@ -0,0 +1,2 @@
1
+ module Gestorh
2
+ end
@@ -0,0 +1,3 @@
1
+ class Transparencia::EventoFolhaPagamento < Transparencia::TransparenciaRecord
2
+ has_many :folha_pagamento_detalhadas
3
+ end
@@ -0,0 +1,4 @@
1
+ class Transparencia::TransparenciaRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ self.establish_connection :transparencia
4
+ end
@@ -0,0 +1,2 @@
1
+ module Transparencia
2
+ end
@@ -1,3 +1,3 @@
1
1
  module Sticutils
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sticutils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Viana
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-21 00:00:00.000000000 Z
11
+ date: 2019-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -65,6 +65,21 @@ files:
65
65
  - LICENSE.txt
66
66
  - README.md
67
67
  - Rakefile
68
+ - app/models/gestorh.rb
69
+ - app/models/gestorh/banco.rb
70
+ - app/models/gestorh/folha.rb
71
+ - app/models/gestorh/folha_agrupada.rb
72
+ - app/models/gestorh/folha_agrupada_total.rb
73
+ - app/models/gestorh/funcao.rb
74
+ - app/models/gestorh/funcionario.rb
75
+ - app/models/gestorh/gestorh_record.rb
76
+ - app/models/gestorh/lotacao.rb
77
+ - app/models/gestorh/movimento.rb
78
+ - app/models/gestorh/movimento_acumulado.rb
79
+ - app/models/gestorh/movimento_posicao.rb
80
+ - app/models/gestorh/nivel_salario.rb
81
+ - app/models/gestorh/verba.rb
82
+ - app/models/gestorh/vinculo.rb
68
83
  - app/models/intranet.rb
69
84
  - app/models/intranet/admin_log.rb
70
85
  - app/models/intranet/admin_module.rb
@@ -222,6 +237,9 @@ files:
222
237
  - app/models/intranet/tjpi_vinculadoemfolha.rb
223
238
  - app/models/intranet/tjpi_vinculo.rb
224
239
  - app/models/intranet/tjpi_vinculo_documento.rb
240
+ - app/models/transparencia.rb
241
+ - app/models/transparencia/evento_folha_pagamento.rb
242
+ - app/models/transparencia/transparencia_record.rb
225
243
  - bin/console
226
244
  - bin/setup
227
245
  - lib/sticutils.rb