|
|
|
@ -10,12 +10,14 @@ import beans.Utilizador;
|
|
|
|
import com.evolute.utils.error.ErrorLogger;
|
|
|
|
import com.evolute.utils.error.ErrorLogger;
|
|
|
|
import com.sun.rave.web.ui.appbase.AbstractPageBean;
|
|
|
|
import com.sun.rave.web.ui.appbase.AbstractPageBean;
|
|
|
|
import com.sun.rave.web.ui.component.Button;
|
|
|
|
import com.sun.rave.web.ui.component.Button;
|
|
|
|
|
|
|
|
import com.sun.rave.web.ui.component.DropDown;
|
|
|
|
import com.sun.rave.web.ui.component.Hyperlink;
|
|
|
|
import com.sun.rave.web.ui.component.Hyperlink;
|
|
|
|
import com.sun.rave.web.ui.component.RadioButton;
|
|
|
|
import com.sun.rave.web.ui.component.RadioButton;
|
|
|
|
import com.sun.rave.web.ui.component.RadioButtonGroup;
|
|
|
|
import com.sun.rave.web.ui.component.RadioButtonGroup;
|
|
|
|
import com.sun.rave.web.ui.component.StaticText;
|
|
|
|
import com.sun.rave.web.ui.component.StaticText;
|
|
|
|
import com.sun.rave.web.ui.component.Table;
|
|
|
|
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 db.EstatisticasConstants;
|
|
|
|
import db.EstatisticasConstants;
|
|
|
|
import db.providers.EstatisticasDataProvider;
|
|
|
|
import db.providers.EstatisticasDataProvider;
|
|
|
|
import global.Global;
|
|
|
|
import global.Global;
|
|
|
|
@ -143,14 +145,26 @@ public class EstatisticasProcesso extends AbstractPageBean
|
|
|
|
this.tableEstatisticas = t;
|
|
|
|
this.tableEstatisticas = t;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private TextField textCausas = new TextField();
|
|
|
|
private DropDown dropCausas = new DropDown();
|
|
|
|
public TextField getTextCausas() {
|
|
|
|
|
|
|
|
return textCausas;
|
|
|
|
public DropDown getDropCausas() {
|
|
|
|
|
|
|
|
return dropCausas;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public void setTextCausas(TextField textCausas) {
|
|
|
|
|
|
|
|
this.textCausas = textCausas;
|
|
|
|
public void setDropCausas(DropDown dropCausas) {
|
|
|
|
|
|
|
|
this.dropCausas = dropCausas;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// private TextField textCausas = new TextField();
|
|
|
|
|
|
|
|
// public TextField getTextCausas() {
|
|
|
|
|
|
|
|
// return textCausas;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// public void setTextCausas(TextField textCausas) {
|
|
|
|
|
|
|
|
// this.textCausas = textCausas;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
private TextField textDepartamento = new TextField();
|
|
|
|
private TextField textDepartamento = new TextField();
|
|
|
|
public TextField getTextDepartamento() {
|
|
|
|
public TextField getTextDepartamento() {
|
|
|
|
return textDepartamento;
|
|
|
|
return textDepartamento;
|
|
|
|
@ -159,21 +173,42 @@ public class EstatisticasProcesso extends AbstractPageBean
|
|
|
|
this.textDepartamento = textDepartamento;
|
|
|
|
this.textDepartamento = textDepartamento;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private TextField textSeccao = new TextField();
|
|
|
|
private DropDown dropSeccoes = new DropDown();
|
|
|
|
public TextField getTextSeccao() {
|
|
|
|
|
|
|
|
return textSeccao;
|
|
|
|
public DropDown getDropSeccoes() {
|
|
|
|
|
|
|
|
return dropSeccoes;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public void setTextSeccao(TextField textSeccao) {
|
|
|
|
|
|
|
|
this.textSeccao = textSeccao;
|
|
|
|
public void setDropSeccoes(DropDown dropSeccoes) {
|
|
|
|
|
|
|
|
this.dropSeccoes = dropSeccoes;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private TextField textTurno = new TextField();
|
|
|
|
|
|
|
|
public TextField getTextTurno() {
|
|
|
|
// private TextField textSeccao = new TextField();
|
|
|
|
return textTurno;
|
|
|
|
// public TextField getTextSeccao() {
|
|
|
|
|
|
|
|
// return textSeccao;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// public void setTextSeccao(TextField textSeccao) {
|
|
|
|
|
|
|
|
// this.textSeccao = textSeccao;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private DropDown dropTurno = new DropDown();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DropDown getDropTurno() {
|
|
|
|
|
|
|
|
return dropTurno;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public void setTextTurno(TextField textTurno) {
|
|
|
|
|
|
|
|
this.textTurno = textTurno;
|
|
|
|
public void setDropTurno(DropDown 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()
|
|
|
|
@ -257,16 +292,7 @@ public class EstatisticasProcesso extends AbstractPageBean
|
|
|
|
private boolean canAccess()
|
|
|
|
private boolean canAccess()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
boolean canAccess = false;
|
|
|
|
boolean canAccess = false;
|
|
|
|
|
|
|
|
canAccess = getSessionBean1().getCanAccessEstatisticas();
|
|
|
|
if ( getSessionBean1().isLoggedIn() )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Utilizador u = getSessionBean1().getCurrentUser();
|
|
|
|
|
|
|
|
if ( u != null && u.getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
canAccess = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return canAccess;
|
|
|
|
return canAccess;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -332,7 +358,32 @@ public class EstatisticasProcesso extends AbstractPageBean
|
|
|
|
|
|
|
|
|
|
|
|
lblUser.setText( getSessionBean1().getCurrentUser().getLogin() );
|
|
|
|
lblUser.setText( getSessionBean1().getCurrentUser().getLogin() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Option[] turnosOptions = new Option[ 4 ];
|
|
|
|
|
|
|
|
turnosOptions[ 0 ] = new Option( "", "" );
|
|
|
|
|
|
|
|
turnosOptions[ 1 ] = new Option( "m", "Manhã" );
|
|
|
|
|
|
|
|
turnosOptions[ 2 ] = new Option( "t", "Tarde" );
|
|
|
|
|
|
|
|
turnosOptions[ 3 ] = new Option( "n", "Noite" );
|
|
|
|
|
|
|
|
dropTurno.setItems( turnosOptions );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
EstatisticasDataProvider statsProvider = EstatisticasDataProvider.getInstance();
|
|
|
|
|
|
|
|
Option[] causas = statsProvider.getCausasAcidente();
|
|
|
|
|
|
|
|
if ( causas != null )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
dropCausas.setItems( causas );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Option[] seccoes = statsProvider.getSeccoesList();
|
|
|
|
|
|
|
|
if ( seccoes != null )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
dropSeccoes.setItems( seccoes );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch ( Exception e )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ErrorLogger.logException( e );
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
@ -431,23 +482,42 @@ public class EstatisticasProcesso extends AbstractPageBean
|
|
|
|
departamento = "".equals( departamento ) ? null : departamento;
|
|
|
|
departamento = "".equals( departamento ) ? null : departamento;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String seccao = null;
|
|
|
|
String seccao = null;
|
|
|
|
if ( textSeccao.getText() != null )
|
|
|
|
if ( dropSeccoes.getSelected() != null )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
seccao = ( ( String ) textSeccao.getText() ).trim();
|
|
|
|
seccao = ( String ) dropSeccoes.getSelected();
|
|
|
|
seccao = "".equals( seccao ) ? null : seccao;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String causas = null;
|
|
|
|
// if ( textSeccao.getText() != null )
|
|
|
|
if ( textCausas.getText() != null )
|
|
|
|
// {
|
|
|
|
|
|
|
|
// seccao = ( ( String ) textSeccao.getText() ).trim();
|
|
|
|
|
|
|
|
// seccao = "".equals( seccao ) ? null : seccao;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
Integer causas = null;
|
|
|
|
|
|
|
|
if ( dropCausas.getSelected() != null )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
causas = ( ( String ) textCausas.getText() ).trim();
|
|
|
|
String causaID = ( String ) dropCausas.getSelected();
|
|
|
|
causas = "".equals( causas ) ? null : causas;
|
|
|
|
if ( causaID != null )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
try { causas = Integer.parseInt( causaID ); }
|
|
|
|
|
|
|
|
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 ( textTurno.getText() != null )
|
|
|
|
if ( dropTurno.getSelected() != null )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
turno = ( ( String ) textTurno.getText() ).trim();
|
|
|
|
turno = ( String ) dropTurno.getSelected();
|
|
|
|
turno = "".equals( turno ) ? 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 )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -629,7 +699,7 @@ public class EstatisticasProcesso extends AbstractPageBean
|
|
|
|
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 );
|
|
|
|
String seccao = ( String ) searchProperties.get( EstatisticasConstants.KEY_SECCAO );
|
|
|
|
String causas = ( String ) 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 );
|
|
|
|
Boolean postoAcidentado = ( Boolean ) searchProperties.get( EstatisticasConstants.KEY_POSTO_ACIDENTADO );
|
|
|
|
Boolean postoAcidentado = ( Boolean ) searchProperties.get( EstatisticasConstants.KEY_POSTO_ACIDENTADO );
|
|
|
|
@ -705,20 +775,50 @@ public class EstatisticasProcesso extends AbstractPageBean
|
|
|
|
columnValue.setCellValue( seccao );
|
|
|
|
columnValue.setCellValue( seccao );
|
|
|
|
row++;
|
|
|
|
row++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String causa = "";
|
|
|
|
|
|
|
|
if ( causas != null )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
EstatisticasDataProvider statsProvider = EstatisticasDataProvider.getInstance();
|
|
|
|
|
|
|
|
causa = statsProvider.getCausaByID( causas );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch ( Exception e )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ErrorLogger.logException( e );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
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( causas );
|
|
|
|
columnValue.setCellValue( causa );
|
|
|
|
row++;
|
|
|
|
row++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String turnoDesc = "";
|
|
|
|
|
|
|
|
if ( turno != null )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if ( "m".equals( turno ) )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
turnoDesc = "Manhã";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if ( "t".equals( turno ) )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
turnoDesc = "Tarde";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if ( "n".equals( turno ) )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
turnoDesc = "Noite";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
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( turno );
|
|
|
|
columnValue.setCellValue( turnoDesc );
|
|
|
|
row++;
|
|
|
|
row++;
|
|
|
|
|
|
|
|
|
|
|
|
keyName = EstatisticasConstants.KEY_NAMES[ row ];
|
|
|
|
keyName = EstatisticasConstants.KEY_NAMES[ row ];
|
|
|
|
|