fixed data ocorrencia verification

git-svn-id: https://svn.coded.pt/svn/SIPRP@1743 bb69d46d-e84e-40c8-a05a-06db0d633741
lxbfYeaa
Frederico Palma 14 years ago
parent 237e55e810
commit 320e39fa3d

@ -6,17 +6,17 @@
<Node id="GestaoUtilizadores.jsp" x="400" y="450" zoom="true"/> <Node id="GestaoUtilizadores.jsp" x="400" y="450" zoom="true"/>
<Node id="FormDirGerRh.jsp" x="150" y="750" zoom="true"/> <Node id="FormDirGerRh.jsp" x="150" y="750" zoom="true"/>
<Node id="FormGestor.jsp" x="400" y="300" zoom="true"/> <Node id="FormGestor.jsp" x="400" y="300" zoom="true"/>
<Node id="Erro.jsp" x="650" y="450" zoom="true"/>
<Node id="Acesso.jsp" x="400" y="750" zoom="false"/> <Node id="Acesso.jsp" x="400" y="750" zoom="false"/>
<Node id="Erro.jsp" x="650" y="450" zoom="true"/>
<Node id="FormRH.jsp" x="400" y="600" zoom="true"/> <Node id="FormRH.jsp" x="400" y="600" zoom="true"/>
<Node id="EstatisticasProcesso.jsp" x="150" y="900" zoom="true"/> <Node id="EstatisticasProcesso.jsp" x="150" y="900" zoom="true"/>
<Node id="FormSeguranca.jsp" x="1150" y="150" zoom="true"/>
<Node id="AnaliseAcidenteTrabalho.jsp" x="150" y="450" zoom="true"/> <Node id="AnaliseAcidenteTrabalho.jsp" x="150" y="450" zoom="true"/>
<Node id="FormSeguranca.jsp" x="1150" y="150" zoom="true"/>
<Node id="NovoUtilizador.jsp" x="900" y="150" zoom="true"/> <Node id="NovoUtilizador.jsp" x="900" y="150" zoom="true"/>
<Node id="FormDirSiprp.jsp" x="1400" y="150" zoom="true"/> <Node id="FormDirSiprp.jsp" x="1400" y="150" zoom="false"/>
<Node id="FichaUtilizador.jsp" x="150" y="300" zoom="true"/> <Node id="FichaUtilizador.jsp" x="150" y="300" zoom="true"/>
<Node id="FormMedico.jsp" x="900" y="450" zoom="true"/>
<Node id="FormHS.jsp" x="900" y="300" zoom="true"/> <Node id="FormHS.jsp" x="900" y="300" zoom="true"/>
<Node id="FormMedico.jsp" x="900" y="450" zoom="true"/>
<Node id="EnviarCorrecao.jsp" x="150" y="150" zoom="true"/> <Node id="EnviarCorrecao.jsp" x="150" y="150" zoom="true"/>
<Node id="UtilizadorFields.jsp" x="1150" y="300" zoom="true"/> <Node id="UtilizadorFields.jsp" x="1150" y="300" zoom="true"/>
<Node id="ConfirmarDesactivar.jsp" x="1650" y="150" zoom="true"/> <Node id="ConfirmarDesactivar.jsp" x="1650" y="150" zoom="true"/>

