Class: Gestorh::FolhaAgrupada
- Inherits:
-
GestorhRecord
- Object
- ActiveRecord::Base
- GestorhRecord
- Gestorh::FolhaAgrupada
- Defined in:
- app/models/gestorh/folha_agrupada.rb
Instance Method Summary collapse
-
#diarias ⇒ Object
diarias.
- #diarias_negativas ⇒ Object
- #diarias_positivas ⇒ Object
- #eventos_e_valores ⇒ Object
- #gratificacoes ⇒ Object
- #indenizacoes ⇒ Object
- #liquido_total ⇒ Object
- #remuneracao_paradigma ⇒ Object
- #subsidio_com_gratificacao ⇒ Object
-
#subsidio_vantagens_pessoais ⇒ Object
sobrou da show.
- #subsidio_vantagens_pessoais_eventuais ⇒ Object
- #subsidios ⇒ Object
- #vantagens_eventuais ⇒ Object
- #vantagens_pessoais ⇒ Object
Instance Method Details
#diarias ⇒ Object
diarias
76 77 78 79 80 81 |
# File 'app/models/gestorh/folha_agrupada.rb', line 76 def diarias if Object.const_defined?('DailyRate') DailyRate.where(cpf: numeric_cpf, date: [Date.new(self.ano, self.mes)..Date.new(self.ano, self.mes).at_end_of_month]) .sum(:pago) end end |
#diarias_negativas ⇒ Object
91 92 93 94 95 96 97 |
# File 'app/models/gestorh/folha_agrupada.rb', line 91 def diarias_negativas if Object.const_defined?('DailyRate') DailyRate.where(cpf: numeric_cpf, pago: [-Float::INFINITY..0], date: [Date.new(self.ano, self.mes)..Date.new(self.ano, self.mes).at_end_of_month]) .sum(:pago) end end |
#diarias_positivas ⇒ Object
83 84 85 86 87 88 89 |
# File 'app/models/gestorh/folha_agrupada.rb', line 83 def diarias_positivas if Object.const_defined?('DailyRate') DailyRate.where(cpf: numeric_cpf, pago: [0..Float::INFINITY], date: [Date.new(self.ano, self.mes)..Date.new(self.ano, self.mes).at_end_of_month]) .sum(:pago) end end |
#eventos_e_valores ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/gestorh/folha_agrupada.rb', line 17 def eventos_e_valores # .where.not('cdclassificacaoverba.cv_classificacao': 'DESCONTO_PREVIDENCIA_PUBLICA_IAPEP') Gestorh::MovimentoAcumulado.where(mv_regfolha: self.folhas, mv_matricula: self.matricula) .joins(verba: :classificacao_verba) .select('mv_regfolha as folha_id', 'mv_verba as codigo_evento', 'cdverba.vb_nome as nome_evento', 'mv_dc as status', 'mv_total as valor', 'cdclassificacaoverba.cv_classificacao as tipo') .to_a .uniq{|x| [x.codigo_evento, x.status, x.valor] } # uniq temporario para remover verbas com 2 classificacoes end |
#gratificacoes ⇒ Object
57 58 59 |
# File 'app/models/gestorh/folha_agrupada.rb', line 57 def gratificacoes self.eventos_e_valores.select{|x| x.tipo == 'RENDIMENTO_GRATIFICACOES' && x.status == 'C'} end |
#indenizacoes ⇒ Object
49 50 51 |
# File 'app/models/gestorh/folha_agrupada.rb', line 49 def indenizacoes self.eventos_e_valores.select{|x| x.tipo == 'RENDIMENTO_INDENIZACOES' && x.status == 'C' } end |
#liquido_total ⇒ Object
13 14 15 |
# File 'app/models/gestorh/folha_agrupada.rb', line 13 def liquido_total self.rendimento_total - self.desconto_total end |
#remuneracao_paradigma ⇒ Object
29 30 31 32 33 34 35 |
# File 'app/models/gestorh/folha_agrupada.rb', line 29 def remuneracao_paradigma if Date.new(ano, mes, 1) < Date.new(2013,7,1) self.eventos_e_valores.select{|x| x.tipo == 'RENDIMENTO_REMUNERACAO' && x.status == 'C'} else [] end end |
#subsidio_com_gratificacao ⇒ Object
71 72 73 |
# File 'app/models/gestorh/folha_agrupada.rb', line 71 def subsidio_com_gratificacao self.subsidios.pluck(:valor).sum end |
#subsidio_vantagens_pessoais ⇒ Object
sobrou da show
62 63 64 |
# File 'app/models/gestorh/folha_agrupada.rb', line 62 def subsidio_vantagens_pessoais self.eventos_e_valores.select{|x| x.tipo == 'RENDIMENTO_VANTAGENS_EVENTUAIS' || x.tipo == 'RENDIMENTO_VANTAGENS_PESSOAIS'} end |
#subsidio_vantagens_pessoais_eventuais ⇒ Object
66 67 68 69 |
# File 'app/models/gestorh/folha_agrupada.rb', line 66 def subsidio_vantagens_pessoais_eventuais self.eventos_e_valores.select{|x| x.tipo == 'RENDIMENTO_SUBSIDIO_DIFERENCA_FUNCAO' || x.tipo == 'RENDIMENTO_VANTAGENS_PESSOAIS' || (x.tipo == 'RENDIMENTO_VANTAGENS_EVENTUAIS' && x.status == 'C')} end |
#subsidios ⇒ Object
41 42 43 44 45 46 47 |
# File 'app/models/gestorh/folha_agrupada.rb', line 41 def subsidios if Date.new(ano, mes, 1) < Date.new(2013,7,1) [] else self.eventos_e_valores.select{|x| (x.tipo == 'RENDIMENTO_SUBSIDIO_DIFERENCA_FUNCAO' || x.tipo == 'RENDIMENTO_REMUNERACAO') && x.status == 'C'} end end |
#vantagens_eventuais ⇒ Object
53 54 55 |
# File 'app/models/gestorh/folha_agrupada.rb', line 53 def vantagens_eventuais self.eventos_e_valores.select{|x| x.tipo == 'RENDIMENTO_VANTAGENS_EVENTUAIS' && x.status == 'C'} end |
#vantagens_pessoais ⇒ Object
37 38 39 |
# File 'app/models/gestorh/folha_agrupada.rb', line 37 def vantagens_pessoais self.eventos_e_valores.select{|x| x.tipo == 'RENDIMENTO_VANTAGENS_PESSOAIS' && x.status == 'C'} end |