@ -19,6 +19,7 @@ import com.sun.rave.web.ui.component.Table;
import com.sun.rave.web.ui.component.TextField ;
import com.sun.rave.web.ui.component.TextField ;
import com.sun.rave.web.ui.model.Option ;
import com.sun.rave.web.ui.model.Option ;
import db.EstatisticasConstants ;
import db.EstatisticasConstants ;
import db.data.siprp.outer.SeccoesData ;
import db.providers.EstatisticasDataProvider ;
import db.providers.EstatisticasDataProvider ;
import global.Global ;
import global.Global ;
import java.text.SimpleDateFormat ;
import java.text.SimpleDateFormat ;
@ -55,6 +56,17 @@ public class EstatisticasProcesso extends AbstractPageBean
this . lnkPlanosActuacao = h ;
this . lnkPlanosActuacao = h ;
}
}
private Hyperlink lnkAnaliseAcidentes = new Hyperlink ( ) ;
public Hyperlink getLnkAnaliseAcidentes ( )
{
return lnkAnaliseAcidentes ;
}
public void setLnkAnaliseAcidentes ( Hyperlink lnkAnaliseAcidentes )
{
this . lnkAnaliseAcidentes = lnkAnaliseAcidentes ;
}
private StaticText lblUser = new StaticText ( ) ;
private StaticText lblUser = new StaticText ( ) ;
public StaticText getLblUser ( )
public StaticText getLblUser ( )
{
{
@ -155,24 +167,14 @@ public class EstatisticasProcesso extends AbstractPageBean
this . dropCausas = dropCausas ;
this . dropCausas = dropCausas ;
}
}
// private TextField textDepartamento = new TextField();
// public TextField getTextDepartamento() {
// private TextField textCausas = new TextField();
// return textDepartamento;
// public TextField getTextCausas() {
// return textCausas;
// }
// }
// public void setText Causas(TextField textCausas ) {
// public void setTextDepartamento(TextField textDepartamento) {
// this.text Causas = textCausas ;
// this.text Departamento = textDepartamento ;
// }
// }
private TextField textDepartamento = new TextField ( ) ;
public TextField getTextDepartamento ( ) {
return textDepartamento ;
}
public void setTextDepartamento ( TextField textDepartamento ) {
this . textDepartamento = textDepartamento ;
}
private DropDown dropSeccoes = new DropDown ( ) ;
private DropDown dropSeccoes = new DropDown ( ) ;
public DropDown getDropSeccoes ( ) {
public DropDown getDropSeccoes ( ) {
@ -183,15 +185,6 @@ public class EstatisticasProcesso extends AbstractPageBean
this . dropSeccoes = dropSeccoes ;
this . dropSeccoes = dropSeccoes ;
}
}
// private TextField textSeccao = new TextField();
// public TextField getTextSeccao() {
// return textSeccao;
// }
// public void setTextSeccao(TextField textSeccao) {
// this.textSeccao = textSeccao;
// }
private DropDown dropTurno = new DropDown ( ) ;
private DropDown dropTurno = new DropDown ( ) ;
public DropDown getDropTurno ( ) {
public DropDown getDropTurno ( ) {
@ -201,14 +194,6 @@ public class EstatisticasProcesso extends AbstractPageBean
public void setDropTurno ( DropDown dropTurno ) {
public void setDropTurno ( DropDown dropTurno ) {
this . dropTurno = dropTurno ;
this . dropTurno = dropTurno ;
}
}
// private TextField textTurno = new TextField();
// public TextField getTextTurno() {
// return textTurno;
// }
// public void setTextTurno(TextField textTurno) {
// this.textTurno = textTurno;
// }
private RadioButtonGroup formacaoSHST = new RadioButtonGroup ( ) ;
private RadioButtonGroup formacaoSHST = new RadioButtonGroup ( ) ;
public RadioButtonGroup getFormacaoSHST ( )
public RadioButtonGroup getFormacaoSHST ( )
@ -236,6 +221,18 @@ public class EstatisticasProcesso extends AbstractPageBean
this . formacaoSHST_false = formacaoSHST_false ;
this . formacaoSHST_false = formacaoSHST_false ;
}
}
private RadioButton formacaoSHST_none = new RadioButton ( ) ;
public RadioButton getFormacaoSHST_none ( )
{
return formacaoSHST_none ;
}
public void setFormacaoSHST_none ( RadioButton formacaoSHST_none )
{
this . formacaoSHST_none = formacaoSHST_none ;
}
private RadioButton postoAcidentado_true = new RadioButton ( ) ;
private RadioButton postoAcidentado_true = new RadioButton ( ) ;
private RadioButton postoAcidentado_false = new RadioButton ( ) ;
private RadioButton postoAcidentado_false = new RadioButton ( ) ;
private RadioButton outrosColaboradores_true = new RadioButton ( ) ;
private RadioButton outrosColaboradores_true = new RadioButton ( ) ;
@ -322,6 +319,8 @@ public class EstatisticasProcesso extends AbstractPageBean
ErrorLogger . logException ( e ) ;
ErrorLogger . logException ( e ) ;
}
}
}
}
formacaoSHST_none . setSelected ( true ) ;
}
}
protected SessionBean1 getSessionBean1 ( )
protected SessionBean1 getSessionBean1 ( )
@ -410,6 +409,29 @@ public class EstatisticasProcesso extends AbstractPageBean
}
}
public String lnkAnalisesAcidente_action ( )
{
Utilizador currentUser = getSessionBean1 ( ) . getCurrentUser ( ) ;
int userType = currentUser = = null ? - 1 : currentUser . getTipo ( ) = = null ? - 1 : currentUser . getTipo ( ) . intValue ( ) ;
switch ( userType )
{
case Global . TIPO_UTILIZADOR_SEGURANCA :
return "form_seguranca" ;
case Global . TIPO_UTILIZADOR_RH :
return "form_rh" ;
case Global . TIPO_UTILIZADOR_HS :
return "form_hs" ;
case Global . TIPO_UTILIZADOR_DIRECTOR_SIPRP :
return "form_dir_siprp" ;
case Global . TIPO_UTILIZADOR_DIRECTOR_GERAL_RH :
return "form_dir_ger_rh" ;
case Global . TIPO_UTILIZADOR_GESTOR :
return "form_gestor" ;
}
return null ;
}
public String lnkPlanosActuacao_action ( )
public String lnkPlanosActuacao_action ( )
{
{
Utilizador u = getSessionBean1 ( ) . getCurrentUser ( ) ;
Utilizador u = getSessionBean1 ( ) . getCurrentUser ( ) ;
@ -475,22 +497,23 @@ public class EstatisticasProcesso extends AbstractPageBean
horasTrabalhadas = ( ( String ) textHorasTrabalhadas . getText ( ) ) . trim ( ) ;
horasTrabalhadas = ( ( String ) textHorasTrabalhadas . getText ( ) ) . trim ( ) ;
horasTrabalhadas = "" . equals ( horasTrabalhadas ) ? null : horasTrabalhadas ;
horasTrabalhadas = "" . equals ( horasTrabalhadas ) ? null : horasTrabalhadas ;
}
}
String departamento = null ;
// String departamento = null;
if ( textDepartamento . getText ( ) ! = null )
// if ( textDepartamento.getText() != null )
{
// {
departamento = ( ( String ) textDepartamento . getText ( ) ) . trim ( ) ;
// departamento = ( ( String ) textDepartamento.getText() ).trim();
departamento = "" . equals ( departamento ) ? null : departamento ;
// departamento = "".equals( departamento ) ? null : departamento;
}
// }
String seccao = null ;
Integer seccaoID = null ;
if ( dropSeccoes . getSelected ( ) ! = null )
if ( dropSeccoes . getSelected ( ) ! = null )
{
{
seccao = ( String ) dropSeccoes . getSelected ( ) ;
// seccaoID = ( Integer ) dropSeccoes.getSelected();
String seccao = ( String ) dropSeccoes . getSelected ( ) ;
if ( seccao ! = null )
{
try { seccaoID = Integer . parseInt ( seccao ) ; }
catch ( Exception e ) { }
}
}
}
// if ( textSeccao.getText() != null )
// {
// seccao = ( ( String ) textSeccao.getText() ).trim();
// seccao = "".equals( seccao ) ? null : seccao;
// }
Integer causas = null ;
Integer causas = null ;
if ( dropCausas . getSelected ( ) ! = null )
if ( dropCausas . getSelected ( ) ! = null )
{
{
@ -501,27 +524,31 @@ public class EstatisticasProcesso extends AbstractPageBean
catch ( Exception e ) { }
catch ( Exception e ) { }
}
}
}
}
// String causas = null;
// if ( textCausas.getText() != null )
// {
// causas = ( ( String ) textCausas.getText() ).trim();
// causas = "".equals( causas ) ? null : causas;
// }
String turno = null ;
String turno = null ;
if ( dropTurno . getSelected ( ) ! = null )
if ( dropTurno . getSelected ( ) ! = null )
{
{
turno = ( String ) dropTurno . getSelected ( ) ;
turno = ( String ) dropTurno . getSelected ( ) ;
turno = turno = = null | | "" . equals ( turno . trim ( ) ) ? null : turno ;
turno = turno = = null | | "" . equals ( turno . trim ( ) ) ? null : turno ;
}
}
// if ( textTurno.getText() != null )
// {
// turno = ( ( String ) textTurno.getText() ).trim();
// turno = "".equals( turno ) ? null : turno;
// }
Boolean shst = null ;
Boolean shst = null ;
if ( formacaoSHST_true . getSelected ( ) ! = null | | formacaoSHST_false . getSelected ( ) ! = null )
if ( formacaoSHST_true . getSelected ( ) ! = null | | formacaoSHST_false . getSelected ( ) ! = null | | formacaoSHST_none . getSelected ( ) ! = null )
{
{
shst = ( Boolean ) formacaoSHST_true . getSelected ( ) ;
Boolean trueSelected = ( Boolean ) formacaoSHST_true . getSelected ( ) ;
Boolean falseSelected = ( Boolean ) formacaoSHST_false . getSelected ( ) ;
Boolean noneSelected = ( Boolean ) formacaoSHST_none . getSelected ( ) ;
if ( trueSelected ! = null & & trueSelected )
{
shst = Boolean . TRUE ;
}
if ( falseSelected ! = null & & falseSelected )
{
shst = Boolean . FALSE ;
}
if ( noneSelected ! = null & & noneSelected )
{
shst = null ;
}
}
}
Boolean postoAcidentado = null ;
Boolean postoAcidentado = null ;
if ( postoAcidentado_true . getSelected ( ) ! = null | | postoAcidentado_false . getSelected ( ) ! = null )
if ( postoAcidentado_true . getSelected ( ) ! = null | | postoAcidentado_false . getSelected ( ) ! = null )
@ -541,8 +568,8 @@ public class EstatisticasProcesso extends AbstractPageBean
searchProperties . put ( EstatisticasConstants . KEY_DATA_OCORRENCIA , dataOcorrencia ) ;
searchProperties . put ( EstatisticasConstants . KEY_DATA_OCORRENCIA , dataOcorrencia ) ;
searchProperties . put ( EstatisticasConstants . KEY_HORA_OCORRENCIA , horaOcorrencia ) ;
searchProperties . put ( EstatisticasConstants . KEY_HORA_OCORRENCIA , horaOcorrencia ) ;
searchProperties . put ( EstatisticasConstants . KEY_HORAS_TRABALHADAS , horasTrabalhadas ) ;
searchProperties . put ( EstatisticasConstants . KEY_HORAS_TRABALHADAS , horasTrabalhadas ) ;
searchProperties . put ( EstatisticasConstants . KEY_DEPARTAMENTO , departamento ) ;
// searchProperties.put( EstatisticasConstants.KEY_DEPARTAMENTO, departamento );
searchProperties . put ( EstatisticasConstants . KEY_SECCAO , seccao ) ;
searchProperties . put ( EstatisticasConstants . KEY_SECCAO , seccao ID ) ;
searchProperties . put ( EstatisticasConstants . KEY_CAUSAS_ACIDENTE , causas ) ;
searchProperties . put ( EstatisticasConstants . KEY_CAUSAS_ACIDENTE , causas ) ;
searchProperties . put ( EstatisticasConstants . KEY_TURNO_TRABALHO , turno ) ;
searchProperties . put ( EstatisticasConstants . KEY_TURNO_TRABALHO , turno ) ;
searchProperties . put ( EstatisticasConstants . KEY_FORMACAO_SHST , shst ) ;
searchProperties . put ( EstatisticasConstants . KEY_FORMACAO_SHST , shst ) ;
@ -556,16 +583,16 @@ public class EstatisticasProcesso extends AbstractPageBean
{
{
Map < String , Object > searchProperties = getFormFieldValues ( ) ;
Map < String , Object > searchProperties = getFormFieldValues ( ) ;
List < EstatisticaProcessoBean > listEstatisticas = new LinkedList < EstatisticaProcessoBean > ( ) ;
listEstatisticas = new LinkedList < EstatisticaProcessoBean > ( ) ;
try
try
{
{
EstatisticasDataProvider edp = EstatisticasDataProvider . getInstance ( ) ;
EstatisticasDataProvider edp = EstatisticasDataProvider . getInstance ( ) ;
listEstatisticas = edp . getEstatisticas ( searchProperties ) ;
listEstatisticas = edp . getEstatisticas ( searchProperties ) ;
}
}
catch ( Exception e )
catch ( Exception e )
{
{
ErrorLogger . logException ( e ) ;
ErrorLogger . logException ( e ) ;
}
}
setListEstatisticas ( listEstatisticas ) ;
setListEstatisticas ( listEstatisticas ) ;
}
}
@ -697,8 +724,19 @@ public class EstatisticasProcesso extends AbstractPageBean
Date dataOcorrencia = ( Date ) searchProperties . get ( EstatisticasConstants . KEY_DATA_OCORRENCIA ) ;
Date dataOcorrencia = ( Date ) searchProperties . get ( EstatisticasConstants . KEY_DATA_OCORRENCIA ) ;
String horaOcorrencia = ( String ) searchProperties . get ( EstatisticasConstants . KEY_HORA_OCORRENCIA ) ;
String horaOcorrencia = ( String ) searchProperties . get ( EstatisticasConstants . KEY_HORA_OCORRENCIA ) ;
String horasTrabalhadas = ( String ) searchProperties . get ( EstatisticasConstants . KEY_HORAS_TRABALHADAS ) ;
String horasTrabalhadas = ( String ) searchProperties . get ( EstatisticasConstants . KEY_HORAS_TRABALHADAS ) ;
String departamento = ( String ) searchProperties . get ( EstatisticasConstants . KEY_DEPARTAMENTO ) ;
// String departamento = ( String ) searchProperties.get( EstatisticasConstants.KEY_DEPARTAMENTO );
String seccao = ( String ) searchProperties . get ( EstatisticasConstants . KEY_SECCAO ) ;
Integer seccaoID = ( Integer ) searchProperties . get ( EstatisticasConstants . KEY_SECCAO ) ;
String seccao = null ;
try
{
SeccoesData seccaoData = EstatisticasDataProvider . getInstance ( ) . loadSeccaoByID ( seccaoID ) ;
seccao = seccaoData = = null ? null : seccaoData . getDescricao ( ) ;
}
catch ( Exception e )
{
ErrorLogger . logException ( e ) ;
}
Integer causas = ( Integer ) searchProperties . get ( EstatisticasConstants . KEY_CAUSAS_ACIDENTE ) ;
Integer causas = ( Integer ) searchProperties . get ( EstatisticasConstants . KEY_CAUSAS_ACIDENTE ) ;
String turno = ( String ) searchProperties . get ( EstatisticasConstants . KEY_TURNO_TRABALHO ) ;
String turno = ( String ) searchProperties . get ( EstatisticasConstants . KEY_TURNO_TRABALHO ) ;
Boolean formacao_shst = ( Boolean ) searchProperties . get ( EstatisticasConstants . KEY_FORMACAO_SHST ) ;
Boolean formacao_shst = ( Boolean ) searchProperties . get ( EstatisticasConstants . KEY_FORMACAO_SHST ) ;
@ -759,13 +797,13 @@ public class EstatisticasProcesso extends AbstractPageBean
columnValue . setCellValue ( horasTrabalhadas ) ;
columnValue . setCellValue ( horasTrabalhadas ) ;
row + + ;
row + + ;
keyName = EstatisticasConstants . KEY_NAMES [ row ] ;
// keyName = EstatisticasConstants.KEY_NAMES[ row ];
currentRow = getRow ( sheet , row ) ;
// currentRow = getRow( sheet, row );
columnLabel = getCell ( currentRow , 0 ) ;
// columnLabel = getCell( currentRow, 0 );
columnLabel . setCellValue ( keyName ) ;
// columnLabel.setCellValue( keyName );
columnValue = getCell ( currentRow , 1 ) ;
// columnValue = getCell( currentRow, 1 );
columnValue . setCellValue ( departamento ) ;
// columnValue.setCellValue( departamento );
row + + ;
// row++;
keyName = EstatisticasConstants . KEY_NAMES [ row ] ;
keyName = EstatisticasConstants . KEY_NAMES [ row ] ;
currentRow = getRow ( sheet , row ) ;
currentRow = getRow ( sheet , row ) ;