@ -1674,6 +1674,7 @@ public class FormDirGerRh extends AbstractPageBean
if ( newValue != null && newValue instanceof Integer ) if ( newValue != null && newValue instanceof Integer )
{ {
Integer newYear = ( Integer ) newValue; Integer newYear = ( Integer ) newValue;
getSessionBean1().setAnoChoice( newYear);
Integer oldYear = oldValue != null && oldValue instanceof Integer ? ( Integer ) oldValue : null; Integer oldYear = oldValue != null && oldValue instanceof Integer ? ( Integer ) oldValue : null;
if ( oldYear == null || !newYear.equals( oldYear ) ) if ( oldYear == null || !newYear.equals( oldYear ) )
{ {
@ -1684,8 +1685,8 @@ public class FormDirGerRh extends AbstractPageBean
private Integer getSelectedYear() private Integer getSelectedYear()
{ {
Integer result = null; Integer result = getSessionBean1().getAnoChoice();
if ( dropCurrentYear != null ) if ( result == null && dropCurrentYear != null )
{ {
Object selected = dropCurrentYear.getSelected(); Object selected = dropCurrentYear.getSelected();
if ( selected != null && selected instanceof Integer ) if ( selected != null && selected instanceof Integer )

@ -1734,6 +1734,7 @@ public class FormDirSiprp extends AbstractPageBean
if ( newValue != null && newValue instanceof Integer ) if ( newValue != null && newValue instanceof Integer )
{ {
Integer newYear = ( Integer ) newValue; Integer newYear = ( Integer ) newValue;
getSessionBean1().setAnoChoice( newYear);
Integer oldYear = oldValue != null && oldValue instanceof Integer ? ( Integer ) oldValue : null; Integer oldYear = oldValue != null && oldValue instanceof Integer ? ( Integer ) oldValue : null;
if ( oldYear == null || !newYear.equals( oldYear ) ) if ( oldYear == null || !newYear.equals( oldYear ) )
{ {
@ -1744,8 +1745,8 @@ public class FormDirSiprp extends AbstractPageBean
private Integer getSelectedYear() private Integer getSelectedYear()
{ {
Integer result = null; Integer result = getSessionBean1().getAnoChoice();
if ( dropCurrentYear != null ) if ( result == null && dropCurrentYear != null )
{ {
Object selected = dropCurrentYear.getSelected(); Object selected = dropCurrentYear.getSelected();
if ( selected != null && selected instanceof Integer ) if ( selected != null && selected instanceof Integer )

@ -1751,6 +1751,7 @@ public class FormGestor extends AbstractPageBean
if ( newValue != null && newValue instanceof Integer ) if ( newValue != null && newValue instanceof Integer )
{ {
Integer newYear = ( Integer ) newValue; Integer newYear = ( Integer ) newValue;
getSessionBean1().setAnoChoice( newYear);
Integer oldYear = oldValue != null && oldValue instanceof Integer ? ( Integer ) oldValue : null; Integer oldYear = oldValue != null && oldValue instanceof Integer ? ( Integer ) oldValue : null;
if ( oldYear == null || !newYear.equals( oldYear ) ) if ( oldYear == null || !newYear.equals( oldYear ) )
{ {
@ -1761,8 +1762,8 @@ public class FormGestor extends AbstractPageBean
private Integer getSelectedYear() private Integer getSelectedYear()
{ {
Integer result = null; Integer result = getSessionBean1().getAnoChoice();
if ( dropCurrentYear != null ) if ( result == null && dropCurrentYear != null )
{ {
Object selected = dropCurrentYear.getSelected(); Object selected = dropCurrentYear.getSelected();
if ( selected != null && selected instanceof Integer ) if ( selected != null && selected instanceof Integer )

@ -2024,8 +2024,8 @@ public class FormHS extends AbstractPageBean
private Integer getSelectedYear() private Integer getSelectedYear()
{ {
Integer result = null; Integer result = getSessionBean1().getAnoChoice();
if ( dropCurrentYear != null ) if ( result == null && dropCurrentYear != null )
{ {
Object selected = dropCurrentYear.getSelected(); Object selected = dropCurrentYear.getSelected();
if ( selected != null && selected instanceof Integer ) if ( selected != null && selected instanceof Integer )
@ -2054,6 +2054,7 @@ public class FormHS extends AbstractPageBean
if ( newValue != null && newValue instanceof Integer ) if ( newValue != null && newValue instanceof Integer )
{ {
Integer newYear = ( Integer ) newValue; Integer newYear = ( Integer ) newValue;
getSessionBean1().setAnoChoice( newYear);
Integer oldYear = oldValue != null && oldValue instanceof Integer ? ( Integer ) oldValue : null; Integer oldYear = oldValue != null && oldValue instanceof Integer ? ( Integer ) oldValue : null;
if ( oldYear == null || !newYear.equals( oldYear ) ) if ( oldYear == null || !newYear.equals( oldYear ) )
{ {

@ -1955,6 +1955,7 @@ public class FormMedico extends AbstractPageBean
if ( newValue != null && newValue instanceof Integer ) if ( newValue != null && newValue instanceof Integer )
{ {
Integer newYear = ( Integer ) newValue; Integer newYear = ( Integer ) newValue;
getSessionBean1().setAnoChoice( newYear);
Integer oldYear = oldValue != null && oldValue instanceof Integer ? ( Integer ) oldValue : null; Integer oldYear = oldValue != null && oldValue instanceof Integer ? ( Integer ) oldValue : null;
if ( oldYear == null || !newYear.equals( oldYear ) ) if ( oldYear == null || !newYear.equals( oldYear ) )
{ {
@ -1965,8 +1966,8 @@ public class FormMedico extends AbstractPageBean
private Integer getSelectedYear() private Integer getSelectedYear()
{ {
Integer result = null; Integer result = getSessionBean1().getAnoChoice();
if ( dropCurrentYear != null ) if ( result == null && dropCurrentYear != null )
{ {
Object selected = dropCurrentYear.getSelected(); Object selected = dropCurrentYear.getSelected();
if ( selected != null && selected instanceof Integer ) if ( selected != null && selected instanceof Integer )

@ -2150,6 +2150,7 @@ public class FormRH extends AbstractPageBean
if ( newValue != null && newValue instanceof Integer ) if ( newValue != null && newValue instanceof Integer )
{ {
Integer newYear = ( Integer ) newValue; Integer newYear = ( Integer ) newValue;
getSessionBean1().setAnoChoice( newYear);
Integer oldYear = oldValue != null && oldValue instanceof Integer ? ( Integer ) oldValue : null; Integer oldYear = oldValue != null && oldValue instanceof Integer ? ( Integer ) oldValue : null;
if ( oldYear == null || !newYear.equals( oldYear ) ) if ( oldYear == null || !newYear.equals( oldYear ) )
{ {
@ -2160,8 +2161,8 @@ public class FormRH extends AbstractPageBean
private Integer getSelectedYear() private Integer getSelectedYear()
{ {
Integer result = null; Integer result = getSessionBean1().getAnoChoice();
if ( dropCurrentYear != null ) if ( result == null && dropCurrentYear != null )
{ {
Object selected = dropCurrentYear.getSelected(); Object selected = dropCurrentYear.getSelected();
if ( selected != null && selected instanceof Integer ) if ( selected != null && selected instanceof Integer )

@ -2249,6 +2249,7 @@ public class FormSeguranca extends AbstractPageBean
if ( newValue != null && newValue instanceof Integer ) if ( newValue != null && newValue instanceof Integer )
{ {
Integer newYear = ( Integer ) newValue; Integer newYear = ( Integer ) newValue;
getSessionBean1().setAnoChoice( newYear);
Integer oldYear = oldValue != null && oldValue instanceof Integer ? ( Integer ) oldValue : null; Integer oldYear = oldValue != null && oldValue instanceof Integer ? ( Integer ) oldValue : null;
if ( oldYear == null || !newYear.equals( oldYear ) ) if ( oldYear == null || !newYear.equals( oldYear ) )
{ {
@ -2259,8 +2260,8 @@ public class FormSeguranca extends AbstractPageBean
private Integer getSelectedYear() private Integer getSelectedYear()
{ {
Integer result = null; Integer result = getSessionBean1().getAnoChoice();
if ( dropCurrentYear != null ) if ( result == null && dropCurrentYear != null )
{ {
Object selected = dropCurrentYear.getSelected(); Object selected = dropCurrentYear.getSelected();
if ( selected != null && selected instanceof Integer ) if ( selected != null && selected instanceof Integer )

@ -129,7 +129,7 @@ public class AnalisesDataProvider extends GenericDataProvider
st.execute( sql ); st.execute( sql );
} }
public String getExpression( String nome, Integer estabelecimentoID, String visitaDate, String POR ) public String getExpression( String nome, Integer estabelecimentoID, String visitaDate, String POR, Integer fromYear )
{ {
String tables = "analises_acidentes"; String tables = "analises_acidentes";
String joinConditions = ""; String joinConditions = "";
@ -165,6 +165,11 @@ public class AnalisesDataProvider extends GenericDataProvider
whereExpression += "AND acidentados.numero_mecanografico LIKE '%" + POR.toUpperCase() + "%' "; whereExpression += "AND acidentados.numero_mecanografico LIKE '%" + POR.toUpperCase() + "%' ";
} }
if( visitaDate == null )
{
whereExpression += " AND EXTRACT( year FROM analises_acidentes.data_acidente ) = " + fromYear + " ";
}
return "SELECT * FROM " + tables + " WHERE " + joinConditions + whereExpression + " "; return "SELECT * FROM " + tables + " WHERE " + joinConditions + whereExpression + " ";
} }
@ -181,7 +186,7 @@ public class AnalisesDataProvider extends GenericDataProvider
} }
Statement st = createStatement(); Statement st = createStatement();
String sql = getExpression( nome, null, visitaDate, POR ); String sql = getExpression( nome, null, visitaDate, POR, fromYear );
if ( responsavel_loja.matches( "y" ) ) if ( responsavel_loja.matches( "y" ) )
{ {
@ -281,7 +286,7 @@ public class AnalisesDataProvider extends GenericDataProvider
} }
Statement st = createStatement(); Statement st = createStatement();
String sql = getExpression( nome, null, visitaDate, POR ); String sql = getExpression( nome, null, visitaDate, POR, fromYear );
if ( responsavel_loja.matches( "y" ) ) if ( responsavel_loja.matches( "y" ) )
{ {
@ -367,7 +372,7 @@ public class AnalisesDataProvider extends GenericDataProvider
} }
Statement st = createStatement(); Statement st = createStatement();
String sql = getExpression( nome, estabelecimentoID, visitaDate, POR ); String sql = getExpression( nome, estabelecimentoID, visitaDate, POR, fromYear );
sql += "AND (estado = " + Global.ESTADO_HS + " OR estado = " + Global.ESTADO_FECHAR + sql += "AND (estado = " + Global.ESTADO_HS + " OR estado = " + Global.ESTADO_FECHAR +
" OR estado = " + Global.ESTADO_CONSOLIDACAO + ")" + " OR estado = " + Global.ESTADO_CONSOLIDACAO + ")" +
@ -428,7 +433,7 @@ public class AnalisesDataProvider extends GenericDataProvider
} }
Statement st = createStatement(); Statement st = createStatement();
String sql = getExpression( nome, null, visitaDate, POR ); String sql = getExpression( nome, null, visitaDate, POR, fromYear );
if ( responsavel_loja.matches( "y" ) ) if ( responsavel_loja.matches( "y" ) )
{ {
@ -503,7 +508,7 @@ public class AnalisesDataProvider extends GenericDataProvider
} }
Statement st = createStatement(); Statement st = createStatement();
String sql = getExpression( nome, estabelecimentoID, visitaDate, POR ); String sql = getExpression( nome, estabelecimentoID, visitaDate, POR, fromYear );
sql += "AND (" + sql += "AND (" +
"estado < " + Global.ESTADO_HS + " OR (estado > " + Global.ESTADO_HS + " AND estado < " + Global.ESTADO_CONSOLIDACAO + ") " + "estado < " + Global.ESTADO_HS + " OR (estado > " + Global.ESTADO_HS + " AND estado < " + Global.ESTADO_CONSOLIDACAO + ") " +
@ -561,7 +566,7 @@ public class AnalisesDataProvider extends GenericDataProvider
} }
Statement st = createStatement(); Statement st = createStatement();
String sql = getExpression( nome, null, visitaDate, POR ); String sql = getExpression( nome, null, visitaDate, POR, fromYear );
if ( responsavel_loja.matches( "y" ) ) if ( responsavel_loja.matches( "y" ) )
{ {
@ -630,7 +635,7 @@ public class AnalisesDataProvider extends GenericDataProvider
} }
Statement st = createStatement(); Statement st = createStatement();
String sql = getExpression( nome, null, visitaDate, POR ); String sql = getExpression( nome, null, visitaDate, POR, fromYear );
sql += "AND estado < 5 OR (estado = 6 AND estado_assinatura <> 2) OR (estado = 6 AND estado_assinatura = 2 AND ass_med = 'y') " + sql += "AND estado < 5 OR (estado = 6 AND estado_assinatura <> 2) OR (estado = 6 AND estado_assinatura = 2 AND ass_med = 'y') " +
"OR (estado > 6 AND estado < 9) " + "OR (estado > 6 AND estado < 9) " +
@ -692,7 +697,8 @@ public class AnalisesDataProvider extends GenericDataProvider
return getAnalisesSeguimentoDirSiprpList( fromYear ); return getAnalisesSeguimentoDirSiprpList( fromYear );
} }
String sql = getExpression( nome, estabelecimentoID, visitaDate, POR ); String sql = getExpression( nome, estabelecimentoID, visitaDate, POR, fromYear );
sql += " AND estado < " + Global.ESTADO_CONCLUIDO + " ORDER BY analise_nr"; sql += " AND estado < " + Global.ESTADO_CONCLUIDO + " ORDER BY analise_nr";
Statement st = createStatement(); Statement st = createStatement();
@ -748,7 +754,7 @@ public class AnalisesDataProvider extends GenericDataProvider
} }
Statement st = createStatement(); Statement st = createStatement();
String sql = getExpression( nome, estabelecimentoID, visitaDate, POR ); String sql = getExpression( nome, estabelecimentoID, visitaDate, POR, fromYear );
sql += "AND estado < " + Global.ESTADO_CONCLUIDO + " "; sql += "AND estado < " + Global.ESTADO_CONCLUIDO + " ";
if ( estabelecimento_id != null ) if ( estabelecimento_id != null )
@ -838,7 +844,7 @@ public class AnalisesDataProvider extends GenericDataProvider
{ {
String sql = null; String sql = null;
sql = getExpression( nome, estabelecimentoID, null, POR ); sql = getExpression( nome, estabelecimentoID, null, POR, ano == null ? fromYear : ano );
if ( estabelecimento_id != null && estabelecimento_id.intValue() > 0 ) if ( estabelecimento_id != null && estabelecimento_id.intValue() > 0 )
{ {

Loading…
Cancel
Save