Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 21.34 KB | None | 0 0
  1. package com.inova10.simulador
  2.  
  3. import java.text.SimpleDateFormat;
  4. import grails.plugins.springsecurity.Secured;
  5. import org.codehaus.groovy.grails.commons.ConfigurationHolder
  6. import grails.converters.*
  7. import com.inova10.simulador.calculos.*
  8. import java.text.*
  9.  
  10. @Secured(['ROLE_ADMIN'])
  11. class RelatorioAdminController {
  12.     private SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy")
  13.  
  14.     def exportService
  15.  
  16.     private ArrayList trabalhadoresInstanceList = Trabalhador.getAll()
  17.  
  18.     def index = { }
  19.  
  20.     def relatorioRh = {        
  21.         [trabalhadoresList:new ArrayList()]
  22.     }
  23.  
  24.     def manipularUsuario = {        
  25.         def trabalhadorInstance = Trabalhador.findByCpf(params.id)
  26.         session.setAttribute("trabalhador",trabalhadorInstance)
  27.         redirect(controller:"trabalhador",action:"show")
  28.     }
  29.  
  30.     private def numeroTrabalhadoresSexo(ArrayList trabalhadores){
  31.         int m = 0
  32.         int f = 0
  33.         for(Trabalhador t:trabalhadores){
  34.             if(t.sexo.equals("M")){
  35.                 m++                
  36.             }else{
  37.                 f++                
  38.             }
  39.         }
  40.         return [m:m, f:f]
  41.     }
  42.  
  43.     def exportRelatorio (ArrayList trabalhadorList, String titulo){
  44.         SimpleDateFormat sdf = new  SimpleDateFormat("dd-MM-yyyy");
  45.         if(params?.format && params.format != "html"){
  46.             String filename = "${params["action"]}_${sdf.format(new Date())}"
  47.             response.contentType = ConfigurationHolder.config.grails.mime.types[params.format]
  48.             response.setHeader("Content-disposition", "attachment; filename=${filename}.${params.extension}")
  49.             List fields = ["ocorrencia", "nome", "cpf", "identificador", "sexo"]
  50.             Map labels = ["ocorrencia": "Ocorrência", "nome": "Nome", "cpf":"CPF","identificador":"Matrícula","sexo":"Sexo"]
  51.             def upperCase = { domain, value ->
  52.                 return value.toUpperCase()
  53.             }
  54.             def formatDate = {domain, value->
  55.                 SimpleDateFormat format = new  SimpleDateFormat("dd/MM/yyyy");
  56.                 return format.format(value)
  57.             }
  58.             def formatSexo = {domain, value->
  59.                 if(value.equals("M"))return "Masculino"
  60.                 return "Feminino"
  61.             }
  62.             def qtdSexo = numeroTrabalhadoresSexo(trabalhadorList)
  63.             String title = """${titulo}
  64.  
  65.            Total de trabalhadores:  ${trabalhadorList.size()}
  66.            Número de trabalhadores por sexo:
  67.                Masculino: ${qtdSexo.m}
  68.                Feminino: ${qtdSexo.f}"""
  69.             Map formatters = [nome: upperCase, ocorrencia:formatDate, sexo:formatSexo]
  70.             Map parameters = [title: title, "column.widths": [0.1, 0.7, 0.2, 0.1, 0.1]]
  71.             exportService.export(params.format, response.outputStream,trabalhadorList, fields, labels,formatters, parameters)
  72.         }
  73.     }
  74.  
  75.     def exportRelatorio (ArrayList trabalhadorList, String titulo, String label){
  76.         SimpleDateFormat sdf = new  SimpleDateFormat("dd-MM-yyyy");
  77.         if(params?.format && params.format != "html"){
  78.             String filename = "${params["action"]}_${sdf.format(new Date())}"
  79.             response.contentType = ConfigurationHolder.config.grails.mime.types[params.format]
  80.             response.setHeader("Content-disposition", "attachment; filename=${filename}.${params.extension}")
  81.             List fields = ["ocorrencia", "nome", "cpf", "identificador", "sexo"]
  82.             Map labels = ["ocorrencia": "${label}", "nome": "Nome", "cpf":"CPF","identificador":"Matrícula","sexo":"Sexo"]
  83.             def upperCase = { domain, value ->
  84.                 return value.toUpperCase()
  85.             }
  86.             def formatDate = {domain, value->
  87.                 SimpleDateFormat format = new  SimpleDateFormat("dd/MM/yyyy");
  88.                 return format.format(value)
  89.             }
  90.             def formatSexo = {domain, value->
  91.                 if(value.equals("M"))return "Masculino"
  92.                 return "Feminino"
  93.             }
  94.             def qtdSexo = numeroTrabalhadoresSexo(trabalhadorList)
  95.             String title = """${titulo}
  96.  
  97.            Total de trabalhadores:  ${trabalhadorList.size()}
  98.            Número de trabalhadores por sexo:
  99.                Masculino: ${qtdSexo.m}
  100.                Feminino: ${qtdSexo.f}"""
  101.             Map formatters = [nome: upperCase, ocorrencia:formatDate, sexo:formatSexo]
  102.             Map parameters = [title: title, "column.widths": [0.1, 0.7, 0.2, 0.1, 0.1]]
  103.             exportService.export(params.format, response.outputStream,trabalhadorList, fields, labels,formatters, parameters)
  104.         }
  105.     }
  106.  
  107.     private ArrayList geraRelatorio(String regraDescricao){
  108.         ArrayList trabalhadoresList = new ArrayList()
  109.         for(TrabalhadorRelatorio t: trabalhadoresInstanceList){
  110.             def intervalos = AjudaAposentadoria.criaIntervalosTempo(t)
  111.             def r = new RegrasAposentadoriaFactory(intervalos, t);
  112.             def regraTrabalhador = r.getInstance(regraDescricao)
  113.             regraTrabalhador.calcula()            
  114.             if(regraTrabalhador.possivel == null){
  115.                 t = null
  116.             }else{
  117.                 if(!regraTrabalhador.possivel.class.name.equals("java.util.Date"))t = null
  118.             }
  119.             if(t){
  120.                 TrabalhadorRelatorio tRelatorio = new TrabalhadorRelatorio(t, regraTrabalhador.possivel)
  121.                 trabalhadoresList.add(tRelatorio)
  122.             }
  123.         }
  124.         trabalhadoresList.sort()
  125.         exportRelatorio(trabalhadoresList, message(code:regraDescricao))
  126.         return trabalhadoresList
  127.     }
  128.  
  129.     private ArrayList geraRelatorio(String regraDescricao, String label){
  130.         ArrayList trabalhadoresList = new ArrayList()
  131.         for(TrabalhadorRelatorio t: trabalhadoresInstanceList){
  132.             def intervalos = AjudaAposentadoria.criaIntervalosTempo(t)
  133.             def r = new RegrasAposentadoriaFactory(intervalos, t);
  134.             def regraTrabalhador = r.getInstance(regraDescricao)
  135.             regraTrabalhador.calcula()
  136.             if(regraTrabalhador.possivel == null){
  137.                 t = null
  138.             }else{
  139.                 if(!regraTrabalhador.possivel.class.name.equals("java.util.Date"))t = null
  140.             }
  141.             if(t){
  142.                 TrabalhadorRelatorio tRelatorio = new TrabalhadorRelatorio(t, regraTrabalhador.possivel)
  143.                 trabalhadoresList.add(tRelatorio)
  144.             }
  145.         }
  146.         trabalhadoresList.sort()
  147.         exportRelatorio(trabalhadoresList, message(code:regraDescricao), label)
  148.         return trabalhadoresList
  149.     }
  150.  
  151.     def tempoCarreira = {
  152.         ArrayList trabalhadoresList = new ArrayList()
  153.         flash.message = "SERVIDORES POR TEMPO NA CARREIRA"
  154.         for(Trabalhador t:trabalhadoresInstanceList){
  155.             def intervalos = AjudaAposentadoria.criaIntervalosTempo(t)
  156.             def intervalosTrabalho = AjudaAposentadoria.filtraIntervalosTrabalho(intervalos);
  157.             def intervalosCarreira = AjudaAposentadoria.filtraCarreira(intervalosTrabalho);
  158.             if(0<intervalosCarreira.size()){
  159.                 intervalosCarreira.sort()
  160.                 TrabalhadorRelatorio tRelatorio = new TrabalhadorRelatorio(t, intervalosCarreira.last().fim)
  161.                 trabalhadoresList.add(tRelatorio)
  162.             }
  163.         }
  164.         trabalhadoresList.sort{ a, b -> b.ocorrencia <=> a.ocorrencia }
  165.         exportRelatorio(trabalhadoresList, (String)flash.message)
  166.         render(view: "relatorioRh", model:[trabalhadoresList:trabalhadoresList, qtdSexo:numeroTrabalhadoresSexo(trabalhadoresList)])
  167.     }
  168.  
  169.     def tempoServicoPublico = {
  170.         ArrayList trabalhadoresList = new ArrayList()
  171.         flash.message = "SERVIDORES POR TEMPO SERVIÇO DE PÚBLICO"
  172.         for(Trabalhador t:trabalhadoresInstanceList){
  173.             def intervalos = AjudaAposentadoria.criaIntervalosTempo(t)
  174.             def intervalosTrabalho = AjudaAposentadoria.filtraIntervalosTrabalho(intervalos);
  175.             def intervalosServicoPublico = AjudaAposentadoria.filtraTipo(intervalosTrabalho);
  176.             if(0<intervalosServicoPublico.size()){
  177.                 intervalosServicoPublico.sort()
  178.                 TrabalhadorRelatorio tRelatorio = new TrabalhadorRelatorio(t, intervalosServicoPublico.last().fim)
  179.                 trabalhadoresList.add(tRelatorio)
  180.             }
  181.         }
  182.         trabalhadoresList.sort{ a, b -> b.ocorrencia <=> a.ocorrencia }
  183.         exportRelatorio(trabalhadoresList, (String)flash.message)
  184.         render(view: "relatorioRh", model:[trabalhadoresList:trabalhadoresList, qtdSexo:numeroTrabalhadoresSexo(trabalhadoresList)])
  185.     }
  186.  
  187.     def isencaoPSSDireitoAdquiridoRolGeral = {
  188.         ArrayList trabalhadoresList = new ArrayList()
  189.         flash.message = "ISENÇÃO PSS - DIREITO ADQUIRIDO - Rol Geral"
  190.         for(TrabalhadorRelatorio t: trabalhadoresInstanceList){
  191.             def intervalos = AjudaAposentadoria.criaIntervalosTempo(t)
  192.             def r = new RegrasAposentadoriaFactory(intervalos, t);
  193.             ArrayList regrasTrabalhador = new ArrayList()
  194.             regrasTrabalhador.add(r.getInstance("regra1.descricao"))
  195.             regrasTrabalhador.add(r.getInstance("regra3.descricao"))
  196.             regrasTrabalhador.add(r.getInstance("regra5.descricao"))
  197.             regrasTrabalhador.each{obj->
  198.                 obj.calcula()
  199.                 if(obj.possivel == null)t=null
  200.                 if(obj.possivel){
  201.                     t=t
  202.                     if(obj.descricao.equals("regra1.descricao"))obj.possivel = sdf.parse("16/12/1998")
  203.                     if(obj.descricao.equals("regra1.descricao")
  204.                     ||obj.descricao.equals("regra5.descricao")){
  205.                         obj.possivel = sdf.parse("19/02/2004")
  206.                     }
  207.                 }
  208.             }
  209.             if(t){
  210.                 regrasTrabalhador.sort()
  211.                 TrabalhadorRelatorio tRelatorio = new TrabalhadorRelatorio(t, regrasTrabalhador.last().possivel)
  212.                 trabalhadoresList.add(tRelatorio)                
  213.             }
  214.         }
  215.         trabalhadoresList.sort()
  216.         exportRelatorio(trabalhadoresList, (String)flash.message,"Dt. ISENÇÃO do PSS")
  217.         render(view: "relatorioRh", model:[trabalhadoresList:trabalhadoresList, qtdSexo:numeroTrabalhadoresSexo(trabalhadoresList),label:"Dt. ISENÇÃO do PSS"])
  218.     }
  219.  
  220.     def isencaoPssDireitoAadquiridoRegraAnteriorEC98Integral = {
  221.         ArrayList trabalhadoresList = geraRelatorio("regra1.descricao","Dt. ISENÇÃO do PSS")
  222.         trabalhadoresList.each{obj->
  223.             obj.ocorrencia = sdf.parse("16/12/1998")
  224.         }
  225.         flash.message = "ISENÇÃO PSS – DIREITO ADQUIRIDO - Regra Anterior a EC20/1998 - INTEGRAL"
  226.         render(view: "relatorioRh", model:[trabalhadoresList:trabalhadoresList, qtdSexo:numeroTrabalhadoresSexo(trabalhadoresList),label:"Dt. ISENÇÃO do PSS"])
  227.     }
  228.  
  229.     def isencaoPssDireitoAdquiridoRegraGeralEC98Integral = {
  230.         ArrayList trabalhadoresList = geraRelatorio("regra3.descricao","Dt. ISENÇÃO do PSS")
  231.         trabalhadoresList.each{obj->
  232.             obj.ocorrencia = sdf.parse("19/02/2004")
  233.         }
  234.         flash.message = "ISENÇÃO PSS – DIREITO ADQUIRIDO - Regra Geral Vigência EC20/1998 - INTEGRAL"
  235.         render(view: "relatorioRh", model:[trabalhadoresList:trabalhadoresList, qtdSexo:numeroTrabalhadoresSexo(trabalhadoresList),label:"Dt. ISENÇÃO do PSS"])
  236.     }
  237.  
  238.     def isencaoPssDireitoAdquiridoRegraTransicaoEC98Art8Integral  = {
  239.         ArrayList trabalhadoresList = geraRelatorio("regra5.descricao","Dt. ISENÇÃO do PSS")
  240.         trabalhadoresList.each{obj->
  241.             obj.ocorrencia = sdf.parse("19/02/2004")
  242.         }
  243.         flash.message = "ISENÇÃO PSS – DIREITO ADQUIRIDO - Regra de Transição Vigência EC20/1998 – Artigo 8o - INTEGRAL"
  244.         render(view: "relatorioRh", model:[trabalhadoresList:trabalhadoresList, qtdSexo:numeroTrabalhadoresSexo(trabalhadoresList),label:"Dt. ISENÇÃO do PSS"])
  245.     }
  246.  
  247.     def abonoDireitoAdquiridoRolGeral = {
  248.         ArrayList trabalhadoresList = new ArrayList()
  249.         flash.message = "ABONO DE PERMANÊNCIA – DIREITO ADQUIRIDO – Rol Geral"
  250.         for(TrabalhadorRelatorio t: trabalhadoresInstanceList){
  251.             def intervalos = AjudaAposentadoria.criaIntervalosTempo(t)
  252.             def r = new RegrasAposentadoriaFactory(intervalos, t);
  253.             ArrayList regrasTrabalhador = new ArrayList()
  254.             regrasTrabalhador.add(r.getInstance("regra1.descricao"))
  255.             regrasTrabalhador.add(r.getInstance("regra2.descricao"))
  256.             regrasTrabalhador.add(r.getInstance("regra3.descricao"))
  257.             regrasTrabalhador.add(r.getInstance("regra4.descricao"))
  258.             regrasTrabalhador.add(r.getInstance("regra5.descricao"))
  259.             regrasTrabalhador.add(r.getInstance("regra6.descricao"))
  260.             regrasTrabalhador.each{obj->
  261.                 obj.calcula()
  262.                 if(obj.possivel == null)t=null
  263.                 if(obj.possivel){
  264.                     t=t
  265.                     if(obj.descricao.equals("regra1.descricao")
  266.                             ||obj.descricao.equals("regra5.descricao")){
  267.                         obj.possivel = sdf.parse("20/05/2004")
  268.                     }
  269.                     if(obj.descricao.equals("regra2.descricao")
  270.                             ||obj.descricao.equals("regra4.descricao")
  271.                             ||obj.descricao.equals("regra6.descricao")){
  272.                         obj.possivel = sdf.parse("31/12/2003")
  273.                     }
  274.                     if(obj.descricao.equals("regra3.descricao"))obj.possivel = sdf.parse("20/02/2004")
  275.                 }
  276.             }
  277.             if(t){
  278.                 regrasTrabalhador.sort()
  279.                 TrabalhadorRelatorio tRelatorio = new TrabalhadorRelatorio(t, regrasTrabalhador[0].possivel)
  280.                 trabalhadoresList.add(tRelatorio)
  281.             }
  282.         }
  283.         trabalhadoresList.sort()
  284.         exportRelatorio(trabalhadoresList, (String)flash.message, "Dt. Abono")
  285.         render(view: "relatorioRh", model:[trabalhadoresList:trabalhadoresList, qtdSexo:numeroTrabalhadoresSexo(trabalhadoresList),label:"Dt. Abono"])
  286.     }
  287.  
  288.     def abonoDireitoAdquiridoRegraAnteriorEC98Integral = {
  289.         ArrayList trabalhadoresList = geraRelatorio("regra1.descricao","Dt. Abono")
  290.        trabalhadoresList.each{obj->
  291.             obj.ocorrencia = sdf.parse("20/05/2004")
  292.         }
  293.         flash.message = "ABONO DE PERMANÊNCIA – DIREITO ADQUIRIDO - Regra Anterior EC 20/1998 - INTEGRAL"
  294.         render(view: "relatorioRh", model:[trabalhadoresList:trabalhadoresList, qtdSexo:numeroTrabalhadoresSexo(trabalhadoresList),label:"Dt. Abono"])
  295.     }
  296.  
  297.     def abonoDireitoAdquiridoRegraAnteriorEC98Proporcional = {
  298.         ArrayList trabalhadoresList = geraRelatorio("regra2.descricao","Dt. Abono")
  299.         trabalhadoresList.each{obj->
  300.             obj.ocorrencia = sdf.parse("31/12/2003")
  301.         }
  302.         flash.message = "ABONO DE PERMANÊNCIA – DIREITO ADQUIRIDO - Regra Anterior EC 20/1998 - Proporcional"
  303.         render(view: "relatorioRh", model:[trabalhadoresList:trabalhadoresList, qtdSexo:numeroTrabalhadoresSexo(trabalhadoresList),label:"Dt. Abono"])
  304.     }
  305.  
  306.     def abonoDireitoAdquiridoRegraGeralEC98Integral = {
  307.         ArrayList trabalhadoresList = geraRelatorio("regra3.descricao","Dt. Abono")
  308.         trabalhadoresList.each{obj->
  309.             obj.ocorrencia = sdf.parse("20/02/2004")
  310.         }
  311.         flash.message = "ABONO DE PERMANÊNCIA – DIREITO ADQUIRIDO - Regra Geral Vigência EC 20/98 - INTEGRAL"
  312.         render(view: "relatorioRh", model:[trabalhadoresList:trabalhadoresList, qtdSexo:numeroTrabalhadoresSexo(trabalhadoresList),label:"Dt. Abono"])
  313.     }
  314.  
  315.     def abonoDireitoAdquiridoRegraGeralEC98Idade = {
  316.         ArrayList trabalhadoresList = geraRelatorio("regra4.descricao","Dt. Abono")
  317.         trabalhadoresList.each{obj->
  318.             obj.ocorrencia = sdf.parse("31/12/2003")
  319.         }
  320.         flash.message = "ABONO DE PERMANÊNCIA – DIREITO ADQUIRIDO - Regra Geral Vigência EC 20/98 – POR IDADE"
  321.         render(view: "relatorioRh", model:[trabalhadoresList:trabalhadoresList, qtdSexo:numeroTrabalhadoresSexo(trabalhadoresList),label:"Dt. Abono"])
  322.     }
  323.  
  324.     def abonoDireitoAdquiridoRegraTransicaoEC98Integral = {
  325.         ArrayList trabalhadoresList = geraRelatorio("regra5.descricao","Dt. Abono")
  326.         trabalhadoresList.each{obj->
  327.             obj.ocorrencia = sdf.parse("20/05/2004")
  328.         }
  329.         flash.message = "ABONO DE PERMANÊNCIA – DIREITO ADQUIRIDO - Regra de Transição Vigência EC 20/98 - INTEGRAL"
  330.         render(view: "relatorioRh", model:[trabalhadoresList:trabalhadoresList, qtdSexo:numeroTrabalhadoresSexo(trabalhadoresList),label:"Dt. Abono"])
  331.     }
  332.  
  333.     def abonoDireitoAdquiridoRegraTransicaoEC98Proporcional = {
  334.         ArrayList trabalhadoresList = geraRelatorio("regra6.descricao","Dt. Abono")
  335.         trabalhadoresList.each{obj->
  336.             obj.ocorrencia = sdf.parse("31/12/2003")
  337.         }
  338.         flash.message = "ABONO DE PERMANÊNCIA – DIREITO ADQUIRIDO - Regra de Transição Vigência EC 20/98 - PROPORCIONAL"
  339.         render(view: "relatorioRh", model:[trabalhadoresList:trabalhadoresList, qtdSexo:numeroTrabalhadoresSexo(trabalhadoresList),label:"Dt. Abono"])
  340.     }
  341.  
  342.     def abonoRegraGeralEC41VoluntariaIntegral = {
  343.         ArrayList trabalhadoresList = geraRelatorio("regra7.descricao","Dt. Abono")
  344.         flash.message = "ABONO DE PERMANÊNCIA – REGRA GERAL Vigência EC 41/2003 – VOLUNTÁRIA - INTEGRAL"
  345.         render(view: "relatorioRh", model:[trabalhadoresList:trabalhadoresList, qtdSexo:numeroTrabalhadoresSexo(trabalhadoresList),label:"Dt. Abono"])
  346.     }
  347.  
  348.     def abonoRegraTransicaoEC41Art2Integral = {
  349.         ArrayList trabalhadoresList = geraRelatorio("regra11.descricao","Dt. Abono")
  350.         flash.message = "ABONO DE PERMANÊNCIA – REGRA DE TRANSIÇÃO – Vigência EC 41/2003 - Artigo 2o - INTEGRAL"
  351.         render(view: "relatorioRh", model:[trabalhadoresList:trabalhadoresList, qtdSexo:numeroTrabalhadoresSexo(trabalhadoresList),label:"Dt. Abono"])
  352.     }
  353.  
  354.     def regraAtuaisRolGeral = {
  355.         ArrayList trabalhadoresList = new ArrayList()
  356.         flash.message = "APOSENTADORIA REGRAS ATUAIS Vigência EC 41/2003 – Rol Geral"
  357.         for(TrabalhadorRelatorio t: trabalhadoresInstanceList){
  358.             def intervalos = AjudaAposentadoria.criaIntervalosTempo(t)
  359.             def r = new RegrasAposentadoriaFactory(intervalos, t);
  360.             ArrayList regrasTrabalhador = new ArrayList()
  361.             regrasTrabalhador.add(r.getInstance("regra8.descricao"))
  362.             regrasTrabalhador.add(r.getInstance("regra9.descricao"))
  363.             regrasTrabalhador.add(r.getInstance("regra12.descricao"))
  364.             regrasTrabalhador.add(r.getInstance("regra13.descricao"))
  365.             regrasTrabalhador.each{obj->
  366.                 obj.calcula()
  367.                 if(obj.possivel == null){
  368.                     t = null
  369.                 }else{
  370.                     if(!obj.possivel.class.name.equals("java.util.Date"))t = null
  371.                 }
  372.             }
  373.             if(t){
  374.                 regrasTrabalhador.sort()
  375.                 TrabalhadorRelatorio tRelatorio = new TrabalhadorRelatorio(t, regrasTrabalhador.last().possivel)
  376.                 trabalhadoresList.add(tRelatorio)
  377.             }
  378.         }
  379.         trabalhadoresList.sort()
  380.         exportRelatorio(trabalhadoresList, (String)flash.message)
  381.         render(view: "relatorioRh", model:[trabalhadoresList:trabalhadoresList, qtdSexo:numeroTrabalhadoresSexo(trabalhadoresList)])
  382.     }
  383.  
  384.     def aposentadoriaRegraGeralEC41VoluntariaIdade = {
  385.         ArrayList trabalhadoresList = geraRelatorio("regra8.descricao")
  386.         flash.message = "APOSENTADORIA REGRA GERAL Vigência EC 41/2003 – VOLUNTÁRIA-POR IDADE"
  387.         render(view: "relatorioRh", model:[trabalhadoresList:trabalhadoresList, qtdSexo:numeroTrabalhadoresSexo(trabalhadoresList)])
  388.     }
  389.  
  390.     def aposentadoriaRegraGeralEC41Compulsoria = {
  391.         ArrayList trabalhadoresList = geraRelatorio("regra12.descricao")
  392.         flash.message = "APOSENTADORIA REGRA GERAL Vigência EC 41/2003 – COMPULSÓRIA"
  393.         render(view: "relatorioRh", model:[trabalhadoresList:trabalhadoresList, qtdSexo:numeroTrabalhadoresSexo(trabalhadoresList)])
  394.     }
  395.  
  396.     def aposentadoriaRegraTransicaoEC47Art3 = {
  397.         ArrayList trabalhadoresList = geraRelatorio("regra13.descricao")
  398.         flash.message = "APOSENTADORIA REGRA DE TRANSIÇÃO Vigência EC 47/2005 – Artigo 3o – INTEGRAL"
  399.         render(view: "relatorioRh", model:[trabalhadoresList:trabalhadoresList, qtdSexo:numeroTrabalhadoresSexo(trabalhadoresList)])
  400.     }
  401.  
  402.     def aposentadoriaRegraTransicaoEC41Art6 = {
  403.         ArrayList trabalhadoresList = geraRelatorio("regra9.descricao")
  404.         flash.message = "APOSENTADORIA REGRA DE TRANSIÇÃO Vigência EC 41/2003 – Artigo 6o – INTEGRAL"
  405.         render(view: "relatorioRh", model:[trabalhadoresList:trabalhadoresList, qtdSexo:numeroTrabalhadoresSexo(trabalhadoresList)])
  406.     }
  407. }
  408.  
  409. class TrabalhadorRelatorio extends Trabalhador implements Comparable {
  410.     TrabalhadorRelatorio(Trabalhador trabalhador, Date ocorrencia){
  411.         this.cpf = trabalhador.cpf
  412.         this.identificador = trabalhador.identificador
  413.         this.nome = trabalhador.nome
  414.         this.sexo = trabalhador.sexo        
  415.         this.ocorrencia = ocorrencia
  416.     }
  417.     Date ocorrencia
  418.     public int compareTo(Object o){
  419.         return ocorrencia.compareTo(o.ocorrencia)
  420.     }
  421. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement