sticutils 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc9e052b991176970003a237ef486f1fd48424de378fc656b9c80e59fbc360a8
4
- data.tar.gz: aa95fbeba10911c1a756b0c875b10c93a9c2e69476b594511a8f1b1ac92d8c77
3
+ metadata.gz: 9c02e6b6ec61e26a14e47767011769859102c97bbf5d52e6c15c475578a65f8c
4
+ data.tar.gz: 42c67a9eafcc49ef69ba69d6629d880ecc305aefb113bbeba08c1e194dcd5f1f
5
5
  SHA512:
6
- metadata.gz: a2bec1c7cc31648fac5fb1bdaed12e12eac6b3e59389a18d9b78d3fad291884dc2552a99c930476c3eeeaff57d3b4d568b55753b5b321283fb8d3675d3acaaae
7
- data.tar.gz: 9936bee69148d54b5026996bd4283396d6188fd760d6e54f5200112012f21270ca93f50612c4c155ac2d5f026fb89a317f327eb7858d892888244776fa847037
6
+ metadata.gz: b438d1da661c6bbb04d995b1dd810e941e9dd0bfb4fd3cca6b142defac7fbe3f4d609fe4c1dc7cf0dad8013ad27afe7f994889bd63db8cc856cab0cc000d56bd
7
+ data.tar.gz: 23034e2e75d1688e98541170b86f50a44f1b2fa3eb2b55ee858b15b2b65f6dd7fe96116aafc95609f732d0a9161943a4f25aa4e97953ab83fbc3a691ebfde283
@@ -0,0 +1,83 @@
1
+ class Gestorh::FolhaAgrupadaIdSeparado < Gestorh::GestorhRecord
2
+ self.table_name = 'public.folhas_agrupadas_gestorh_folha_id_separado'
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
@@ -1,3 +1,3 @@
1
1
  module Sticutils
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
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.7
4
+ version: 0.1.8
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-04-23 00:00:00.000000000 Z
11
+ date: 2019-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -69,6 +69,7 @@ files:
69
69
  - app/models/gestorh/banco.rb
70
70
  - app/models/gestorh/folha.rb
71
71
  - app/models/gestorh/folha_agrupada.rb
72
+ - app/models/gestorh/folha_agrupada_id_separado.rb
72
73
  - app/models/gestorh/folha_agrupada_total.rb
73
74
  - app/models/gestorh/funcao.rb
74
75
  - app/models/gestorh/funcionario.rb