-
private int __placeholder;
+ private DropDown dropEmpresaConc = new DropDown();
+ private DropDown dropEmpresaSeg = new DropDown();
+ private DropDown dropEmpresasActuais = new DropDown();
+
+ private StaticText labelFilterEmpresaActual = new StaticText();
+ private StaticText labelFilterEmpresaConc = new StaticText();
+ private StaticText labelFilterEmpresaSeg = new StaticText();
+
/**
* Automatically managed component initialization. WARNING:
* This method is automatically generated, so any user-specified code inserted
@@ -1428,6 +1434,8 @@ public class FormHS extends AbstractPageBean
// . . . handle exception . . .
}
}
+
+ siprp = getSessionBean1().isSiprp();
}
/**
@@ -1450,6 +1458,7 @@ public class FormHS extends AbstractPageBean
{
getSessionBean1().getAnalisesActualDataProvider().setList( null );
ArrayList actuaisList = AnalisesDataProvider.getInstance().getAnalisesActuaisHsList(
+ getSessionBean1().getCurrentUser().getEmpresa_id(),
getSessionBean1().getCurrentUser().getEstabelecimento_id(), fromYear );
getSessionBean1().getAnalisesActualDataProvider().setList( actuaisList );
table1.setRendered( true );
@@ -1464,6 +1473,7 @@ public class FormHS extends AbstractPageBean
{
getSessionBean1().getAnalisesSeguimentoDataProvider().setList( null );
ArrayList seguimentoList = AnalisesDataProvider.getInstance().getAnalisesSeguimentoHsList(
+ getSessionBean1().getCurrentUser().getEmpresa_id(),
getSessionBean1().getCurrentUser().getEstabelecimento_id(), fromYear );
getSessionBean1().getAnalisesSeguimentoDataProvider().setList( seguimentoList );
table2.setRendered( true );
@@ -1486,6 +1496,7 @@ public class FormHS extends AbstractPageBean
table3.setRendered( false );
ErrorLogger.logException( ex );
}
+
}
/**
@@ -1506,13 +1517,21 @@ public class FormHS extends AbstractPageBean
String referer = request.getRequestURI();
String pageFrom = Utils.getPageFrom( referer );
System.out.println( "PAGE FROM : " + pageFrom );
+
if ( ! pageFrom.matches( "FormHS.jsp" ) || getSessionBean1().isFromAnaliseDeletion()
|| dropCurrentYear.getItems() == null )
{
fillCurrentYearDrop();
- Utils.fillEstabelecimentos( dropEstabelecimentosActuais, dropEstabelecimentosSeguimento, dropEstabelecimentosConcluidos );
- fillInitialForm();
+ Utils.fillEmpresas( dropEmpresaConc, dropEmpresasActuais, dropEmpresaSeg );
+ Utils.fillEstabelecimentos( getSessionBean1().getCurrentUser().getEmpresa_id(),
+ dropEstabelecimentosConcluidos, dropEstabelecimentosActuais, dropEstabelecimentosSeguimento );
+
+ dropEmpresaConc.setSelected( getSessionBean1().getCurrentUser().getEmpresa_id() );
+ dropEmpresasActuais.setSelected( getSessionBean1().getCurrentUser().getEmpresa_id() );
+ dropEmpresaSeg.setSelected( getSessionBean1().getCurrentUser().getEmpresa_id() );
+
+ fillInitialForm();
fillAnoDropDown();
}
@@ -1725,14 +1744,37 @@ public class FormHS extends AbstractPageBean
// estabelecimento = null;
// }
// }
- Integer estabelecimentoID = Utils.getSelectedID( dropEstabelecimentosConcluidos );
+ Integer selectedEmpresa;
+ if( dropEmpresaConc.getSelected() instanceof Integer )
+ {
+ selectedEmpresa = ( Integer ) dropEmpresaConc.getSelected();
+ }
+ else
+ {
+ selectedEmpresa = Utils.getSelectedID( dropEmpresaConc );
+ }
+ if( selectedEmpresa == null )
+ {
+ selectedEmpresa = getSessionBean1().getCurrentUser().getEmpresa_id();
+ }
+
+ Integer estabelecimentoID;
+ if( dropEstabelecimentosConcluidos.getSelected() instanceof Integer )
+ {
+ estabelecimentoID = ( Integer ) dropEstabelecimentosConcluidos.getSelected();
+ }
+ else
+ {
+ estabelecimentoID = Utils.getSelectedID( dropEstabelecimentosConcluidos );
+ }
try
{
AnalisesDataProvider adp = AnalisesDataProvider.getInstance();
ArrayList concluidasList = adp.searchAnalisesConcluidasList(
+ selectedEmpresa,
getSessionBean1().getCurrentUser().getEstabelecimento_id(),
ano, mes, dia, por, nome, estabelecimentoID, getSelectedYear() );
@@ -1970,14 +2012,37 @@ public class FormHS extends AbstractPageBean
// estabelecimento = null;
// }
// }
- Integer estabelecimentoID = Utils.getSelectedID( dropEstabelecimentosActuais );
+ Integer selectedEmpresa;
+ if( dropEmpresasActuais.getSelected() instanceof Integer )
+ {
+ selectedEmpresa = ( Integer ) dropEmpresasActuais.getSelected();
+ }
+ else
+ {
+ selectedEmpresa = Utils.getSelectedID( dropEmpresasActuais );
+ }
+ if( selectedEmpresa == null )
+ {
+ selectedEmpresa = getSessionBean1().getCurrentUser().getEmpresa_id();
+ }
+
+ Integer estabelecimentoID;
+ if( dropEstabelecimentosActuais.getSelected() instanceof Integer )
+ {
+ estabelecimentoID = ( Integer ) dropEstabelecimentosActuais.getSelected();
+ }
+ else
+ {
+ estabelecimentoID = Utils.getSelectedID( dropEstabelecimentosActuais );
+ }
try
{
AnalisesDataProvider adp = AnalisesDataProvider.getInstance();
ArrayList actualList = adp.searchAnalisesActuaisHS(
+ selectedEmpresa,
getSessionBean1().getCurrentUser().getEstabelecimento_id(),
nome, estabelecimentoID, visitaDateStr, POR, getSelectedYear() );
@@ -2036,13 +2101,37 @@ public class FormHS extends AbstractPageBean
// estabelecimento = null;
// }
// }
- Integer estabelecimentoID = Utils.getSelectedID( dropEstabelecimentosSeguimento );
+ Integer selectedEmpresa;
+ if( dropEmpresaSeg.getSelected() instanceof Integer )
+ {
+ selectedEmpresa = ( Integer ) dropEmpresaSeg.getSelected();
+ }
+ else
+ {
+ selectedEmpresa = Utils.getSelectedID( dropEmpresaSeg );
+ }
+
+ if( selectedEmpresa == null )
+ {
+ selectedEmpresa = getSessionBean1().getCurrentUser().getEmpresa_id();
+ }
+
+ Integer estabelecimentoID;
+ if( dropEstabelecimentosSeguimento.getSelected() instanceof Integer )
+ {
+ estabelecimentoID = ( Integer ) dropEstabelecimentosSeguimento.getSelected();
+ }
+ else
+ {
+ estabelecimentoID = Utils.getSelectedID( dropEstabelecimentosSeguimento );
+ }
try
{
AnalisesDataProvider adp = AnalisesDataProvider.getInstance();
ArrayList seguimentoList = adp.searchAnalisesSeguimentoHS(
+ selectedEmpresa,
getSessionBean1().getCurrentUser().getEstabelecimento_id(),
nome, estabelecimentoID, visitaDateStr, POR, getSelectedYear() );
@@ -2100,5 +2189,136 @@ public class FormHS extends AbstractPageBean
}
}
}
+
+ public void setLabelFilterEmpresaActual( StaticText labelFilterEmpresaActual )
+ {
+ this.labelFilterEmpresaActual = labelFilterEmpresaActual;
+ }
+
+ public StaticText getLabelFilterEmpresaActual()
+ {
+ return labelFilterEmpresaActual;
+ }
+
+ public void setDropEmpresasActuais( DropDown dropEmpresasActuais )
+ {
+ this.dropEmpresasActuais = dropEmpresasActuais;
+ }
+
+ public void dropEmpresasActuais_valueChangeListener( ValueChangeEvent event )
+ {
+ Integer _old;
+ Integer _new;
+ if( event.getNewValue() != null && event.getNewValue() instanceof Integer )
+ {
+ _new = ( Integer ) event.getNewValue();
+ _old = event.getOldValue() != null &&
+ event.getOldValue() instanceof Integer ? ( Integer ) event.getOldValue() : null;
+
+ if( _old == null || !_new.equals( _old ) )
+ {
+ Utils.fillEstabelecimentos( _new, dropEstabelecimentosActuais );
+ dropEstabelecimentosActuais.setSelected( null );
+ }
+ }
+ }
+
+ public DropDown getDropEmpresasActuais()
+ {
+ return dropEmpresasActuais;
+ }
+
+ public void setLabelFilterEmpresaSeg( StaticText labelFilterEmpresaSeg )
+ {
+ this.labelFilterEmpresaSeg = labelFilterEmpresaSeg;
+ }
+
+ public StaticText getLabelFilterEmpresaSeg()
+ {
+ return labelFilterEmpresaSeg;
+ }
+
+ public void setDropEmpresaSeg( DropDown dropEmpresaSeg )
+ {
+ this.dropEmpresaSeg = dropEmpresaSeg;
+ }
+
+ public void dropEmpresasSeg_valueChangeListener( ValueChangeEvent event )
+ {
+ Integer _old;
+ Integer _new;
+
+ if( event.getNewValue() != null && event.getNewValue() instanceof Integer )
+ {
+ _new = ( Integer ) event.getNewValue();
+
+ _old =
+ event.getOldValue() != null &&
+ event.getOldValue() instanceof Integer ? ( Integer ) event.getOldValue() : null;
+
+ if( _old == null || !_new.equals( _old ) )
+ {
+ Utils.fillEstabelecimentos( _new, dropEstabelecimentosSeguimento );
+ dropEstabelecimentosSeguimento.setSelected( null );
+ }
+ }
+ }
+
+ public DropDown getDropEmpresaSeg()
+ {
+ return dropEmpresaSeg;
+ }
+
+ public void setLabelFilterEmpresaConc( StaticText labelFilterEmpresaConc )
+ {
+ this.labelFilterEmpresaConc = labelFilterEmpresaConc;
+ }
+
+ public StaticText getLabelFilterEmpresaConc()
+ {
+ return labelFilterEmpresaConc;
+ }
+
+ public void setDropEmpresaConc( DropDown dropEmpresaConc )
+ {
+ this.dropEmpresaConc = dropEmpresaConc;
+ }
+
+ public void dropEmpresasConc_valueChangeListener( ValueChangeEvent event )
+ {
+ Integer _old;
+ Integer _new;
+
+ if( event.getNewValue() != null && event.getNewValue() instanceof Integer )
+ {
+ _new = ( Integer ) event.getNewValue();
+
+ _old = event.getOldValue() != null &&
+ event.getOldValue() instanceof Integer ? ( Integer ) event.getOldValue() : null;
+
+ if( _old == null || !_new.equals( _old ) )
+ {
+ Utils.fillEstabelecimentos( _new, dropEstabelecimentosConcluidos );
+ dropEstabelecimentosConcluidos.setSelected( null );
+ }
+ }
+ }
+
+ public DropDown getDropEmpresaConc()
+ {
+ return dropEmpresaConc;
+ }
+
+ private Boolean siprp = Boolean.FALSE;
+
+ public Boolean getSiprp()
+ {
+ return siprp;
+ }
+
+ public void setSiprp( Boolean siprp )
+ {
+ this.siprp = siprp;
+ }
}
diff --git a/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormMedico.java b/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormMedico.java
index 017a0da7..ad76f0f4 100644
--- a/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormMedico.java
+++ b/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormMedico.java
@@ -1438,6 +1438,7 @@ public class FormMedico extends AbstractPageBean
table2.setRendered( true );
ArrayList seguimentoList = adp.getAnalisesSeguimentoMedList(
+ getSessionBean1().getCurrentUser().getEmpresa_id(),
getSessionBean1().getCurrentUser().getEstabelecimento_id(), fromYear );
getSessionBean1().getAnalisesSeguimentoDataProvider().setList( seguimentoList );
}
@@ -1453,6 +1454,7 @@ public class FormMedico extends AbstractPageBean
table3.setRendered( true );
ArrayList concluidasList = adp.getAnalisesConcluidasList(
+ getSessionBean1().getCurrentUser().getEmpresa_id(),
getSessionBean1().getCurrentUser().getEstabelecimento_id(), fromYear );
getSessionBean1().getAnalisesConcluidasDataProvider().setList( concluidasList );
}
@@ -1715,6 +1717,7 @@ public class FormMedico extends AbstractPageBean
AnalisesDataProvider adp = AnalisesDataProvider.getInstance();
ArrayList concluidasList = adp.searchAnalisesConcluidasList(
+ getSessionBean1().getCurrentUser().getEmpresa_id(),
getSessionBean1().getCurrentUser().getEstabelecimento_id(),
ano, mes, dia, por, nome, null, getSelectedYear() );
@@ -1966,6 +1969,7 @@ public class FormMedico extends AbstractPageBean
AnalisesDataProvider adp = AnalisesDataProvider.getInstance();
ArrayList seguimentoList = adp.searchAnalisesSeguimentoMedico(
+ getSessionBean1().getCurrentUser().getEmpresa_id(),
getSessionBean1().getCurrentUser().getEstabelecimento_id(),
nome, visitaDateStr, POR, getSelectedYear() );
diff --git a/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormRH.java b/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormRH.java
index da58552d..168e296e 100644
--- a/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormRH.java
+++ b/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormRH.java
@@ -1469,6 +1469,7 @@ public class FormRH extends AbstractPageBean
table1.setRendered( true );
ArrayList actuaisList = adp.getAnalisesActuaisRhList(
+ getSessionBean1().getCurrentUser().getEmpresa_id(),
getSessionBean1().getCurrentUser().getEstabelecimento_id(), responsavel_loja, fromYear );
getSessionBean1().getAnalisesActualDataProvider().setList( actuaisList );
}
@@ -1484,6 +1485,7 @@ public class FormRH extends AbstractPageBean
table2.setRendered( true );
ArrayList seguimentoList = adp.getAnalisesSeguimentoRhList(
+ getSessionBean1().getCurrentUser().getEmpresa_id(),
getSessionBean1().getCurrentUser().getEstabelecimento_id(), responsavel_loja, fromYear );
getSessionBean1().getAnalisesSeguimentoDataProvider().setList( seguimentoList );
}
@@ -1499,6 +1501,7 @@ public class FormRH extends AbstractPageBean
table3.setRendered( true );
ArrayList concluidasList = adp.getAnalisesConcluidasList(
+ getSessionBean1().getCurrentUser().getEmpresa_id(),
getSessionBean1().getCurrentUser().getEstabelecimento_id(), fromYear );
getSessionBean1().getAnalisesConcluidasDataProvider().setList( concluidasList );
}
@@ -1786,6 +1789,7 @@ public class FormRH extends AbstractPageBean
//getSessionBean1().getAnalisesConcluidasDataProvider().setList(new ArrayList());
ArrayList concluidasList = adp.searchAnalisesConcluidasList(
+ getSessionBean1().getCurrentUser().getEmpresa_id(),
getSessionBean1().getCurrentUser().getEstabelecimento_id(),
ano, mes, dia, por, nome, null, getSelectedYear() );
@@ -2107,6 +2111,7 @@ public class FormRH extends AbstractPageBean
AnalisesDataProvider adp = AnalisesDataProvider.getInstance();
ArrayList actualList = adp.searchAnalisesActualRH(
+ getSessionBean1().getCurrentUser().getEmpresa_id(),
getSessionBean1().getCurrentUser().getEstabelecimento_id(),
nome, visitaDateStr, POR,
getSessionBean1().getCurrentUser().getResponsavel_loja(), getSelectedYear() );
@@ -2161,6 +2166,7 @@ public class FormRH extends AbstractPageBean
AnalisesDataProvider adp = AnalisesDataProvider.getInstance();
ArrayList seguimentoList = adp.searchAnalisesSeguimentoRH(
+ getSessionBean1().getCurrentUser().getEmpresa_id(),
getSessionBean1().getCurrentUser().getEstabelecimento_id(),
nome, visitaDateStr, POR,
getSessionBean1().getCurrentUser().getResponsavel_loja(), getSelectedYear() );
diff --git a/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormSeguranca.java b/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormSeguranca.java
index 72c2008b..ff2954bb 100644
--- a/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormSeguranca.java
+++ b/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormSeguranca.java
@@ -1506,6 +1506,7 @@ public class FormSeguranca extends AbstractPageBean
table1.setRendered( true );
ArrayList actuaisList = adp.getAnalisesActuaisSegList(
+ getSessionBean1().getCurrentUser().getEmpresa_id(),
getSessionBean1().getCurrentUser().getEstabelecimento_id(), responsavel_loja, fromYear );
getSessionBean1().getAnalisesActualDataProvider().setList( actuaisList );
}
@@ -1521,6 +1522,7 @@ public class FormSeguranca extends AbstractPageBean
table2.setRendered( true );
ArrayList seguimentoList = adp.getAnalisesSeguimentoSegList(
+ getSessionBean1().getCurrentUser().getEmpresa_id(),
getSessionBean1().getCurrentUser().getEstabelecimento_id(), responsavel_loja, fromYear );
getSessionBean1().getAnalisesSeguimentoDataProvider().setList( seguimentoList );
}
@@ -1536,6 +1538,7 @@ public class FormSeguranca extends AbstractPageBean
table3.setRendered( true );
ArrayList concluidasList = adp.getAnalisesConcluidasList(
+ getSessionBean1().getCurrentUser().getEmpresa_id(),
getSessionBean1().getCurrentUser().getEstabelecimento_id(), fromYear );
getSessionBean1().getAnalisesConcluidasDataProvider().setList( concluidasList );
}
@@ -1834,6 +1837,7 @@ public class FormSeguranca extends AbstractPageBean
AnalisesDataProvider adp = AnalisesDataProvider.getInstance();
ArrayList actualList = adp.searchAnalisesActualSeg(
+ getSessionBean1().getCurrentUser().getEmpresa_id(),
getSessionBean1().getCurrentUser().getEstabelecimento_id(),
nome, visitaDateStr, POR,
getSessionBean1().getCurrentUser().getResponsavel_loja(), getSelectedYear() );
@@ -1888,6 +1892,7 @@ public class FormSeguranca extends AbstractPageBean
AnalisesDataProvider adp = AnalisesDataProvider.getInstance();
ArrayList seguimentoList = adp.searchAnalisesSeguimentoSeg(
+ getSessionBean1().getCurrentUser().getEmpresa_id(),
getSessionBean1().getCurrentUser().getEstabelecimento_id(),
nome, visitaDateStr, POR,
getSessionBean1().getCurrentUser().getResponsavel_loja(), getSelectedYear() );
@@ -1967,6 +1972,7 @@ public class FormSeguranca extends AbstractPageBean
{
AnalisesDataProvider adp = AnalisesDataProvider.getInstance();
ArrayList concluidasList = adp.searchAnalisesConcluidasList(
+ getSessionBean1().getCurrentUser().getEmpresa_id(),
getSessionBean1().getCurrentUser().getEstabelecimento_id(),
ano, mes, dia, por, nome, null, getSelectedYear() );
diff --git a/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/Login.java b/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/Login.java
index f2f48b7d..0335696d 100644
--- a/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/Login.java
+++ b/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/Login.java
@@ -23,11 +23,13 @@ import com.sun.rave.web.ui.component.TextField;
import com.sun.rave.web.ui.model.Option;
import db.providers.AnalisesDataProvider;
import db.providers.UtilizadoresDataProvider;
+
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import javax.faces.FacesException;
import javax.faces.component.html.HtmlPanelGrid;
+
import utils.Utils;
/**
@@ -39,381 +41,429 @@ import utils.Utils;
*/
public class Login extends AbstractPageBean
{
- //
- private int __placeholder;
-
- /**
- * Automatically managed component initialization. WARNING:
- * This method is automatically generated, so any user-specified code inserted
- * here is subject to being replaced.
- */
- private void _init() throws Exception {
- }
-
- private Page page1 = new Page();
-
- public Page getPage1() {
- return page1;
- }
-
- public void setPage1(Page p) {
- this.page1 = p;
- }
-
- private Html html1 = new Html();
-
- public Html getHtml1() {
- return html1;
- }
-
- public void setHtml1(Html h) {
- this.html1 = h;
- }
-
- private Head head1 = new Head();
-
- public Head getHead1() {
- return head1;
- }
-
- public void setHead1(Head h) {
- this.head1 = h;
- }
-
- private Link link1 = new Link();
-
- public Link getLink1() {
- return link1;
- }
-
- public void setLink1(Link l) {
- this.link1 = l;
- }
-
- private Body body1 = new Body();
-
- public Body getBody1() {
- return body1;
- }
-
- public void setBody1(Body b) {
- this.body1 = b;
- }
-
- private Form form1 = new Form();
-
- public Form getForm1() {
- return form1;
- }
-
- public void setForm1(Form f) {
- this.form1 = f;
- }
-
- private HtmlPanelGrid gridPanel6 = new HtmlPanelGrid();
-
- public HtmlPanelGrid getGridPanel6() {
- return gridPanel6;
- }
-
- public void setGridPanel6(HtmlPanelGrid hpg) {
- this.gridPanel6 = hpg;
- }
-
- private HtmlPanelGrid gridPanel1 = new HtmlPanelGrid();
-
- public HtmlPanelGrid getGridPanel1() {
- return gridPanel1;
- }
-
- public void setGridPanel1(HtmlPanelGrid hpg) {
- this.gridPanel1 = hpg;
- }
-
- private HtmlPanelGrid gridPanel2 = new HtmlPanelGrid();
-
- public HtmlPanelGrid getGridPanel2() {
- return gridPanel2;
- }
-
- public void setGridPanel2(HtmlPanelGrid hpg) {
- this.gridPanel2 = hpg;
- }
-
- private HtmlPanelGrid gridPanel3 = new HtmlPanelGrid();
-
- public HtmlPanelGrid getGridPanel3() {
- return gridPanel3;
- }
-
- public void setGridPanel3(HtmlPanelGrid hpg) {
- this.gridPanel3 = hpg;
- }
-
- private HtmlPanelGrid gridPanel4 = new HtmlPanelGrid();
-
- public HtmlPanelGrid getGridPanel4() {
- return gridPanel4;
- }
-
- public void setGridPanel4(HtmlPanelGrid hpg) {
- this.gridPanel4 = hpg;
- }
-
- private StaticText staticText1 = new StaticText();
-
- public StaticText getStaticText1() {
- return staticText1;
- }
-
- public void setStaticText1(StaticText st) {
- this.staticText1 = st;
- }
-
- private TextField txtUtilizador = new TextField();
-
- public TextField getTxtUtilizador() {
- return txtUtilizador;
- }
-
- public void setTxtUtilizador(TextField tf) {
- this.txtUtilizador = tf;
- }
-
- private StaticText staticText2 = new StaticText();
-
- public StaticText getStaticText2() {
- return staticText2;
- }
-
- public void setStaticText2(StaticText st) {
- this.staticText2 = st;
- }
-
- private PasswordField txtPassword = new PasswordField();
-
- public PasswordField getTxtPassword() {
- return txtPassword;
- }
-
- public void setTxtPassword(PasswordField pf) {
- this.txtPassword = pf;
- }
-
- private HtmlPanelGrid gridPanel5 = new HtmlPanelGrid();
-
- public HtmlPanelGrid getGridPanel5() {
- return gridPanel5;
- }
+ //
+ private int __placeholder;
+
+ /**
+ * Automatically managed component initialization. WARNING:
+ * This method is automatically generated, so any user-specified code inserted
+ * here is subject to being replaced.
+ */
+ private void _init() throws Exception
+ {
+ }
+
+ private Page page1 = new Page();
+
+ public Page getPage1()
+ {
+ return page1;
+ }
+
+ public void setPage1( Page p )
+ {
+ this.page1 = p;
+ }
+
+ private Html html1 = new Html();
+
+ public Html getHtml1()
+ {
+ return html1;
+ }
+
+ public void setHtml1( Html h )
+ {
+ this.html1 = h;
+ }
+
+ private Head head1 = new Head();
+
+ public Head getHead1()
+ {
+ return head1;
+ }
+
+ public void setHead1( Head h )
+ {
+ this.head1 = h;
+ }
+
+ private Link link1 = new Link();
+
+ public Link getLink1()
+ {
+ return link1;
+ }
+
+ public void setLink1( Link l )
+ {
+ this.link1 = l;
+ }
+
+ private Body body1 = new Body();
+
+ public Body getBody1()
+ {
+ return body1;
+ }
+
+ public void setBody1( Body b )
+ {
+ this.body1 = b;
+ }
- public void setGridPanel5(HtmlPanelGrid hpg) {
- this.gridPanel5 = hpg;
- }
+ private Form form1 = new Form();
- private Hyperlink lnkPassRecovery = new Hyperlink();
+ public Form getForm1()
+ {
+ return form1;
+ }
+
+ public void setForm1( Form f )
+ {
+ this.form1 = f;
+ }
+
+ private HtmlPanelGrid gridPanel6 = new HtmlPanelGrid();
+
+ public HtmlPanelGrid getGridPanel6()
+ {
+ return gridPanel6;
+ }
+
+ public void setGridPanel6( HtmlPanelGrid hpg )
+ {
+ this.gridPanel6 = hpg;
+ }
+
+ private HtmlPanelGrid gridPanel1 = new HtmlPanelGrid();
+
+ public HtmlPanelGrid getGridPanel1()
+ {
+ return gridPanel1;
+ }
+
+ public void setGridPanel1( HtmlPanelGrid hpg )
+ {
+ this.gridPanel1 = hpg;
+ }
+
+ private HtmlPanelGrid gridPanel2 = new HtmlPanelGrid();
- public Hyperlink getLnkPassRecovery() {
- return lnkPassRecovery;
- }
+ public HtmlPanelGrid getGridPanel2()
+ {
+ return gridPanel2;
+ }
+
+ public void setGridPanel2( HtmlPanelGrid hpg )
+ {
+ this.gridPanel2 = hpg;
+ }
+
+ private HtmlPanelGrid gridPanel3 = new HtmlPanelGrid();
+
+ public HtmlPanelGrid getGridPanel3()
+ {
+ return gridPanel3;
+ }
+
+ public void setGridPanel3( HtmlPanelGrid hpg )
+ {
+ this.gridPanel3 = hpg;
+ }
- public void setLnkPassRecovery(Hyperlink h) {
- this.lnkPassRecovery = h;
- }
+ private HtmlPanelGrid gridPanel4 = new HtmlPanelGrid();
- private Button butLogin = new Button();
+ public HtmlPanelGrid getGridPanel4()
+ {
+ return gridPanel4;
+ }
- public Button getButLogin() {
- return butLogin;
- }
+ public void setGridPanel4( HtmlPanelGrid hpg )
+ {
+ this.gridPanel4 = hpg;
+ }
- public void setButLogin(Button b) {
- this.butLogin = b;
- }
+ private StaticText staticText1 = new StaticText();
- private StaticText txtMsg = new StaticText();
+ public StaticText getStaticText1()
+ {
+ return staticText1;
+ }
- public StaticText getTxtMsg() {
- return txtMsg;
- }
+ public void setStaticText1( StaticText st )
+ {
+ this.staticText1 = st;
+ }
+
+ private TextField txtUtilizador = new TextField();
- public void setTxtMsg(StaticText st) {
- this.txtMsg = st;
- }
-
- //
- /**
- * Construct a new Page bean instance.
- */
- public Login()
- {
-// connect();
- }
-
- /**
- * Callback method that is called whenever a page is navigated to,
- * either directly via a URL, or indirectly via page navigation.
- * Customize this method to acquire resources that will be needed
- * for event handlers and lifecycle methods, whether or not this
- * page is performing post back processing.
- *
- * Note that, if the current request is a postback, the property
- * values of the components do not represent any
- * values submitted with this request. Instead, they represent the
- * property values that were saved for this view when it was rendered.
- */
+ public TextField getTxtUtilizador()
+ {
+ return txtUtilizador;
+ }
+
+ public void setTxtUtilizador( TextField tf )
+ {
+ this.txtUtilizador = tf;
+ }
+
+ private StaticText staticText2 = new StaticText();
+
+ public StaticText getStaticText2()
+ {
+ return staticText2;
+ }
+
+ public void setStaticText2( StaticText st )
+ {
+ this.staticText2 = st;
+ }
+
+ private PasswordField txtPassword = new PasswordField();
+
+ public PasswordField getTxtPassword()
+ {
+ return txtPassword;
+ }
+
+ public void setTxtPassword( PasswordField pf )
+ {
+ this.txtPassword = pf;
+ }
+
+ private HtmlPanelGrid gridPanel5 = new HtmlPanelGrid();
+
+ public HtmlPanelGrid getGridPanel5()
+ {
+ return gridPanel5;
+ }
+
+ public void setGridPanel5( HtmlPanelGrid hpg )
+ {
+ this.gridPanel5 = hpg;
+ }
+
+ private Hyperlink lnkPassRecovery = new Hyperlink();
+
+ public Hyperlink getLnkPassRecovery()
+ {
+ return lnkPassRecovery;
+ }
+
+ public void setLnkPassRecovery( Hyperlink h )
+ {
+ this.lnkPassRecovery = h;
+ }
+
+ private Button butLogin = new Button();
+
+ public Button getButLogin()
+ {
+ return butLogin;
+ }
+
+ public void setButLogin( Button b )
+ {
+ this.butLogin = b;
+ }
+
+ private StaticText txtMsg = new StaticText();
+
+ public StaticText getTxtMsg()
+ {
+ return txtMsg;
+ }
+
+ public void setTxtMsg( StaticText st )
+ {
+ this.txtMsg = st;
+ }
+
+ //
+
+ /**
+ *
Construct a new Page bean instance.
+ */
+ public Login()
+ {
+ // connect();
+ }
+
+ /**
+ * Callback method that is called whenever a page is navigated to,
+ * either directly via a URL, or indirectly via page navigation.
+ * Customize this method to acquire resources that will be needed
+ * for event handlers and lifecycle methods, whether or not this
+ * page is performing post back processing.
+ *
+ * Note that, if the current request is a postback, the property
+ * values of the components do not represent any
+ * values submitted with this request. Instead, they represent the
+ * property values that were saved for this view when it was rendered.
+ */
@Override
- public void init()
- {
- // Perform initializations inherited from our superclass
- super.init();
- // Perform application initialization that must complete
- // *before* managed components are initialized
- // TODO - add your own initialiation code here
-
- //
- // Initialize automatically managed components
- // *Note* - this logic should NOT be modified
- try {
- _init();
- } catch (Exception e) {
- log("Page1 Initialization Failure", e);
- throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
- }
-
- //
- // Perform application initialization that must complete
- // *after* managed components are initialized
- // TODO - add your own initialization code here
-
- }
-
- /**
- * Callback method that is called after the component tree has been
- * restored, but before any event processing takes place. This method
- * will only be called on a postback request that
- * is processing a form submit. Customize this method to allocate
- * resources that will be required in your event handlers.
- */
+ public void init()
+ {
+ // Perform initializations inherited from our superclass
+ super.init();
+ // Perform application initialization that must complete
+ // *before* managed components are initialized
+ // TODO - add your own initialiation code here
+
+ //
+ // Initialize automatically managed components
+ // *Note* - this logic should NOT be modified
+ try
+ {
+ _init();
+ }
+ catch( Exception e )
+ {
+ log( "Page1 Initialization Failure", e );
+ throw e instanceof FacesException ? ( FacesException ) e : new FacesException( e );
+ }
+
+ //
+ // Perform application initialization that must complete
+ // *after* managed components are initialized
+ // TODO - add your own initialization code here
+
+ }
+
+ /**
+ * Callback method that is called after the component tree has been
+ * restored, but before any event processing takes place. This method
+ * will only be called on a postback request that
+ * is processing a form submit. Customize this method to allocate
+ * resources that will be required in your event handlers.
+ */
@Override
- public void preprocess()
- {
- }
-
- /**
- * Callback method that is called just before rendering takes place.
- * This method will only be called for the page that
- * will actually be rendered (and not, for example, on a page that
- * handled a postback and then navigated to a different page). Customize
- * this method to allocate resources that will be required for rendering
- * this page.
- */
+ public void preprocess()
+ {
+ }
+
+ /**
+ * Callback method that is called just before rendering takes place.
+ * This method will only be called for the page that
+ * will actually be rendered (and not, for example, on a page that
+ * handled a postback and then navigated to a different page). Customize
+ * this method to allocate resources that will be required for rendering
+ * this page.
+ */
@Override
- public void prerender()
- {
- txtMsg.setText(getSessionBean1().getMsg());
- getSessionBean1().setMsg("");
- }
-
- /**
- * Callback method that is called after rendering is completed for
- * this request, if init() was called (regardless of whether
- * or not this was the page that was actually rendered). Customize this
- * method to release resources acquired in the init(),
- * preprocess(), or prerender() methods (or
- * acquired during execution of an event handler).
- */
+ public void prerender()
+ {
+ txtMsg.setText( getSessionBean1().getMsg() );
+ getSessionBean1().setMsg( "" );
+ }
+
+ /**
+ * Callback method that is called after rendering is completed for
+ * this request, if init() was called (regardless of whether
+ * or not this was the page that was actually rendered). Customize this
+ * method to release resources acquired in the init(),
+ * preprocess(), or prerender() methods (or
+ * acquired during execution of an event handler).
+ */
@Override
- public void destroy()
- {
-
- }
-
- /**
- * Return a reference to the scoped data bean.
- */
- protected SessionBean1 getSessionBean1() {
- return (SessionBean1)getBean("SessionBean1");
- }
-
- /**
- * Return a reference to the scoped data bean.
- */
- protected RequestBean1 getRequestBean1() {
- return (RequestBean1)getBean("RequestBean1");
- }
-
- /**
- * Return a reference to the scoped data bean.
- */
- protected ApplicationBean1 getApplicationBean1()
- {
- return (ApplicationBean1)getBean("ApplicationBean1");
- }
-
- public String butLogin_action()
- {
- String sRet = null;
-
- if(txtUtilizador.getText() != null)
- {
- String utilizador = (String) txtUtilizador.getText();
- if(utilizador.trim().length() > 0)
- {
- if(txtPassword.getText() != null)
- {
- String password = (String) txtPassword.getText();
- if( password.trim().length() > 0 )
- {
- try
- {
- UtilizadoresDataProvider udp = UtilizadoresDataProvider.getInstance();
-
- Utilizador u = udp.getUtilizador( utilizador );
- if( u != null && "y".equals( u.getActivo() ) )
- {
- if ( ! password.equals( u.getPassword() ) )
- {
- getSessionBean1().setMsg( "Palavra-chave inválida !" );
- }
- else
- {
- //if(u.getOwner_id().intValue() == 0 )
+ public void destroy()
+ {
+
+ }
+
+ /**
+ * Return a reference to the scoped data bean.
+ */
+ protected SessionBean1 getSessionBean1()
+ {
+ return ( SessionBean1 ) getBean( "SessionBean1" );
+ }
+
+ /**
+ * Return a reference to the scoped data bean.
+ */
+ protected RequestBean1 getRequestBean1()
+ {
+ return ( RequestBean1 ) getBean( "RequestBean1" );
+ }
+
+ /**
+ * Return a reference to the scoped data bean.
+ */
+ protected ApplicationBean1 getApplicationBean1()
+ {
+ return ( ApplicationBean1 ) getBean( "ApplicationBean1" );
+ }
+
+ public String butLogin_action()
+ {
+ String sRet = null;
+
+ if( txtUtilizador.getText() != null )
+ {
+ String utilizador = ( String ) txtUtilizador.getText();
+ if( utilizador.trim().length() > 0 )
+ {
+ if( txtPassword.getText() != null )
+ {
+ String password = ( String ) txtPassword.getText();
+ if( password.trim().length() > 0 )
+ {
+ try
+ {
+ UtilizadoresDataProvider udp = UtilizadoresDataProvider.getInstance();
+
+ Utilizador u = udp.getUtilizador( utilizador );
+ if( u != null && "y".equals( u.getActivo() ) )
+ {
+ if( !password.equals( u.getPassword() ) )
+ {
+ getSessionBean1().setMsg( "Palavra-chave inválida !" );
+ }
+ else
+ {
+ //if(u.getOwner_id().intValue() == 0 )
Utils.doLogin( getExternalContext(), u );
- //Login Ok !
-// if(u.getPrimeiro_login().matches("y") || mustChangePassword(u))
- if(u.getPrimeiro_login().matches("y") )
- {
- getSessionBean1().setMudarPassword(true);
- getSessionBean1().setCurrentUser( u );
- getSessionBean1().setNavFrom("Login");
- getSessionBean1().setModoEdicaoUtilizador("edit");
- getSessionBean1().setLoggedIn(true);
- initializeClock();
- initializeDropDownOptions();
- return "user";
- }
- try
- {
- Integer permissao = udp.getPermissionCode( u.getId() );
+ //Login Ok !
+ //if(u.getPrimeiro_login().matches("y") || mustChangePassword(u))
+ if( u.getPrimeiro_login().matches( "y" ) )
+ {
+ getSessionBean1().setMudarPassword( true );
+ getSessionBean1().setCurrentUser( u );
+ getSessionBean1().setNavFrom( "Login" );
+ getSessionBean1().setModoEdicaoUtilizador( "edit" );
+ getSessionBean1().setLoggedIn( true );
+ initializeClock();
+ initializeDropDownOptions();
+ return "user";
+ }
+
+ getSessionBean1().setSiprp( udp.isSiprp( u ) );
+
+ try
+ {
+ Integer permissao = udp.getPermissionCode( u.getId() );
sRet = "form_seguranca";
- if ( permissao != null )
+ if( permissao != null )
{
- if(permissao.intValue() == 1) //seguranca
+ if( permissao.intValue() == 1 ) //seguranca
{
- if(u.getResponsavel_loja().matches("y"))
+ if( u.getResponsavel_loja().matches( "y" ) )
{
- sRet = "acesso";
- }
- else
+ sRet = "acesso";
+ }
+ else
{
sRet = "form_seguranca";
}
}
- else if(permissao.intValue() == 2) // rh
+ else if( permissao.intValue() == 2 ) // rh
{
- if(u.getResponsavel_loja().matches("y"))
+ if( u.getResponsavel_loja().matches( "y" ) )
{
sRet = "acesso";
}
@@ -423,255 +473,256 @@ public class Login extends AbstractPageBean
}
//sRet = "form_rh";
}
- else if(permissao.intValue() == 3) // hs
+ else if( permissao.intValue() == 3 ) // hs
{
//sRet = "form_hs";
sRet = "acesso";
}
- else if(permissao.intValue() == 5) // medico
+ else if( permissao.intValue() == 5 ) // medico
{
sRet = "form_medico";
}
- else if(permissao.intValue() == 6) // gestor
+ else if( permissao.intValue() == 6 ) // gestor
{
//sRet = "form_gestor";
sRet = "acesso";
}
- else if(permissao.intValue() == 7) // director geral rh
+ else if( permissao.intValue() == 7 ) // director geral rh
{
//sRet = "form_rh";
//sRet = "form_dir_ger_rh";
sRet = "acesso";
}
- else if(permissao.intValue() == 8) // director siprp
+ else if( permissao.intValue() == 8 ) // director siprp
{
//sRet = "form_dir_siprp";
sRet = "acesso";
}
- else if(permissao.intValue() == 9) // director loja
+ else if( permissao.intValue() == 9 ) // director loja
{
sRet = "acesso";
}
- else if(permissao.intValue() == 10) // director nacional de seguranca
+ else if( permissao.intValue() == 10 ) // director nacional de seguranca
{
sRet = "acesso";
}
}
- u.setCodigo_permissao( permissao );
- getSessionBean1().setCurrentUser( u );
- getSessionBean1().setLoggedIn( true );
- initializeClock();
- initializeDropDownOptions();
-
- // so para testes. retirar depois :
- ///getSessionBean1().setModoEdicaoUtilizador("new");
- ///sRet = "create_user";
- }
- catch ( Exception e1 )
- {
- ErrorLogger.logException( e1 );
- getSessionBean1().setMsg("Não tem permissão para entrar na aplicação !");
- }
- }
-
- }
- else
- {
- getSessionBean1().setMsg("Utilizador inválido ! ");
- }
- }
- catch(Exception ex)
- {
- ErrorLogger.logException( ex );
- getSessionBean1().setMsg("Utilizador inválido ! ");
- }
- }
- else
- {
- getSessionBean1().setMsg("Falta palavra-chave !");
- }
- }
- else
- {
- getSessionBean1().setMsg("Falta palavra-chave !");
- }
- }
- else
- {
- getSessionBean1().setMsg("Falta utilizador !");
- }
- }
- else
- {
- getSessionBean1().setMsg("Falta utilizador !");
- }
- return sRet;
- }
-
- public String lnkPassRecovery_action()
- {
- return "recuperar_password";
- }
-
-// private void connect()
-// {
-// db.Db db = new db.Db();
-// try
-// {
-// Connection connection = db.connect();
-// }
-// catch(Exception ex)
-// {
-// getSessionBean1().setMsg("Erro na ligação à Base de Dados");
-// //***** terminate session
-// try
-// {
-// getExternalContext().redirect("faces/Erro.jsp");
-// }
-// catch ( Exception e )
-// {
-// ErrorLogger.logException( e );
-// }
-// ErrorLogger.logException( ex );
-// }
-// }
-
- private void initializeClock()
- {
- com.sun.rave.web.ui.model.Option[] horasOptions = new com.sun.rave.web.ui.model.Option[25];
- horasOptions[0] = new Option(new Integer(-1), "-");
- int j = 0;
- String str_j = "";
- for(int i=1; i < 25; i++)
- {
- if(j < 10)
- {
- str_j = "0" + new Integer(j).toString();
- }
- else
- {
- str_j = new Integer(j).toString();
- }
- horasOptions[i] = new Option(new Integer(j), str_j);
- j++;
- }
- getSessionBean1().setHorasOptions(horasOptions);
-
- com.sun.rave.web.ui.model.Option[] minutosOptions = new com.sun.rave.web.ui.model.Option[13];
- minutosOptions[0] = new Option(new Integer(-1), "-");
- j = 0;
- for(int i=1; i < 13; i++)
- {
- if(j < 10)
- {
- str_j = "0" + new Integer(j).toString();
- }
- else
- {
- str_j = new Integer(j).toString();
- }
- minutosOptions[i] = new Option(new Integer(j), str_j);
- j += 5;
- }
- getSessionBean1().setMinutosOptions(minutosOptions);
- }
-
- private void initializeDropDownOptions()
- {
-// UtilizadoresDataProvider udp = new UtilizadoresDataProvider();
-// try
-// {
-// getSessionBean1().setTecnicosOptions(udp.getTecnicosSaudeList());
-// //drpTipo.setSelected(new Integer(0));
-// }
-// catch(Exception ex)
-// {
-// ErrorLogger.logException( ex );
-// }
-
-// try
-// {
-// getSessionBean1().setMedicosOptions(udp.getMedicosList());
-// //drpTipo.setSelected(new Integer(0));
-// }
-// catch(Exception ex)
-// {
-// ErrorLogger.logException( ex );
-// }
-
-// AnalisesDataProvider adp = new AnalisesDataProvider();
- try
- {
- AnalisesDataProvider adp = AnalisesDataProvider.getInstance();
- getSessionBean1().setCausasOptions( adp.getCausasAcidente( false ) );
- }
- catch(Exception ex)
- {
- ErrorLogger.logException( ex );
- }
-
- try
- {
- AnalisesDataProvider adp = AnalisesDataProvider.getInstance();
- getSessionBean1().setDepartamentoOptions(adp.getDepartamentosList());
- }
- catch(Exception ex)
- {
- ErrorLogger.logException( ex );
- }
-
- }
-
- private boolean mustChangePassword(Utilizador u)
- {
- java.util.Date now = new java.util.Date();
- Calendar cal = new GregorianCalendar();
- cal.setTime(now);
- int ano = cal.get(Calendar.YEAR);
- int mes = cal.get(Calendar.MONTH);
- int dia = cal.get(Calendar.DAY_OF_MONTH);
-
- Calendar today = new GregorianCalendar(ano, mes, dia);
- Calendar firstJan = new GregorianCalendar(ano, Calendar.JANUARY, 1);
-// Calendar firstJan = new GregorianCalendar(ano, Calendar.DECEMBER, 27);
- Calendar firstJul = new GregorianCalendar(ano, Calendar.JULY, 1);
-
- if(today.compareTo(firstJan) == 0 || today.compareTo(firstJul) == 0)
- {
- return true;
- }
-
- if(u.getData_password() == null)
- {
- return true;
- }
- else
- {
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
- try
- {
- java.util.Date dt_password = sdf.parse(u.getData_password().toString());
- Calendar cal_dt_password = new GregorianCalendar();
- cal_dt_password.setTime(dt_password);
- cal_dt_password.add(GregorianCalendar.MONTH, 6);
- if(cal.compareTo(cal_dt_password) > 0)
- {
- return true;
- }
- else
- {
- return false;
- }
-
- }
- catch(Exception ex)
- {
- ErrorLogger.logException( ex );
- }
-
- }
- return false;
- }
+ u.setCodigo_permissao( permissao );
+ getSessionBean1().setCurrentUser( u );
+ getSessionBean1().setLoggedIn( true );
+ initializeClock();
+ initializeDropDownOptions();
+
+ // so para testes. retirar depois :
+ ///getSessionBean1().setModoEdicaoUtilizador("new");
+ ///sRet = "create_user";
+ }
+ catch( Exception e1 )
+ {
+ ErrorLogger.logException( e1 );
+ getSessionBean1()
+ .setMsg( "Não tem permissão para entrar na aplicação !" );
+ }
+ }
+
+ }
+ else
+ {
+ getSessionBean1().setMsg( "Utilizador inválido ! " );
+ }
+ }
+ catch( Exception ex )
+ {
+ ErrorLogger.logException( ex );
+ getSessionBean1().setMsg( "Utilizador inválido ! " );
+ }
+ }
+ else
+ {
+ getSessionBean1().setMsg( "Falta palavra-chave !" );
+ }
+ }
+ else
+ {
+ getSessionBean1().setMsg( "Falta palavra-chave !" );
+ }
+ }
+ else
+ {
+ getSessionBean1().setMsg( "Falta utilizador !" );
+ }
+ }
+ else
+ {
+ getSessionBean1().setMsg( "Falta utilizador !" );
+ }
+ return sRet;
+ }
+
+ public String lnkPassRecovery_action()
+ {
+ return "recuperar_password";
+ }
+
+ // private void connect()
+ // {
+ // db.Db db = new db.Db();
+ // try
+ // {
+ // Connection connection = db.connect();
+ // }
+ // catch(Exception ex)
+ // {
+ // getSessionBean1().setMsg("Erro na ligação à Base de Dados");
+ // //***** terminate session
+ // try
+ // {
+ // getExternalContext().redirect("faces/Erro.jsp");
+ // }
+ // catch ( Exception e )
+ // {
+ // ErrorLogger.logException( e );
+ // }
+ // ErrorLogger.logException( ex );
+ // }
+ // }
+
+ private void initializeClock()
+ {
+ com.sun.rave.web.ui.model.Option[] horasOptions = new com.sun.rave.web.ui.model.Option[25];
+ horasOptions[0] = new Option( new Integer( -1 ), "-" );
+ int j = 0;
+ String str_j = "";
+ for( int i = 1; i < 25; i++ )
+ {
+ if( j < 10 )
+ {
+ str_j = "0" + new Integer( j ).toString();
+ }
+ else
+ {
+ str_j = new Integer( j ).toString();
+ }
+ horasOptions[i] = new Option( new Integer( j ), str_j );
+ j++;
+ }
+ getSessionBean1().setHorasOptions( horasOptions );
+
+ com.sun.rave.web.ui.model.Option[] minutosOptions = new com.sun.rave.web.ui.model.Option[13];
+ minutosOptions[0] = new Option( new Integer( -1 ), "-" );
+ j = 0;
+ for( int i = 1; i < 13; i++ )
+ {
+ if( j < 10 )
+ {
+ str_j = "0" + new Integer( j ).toString();
+ }
+ else
+ {
+ str_j = new Integer( j ).toString();
+ }
+ minutosOptions[i] = new Option( new Integer( j ), str_j );
+ j += 5;
+ }
+ getSessionBean1().setMinutosOptions( minutosOptions );
+ }
+
+ private void initializeDropDownOptions()
+ {
+ // UtilizadoresDataProvider udp = new UtilizadoresDataProvider();
+ // try
+ // {
+ // getSessionBean1().setTecnicosOptions(udp.getTecnicosSaudeList());
+ // //drpTipo.setSelected(new Integer(0));
+ // }
+ // catch(Exception ex)
+ // {
+ // ErrorLogger.logException( ex );
+ // }
+
+ // try
+ // {
+ // getSessionBean1().setMedicosOptions(udp.getMedicosList());
+ // //drpTipo.setSelected(new Integer(0));
+ // }
+ // catch(Exception ex)
+ // {
+ // ErrorLogger.logException( ex );
+ // }
+
+ // AnalisesDataProvider adp = new AnalisesDataProvider();
+ try
+ {
+ AnalisesDataProvider adp = AnalisesDataProvider.getInstance();
+ getSessionBean1().setCausasOptions( adp.getCausasAcidente( false ) );
+ }
+ catch( Exception ex )
+ {
+ ErrorLogger.logException( ex );
+ }
+
+ try
+ {
+ AnalisesDataProvider adp = AnalisesDataProvider.getInstance();
+ getSessionBean1().setDepartamentoOptions( adp.getDepartamentosList() );
+ }
+ catch( Exception ex )
+ {
+ ErrorLogger.logException( ex );
+ }
+
+ }
+
+ private boolean mustChangePassword( Utilizador u )
+ {
+ java.util.Date now = new java.util.Date();
+ Calendar cal = new GregorianCalendar();
+ cal.setTime( now );
+ int ano = cal.get( Calendar.YEAR );
+ int mes = cal.get( Calendar.MONTH );
+ int dia = cal.get( Calendar.DAY_OF_MONTH );
+
+ Calendar today = new GregorianCalendar( ano, mes, dia );
+ Calendar firstJan = new GregorianCalendar( ano, Calendar.JANUARY, 1 );
+ // Calendar firstJan = new GregorianCalendar(ano, Calendar.DECEMBER, 27);
+ Calendar firstJul = new GregorianCalendar( ano, Calendar.JULY, 1 );
+
+ if( today.compareTo( firstJan ) == 0 || today.compareTo( firstJul ) == 0 )
+ {
+ return true;
+ }
+
+ if( u.getData_password() == null )
+ {
+ return true;
+ }
+ else
+ {
+ SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd" );
+ try
+ {
+ java.util.Date dt_password = sdf.parse( u.getData_password().toString() );
+ Calendar cal_dt_password = new GregorianCalendar();
+ cal_dt_password.setTime( dt_password );
+ cal_dt_password.add( GregorianCalendar.MONTH, 6 );
+ if( cal.compareTo( cal_dt_password ) > 0 )
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+
+ }
+ catch( Exception ex )
+ {
+ ErrorLogger.logException( ex );
+ }
+
+ }
+ return false;
+ }
}
diff --git a/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/SessionBean1.java b/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/SessionBean1.java
index eeee173f..36815b75 100644
--- a/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/SessionBean1.java
+++ b/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/SessionBean1.java
@@ -571,9 +571,19 @@ public class SessionBean1 extends AbstractSessionBean
this.estabelecimentosGestorOptions = estabelecimentosGestorOptions;
}
-
-
- //
+ private Boolean siprp;
+
+ public Boolean isSiprp()
+ {
+ return siprp;
+ }
+
+ public void setSiprp( Boolean siprp )
+ {
+ this.siprp = siprp;
+ }
+
+ //
private Integer estabelecimentoOutroChoice;
public Integer getEstabelecimentoOutroChoice()
diff --git a/trunk/AnaliseAcidentesTrabalho/src/beans/Utilizador.java b/trunk/AnaliseAcidentesTrabalho/src/beans/Utilizador.java
index e5763466..77ee670e 100644
--- a/trunk/AnaliseAcidentesTrabalho/src/beans/Utilizador.java
+++ b/trunk/AnaliseAcidentesTrabalho/src/beans/Utilizador.java
@@ -63,25 +63,25 @@ public class Utilizador implements Serializable
public Utilizador( UtilizadoresData utilizadoresData )
{
- this.withId( utilizadoresData.getId() )
- .withLogin( utilizadoresData.getLogin() )
- .withPassword( utilizadoresData.getPassword() )
- .withData_password( new Date( utilizadoresData.getData_password().getTime() ) )
- .withEmail( utilizadoresData.getEmail() )
- .withEmpresa_id( utilizadoresData.getEmpresa_id() )
- .withEstabelecimento_id( utilizadoresData.getEstabelecimento_id() )
- .withAdministrador( utilizadoresData.getAdministrador() )
- .withTipo( utilizadoresData.getTipo() )
- .withNumero_cedula( utilizadoresData.getNumero_cedula() )
- .withCap( utilizadoresData.getCap() )
- .withNome( utilizadoresData.getNome() )
- .withMedico_id( utilizadoresData.getMedico_id() )
- .withFuncionario_hst_id( utilizadoresData.getFuncionario_hst_id() )
- .withActivo( utilizadoresData.getActivo() )
- .withResponsavel_loja( utilizadoresData.getResponsavel_loja() )
- .withGestor_geral( utilizadoresData.getGestor_geral() )
- .withPrimeiro_login( utilizadoresData.getPrimeiro_login() )
- .withApagado( utilizadoresData.getApagado() );
+ this.withId( utilizadoresData.getId() );
+ this.withLogin( utilizadoresData.getLogin() );
+ this.withPassword( utilizadoresData.getPassword() );
+ this.withData_password( new Date( utilizadoresData.getData_password().getTime() ) );
+ this.withEmail( utilizadoresData.getEmail() );
+ this.withEmpresa_id( utilizadoresData.getEmpresa_id() );
+ this.withEstabelecimento_id( utilizadoresData.getEstabelecimento_id() );
+ this.withAdministrador( utilizadoresData.getAdministrador() );
+ this.withTipo( utilizadoresData.getTipo() );
+ this.withNumero_cedula( utilizadoresData.getNumero_cedula() );
+ this.withCap( utilizadoresData.getCap() );
+ this.withNome( utilizadoresData.getNome() );
+ this.withMedico_id( utilizadoresData.getMedico_id() );
+ this.withFuncionario_hst_id( utilizadoresData.getFuncionario_hst_id() );
+ this.withActivo( utilizadoresData.getActivo() );
+ this.withResponsavel_loja( utilizadoresData.getResponsavel_loja() );
+ this.withGestor_geral( utilizadoresData.getGestor_geral() );
+ this.withPrimeiro_login( utilizadoresData.getPrimeiro_login() );
+ this.withApagado( utilizadoresData.getApagado() );
}
public Utilizador withId( final Integer id )
diff --git a/trunk/AnaliseAcidentesTrabalho/src/db/providers/AnalisesDataProvider.java b/trunk/AnaliseAcidentesTrabalho/src/db/providers/AnalisesDataProvider.java
index f280e556..847c5bba 100644
--- a/trunk/AnaliseAcidentesTrabalho/src/db/providers/AnalisesDataProvider.java
+++ b/trunk/AnaliseAcidentesTrabalho/src/db/providers/AnalisesDataProvider.java
@@ -68,7 +68,6 @@ import utils.Strings;
import utils.Utils;
/**
- *
* @author lluis
*/
@SuppressWarnings( "UnusedParameters" )
@@ -85,7 +84,7 @@ public class AnalisesDataProvider extends GenericDataProvider
public static synchronized AnalisesDataProvider getInstance() throws Exception
{
- if ( INSTANCE == null )
+ if( INSTANCE == null )
{
INSTANCE = new AnalisesDataProvider();
}
@@ -94,7 +93,7 @@ public class AnalisesDataProvider extends GenericDataProvider
public Controle getControloByAno( Integer ano ) throws Exception
{
- List controles = getProvider().listLoad( ControleData.class, new Object[]{ ano },
+ List< ControleData > controles = getProvider().listLoad( ControleData.class, new Object[]{ ano },
new String[]{ ControleData.ANALISE_YEAR_FULL }, new String[]{ ControleData.ID_FULL } );
return controles.size() > 0 ? toControleBean( controles.get( 0 ) ) : null;
}
@@ -145,14 +144,17 @@ public class AnalisesDataProvider extends GenericDataProvider
/*************************************************************************/
/********************************* ACTUAIS *******************************/
- /*************************************************************************/
- public ArrayList< AnaliseAcidente > searchAnalisesActualSeg( Integer estabelecimento_id, String nome, String visitaDate, String POR, String responsavel_loja, Integer fromYear )
+ /**
+ * *********************************************************************
+ */
+ public ArrayList< AnaliseAcidente > searchAnalisesActualSeg( Integer empresa_id, Integer estabelecimento_id, String
+ nome, String visitaDate, String POR, String responsavel_loja, Integer fromYear )
throws Exception
{
ArrayList< AnaliseAcidente > res;
- if ( nome == null && visitaDate == null && POR == null )
+ if( nome == null && visitaDate == null && POR == null )
{
- res = getAnalisesActuaisSegList( estabelecimento_id, responsavel_loja, fromYear );
+ res = getAnalisesActuaisSegList( empresa_id, estabelecimento_id, responsavel_loja, fromYear );
}
else
{
@@ -167,24 +169,31 @@ public class AnalisesDataProvider extends GenericDataProvider
if( responsavel_loja.matches( "y" ) )
{
where = where
- .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_SEG )
- .or( new Field( AnalisesAcidentesData.AVERIGUACAO_POSTERIOR_FULL ).isEqual( "y" ).and( new Field( AnalisesAcidentesData.AVERIGUACAO_OBS_FULL ).isEqual( "" ) ) )
- .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_ASSINATURA_SEG ) ) )
- .and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) );
+ .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_SEG )
+ .or( new Field( AnalisesAcidentesData.AVERIGUACAO_POSTERIOR_FULL ).isEqual( "y" )
+ .and( new Field( AnalisesAcidentesData.AVERIGUACAO_OBS_FULL ).isEqual( "" ) ) )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_ASSINATURA_SEG ) ) )
+ .and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) );
}
else
{
where = where
- .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_SEG )
- .or( new Field( AnalisesAcidentesData.AVERIGUACAO_POSTERIOR_FULL ).isEqual( "y" ).and( new Field( AnalisesAcidentesData.AVERIGUACAO_OBS_FULL ).isEqual( "" ) ) ) )
- .and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) );
+ .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_SEG )
+ .or( new Field( AnalisesAcidentesData.AVERIGUACAO_POSTERIOR_FULL ).isEqual( "y" )
+ .and( new Field( AnalisesAcidentesData.AVERIGUACAO_OBS_FULL ).isEqual( "" ) ) ) )
+ .and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) );
}
- Select select = new Select2( tables, joinTypes, joinConditions, new String[]{ "*" }, where, order, null, null, null );
+ if( empresa_id != null )
+ {
+ where = where.and( new Field( AnalisesAcidentesData.EMPRESA_ID_FULL ).isEqual( empresa_id ) );
+ }
+
+ Select select =
+ new Select2( tables, joinTypes, joinConditions, new String[]{ "*" }, where, order, null, null, null );
System.out.println( "SQL: " + select.toString() );
-
Virtual2DArray result = getExecuter().executeQuery( select );
res = fillAnaliseFields( result );
@@ -192,48 +201,56 @@ public class AnalisesDataProvider extends GenericDataProvider
return res;
}
- public ArrayList< AnaliseAcidente > getAnalisesActuaisSegList( Integer estabelecimentoID, String responsavel_loja, Integer fromYear )
+ public ArrayList< AnaliseAcidente > getAnalisesActuaisSegList( Integer empresa_id, Integer estabelecimentoID, String
+ responsavel_loja, Integer fromYear )
throws Exception
{
Expression where = new Field( AnalisesAcidentesData.APAGADA_FULL ).isEqual( "n" );
where = where.and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimentoID ) );
- if ( fromYear != null )
+ if( fromYear != null )
{
- where = where.and( new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" ).isEqual( fromYear ) );
+ where = where.and(
+ new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" ).isEqual( fromYear ) );
}
Expression states = new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_SEG ).or(
- new Field( AnalisesAcidentesData.AVERIGUACAO_POSTERIOR_FULL ).isEqual( "y" ).and( new Field( AnalisesAcidentesData.AVERIGUACAO_OBS_FULL ).isEqual( "" ) ) );
- if ( "y".equals( responsavel_loja ) )
+ new Field( AnalisesAcidentesData.AVERIGUACAO_POSTERIOR_FULL ).isEqual( "y" )
+ .and( new Field( AnalisesAcidentesData.AVERIGUACAO_OBS_FULL ).isEqual( "" ) ) );
+ if( "y".equals( responsavel_loja ) )
{
states = states.or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_ASSINATURA_SEG ) );
}
where = where.and( states );
+ if( empresa_id != null )
+ {
+ where = where.and( new Field( AnalisesAcidentesData.EMPRESA_ID_FULL ).isEqual( empresa_id ) );
+ }
+
Select2 query = new Select2(
- new String[] { AnalisesAcidentesData.TABLENAME },
- new Integer[] { },
- new Expression[] { },
+ new String[]{ AnalisesAcidentesData.TABLENAME },
+ new Integer[]{ },
+ new Expression[]{ },
new String[]{ "*" },
where,
- new String[] { AnalisesAcidentesData.ANALISE_NR_FULL },
+ new String[]{ AnalisesAcidentesData.ANALISE_NR_FULL },
null, null, null );
System.out.println( "SQL: " + query.toString() );
-
Virtual2DArray result = getExecuter().executeQuery( query );
return fillAnaliseFields( result );
}
- public ArrayList< AnaliseAcidente > searchAnalisesActualRH( Integer estabelecimento_id, String nome, String visitaDate, String POR, String responsavel_loja, Integer fromYear )
+ public ArrayList< AnaliseAcidente > searchAnalisesActualRH( Integer empresa_id, Integer estabelecimento_id, String
+ nome, String visitaDate, String POR, String responsavel_loja, Integer fromYear )
throws Exception
{
ArrayList< AnaliseAcidente > res;
- if ( nome == null && visitaDate == null && POR == null )
+ if( nome == null && visitaDate == null && POR == null )
{
- res = getAnalisesActuaisRhList( estabelecimento_id, responsavel_loja, fromYear );
+ res = getAnalisesActuaisRhList( empresa_id, estabelecimento_id, responsavel_loja, fromYear );
}
else
{
@@ -248,23 +265,29 @@ public class AnalisesDataProvider extends GenericDataProvider
if( responsavel_loja.matches( "y" ) )
{
where = where.and(
- new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_RH1 )
- .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_RH2 ) )
- .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_ASSINATURA_RH ) )
- ).and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) );
+ new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_RH1 )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_RH2 ) )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_ASSINATURA_RH ) )
+ ).and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) );
}
else
{
where = where.and(
- new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_RH1 )
- .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_RH2 ) )
- ).and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) );
+ new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_RH1 )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_RH2 ) )
+ ).and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) );
+ }
+
+ if( empresa_id != null )
+ {
+ where = where.and( new Field( AnalisesAcidentesData.EMPRESA_ID_FULL ).isEqual( empresa_id ) );
}
- Select select = new Select2( tables, joinTypes, joinConditions, new String[]{ "*" }, where, order, null, null, null );
+ Select select =
+ new Select2( tables, joinTypes, joinConditions, new String[]{ "*" }, where, order, null, null, null );
System.out.println( "SQL: " + select.toString() );
-
+
Virtual2DArray result = getExecuter().executeQuery( select );
res = fillAnaliseFields( result );
@@ -272,53 +295,61 @@ public class AnalisesDataProvider extends GenericDataProvider
return res;
}
- public ArrayList< AnaliseAcidente > getAnalisesActuaisRhList( Integer estabelecimentoID, String responsavel_loja, Integer fromYear )
+ public ArrayList< AnaliseAcidente > getAnalisesActuaisRhList( Integer empresa_id, Integer estabelecimentoID, String
+ responsavel_loja, Integer fromYear )
throws Exception
{
Expression where = new Field( AnalisesAcidentesData.APAGADA_FULL ).isEqual( "n" );
where = where.and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimentoID ) );
- if ( fromYear != null )
+ if( fromYear != null )
{
- where = where.and( new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" ).isEqual( fromYear ) );
+ where = where.and(
+ new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" ).isEqual( fromYear ) );
}
Expression or = new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_RH1 )
- .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_RH2 ) );
- if ( "y".equals( responsavel_loja ) )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_RH2 ) );
+ if( "y".equals( responsavel_loja ) )
{
or = or.or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_ASSINATURA_RH ) );
}
where = where.and( or );
+ if( empresa_id != null )
+ {
+ where = where.and( new Field( AnalisesAcidentesData.EMPRESA_ID_FULL ).isEqual( empresa_id ) );
+ }
+
Select2 query = new Select2(
- new String[] { AnalisesAcidentesData.TABLENAME },
- new Integer[] { },
- new Expression[] { },
- new String[] { "*" },
+ new String[]{ AnalisesAcidentesData.TABLENAME },
+ new Integer[]{ },
+ new Expression[]{ },
+ new String[]{ "*" },
where,
- new String[] { AnalisesAcidentesData.ANALISE_NR_FULL },
+ new String[]{ AnalisesAcidentesData.ANALISE_NR_FULL },
null, null, null );
System.out.println( "SQL: " + query.toString() );
-
Virtual2DArray result = getExecuter().executeQuery( query );
return fillAnaliseFields( result );
}
- public ArrayList< AnaliseAcidente > searchAnalisesActuaisHS( Integer estabelecimento_id, String nome, Integer estabelecimentoID, String visitaDate, String POR, Integer fromYear )
+ public ArrayList< AnaliseAcidente > searchAnalisesActuaisHS( Integer empresa_id, Integer estabelecimento_id, String
+ nome, Integer estabelecimentoID, String visitaDate, String POR, Integer fromYear )
throws Exception
{
ArrayList< AnaliseAcidente > res;
- if ( nome == null && estabelecimentoID == null && visitaDate == null && POR == null )
+ if( nome == null && estabelecimentoID == null && visitaDate == null && POR == null )
{
- res = getAnalisesActuaisHsList( estabelecimento_id, fromYear );
+ res = getAnalisesActuaisHsList( empresa_id, estabelecimento_id, fromYear );
}
else
{
- CommonExpression commonExpression = new CommonExpression( nome, estabelecimentoID, visitaDate, POR, fromYear ).invoke();
+ CommonExpression commonExpression =
+ new CommonExpression( nome, estabelecimentoID, visitaDate, POR, fromYear ).invoke();
String[] tables = commonExpression.getTables();
Integer[] joinTypes = commonExpression.getJoinTypes();
Expression[] joinConditions = commonExpression.getJoinConditions();
@@ -326,16 +357,21 @@ public class AnalisesDataProvider extends GenericDataProvider
String[] order = new String[]{ AnalisesAcidentesData.ANALISE_NR_FULL };
Expression where = commonExpression.getWhere().and(
- new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_HS )
- .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_FECHAR ) )
- .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_CONSOLIDACAO ) )
+ new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_HS )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_FECHAR ) )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_CONSOLIDACAO ) )
);
- Select select = new Select2( tables, joinTypes, joinConditions, new String[]{ "*" }, where, order, null, null, null );
+ if( empresa_id != null )
+ {
+ where = where.and( new Field( AnalisesAcidentesData.EMPRESA_ID_FULL ).isEqual( empresa_id ) );
+ }
+
+ Select select =
+ new Select2( tables, joinTypes, joinConditions, new String[]{ "*" }, where, order, null, null, null );
System.out.println( "SQL: " + select.toString() );
-
Virtual2DArray result = getExecuter().executeQuery( select );
res = fillAnaliseFields( result );
@@ -343,29 +379,37 @@ public class AnalisesDataProvider extends GenericDataProvider
return res;
}
- public ArrayList< AnaliseAcidente > getAnalisesActuaisHsList( Integer estabelecimentoID, Integer fromYear ) throws Exception
+ public ArrayList< AnaliseAcidente > getAnalisesActuaisHsList( Integer empresa_id, Integer estabelecimentoID, Integer
+ fromYear ) throws Exception
{
Expression where = new Field( AnalisesAcidentesData.APAGADA_FULL ).isEqual( "n" ).and(
- new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_HS ).or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_FECHAR ) ).or( new Field( "estado" ).isEqual( Global.ESTADO_CONSOLIDACAO ) ) );
+ new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_HS )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_FECHAR ) )
+ .or( new Field( "estado" ).isEqual( Global.ESTADO_CONSOLIDACAO ) ) );
+
+ if( fromYear != null )
+ {
+ where = where.and(
+ new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" ).isEqual( fromYear ) );
+ }
- if ( fromYear != null )
+ if( empresa_id != null )
{
- where = where.and( new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" ).isEqual( fromYear ) );
+ where = where.and( new Field( AnalisesAcidentesData.EMPRESA_ID_FULL ).isEqual( empresa_id ) );
}
Select2 query = new Select2(
- new String[] { AnalisesAcidentesData.TABLENAME },
- new Integer[] { },
- new Expression[] { },
- new String[] { "*" },
+ new String[]{ AnalisesAcidentesData.TABLENAME },
+ new Integer[]{ },
+ new Expression[]{ },
+ new String[]{ "*" },
where,
- new String[] { AnalisesAcidentesData.ANALISE_NR_FULL },
+ new String[]{ AnalisesAcidentesData.ANALISE_NR_FULL },
null, null, null
);
System.out.println( "SQL: " + query.toString() );
-
Virtual2DArray result = getExecuter().executeQuery( query );
return fillAnaliseFields( result );
@@ -373,14 +417,18 @@ public class AnalisesDataProvider extends GenericDataProvider
/*************************************************************************/
/******************************* SEGUIMENTO ******************************/
- /*************************************************************************/
- public ArrayList< AnaliseAcidente > searchAnalisesSeguimentoSeg( Integer estabelecimento_id, String nome, String visitaDate, String POR, String responsavel_loja, Integer fromYear )
+ /**
+ * *********************************************************************
+ */
+ public ArrayList< AnaliseAcidente > searchAnalisesSeguimentoSeg( Integer empresa_id, Integer estabelecimento_id,
+ String nome, String visitaDate, String POR,
+ String responsavel_loja, Integer fromYear )
throws Exception
{
ArrayList< AnaliseAcidente > res;
- if ( nome == null && visitaDate == null && POR == null )
+ if( nome == null && visitaDate == null && POR == null )
{
- res = getAnalisesSeguimentoSegList( estabelecimento_id, responsavel_loja, fromYear );
+ res = getAnalisesSeguimentoSegList( empresa_id, estabelecimento_id, responsavel_loja, fromYear );
}
else
{
@@ -394,18 +442,36 @@ public class AnalisesDataProvider extends GenericDataProvider
if( responsavel_loja.matches( "y" ) )
{
- where = where.and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) ).and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( Global.ESTADO_SEG ).and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_ASSINATURA_SEG ) ).and( new Field( AnalisesAcidentesData.AVERIGUACAO_POSTERIOR_FULL ).isEqual( "n" ).or( new Field( AnalisesAcidentesData.AVERIGUACAO_POSTERIOR_FULL ).isEqual( "y" ).and( new Field( AnalisesAcidentesData.AVERIGUACAO_OBS_FULL ).isDifferent( "" ) ) ) ).or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( Global.ESTADO_ASSINATURA_SEG ).and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_CONCLUIDO ) ) ) );
+ where = where.and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) )
+ .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( Global.ESTADO_SEG )
+ .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_ASSINATURA_SEG ) ).and(
+ new Field( AnalisesAcidentesData.AVERIGUACAO_POSTERIOR_FULL ).isEqual( "n" ).or(
+ new Field( AnalisesAcidentesData.AVERIGUACAO_POSTERIOR_FULL ).isEqual( "y" )
+ .and( new Field( AnalisesAcidentesData.AVERIGUACAO_OBS_FULL ).isDifferent( "" ) ) ) ).or(
+ new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( Global.ESTADO_ASSINATURA_SEG )
+ .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_CONCLUIDO ) ) ) );
}
else
{
- where = where.and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) ).and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_FECHAR ).or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( Global.ESTADO_SEG ).and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_FECHAR ) ).and( new Field( AnalisesAcidentesData.AVERIGUACAO_POSTERIOR_FULL ).isEqual( "n" ).or( new Field( AnalisesAcidentesData.AVERIGUACAO_POSTERIOR_FULL ).isEqual( "y" ).and( new Field( AnalisesAcidentesData.AVERIGUACAO_OBS_FULL ).isDifferent( "" ) ) ) ) ) );
+ where = where.and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) )
+ .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_FECHAR ).or(
+ new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( Global.ESTADO_SEG )
+ .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_FECHAR ) ).and(
+ new Field( AnalisesAcidentesData.AVERIGUACAO_POSTERIOR_FULL ).isEqual( "n" ).or(
+ new Field( AnalisesAcidentesData.AVERIGUACAO_POSTERIOR_FULL ).isEqual( "y" )
+ .and( new Field( AnalisesAcidentesData.AVERIGUACAO_OBS_FULL ).isDifferent( "" ) ) ) ) ) );
}
- Select select = new Select2( tables, joinTypes, joinConditions, new String[]{ "*" }, where, order, null, null, null );
+ if( empresa_id != null )
+ {
+ where = where.and( new Field( AnalisesAcidentesData.EMPRESA_ID_FULL ).isEqual( empresa_id ) );
+ }
+
+ Select select =
+ new Select2( tables, joinTypes, joinConditions, new String[]{ "*" }, where, order, null, null, null );
System.out.println( "SQL: " + select.toString() );
-
Virtual2DArray result = getExecuter().executeQuery( select );
res = fillAnaliseFields( result );
@@ -413,50 +479,72 @@ public class AnalisesDataProvider extends GenericDataProvider
return res;
}
- public ArrayList< AnaliseAcidente > getAnalisesSeguimentoSegList( Integer estabelecimento_id, String responsavel_loja, Integer fromYear )
+ public ArrayList< AnaliseAcidente > getAnalisesSeguimentoSegList( Integer empresa_id, Integer estabelecimento_id,
+ String responsavel_loja, Integer fromYear )
throws Exception
{
- String tables[] = new String[] { AnalisesAcidentesData.TABLENAME };
+ String tables[] = new String[]{ AnalisesAcidentesData.TABLENAME };
Expression where = new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id )
- .or( new Field( AnalisesAcidentesData.APAGADA_FULL ).isEqual( "n" ) );
+ .or( new Field( AnalisesAcidentesData.APAGADA_FULL ).isEqual( "n" ) );
String[] order = new String[]{ AnalisesAcidentesData.ANALISE_NR_FULL };
- if ( responsavel_loja.matches( "y" ) )
+ if( responsavel_loja.matches( "y" ) )
{
- where = where.and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( Global.ESTADO_SEG ).and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_ASSINATURA_SEG ) ).and( new Field( AnalisesAcidentesData.AVERIGUACAO_POSTERIOR_FULL ).isEqual( "n" ).or( new Field( AnalisesAcidentesData.AVERIGUACAO_POSTERIOR_FULL ).isEqual( "y" ).and( new Field( AnalisesAcidentesData.AVERIGUACAO_OBS_FULL ).isDifferent( "" ) ) ) ).or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( Global.ESTADO_ASSINATURA_SEG ).and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_CONCLUIDO ) ) ) );
+ where = where.and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( Global.ESTADO_SEG )
+ .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_ASSINATURA_SEG ) ).and(
+ new Field( AnalisesAcidentesData.AVERIGUACAO_POSTERIOR_FULL ).isEqual( "n" ).or(
+ new Field( AnalisesAcidentesData.AVERIGUACAO_POSTERIOR_FULL ).isEqual( "y" )
+ .and( new Field( AnalisesAcidentesData.AVERIGUACAO_OBS_FULL ).isDifferent( "" ) ) ) ).or(
+ new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( Global.ESTADO_ASSINATURA_SEG )
+ .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_CONCLUIDO ) ) ) );
}
else
{
- where = where.and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_FECHAR ).or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( Global.ESTADO_SEG ).and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_FECHAR ) ).and( new Field( AnalisesAcidentesData.AVERIGUACAO_POSTERIOR_FULL ).isEqual( "n" ).or( new Field( AnalisesAcidentesData.AVERIGUACAO_POSTERIOR_FULL ).isEqual( "y" ).and( new Field( AnalisesAcidentesData.AVERIGUACAO_OBS_FULL ).isDifferent( "" ) ) ) ) ) );
+ where = where.and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_FECHAR ).or(
+ new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( Global.ESTADO_SEG )
+ .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_FECHAR ) ).and(
+ new Field( AnalisesAcidentesData.AVERIGUACAO_POSTERIOR_FULL ).isEqual( "n" ).or(
+ new Field( AnalisesAcidentesData.AVERIGUACAO_POSTERIOR_FULL ).isEqual( "y" )
+ .and( new Field( AnalisesAcidentesData.AVERIGUACAO_OBS_FULL ).isDifferent( "" ) ) ) ) ) );
}
- if ( fromYear != null )
+ if( fromYear != null )
{
- where = where.and( new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" ).isEqual( fromYear ) );
+ where = where.and(
+ new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" ).isEqual( fromYear ) );
}
- Select2 query = new Select2( tables, new Integer[] { }, new Expression[] { }, new String[] { "*" }, where, order, null, null, null );
+ if( empresa_id != null )
+ {
+ where = where.and( new Field( AnalisesAcidentesData.EMPRESA_ID_FULL ).isEqual( empresa_id ) );
+ }
+
+ Select2 query =
+ new Select2( tables, new Integer[]{ }, new Expression[]{ }, new String[]{ "*" }, where, order, null, null,
+ null );
System.out.println( "SQL: " + query.toString() );
-
Virtual2DArray result = getExecuter().executeQuery( query );
return fillAnaliseFields( result );
}
- public ArrayList< AnaliseAcidente > searchAnalisesSeguimentoHS( Integer estabelecimento_id, String nome, Integer estabelecimentoID, String visitaDate, String POR, Integer fromYear )
+ public ArrayList< AnaliseAcidente > searchAnalisesSeguimentoHS( Integer empresa_id, Integer estabelecimento_id,
+ String nome, Integer estabelecimentoID,
+ String visitaDate, String POR, Integer fromYear )
throws Exception
{
ArrayList< AnaliseAcidente > res;
- if ( nome == null && estabelecimentoID == null && visitaDate == null && POR == null )
+ if( nome == null && estabelecimentoID == null && visitaDate == null && POR == null )
{
- res = getAnalisesSeguimentoHsList( estabelecimento_id, fromYear );
+ res = getAnalisesSeguimentoHsList( empresa_id, estabelecimento_id, fromYear );
}
else
{
- CommonExpression commonExpression = new CommonExpression( nome, estabelecimentoID, visitaDate, POR, fromYear ).invoke();
+ CommonExpression commonExpression =
+ new CommonExpression( nome, estabelecimentoID, visitaDate, POR, fromYear ).invoke();
String[] tables = commonExpression.getTables();
Integer[] joinTypes = commonExpression.getJoinTypes();
Expression[] joinConditions = commonExpression.getJoinConditions();
@@ -464,12 +552,21 @@ public class AnalisesDataProvider extends GenericDataProvider
String[] order = new String[]{ AnalisesAcidentesData.ANALISE_NR_FULL };
Expression where = commonExpression.getWhere().
- and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_HS ).or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( Global.ESTADO_HS ).and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_CONSOLIDACAO ) ) ).or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( Global.ESTADO_CONSOLIDACAO ).and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_FECHAR ) ) ) );
+ and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_HS ).or(
+ new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( Global.ESTADO_HS )
+ .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_CONSOLIDACAO ) ) ).or(
+ new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( Global.ESTADO_CONSOLIDACAO )
+ .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_FECHAR ) ) ) );
- Select select = new Select2( tables, joinTypes, joinConditions, new String[]{ "*" }, where, order, null, null, null );
+ if( empresa_id != null )
+ {
+ where = where.and( new Field( AnalisesAcidentesData.EMPRESA_ID_FULL ).isEqual( empresa_id ) );
+ }
- System.out.println( "SQL: " + select.toString() );
+ Select select =
+ new Select2( tables, joinTypes, joinConditions, new String[]{ "*" }, where, order, null, null, null );
+ System.out.println( "SQL: " + select.toString() );
Virtual2DArray result = getExecuter().executeQuery( select );
@@ -478,46 +575,54 @@ public class AnalisesDataProvider extends GenericDataProvider
return res;
}
- public ArrayList< AnaliseAcidente > getAnalisesSeguimentoHsList( Integer estabelecimentoID, Integer fromYear )
+ public ArrayList< AnaliseAcidente > getAnalisesSeguimentoHsList( Integer empresa_id, Integer estabelecimentoID,
+ Integer fromYear )
throws Exception
{
Expression where = new Field( AnalisesAcidentesData.APAGADA_FULL ).isEqual( "n" );
- if ( fromYear != null )
+ if( fromYear != null )
{
- where = where.and( new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" ).isEqual( fromYear ) );
+ where = where.and(
+ new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" ).isEqual( fromYear ) );
}
where = where.and(
new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_HS )
- .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( Global.ESTADO_HS )
- .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_CONSOLIDACAO ) ) )
- .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( Global.ESTADO_CONSOLIDACAO )
- .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_FECHAR ) ) ) );
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( Global.ESTADO_HS )
+ .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_CONSOLIDACAO ) ) )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( Global.ESTADO_CONSOLIDACAO )
+ .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_FECHAR ) ) ) );
+
+ if( empresa_id != null )
+ {
+ where = where.and( new Field( AnalisesAcidentesData.EMPRESA_ID_FULL ).isEqual( empresa_id ) );
+ }
Select2 query = new Select2(
- new String[] { AnalisesAcidentesData.TABLENAME },
- new Integer[] { },
- new Expression[] { },
- new String[] { "*" },
- where,
- new String[] { AnalisesAcidentesData.ANALISE_NR_FULL },
+ new String[]{ AnalisesAcidentesData.TABLENAME },
+ new Integer[]{ },
+ new Expression[]{ },
+ new String[]{ "*" },
+ where,
+ new String[]{ AnalisesAcidentesData.ANALISE_NR_FULL },
null, null, null
);
System.out.println( "SQL: " + query.toString() );
-
Virtual2DArray result = getExecuter().executeQuery( query );
return fillAnaliseFields( result );
}
- public ArrayList< AnaliseAcidente > searchAnalisesSeguimentoRH( Integer estabelecimento_id, String nome, String visitaDate, String POR, String responsavel_loja, Integer fromYear )
+ public ArrayList< AnaliseAcidente > searchAnalisesSeguimentoRH( Integer empresa_id, Integer estabelecimento_id,
+ String nome, String visitaDate, String POR,
+ String responsavel_loja, Integer fromYear )
throws Exception
{
ArrayList< AnaliseAcidente > res;
- if ( nome == null && visitaDate == null && POR == null )
+ if( nome == null && visitaDate == null && POR == null )
{
- res = getAnalisesSeguimentoRhList( estabelecimento_id, responsavel_loja, fromYear );
+ res = getAnalisesSeguimentoRhList( empresa_id, estabelecimento_id, responsavel_loja, fromYear );
}
else
{
@@ -531,18 +636,34 @@ public class AnalisesDataProvider extends GenericDataProvider
if( responsavel_loja.matches( "y" ) )
{
- where = where.and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) ).and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_SEG ).or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_HS ) ).or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_CONSOLIDACAO ) ).or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_ASSINATURA_SEG ) ).or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_FECHAR ) ) );
+ where = where.and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) )
+ .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_SEG )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_HS ) )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_CONSOLIDACAO ) )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_ASSINATURA_SEG ) )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_FECHAR ) ) );
}
else
{
- where = where.and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) ).and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_SEG ).or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_HS ) ).or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_CONSOLIDACAO ) ).or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_ASSINATURA_SEG ) ).or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_ASSINATURA_RH ) ).or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_FECHAR ) ) );
+ where = where.and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) )
+ .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_SEG )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_HS ) )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_CONSOLIDACAO ) )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_ASSINATURA_SEG ) )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_ASSINATURA_RH ) )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_FECHAR ) ) );
+ }
+
+ if( empresa_id != null )
+ {
+ where = where.and( new Field( AnalisesAcidentesData.EMPRESA_ID_FULL ).isEqual( empresa_id ) );
}
- Select select = new Select2( tables, joinTypes, joinConditions, new String[]{ "*" }, where, order, null, null, null );
+ Select select =
+ new Select2( tables, joinTypes, joinConditions, new String[]{ "*" }, where, order, null, null, null );
System.out.println( "SQL: " + select.toString() );
-
Virtual2DArray result = getExecuter().executeQuery( select );
res = fillAnaliseFields( result );
@@ -550,34 +671,41 @@ public class AnalisesDataProvider extends GenericDataProvider
return res;
}
- public ArrayList< AnaliseAcidente > getAnalisesSeguimentoRhList( Integer estabelecimentoID, String responsavel_loja, Integer fromYear )
+ public ArrayList< AnaliseAcidente > getAnalisesSeguimentoRhList( Integer empresa_id, Integer estabelecimentoID,
+ String responsavel_loja, Integer fromYear )
throws Exception
{
Expression where = new Field( AnalisesAcidentesData.APAGADA_FULL ).isEqual( "n" );
where = where.and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimentoID ) );
- if ( fromYear != null )
+ if( fromYear != null )
{
- where = where.and( new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" ).isEqual( fromYear ) );
+ where = where.and(
+ new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" ).isEqual( fromYear ) );
}
Expression or = new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_SEG )
- .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_HS ) )
- .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_CONSOLIDACAO ) )
- .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_ASSINATURA_SEG ) )
- .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_FECHAR ) );
- if ( !"y".equals( responsavel_loja ) )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_HS ) )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_CONSOLIDACAO ) )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_ASSINATURA_SEG ) )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_FECHAR ) );
+ if( !"y".equals( responsavel_loja ) )
{
or = or.or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_ASSINATURA_RH ) );
}
where = where.and( or );
+ if( empresa_id != null )
+ {
+ where = where.and( new Field( AnalisesAcidentesData.EMPRESA_ID_FULL ).isEqual( empresa_id ) );
+ }
+
Select2 query = new Select2(
- new String[] { AnalisesAcidentesData.TABLENAME },
- new Integer[] { },
- new Expression[] { },
- new String[] { "*" },
+ new String[]{ AnalisesAcidentesData.TABLENAME },
+ new Integer[]{ },
+ new Expression[]{ },
+ new String[]{ "*" },
where,
- new String[] { AnalisesAcidentesData.ANALISE_NR_FULL },
+ new String[]{ AnalisesAcidentesData.ANALISE_NR_FULL },
null, null, null
);
@@ -587,13 +715,15 @@ public class AnalisesDataProvider extends GenericDataProvider
return fillAnaliseFields( result );
}
- public ArrayList< AnaliseAcidente > searchAnalisesSeguimentoMedico( Integer estabelecimento_id, String nome, String visitaDate, String POR, Integer fromYear )
+ public ArrayList< AnaliseAcidente > searchAnalisesSeguimentoMedico( Integer empresa_id, Integer estabelecimento_id,
+ String nome, String visitaDate, String POR,
+ Integer fromYear )
throws Exception
{
ArrayList< AnaliseAcidente > res;
- if ( nome == null && visitaDate == null && POR == null )
+ if( nome == null && visitaDate == null && POR == null )
{
- res = getAnalisesSeguimentoMedList( estabelecimento_id, fromYear );
+ res = getAnalisesSeguimentoMedList( empresa_id, estabelecimento_id, fromYear );
}
else
{
@@ -606,17 +736,26 @@ public class AnalisesDataProvider extends GenericDataProvider
String[] order = new String[]{ AnalisesAcidentesData.ANALISE_NR_FULL };
Expression where = commonExpression.getWhere()
- .and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) )
- .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_CONSOLIDACAO ) )
- .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_ASSINATURA_SEG ).and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isDifferent( Global.ESTADO_RH1 ) ) )
- .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_ASSINATURA_SEG ).and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_RH1 ) ).and( new Field( "ass_med" ).isEqual( "y" ) ) )
- .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( Global.ESTADO_ASSINATURA_SEG ).and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_CONCLUIDO ) ) );
+ .and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) )
+ .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_CONSOLIDACAO ) )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_ASSINATURA_SEG )
+ .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isDifferent( Global.ESTADO_RH1 ) ) )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_ASSINATURA_SEG )
+ .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_RH1 ) )
+ .and( new Field( "ass_med" ).isEqual( "y" ) ) )
+ .or( new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( Global.ESTADO_ASSINATURA_SEG )
+ .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_CONCLUIDO ) ) );
+
+ if( empresa_id != null )
+ {
+ where = where.and( new Field( AnalisesAcidentesData.EMPRESA_ID_FULL ).isEqual( empresa_id ) );
+ }
- Select select = new Select2( tables, joinTypes, joinConditions, new String[]{ "*" }, where, order, null, null, null );
+ Select select =
+ new Select2( tables, joinTypes, joinConditions, new String[]{ "*" }, where, order, null, null, null );
System.out.println( "SQL: " + select.toString() );
-
Virtual2DArray result = getExecuter().executeQuery( select );
res = fillAnaliseFields( result );
@@ -624,66 +763,84 @@ public class AnalisesDataProvider extends GenericDataProvider
return res;
}
- public ArrayList< AnaliseAcidente > getAnalisesSeguimentoMedList( Integer estabelecimentoID, Integer fromYear )
+ public ArrayList< AnaliseAcidente > getAnalisesSeguimentoMedList( Integer empresa_id, Integer estabelecimentoID,
+ Integer fromYear )
throws Exception
{
Expression where = new Field( AnalisesAcidentesData.APAGADA_FULL ).isEqual( "n" );
where = where.and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimentoID ) );
- if ( fromYear != null )
+ if( fromYear != null )
{
- where = where.and( new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" ).isEqual( fromYear ) );
+ where = where.and(
+ new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" ).isEqual( fromYear ) );
}
where = where.and(
new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( 5 ).or(
- new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( 6 ).and( new Field( AnalisesAcidentesData.ESTADO_ASSINATURA_FULL ).isDifferent( 2 ) ) ).or(
- new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( 6 ).and( new Field( AnalisesAcidentesData.ESTADO_ASSINATURA_FULL ).isEqual( 2 ) ).and( new Field( "analises_acidentes.ass_med" ).isEqual( "y" ) ) ).or(
- new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( 6 ).and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( 9 ) ) ) );
+ new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( 6 )
+ .and( new Field( AnalisesAcidentesData.ESTADO_ASSINATURA_FULL ).isDifferent( 2 ) ) ).or(
+ new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( 6 )
+ .and( new Field( AnalisesAcidentesData.ESTADO_ASSINATURA_FULL ).isEqual( 2 ) )
+ .and( new Field( "analises_acidentes.ass_med" ).isEqual( "y" ) ) ).or(
+ new Field( AnalisesAcidentesData.ESTADO_FULL ).isGreater( 6 )
+ .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( 9 ) ) ) );
+
+ if( empresa_id != null )
+ {
+ where = where.and( new Field( AnalisesAcidentesData.EMPRESA_ID_FULL ).isEqual( empresa_id ) );
+ }
Select2 query = new Select2(
- new String[] { AnalisesAcidentesData.TABLENAME },
- new Integer[] { },
- new Expression[] { },
- new String[] { "*" },
- where,
- new String[] { AnalisesAcidentesData.ANALISE_NR_FULL },
- null, null, null
+ new String[]{ AnalisesAcidentesData.TABLENAME },
+ new Integer[]{ },
+ new Expression[]{ },
+ new String[]{ "*" },
+ where,
+ new String[]{ AnalisesAcidentesData.ANALISE_NR_FULL },
+ null, null, null
);
System.out.println( "SQL: " + query.toString() );
-
Virtual2DArray result = getExecuter().executeQuery( query );
return fillAnaliseFields( result );
}
- public ArrayList< AnaliseAcidente > searchAnalisesSeguimentoDirSiprp( String nome, Integer estabelecimentoID, String visitaDate, String POR, Integer fromYear )
+ public ArrayList< AnaliseAcidente > searchAnalisesSeguimentoDirSiprp( Integer empresa_id, String nome, Integer
+ estabelecimentoID, String visitaDate, String POR, Integer fromYear )
throws Exception
{
ArrayList< AnaliseAcidente > res;
- if ( nome == null && estabelecimentoID == null && visitaDate == null && POR == null )
+ if( nome == null && estabelecimentoID == null && visitaDate == null && POR == null )
{
res = getAnalisesSeguimentoDirSiprpList( fromYear );
}
else
{
- CommonExpression commonExpression = new CommonExpression( nome, estabelecimentoID, visitaDate, POR, fromYear ).invoke();
+ CommonExpression commonExpression =
+ new CommonExpression( nome, estabelecimentoID, visitaDate, POR, fromYear ).invoke();
String[] tables = commonExpression.getTables();
Integer[] joinTypes = commonExpression.getJoinTypes();
Expression[] joinConditions = commonExpression.getJoinConditions();
String[] order = new String[]{ AnalisesAcidentesData.ANALISE_NR_FULL };
- Expression where = commonExpression.getWhere().and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_CONCLUIDO ) );
+ Expression where = commonExpression.getWhere()
+ .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_CONCLUIDO ) );
- Select select = new Select2( tables, joinTypes, joinConditions, new String[]{ "*" }, where, order, null, null, null );
+ if( empresa_id != null )
+ {
+ where = where.and( new Field( AnalisesAcidentesData.EMPRESA_ID_FULL ).isEqual( empresa_id ) );
+ }
+
+ Select select =
+ new Select2( tables, joinTypes, joinConditions, new String[]{ "*" }, where, order, null, null, null );
System.out.println( "SQL: " + select.toString() );
-
Virtual2DArray result = getExecuter().executeQuery( select );
res = fillAnaliseFields( result );
@@ -695,33 +852,34 @@ public class AnalisesDataProvider extends GenericDataProvider
{
Expression where = new Field( AnalisesAcidentesData.APAGADA_FULL ).isEqual( "n" );
where = where.and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_CONCLUIDO ) );
- if ( fromYear != null )
+ if( fromYear != null )
{
- where = where.and( new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" ).isEqual( fromYear ) );
+ where = where.and(
+ new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" ).isEqual( fromYear ) );
}
Select2 query = new Select2(
- new String[] { AnalisesAcidentesData.TABLENAME },
- new Integer[] { },
- new Expression[] { },
- new String[] { "*" },
- where,
- new String[] { AnalisesAcidentesData.ANALISE_NR_FULL },
- null, null, null
+ new String[]{ AnalisesAcidentesData.TABLENAME },
+ new Integer[]{ },
+ new Expression[]{ },
+ new String[]{ "*" },
+ where,
+ new String[]{ AnalisesAcidentesData.ANALISE_NR_FULL },
+ null, null, null
);
System.out.println( "SQL: " + query.toString() );
-
Virtual2DArray result = getExecuter().executeQuery( query );
return fillAnaliseFields( result );
}
- public ArrayList< AnaliseAcidente > searchAnalisesSeguimentoDirGerRh( String nome, Integer estabelecimentoID, String visitaDate, String POR, Integer fromYear )
+ public ArrayList< AnaliseAcidente > searchAnalisesSeguimentoDirGerRh( Integer empresa_id, String nome, Integer
+ estabelecimentoID, String visitaDate, String POR, Integer fromYear )
throws Exception
{
- return searchAnalisesSeguimentoDirSiprp( nome, estabelecimentoID, visitaDate, POR, fromYear );
+ return searchAnalisesSeguimentoDirSiprp( empresa_id, nome, estabelecimentoID, visitaDate, POR, fromYear );
}
public ArrayList< AnaliseAcidente > getAnalisesSeguimentoDirGerRhList( Integer fromYear ) throws Exception
@@ -729,31 +887,41 @@ public class AnalisesDataProvider extends GenericDataProvider
return getAnalisesSeguimentoDirSiprpList( fromYear );
}
- public ArrayList< AnaliseAcidente > searchAnalisesSeguimentoGestor( Integer estabelecimento_id, String nome, Integer estabelecimentoID, String visitaDate, String POR, Integer fromYear )
+ public ArrayList< AnaliseAcidente > searchAnalisesSeguimentoGestor( Integer empresa_id, Integer estabelecimento_id,
+ String nome, Integer estabelecimentoID,
+ String visitaDate, String POR, Integer fromYear )
throws Exception
{
ArrayList< AnaliseAcidente > res;
- if ( nome == null && estabelecimentoID == null && visitaDate == null && POR == null )
+ if( nome == null && estabelecimentoID == null && visitaDate == null && POR == null )
{
- res = getAnalisesSeguimentoGestorList( estabelecimento_id, fromYear );
+ res = getAnalisesSeguimentoGestorList( empresa_id, estabelecimento_id, fromYear );
}
else
{
- CommonExpression commonExpression = new CommonExpression( nome, estabelecimentoID, visitaDate, POR, fromYear ).invoke();
+ CommonExpression commonExpression =
+ new CommonExpression( nome, estabelecimentoID, visitaDate, POR, fromYear ).invoke();
String[] tables = commonExpression.getTables();
Integer[] joinTypes = commonExpression.getJoinTypes();
Expression[] joinConditions = commonExpression.getJoinConditions();
String[] order = new String[]{ AnalisesAcidentesData.ANALISE_NR_FULL };
- Expression where = commonExpression.getWhere().and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_CONCLUIDO ) );
+ Expression where = commonExpression.getWhere()
+ .and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_CONCLUIDO ) );
if( estabelecimento_id != null )
{
where = where.and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) );
}
- Select select = new Select2( tables, joinTypes, joinConditions, new String[]{ "*" }, where, order, null, null, null );
+ if( empresa_id != null )
+ {
+ where = where.and( new Field( AnalisesAcidentesData.EMPRESA_ID_FULL ).isEqual( empresa_id ) );
+ }
+
+ Select select =
+ new Select2( tables, joinTypes, joinConditions, new String[]{ "*" }, where, order, null, null, null );
System.out.println( "SQL: " + select.toString() );
@@ -763,33 +931,39 @@ public class AnalisesDataProvider extends GenericDataProvider
return res;
}
- public ArrayList< AnaliseAcidente > getAnalisesSeguimentoGestorList( Integer estabelecimentoID, Integer fromYear )
+ public ArrayList< AnaliseAcidente > getAnalisesSeguimentoGestorList( Integer empresa_id, Integer estabelecimentoID,
+ Integer fromYear )
throws Exception
{
Expression where = new Field( AnalisesAcidentesData.APAGADA_FULL ).isEqual( "n" );
where = where.and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isLess( Global.ESTADO_CONCLUIDO ) );
- if ( estabelecimentoID != null )
+ if( estabelecimentoID != null )
{
where = where.and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimentoID ) );
}
- if ( fromYear != null )
+ if( fromYear != null )
+ {
+ where = where.and(
+ new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" ).isEqual( fromYear ) );
+ }
+
+ if( empresa_id != null )
{
- where = where.and( new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" ).isEqual( fromYear ) );
+ where = where.and( new Field( AnalisesAcidentesData.EMPRESA_ID_FULL ).isEqual( empresa_id ) );
}
Select2 query = new Select2(
- new String[] { AnalisesAcidentesData.TABLENAME },
- new Integer[] { },
- new Expression[] { },
- new String[] { "*" },
- where,
- new String[] { AnalisesAcidentesData.ANALISE_NR_FULL },
- null, null, null
+ new String[]{ AnalisesAcidentesData.TABLENAME },
+ new Integer[]{ },
+ new Expression[]{ },
+ new String[]{ "*" },
+ where,
+ new String[]{ AnalisesAcidentesData.ANALISE_NR_FULL },
+ null, null, null
);
System.out.println( "SQL: " + query.toString() );
-
Virtual2DArray result = getExecuter().executeQuery( query );
return fillAnaliseFields( result );
@@ -797,27 +971,36 @@ public class AnalisesDataProvider extends GenericDataProvider
/*************************************************************************/
/****************************** CONCLUIDOS *******************************/
- /*************************************************************************/
- public ArrayList< AnaliseAcidente > getAnalisesConcluidasList( Integer estabelecimentoID, Integer fromYear ) throws Exception
+ /**
+ * *********************************************************************
+ */
+ public ArrayList< AnaliseAcidente > getAnalisesConcluidasList( Integer empresa_id, Integer estabelecimentoID, Integer
+ fromYear ) throws Exception
{
Expression where = new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_CONCLUIDO );
where = where.and( new Field( AnalisesAcidentesData.APAGADA_FULL ).isEqual( "n" ) );
- if ( estabelecimentoID != null )
+ if( estabelecimentoID != null )
{
where = where.and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimentoID ) );
}
- if ( fromYear != null )
+ if( fromYear != null )
+ {
+ where = where.and(
+ new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" ).isEqual( fromYear ) );
+ }
+
+ if( empresa_id != null )
{
- where = where.and( new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" ).isEqual( fromYear ) );
+ where = where.and( new Field( AnalisesAcidentesData.EMPRESA_ID_FULL ).isEqual( empresa_id ) );
}
Select2 query = new Select2(
- new String[] { AnalisesAcidentesData.TABLENAME },
- new Integer[] { },
- new Expression[] { },
- new String[] { "*" },
+ new String[]{ AnalisesAcidentesData.TABLENAME },
+ new Integer[]{ },
+ new Expression[]{ },
+ new String[]{ "*" },
where,
- new String[] { AnalisesAcidentesData.ANALISE_NR_FULL },
+ new String[]{ AnalisesAcidentesData.ANALISE_NR_FULL },
null, null, null
);
@@ -825,7 +1008,6 @@ public class AnalisesDataProvider extends GenericDataProvider
System.out.println( "SQL: " + query.toString() );
-
Virtual2DArray result = getExecuter().executeQuery( query );
return fillAnaliseFields( result );
@@ -833,13 +1015,17 @@ public class AnalisesDataProvider extends GenericDataProvider
public ArrayList< AnaliseAcidente > getAnalisesConcluidasHsList( Integer fromYear ) throws Exception
{
- return getAnalisesConcluidasList( null, fromYear );
+ return getAnalisesConcluidasList( null, null, fromYear );
}
- public ArrayList< AnaliseAcidente > searchAnalisesConcluidasList( Integer estabelecimento_id, Integer ano, Integer mes, Integer dia, String POR, String nome, Integer estabelecimentoID, Integer fromYear )
+ public ArrayList< AnaliseAcidente > searchAnalisesConcluidasList( Integer empresa_id, Integer estabelecimento_id,
+ Integer ano, Integer mes, Integer dia, String POR,
+ String nome, Integer estabelecimentoID,
+ Integer fromYear )
throws Exception
{
- CommonExpression commonExpression = new CommonExpression( nome, estabelecimentoID, null, POR, ano == null ? fromYear : ano ).invoke();
+ CommonExpression commonExpression =
+ new CommonExpression( nome, estabelecimentoID, null, POR, ano == null ? fromYear : ano ).invoke();
Expression where = commonExpression.getWhere();
String[] tables = commonExpression.getTables();
Integer[] joinTypes = commonExpression.getJoinTypes();
@@ -847,12 +1033,12 @@ public class AnalisesDataProvider extends GenericDataProvider
String[] order = new String[]{ AnalisesAcidentesData.ANALISE_NR_FULL };
- if ( estabelecimento_id != null && estabelecimento_id > 0 )
+ if( estabelecimento_id != null && estabelecimento_id > 0 )
{
where = where.and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) );
}
- if ( ano != null )
+ if( ano != null )
{
final DateFormat D_F = new SimpleDateFormat( "yyyy-MM-dd" );
Calendar calendar_from = Calendar.getInstance();
@@ -866,12 +1052,12 @@ public class AnalisesDataProvider extends GenericDataProvider
calendar_to.set( Calendar.MONTH, 11 );
calendar_to.set( Calendar.DATE, 31 );
- if ( mes != null )
+ if( mes != null )
{
calendar_from.set( Calendar.MONTH, mes - 1 );
calendar_to.set( Calendar.MONTH, mes - 1 );
- if ( dia != null )
+ if( dia != null )
{
calendar_from.set( Calendar.DATE, dia );
calendar_to.set( Calendar.DATE, dia );
@@ -891,29 +1077,38 @@ public class AnalisesDataProvider extends GenericDataProvider
Date dateStart = calendar_from.getTime();
Date dateEnd = calendar_to.getTime();
- if ( dateStart.compareTo( dateEnd ) == 0 )
+ if( dateStart.compareTo( dateEnd ) == 0 )
{
where = where.and( new Field( AnalisesAcidentesData.DATA_ACIDENTE_FULL ).isEqual( D_F.format( dateStart ) ) );
}
else
{
- where = where.and( new Field( AnalisesAcidentesData.DATA_ACIDENTE_FULL ).isGreaterOrEqual( D_F.format( dateStart ) ) )
- .and( new Field( AnalisesAcidentesData.DATA_ACIDENTE_FULL ).isLessOrEqual( D_F.format( dateEnd ) ) );
+ where =
+ where.and( new Field( AnalisesAcidentesData.DATA_ACIDENTE_FULL ).isGreaterOrEqual( D_F.format( dateStart )
+ ) )
+ .and( new Field( AnalisesAcidentesData.DATA_ACIDENTE_FULL ).isLessOrEqual( D_F.format( dateEnd ) ) );
}
}
where = where.and( new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_CONCLUIDO ) );
- if ( ano == null && mes == null && dia == null && POR == null && nome == null && estabelecimentoID == null && fromYear != null )
+ if( ano == null && mes == null && dia == null && POR == null && nome == null && estabelecimentoID == null &&
+ fromYear != null )
+ {
+ where = where.and(
+ new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" ).isEqual( fromYear ) );
+ }
+
+ if( empresa_id != null )
{
- where = where.and( new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" ).isEqual( fromYear ) );
+ where = where.and( new Field( AnalisesAcidentesData.EMPRESA_ID_FULL ).isEqual( empresa_id ) );
}
- Select select = new Select2( tables, joinTypes, joinConditions, new String[]{ "*" }, where, order, null, null, null );
+ Select select =
+ new Select2( tables, joinTypes, joinConditions, new String[]{ "*" }, where, order, null, null, null );
System.out.println( "SQL: " + select.toString() );
-
Virtual2DArray result = getExecuter().executeQuery( select );
return fillAnaliseFields( result );
@@ -937,155 +1132,163 @@ public class AnalisesDataProvider extends GenericDataProvider
for( int i = 0; i < rs.rowCount(); i++ )
{
-
+
estabelecimento_id = rs.get( i, "estabelecimento_id" );
acidentado_id = rs.get( i, "acidentado_id" );
ac = getAcidentado( acidentado_id );
exp = new Field( db.data.siprp_local.outer.EstabelecimentosData.ID_FULL ).isEqual( estabelecimento_id );
- select = new Select2( db.data.siprp_local.outer.EstabelecimentosData.TABLENAME, exp, db.data.siprp_local.outer.EstabelecimentosData.NOME_FULL );
+ select = new Select2( db.data.siprp_local.outer.EstabelecimentosData.TABLENAME, exp,
+ db.data.siprp_local.outer.EstabelecimentosData.NOME_FULL );
subresult = getLocalExecuter().executeQuery( select );
nome_estabelecimento = ( subresult.rowCount() > 0 ) ? ( String ) subresult.get( 0, "nome" ) : "";
exp = new Field( db.data.siprp_local.outer.TrabalhadoresData.ID_FULL ).isEqual( ac.getTrabalhador_id() );
- select = new Select2( db.data.siprp_local.outer.TrabalhadoresData.TABLENAME, exp, db.data.siprp_local.outer.TrabalhadoresData.NOME_FULL, db.data.siprp_local.outer.TrabalhadoresData.NUMERO_MECANOGRAFICO_FULL );
+ select = new Select2( db.data.siprp_local.outer.TrabalhadoresData.TABLENAME, exp,
+ db.data.siprp_local.outer.TrabalhadoresData.NOME_FULL,
+ db.data.siprp_local.outer.TrabalhadoresData.NUMERO_MECANOGRAFICO_FULL );
subresult = getLocalExecuter().executeQuery( select );
nome_acidentado = ( subresult.rowCount() > 0 ) ? ( String ) subresult.get( 0, "nome" ) : "";
- numero_mecanografico = ( subresult.rowCount() > 0 ) ? ( String ) subresult.get( 0, "numero_mecanografico" ) : "";
+ numero_mecanografico =
+ ( subresult.rowCount() > 0 ) ? ( String ) subresult.get( 0, "numero_mecanografico" ) : "";
estado = rs.get( i, "estado" );
AnaliseAcidente acidente = AnaliseAcidente
- .build()
- .withId( ( Integer ) rs.get( i, "id" ) )
- .withNr( i )
- .withData_acidente( ( java.sql.Date ) rs.get( i, "data_acidente" ) )
- .withEmpresa_id( ( Integer ) rs.get( i, "empresa_id" ) )
- .withEstabelecimento_id( estabelecimento_id )
- .withNome_estabelecimento( Utils.unicodeToHTML( nome_estabelecimento ) )
- .withEstado( estado )
- .withEstado_assinatura( ( Integer ) rs.get( i, "estado_assinatura" ) )
- .withFase( getFase( estado ) )
- .withAcidentado_id( acidentado_id )
- .withNome_acidentado( Utils.unicodeToHTML( nome_acidentado ) )
- .withNumero_mecanografico( numero_mecanografico )
- .withHoras_turno( ( Integer ) rs.get( i, "horas_turno" ) )
- .withAveriguador( ( String ) rs.get( i, "averiguador" ) )
- .withDepartamento_id( ( Integer ) rs.get( i, "departamento_id" ) )
- .withSeccao_id( ( Integer ) rs.get( i, "seccao_id" ) )
- .withLocal_trabalho( ( String ) rs.get( i, "local_trabalho" ) );
+ .build()
+ .withId( ( Integer ) rs.get( i, "id" ) )
+ .withNr( i )
+ .withData_acidente( ( java.sql.Date ) rs.get( i, "data_acidente" ) )
+ .withEmpresa_id( ( Integer ) rs.get( i, "empresa_id" ) )
+ .withEstabelecimento_id( estabelecimento_id )
+ .withNome_estabelecimento( Utils.unicodeToHTML( nome_estabelecimento ) )
+ .withEstado( estado )
+ .withEstado_assinatura( ( Integer ) rs.get( i, "estado_assinatura" ) )
+ .withFase( getFase( estado ) )
+ .withAcidentado_id( acidentado_id )
+ .withNome_acidentado( Utils.unicodeToHTML( nome_acidentado ) )
+ .withNumero_mecanografico( numero_mecanografico )
+ .withHoras_turno( ( Integer ) rs.get( i, "horas_turno" ) )
+ .withAveriguador( ( String ) rs.get( i, "averiguador" ) )
+ .withDepartamento_id( ( Integer ) rs.get( i, "departamento_id" ) )
+ .withSeccao_id( ( Integer ) rs.get( i, "seccao_id" ) )
+ .withLocal_trabalho( ( String ) rs.get( i, "local_trabalho" ) );
acidente = acidente
- .withTarefa( ( String ) rs.get( i, "tarefa" ) )
- .withSubstancias( ( String ) rs.get( i, "substancias" ) )
- .withCondicoes( ( String ) rs.get( i, "condicoes" ) )
- .withTestemunhas( ( String ) rs.get( i, "testemunhas" ) )
- .withCausas( ( Integer ) rs.get( i, "causas" ) )
- .withDescricao( ( String ) rs.get( i, "descricao" ) )
- .withConclusoes( ( String ) rs.get( i, "conclusoes" ) )
- .withAccoes( ( String ) rs.get( i, "accoes" ) )
- .withAveriguacao_posterior( ( String ) rs.get( i, "averiguacao_posterior" ) )
- .withAveriguacao_obs( ( String ) rs.get( i, "averiguacao_obs" ) )
- .withHora_acidente( ( java.sql.Time ) rs.get( i, "hora_acidente" ) )
- .withFormacao_shst( ( String ) rs.get( i, "formacao_shst" ) )
- .withFormacao_shst_nao_porque( Strings.nullToEmpty( ( String ) rs.get( i, "formacao_shst_nao_porque" ) ) );
+ .withTarefa( ( String ) rs.get( i, "tarefa" ) )
+ .withSubstancias( ( String ) rs.get( i, "substancias" ) )
+ .withCondicoes( ( String ) rs.get( i, "condicoes" ) )
+ .withTestemunhas( ( String ) rs.get( i, "testemunhas" ) )
+ .withCausas( ( Integer ) rs.get( i, "causas" ) )
+ .withDescricao( ( String ) rs.get( i, "descricao" ) )
+ .withConclusoes( ( String ) rs.get( i, "conclusoes" ) )
+ .withAccoes( ( String ) rs.get( i, "accoes" ) )
+ .withAveriguacao_posterior( ( String ) rs.get( i, "averiguacao_posterior" ) )
+ .withAveriguacao_obs( ( String ) rs.get( i, "averiguacao_obs" ) )
+ .withHora_acidente( ( java.sql.Time ) rs.get( i, "hora_acidente" ) )
+ .withFormacao_shst( ( String ) rs.get( i, "formacao_shst" ) )
+ .withFormacao_shst_nao_porque( Strings.nullToEmpty( ( String ) rs.get( i, "formacao_shst_nao_porque" ) ) );
acidente = acidente
- .withOutros_acidentes_com_colaborador( ( String ) rs.get( i, "outros_acidentes_com_colaborador" ) )
- .withNr_acidentes_com_colaborador( ( Integer ) rs.get( i, "nr_acidentes_com_colaborador" ) )
- .withNr_relatorio_acidente_colaborador1( ( Integer ) rs.get( i, "nr_relatorio_acidente_colaborador1" ) )
- .withNr_relatorio_acidente_colaborador2( ( Integer ) rs.get( i, "nr_relatorio_acidente_colaborador2" ) )
- .withNr_relatorio_acidente_colaborador3( ( Integer ) rs.get( i, "nr_relatorio_acidente_colaborador3" ) )
- .withNr_relatorio_acidente_colaborador4( ( Integer ) rs.get( i, "nr_relatorio_acidente_colaborador4" ) )
- .withAcidentes_outros_colaboradores( ( String ) rs.get( i, "acidentes_outros_colaboradores" ) )
- .withNr_acidentes_outros_colaboradores( ( Integer ) rs.get( i, "nr_acidentes_outros_colaboradores" ) )
- .withNr_relatorio_acidente_outros_colaboradores1( ( Integer ) rs.get( i, "nr_relatorio_acidente_outros_colaboradores1" ) )
- .withNr_relatorio_acidente_outros_colaboradores2( ( Integer ) rs.get( i, "nr_relatorio_acidente_outros_colaboradores2" ) )
- .withNr_relatorio_acidente_outros_colaboradores3( ( Integer ) rs.get( i, "nr_relatorio_acidente_outros_colaboradores3" ) )
- .withNr_relatorio_acidente_outros_colaboradores4( ( Integer ) rs.get( i, "nr_relatorio_acidente_outros_colaboradores4" ) )
- .withLesao_cabeca( ( String ) rs.get( i, "lesao_cabeca" ) )
- .withLesao_pescoco( ( String ) rs.get( i, "lesao_pescoco" ) )
- .withLesao_tronco( ( String ) rs.get( i, "lesao_tronco" ) );
+ .withOutros_acidentes_com_colaborador( ( String ) rs.get( i, "outros_acidentes_com_colaborador" ) )
+ .withNr_acidentes_com_colaborador( ( Integer ) rs.get( i, "nr_acidentes_com_colaborador" ) )
+ .withNr_relatorio_acidente_colaborador1( ( Integer ) rs.get( i, "nr_relatorio_acidente_colaborador1" ) )
+ .withNr_relatorio_acidente_colaborador2( ( Integer ) rs.get( i, "nr_relatorio_acidente_colaborador2" ) )
+ .withNr_relatorio_acidente_colaborador3( ( Integer ) rs.get( i, "nr_relatorio_acidente_colaborador3" ) )
+ .withNr_relatorio_acidente_colaborador4( ( Integer ) rs.get( i, "nr_relatorio_acidente_colaborador4" ) )
+ .withAcidentes_outros_colaboradores( ( String ) rs.get( i, "acidentes_outros_colaboradores" ) )
+ .withNr_acidentes_outros_colaboradores( ( Integer ) rs.get( i, "nr_acidentes_outros_colaboradores" ) )
+ .withNr_relatorio_acidente_outros_colaboradores1(
+ ( Integer ) rs.get( i, "nr_relatorio_acidente_outros_colaboradores1" ) )
+ .withNr_relatorio_acidente_outros_colaboradores2(
+ ( Integer ) rs.get( i, "nr_relatorio_acidente_outros_colaboradores2" ) )
+ .withNr_relatorio_acidente_outros_colaboradores3(
+ ( Integer ) rs.get( i, "nr_relatorio_acidente_outros_colaboradores3" ) )
+ .withNr_relatorio_acidente_outros_colaboradores4(
+ ( Integer ) rs.get( i, "nr_relatorio_acidente_outros_colaboradores4" ) )
+ .withLesao_cabeca( ( String ) rs.get( i, "lesao_cabeca" ) )
+ .withLesao_pescoco( ( String ) rs.get( i, "lesao_pescoco" ) )
+ .withLesao_tronco( ( String ) rs.get( i, "lesao_tronco" ) );
acidente = acidente
- .withLesao_membro_sup_dir( ( String ) rs.get( i, "lesao_membro_sup_dir" ) )
- .withLesao_membro_sup_esq( ( String ) rs.get( i, "lesao_membro_sup_esq" ) )
- .withLesao_membro_inf_dir( ( String ) rs.get( i, "lesao_membro_inf_dir" ) )
- .withLesao_membro_inf_esq( ( String ) rs.get( i, "lesao_membro_inf_esq" ) )
- .withEspecif1( Strings.nullToEmpty( ( String ) rs.get( i, "especif1" ) ) )
- .withEspecif2( Strings.nullToEmpty( ( String ) rs.get( i, "especif2" ) ) )
- .withEspecif3( Strings.nullToEmpty( ( String ) rs.get( i, "especif3" ) ) )
- .withEspecif4( Strings.nullToEmpty( ( String ) rs.get( i, "especif4" ) ) )
- .withTipo_lesao( Strings.nullToEmpty( ( String ) rs.get( i, "tipo_lesao" ) ) )
- .withTipo_incapacidade( ( String ) rs.get( i, "tipo_incapacidade" ) )
- .withCoef_incapacidade( ( Integer ) rs.get( i, "coef_incapacidade" ) )
- .withData_aval_incapacidade( ( java.sql.Date ) rs.get( i, "data_aval_incapacidade" ) )
- .withData_rev_incapacidade( ( java.sql.Date ) rs.get( i, "data_rev_incapacidade" ) )
- .withPeriodo_incapacidade_de( ( java.sql.Date ) rs.get( i, "periodo_incapacidade_de" ) )
- .withPeriodo_incapacidade_a( ( java.sql.Date ) rs.get( i, "periodo_incapacidade_a" ) );
+ .withLesao_membro_sup_dir( ( String ) rs.get( i, "lesao_membro_sup_dir" ) )
+ .withLesao_membro_sup_esq( ( String ) rs.get( i, "lesao_membro_sup_esq" ) )
+ .withLesao_membro_inf_dir( ( String ) rs.get( i, "lesao_membro_inf_dir" ) )
+ .withLesao_membro_inf_esq( ( String ) rs.get( i, "lesao_membro_inf_esq" ) )
+ .withEspecif1( Strings.nullToEmpty( ( String ) rs.get( i, "especif1" ) ) )
+ .withEspecif2( Strings.nullToEmpty( ( String ) rs.get( i, "especif2" ) ) )
+ .withEspecif3( Strings.nullToEmpty( ( String ) rs.get( i, "especif3" ) ) )
+ .withEspecif4( Strings.nullToEmpty( ( String ) rs.get( i, "especif4" ) ) )
+ .withTipo_lesao( Strings.nullToEmpty( ( String ) rs.get( i, "tipo_lesao" ) ) )
+ .withTipo_incapacidade( ( String ) rs.get( i, "tipo_incapacidade" ) )
+ .withCoef_incapacidade( ( Integer ) rs.get( i, "coef_incapacidade" ) )
+ .withData_aval_incapacidade( ( java.sql.Date ) rs.get( i, "data_aval_incapacidade" ) )
+ .withData_rev_incapacidade( ( java.sql.Date ) rs.get( i, "data_rev_incapacidade" ) )
+ .withPeriodo_incapacidade_de( ( java.sql.Date ) rs.get( i, "periodo_incapacidade_de" ) )
+ .withPeriodo_incapacidade_a( ( java.sql.Date ) rs.get( i, "periodo_incapacidade_a" ) );
acidente = acidente
- .withImg_flexao( ( String ) rs.get( i, "img_flexao" ) )
- .withImg_ext1( ( String ) rs.get( i, "img_ext1" ) )
- .withImg_ext2( ( String ) rs.get( i, "img_ext2" ) )
- .withImg_cab2( ( String ) rs.get( i, "img_cab2" ) )
- .withImg_cab3( ( String ) rs.get( i, "img_cab3" ) )
- .withImg_ma2( ( String ) rs.get( i, "img_ma2" ) )
- .withImg_ma3( ( String ) rs.get( i, "img_ma3" ) )
- .withImg_ma5( ( String ) rs.get( i, "img_ma5" ) )
- .withImg_ma6( ( String ) rs.get( i, "img_ma6" ) )
- .withImg_ma8( ( String ) rs.get( i, "img_ma8" ) )
- .withImg_ma10( ( String ) rs.get( i, "img_ma10" ) )
- .withImg_rot1( ( String ) rs.get( i, "img_rot1" ) )
- .withImg_rot2( ( String ) rs.get( i, "img_rot2" ) )
- .withImg_cab1( ( String ) rs.get( i, "img_cab1" ) )
- .withImg_cab4( ( String ) rs.get( i, "img_cab4" ) )
- .withImg_ma1( ( String ) rs.get( i, "img_ma1" ) )
- .withImg_ma4( ( String ) rs.get( i, "img_ma4" ) )
- .withImg_ma7( ( String ) rs.get( i, "img_ma7" ) )
- .withImg_ma9( ( String ) rs.get( i, "img_ma9" ) );
+ .withImg_flexao( ( String ) rs.get( i, "img_flexao" ) )
+ .withImg_ext1( ( String ) rs.get( i, "img_ext1" ) )
+ .withImg_ext2( ( String ) rs.get( i, "img_ext2" ) )
+ .withImg_cab2( ( String ) rs.get( i, "img_cab2" ) )
+ .withImg_cab3( ( String ) rs.get( i, "img_cab3" ) )
+ .withImg_ma2( ( String ) rs.get( i, "img_ma2" ) )
+ .withImg_ma3( ( String ) rs.get( i, "img_ma3" ) )
+ .withImg_ma5( ( String ) rs.get( i, "img_ma5" ) )
+ .withImg_ma6( ( String ) rs.get( i, "img_ma6" ) )
+ .withImg_ma8( ( String ) rs.get( i, "img_ma8" ) )
+ .withImg_ma10( ( String ) rs.get( i, "img_ma10" ) )
+ .withImg_rot1( ( String ) rs.get( i, "img_rot1" ) )
+ .withImg_rot2( ( String ) rs.get( i, "img_rot2" ) )
+ .withImg_cab1( ( String ) rs.get( i, "img_cab1" ) )
+ .withImg_cab4( ( String ) rs.get( i, "img_cab4" ) )
+ .withImg_ma1( ( String ) rs.get( i, "img_ma1" ) )
+ .withImg_ma4( ( String ) rs.get( i, "img_ma4" ) )
+ .withImg_ma7( ( String ) rs.get( i, "img_ma7" ) )
+ .withImg_ma9( ( String ) rs.get( i, "img_ma9" ) );
acidente = acidente
- .withRestricao_carga( ( Integer ) rs.get( i, "restricao_carga" ) )
- .withRestricao_motricidade( ( String ) rs.get( i, "restricao_motricidade" ) )
- .withRestricao_conducao( ( String ) rs.get( i, "restricao_conducao" ) )
- .withRestricao_vibracoes( ( String ) rs.get( i, "restricao_vibracoes" ) )
- .withRestricao_outras( Strings.nullToEmpty( ( String ) rs.get( i, "restricao_outras" ) ) )
- .withMed_observ( Strings.nullToEmpty( ( String ) rs.get( i, "med_observ" ) ) )
- .withAnalise_nr( ( String ) rs.get( i, "analise_nr" ) )
- .withMedico_id( ( Integer ) rs.get( i, "medico_id" ) )
- .withTecnico_saude_id( ( Integer ) rs.get( i, "tecnico_saude_id" ) )
- .withAss_resp_seg( ( String ) rs.get( i, "ass_resp_seg" ) )
- .withAss_resp_rh( ( String ) rs.get( i, "ass_resp_rh" ) )
- .withAss_consolidacao( ( String ) rs.get( i, "ass_consolidacao" ) );
+ .withRestricao_carga( ( Integer ) rs.get( i, "restricao_carga" ) )
+ .withRestricao_motricidade( ( String ) rs.get( i, "restricao_motricidade" ) )
+ .withRestricao_conducao( ( String ) rs.get( i, "restricao_conducao" ) )
+ .withRestricao_vibracoes( ( String ) rs.get( i, "restricao_vibracoes" ) )
+ .withRestricao_outras( Strings.nullToEmpty( ( String ) rs.get( i, "restricao_outras" ) ) )
+ .withMed_observ( Strings.nullToEmpty( ( String ) rs.get( i, "med_observ" ) ) )
+ .withAnalise_nr( ( String ) rs.get( i, "analise_nr" ) )
+ .withMedico_id( ( Integer ) rs.get( i, "medico_id" ) )
+ .withTecnico_saude_id( ( Integer ) rs.get( i, "tecnico_saude_id" ) )
+ .withAss_resp_seg( ( String ) rs.get( i, "ass_resp_seg" ) )
+ .withAss_resp_rh( ( String ) rs.get( i, "ass_resp_rh" ) )
+ .withAss_consolidacao( ( String ) rs.get( i, "ass_consolidacao" ) );
acidente = acidente
- .withData_consolidacao( ( java.sql.Date ) rs.get( i, "data_consolidacao" ) )
- .withData_assinatura_seg( ( java.sql.Date ) rs.get( i, "data_assinatura_seg" ) )
- .withData_assinatura_rh( ( java.sql.Date ) rs.get( i, "data_assinatura_rh" ) )
- .withNome_resp_seg( ( String ) rs.get( i, "nome_resp_seg" ) )
- .withNome_resp_rh( ( String ) rs.get( i, "nome_resp_rh" ) )
- .withCorrecao( ( String ) rs.get( i, "correcao" ) )
- .withObservacoes_correcao( ( String ) rs.get( i, "observacoes_correcao" ) )
- .withEstado_antes_correcao( ( Integer ) rs.get( i, "estado_antes_correcao" ) )
- .withAss_superior( ( String ) rs.get( i, "ass_superior" ) )
- .withNome_superior( ( String ) rs.get( i, "nome_superior" ) )
- .withData_assinatura_superior( ( java.sql.Date ) rs.get( i, "data_assinatura_superior" ) )
- .withData_inicio_processo( ( java.sql.Date ) rs.get( i, "data_inicio_processo" ) )
- .withNome_resp_consolidacao( ( String ) rs.get( i, "nome_resp_consolidacao" ) );
+ .withData_consolidacao( ( java.sql.Date ) rs.get( i, "data_consolidacao" ) )
+ .withData_assinatura_seg( ( java.sql.Date ) rs.get( i, "data_assinatura_seg" ) )
+ .withData_assinatura_rh( ( java.sql.Date ) rs.get( i, "data_assinatura_rh" ) )
+ .withNome_resp_seg( ( String ) rs.get( i, "nome_resp_seg" ) )
+ .withNome_resp_rh( ( String ) rs.get( i, "nome_resp_rh" ) )
+ .withCorrecao( ( String ) rs.get( i, "correcao" ) )
+ .withObservacoes_correcao( ( String ) rs.get( i, "observacoes_correcao" ) )
+ .withEstado_antes_correcao( ( Integer ) rs.get( i, "estado_antes_correcao" ) )
+ .withAss_superior( ( String ) rs.get( i, "ass_superior" ) )
+ .withNome_superior( ( String ) rs.get( i, "nome_superior" ) )
+ .withData_assinatura_superior( ( java.sql.Date ) rs.get( i, "data_assinatura_superior" ) )
+ .withData_inicio_processo( ( java.sql.Date ) rs.get( i, "data_inicio_processo" ) )
+ .withNome_resp_consolidacao( ( String ) rs.get( i, "nome_resp_consolidacao" ) );
acidente = acidente
- .withRh_fase4( ( Integer ) rs.get( i, "rh_fase4" ) )
- .withConcluido_por_desactivacao( ( Boolean ) rs.get( i, "concluido_por_desactivacao" ) )
- .withData_desactivacao( ( Date ) rs.get( i, "data_desactivacao" ) )
- .withComentario_desactivacao( ( String ) rs.get( i, "comentario_desactivacao" ) )
- .withParticipado( "y".equals( rs.get( i, "participado" ) ) )
- .withNomeResponsavelParticipacao( ( String ) rs.get( i, "nome_responsavel_participacao" ) )
- .withDataParticipacao( ( Date ) rs.get( i, "data_participacao" ) )
- .end();
+ .withRh_fase4( ( Integer ) rs.get( i, "rh_fase4" ) )
+ .withConcluido_por_desactivacao( ( Boolean ) rs.get( i, "concluido_por_desactivacao" ) )
+ .withData_desactivacao( ( Date ) rs.get( i, "data_desactivacao" ) )
+ .withComentario_desactivacao( ( String ) rs.get( i, "comentario_desactivacao" ) )
+ .withParticipado( "y".equals( rs.get( i, "participado" ) ) )
+ .withNomeResponsavelParticipacao( ( String ) rs.get( i, "nome_responsavel_participacao" ) )
+ .withDataParticipacao( ( Date ) rs.get( i, "data_participacao" ) )
+ .end();
list.add( acidente );
}
@@ -1093,48 +1296,65 @@ public class AnalisesDataProvider extends GenericDataProvider
return list;
}
- public ArrayList< Trabalhador > searchTrabalhador( Integer empresa_id, Integer estabelecimento_id, String nrMecanografico, String nome )
+ public ArrayList< Trabalhador > searchTrabalhador( Integer empresa_id, Integer estabelecimento_id,
+ String nrMecanografico, String nome )
throws Exception
{
ArrayList< Trabalhador > list = new ArrayList< Trabalhador >();
-// All
+ // All
- String[] fields = { db.data.siprp_local.outer.TrabalhadoresData.ID_FULL, db.data.siprp_local.outer.TrabalhadoresData.NOME_FULL, db.data.siprp_local.outer.TrabalhadoresData.DATA_NASCIMENTO_FULL,
- db.data.siprp_local.outer.TrabalhadoresData.FUNCAO_PROPOSTA_FULL, db.data.siprp_local.outer.TrabalhadoresData.DATA_ADMISSAO_FULL,
- db.data.siprp_local.outer.TrabalhadoresData.NUMERO_MECANOGRAFICO_FULL, db.data.siprp_local.outer.EstabelecimentosData.ID_FULL, db.data.siprp_local.outer.EstabelecimentosData.NOME_FULL };
+ String[] fields =
+ { db.data.siprp_local.outer.TrabalhadoresData.ID_FULL, db.data.siprp_local.outer.TrabalhadoresData.NOME_FULL,
+ db.data.siprp_local.outer.TrabalhadoresData.DATA_NASCIMENTO_FULL,
+ db.data.siprp_local.outer.TrabalhadoresData.FUNCAO_PROPOSTA_FULL,
+ db.data.siprp_local.outer.TrabalhadoresData.DATA_ADMISSAO_FULL,
+ db.data.siprp_local.outer.TrabalhadoresData.NUMERO_MECANOGRAFICO_FULL,
+ db.data.siprp_local.outer.EstabelecimentosData.ID_FULL,
+ db.data.siprp_local.outer.EstabelecimentosData.NOME_FULL };
- String[] tables = { db.data.siprp_local.outer.TrabalhadoresData.TABLENAME, db.data.siprp_local.outer.EstabelecimentosData.TABLENAME };
+ String[] tables = { db.data.siprp_local.outer.TrabalhadoresData.TABLENAME,
+ db.data.siprp_local.outer.EstabelecimentosData.TABLENAME };
- Expression[] joinExp = { new Field( db.data.siprp_local.outer.TrabalhadoresData.ESTABELECIMENTO_ID_FULL ).isEqual( new Field( db.data.siprp_local.outer.EstabelecimentosData.ID_FULL ) ) };
+ Expression[] joinExp = { new Field( db.data.siprp_local.outer.TrabalhadoresData.ESTABELECIMENTO_ID_FULL )
+ .isEqual( new Field( db.data.siprp_local.outer.EstabelecimentosData.ID_FULL ) ) };
Integer[] joinTypes = { Select2.JOIN_INNER };
- Expression whereExp = new Field( db.data.siprp_local.outer.EstabelecimentosData.EMPRESA_ID_FULL ).isEqual( empresa_id )
- .and( new Field( db.data.siprp_local.outer.TrabalhadoresData.INACTIVO_FULL ).isEqual( "n" ) );
+ Expression whereExp =
+ new Field( db.data.siprp_local.outer.EstabelecimentosData.EMPRESA_ID_FULL ).isEqual( empresa_id )
+ .and( new Field( db.data.siprp_local.outer.TrabalhadoresData.INACTIVO_FULL ).isEqual( "n" ) );
String[] order = { db.data.siprp_local.outer.TrabalhadoresData.NOME_FULL };
-// trabalhadores do estabelecimento
+ // trabalhadores do estabelecimento
- Expression firstWhereExp = whereExp.and( new Field( db.data.siprp_local.outer.EstabelecimentosData.ID_FULL ).isEqual( estabelecimento_id ) );
+ Expression firstWhereExp =
+ whereExp.and( new Field( db.data.siprp_local.outer.EstabelecimentosData.ID_FULL ).isEqual( estabelecimento_id
+ ) );
- if ( nrMecanografico != null )
+ if( nrMecanografico != null )
{
- if ( nome != null )
+ if( nome != null )
{
- firstWhereExp = firstWhereExp.and( new Field( db.data.siprp_local.outer.TrabalhadoresData.NOME_FULL ).isLike( "%" + nome + "%" ).or( new Field( "lower(" + db.data.siprp_local.outer.TrabalhadoresData.NUMERO_MECANOGRAFICO_FULL + ")" ).isLike( "%" + nrMecanografico.toLowerCase() + "%" ) ) );
+ firstWhereExp = firstWhereExp.and(
+ new Field( db.data.siprp_local.outer.TrabalhadoresData.NOME_FULL ).isLike( "%" + nome + "%" ).or(
+ new Field( "lower(" + db.data.siprp_local.outer.TrabalhadoresData.NUMERO_MECANOGRAFICO_FULL + ")" )
+ .isLike( "%" + nrMecanografico.toLowerCase() + "%" ) ) );
}
else
{
- firstWhereExp = firstWhereExp.and( new Field( "lower(" + db.data.siprp_local.outer.TrabalhadoresData.NUMERO_MECANOGRAFICO_FULL + ")" ).isLike( "%" + nrMecanografico.toLowerCase() + "%" ) );
+ firstWhereExp = firstWhereExp.and(
+ new Field( "lower(" + db.data.siprp_local.outer.TrabalhadoresData.NUMERO_MECANOGRAFICO_FULL + ")" )
+ .isLike( "%" + nrMecanografico.toLowerCase() + "%" ) );
}
}
else
{
- if ( nome != null )
+ if( nome != null )
{
- firstWhereExp = firstWhereExp.and( new Field( db.data.siprp_local.outer.TrabalhadoresData.NOME_FULL ).isLike( "%" + nome + "%" ) );
+ firstWhereExp = firstWhereExp
+ .and( new Field( db.data.siprp_local.outer.TrabalhadoresData.NOME_FULL ).isLike( "%" + nome + "%" ) );
}
}
@@ -1156,39 +1376,46 @@ public class AnalisesDataProvider extends GenericDataProvider
String rEstabelecimentoNome = result.get( i, 7 );
Trabalhador trabalhador = Trabalhador
- .createTrabalhador()
- .withId( rId )
- .withNome( rNome )
- .withData_nascimento( new java.sql.Date( rDataNascimento.getTime() ) )
- .withFuncao( rFuncao )
- .withData_admissao( new java.sql.Date( rDataAdmissao.getTime() ) )
- .withNumero_mecanografico( rNumeroMecanografico )
- .withEstabelecimento_id( rEstabelecimentoId )
- .withEstabelecimento( rEstabelecimentoNome );
+ .createTrabalhador()
+ .withId( rId )
+ .withNome( rNome )
+ .withData_nascimento( new java.sql.Date( rDataNascimento.getTime() ) )
+ .withFuncao( rFuncao )
+ .withData_admissao( new java.sql.Date( rDataAdmissao.getTime() ) )
+ .withNumero_mecanografico( rNumeroMecanografico )
+ .withEstabelecimento_id( rEstabelecimentoId )
+ .withEstabelecimento( rEstabelecimentoNome );
list.add( trabalhador );
}
-//restantes trabalhadores
+ //restantes trabalhadores
- Expression secondWhereExp = whereExp.and( new Field( db.data.siprp_local.outer.EstabelecimentosData.ID_FULL ).isDifferent( estabelecimento_id ) );
+ Expression secondWhereExp = whereExp
+ .and( new Field( db.data.siprp_local.outer.EstabelecimentosData.ID_FULL ).isDifferent( estabelecimento_id ) );
- if ( nrMecanografico != null )
+ if( nrMecanografico != null )
{
- if ( nome != null )
+ if( nome != null )
{
- secondWhereExp = secondWhereExp.and( new Field( db.data.siprp_local.outer.TrabalhadoresData.NOME_FULL ).isLike( "%" + nome + "%" ).or( new Field( "lower(" + db.data.siprp_local.outer.TrabalhadoresData.NUMERO_MECANOGRAFICO_FULL + ")" ).isLike( "%" + nrMecanografico.toLowerCase() + "%" ) ) );
+ secondWhereExp = secondWhereExp.and(
+ new Field( db.data.siprp_local.outer.TrabalhadoresData.NOME_FULL ).isLike( "%" + nome + "%" ).or(
+ new Field( "lower(" + db.data.siprp_local.outer.TrabalhadoresData.NUMERO_MECANOGRAFICO_FULL + ")" )
+ .isLike( "%" + nrMecanografico.toLowerCase() + "%" ) ) );
}
else
{
- secondWhereExp = secondWhereExp.and( new Field( "lower(" + db.data.siprp_local.outer.TrabalhadoresData.NUMERO_MECANOGRAFICO_FULL + ")" ).isLike( "%" + nrMecanografico.toLowerCase() + "%" ) );
+ secondWhereExp = secondWhereExp.and(
+ new Field( "lower(" + db.data.siprp_local.outer.TrabalhadoresData.NUMERO_MECANOGRAFICO_FULL + ")" )
+ .isLike( "%" + nrMecanografico.toLowerCase() + "%" ) );
}
}
else
{
- if ( nome != null )
+ if( nome != null )
{
- secondWhereExp = secondWhereExp.and( new Field( db.data.siprp_local.outer.TrabalhadoresData.NOME_FULL ).isLike( "%" + nome + "%" ) );
+ secondWhereExp = secondWhereExp
+ .and( new Field( db.data.siprp_local.outer.TrabalhadoresData.NOME_FULL ).isLike( "%" + nome + "%" ) );
}
}
@@ -1211,15 +1438,15 @@ public class AnalisesDataProvider extends GenericDataProvider
String rEstabelecimentoNome = result.get( i, 7 );
Trabalhador trabalhador = Trabalhador
- .createTrabalhador()
- .withId( rId )
- .withNome( rNome )
- .withData_nascimento( new java.sql.Date( rDataNascimento.getTime() ) )
- .withFuncao( rFuncao )
- .withData_admissao( new java.sql.Date( rDataAdmissao.getTime() ) )
- .withNumero_mecanografico( rNumeroMecanografico )
- .withEstabelecimento_id( rEstabelecimentoId )
- .withEstabelecimento( rEstabelecimentoNome );
+ .createTrabalhador()
+ .withId( rId )
+ .withNome( rNome )
+ .withData_nascimento( new java.sql.Date( rDataNascimento.getTime() ) )
+ .withFuncao( rFuncao )
+ .withData_admissao( new java.sql.Date( rDataAdmissao.getTime() ) )
+ .withNumero_mecanografico( rNumeroMecanografico )
+ .withEstabelecimento_id( rEstabelecimentoId )
+ .withEstabelecimento( rEstabelecimentoNome );
list.add( trabalhador );
}
@@ -1227,40 +1454,52 @@ public class AnalisesDataProvider extends GenericDataProvider
return list;
}
- public ArrayList< Trabalhador > searchTrabalhador( Integer empresa_id, String nrMecanografico, String nome ) throws Exception
+ public ArrayList< Trabalhador > searchTrabalhador( Integer empresa_id, String nrMecanografico, String nome )
+ throws Exception
{
ArrayList< Trabalhador > list = new ArrayList< Trabalhador >();
StringTokenizer st;
- Expression expr = new Field( db.data.siprp_local.outer.EstabelecimentosData.EMPRESA_ID_FULL ).isEqual( empresa_id ).and(
- new Field( db.data.siprp_local.outer.TrabalhadoresData.INACTIVO_FULL ).isEqual( "n" ) ).and( new Field( db.data.siprp_local.outer.EstabelecimentosData.INACTIVO_FULL ).isEqual( "n" ) );
+ Expression expr =
+ new Field( db.data.siprp_local.outer.EstabelecimentosData.EMPRESA_ID_FULL ).isEqual( empresa_id ).and(
+ new Field( db.data.siprp_local.outer.TrabalhadoresData.INACTIVO_FULL ).isEqual( "n" ) )
+ .and( new Field( db.data.siprp_local.outer.EstabelecimentosData.INACTIVO_FULL ).isEqual( "n" ) );
if( nome != null )
{
st = new StringTokenizer( nome );
- while ( st.hasMoreTokens() )
+ while( st.hasMoreTokens() )
{
- expr = expr.and( new Field( db.data.siprp_local.outer.TrabalhadoresData.NOME_FULL ).isILike( "%" + st.nextToken() + "%" ) );
+ expr = expr.and(
+ new Field( db.data.siprp_local.outer.TrabalhadoresData.NOME_FULL ).isILike( "%" + st.nextToken() + "%" ) );
}
}
- if ( nrMecanografico != null )
+ if( nrMecanografico != null )
{
- expr = expr.and( new Field( db.data.siprp_local.outer.TrabalhadoresData.NUMERO_MECANOGRAFICO_FULL ).isILike( nrMecanografico.toLowerCase() ) );
+ expr = expr.and( new Field( db.data.siprp_local.outer.TrabalhadoresData.NUMERO_MECANOGRAFICO_FULL )
+ .isILike( nrMecanografico.toLowerCase() ) );
}
Select select =
- new Select2( new String[]{ db.data.siprp_local.outer.TrabalhadoresData.TABLENAME, db.data.siprp_local.outer.EstabelecimentosData.TABLENAME },
- new Integer[]{ Select2.JOIN_INNER },
- new Expression[]{ new Field( db.data.siprp_local.outer.TrabalhadoresData.ESTABELECIMENTO_ID_FULL ).isEqual( new Field( EstabelecimentosData.ID_FULL ) ) },
- new String[]{ db.data.siprp_local.outer.TrabalhadoresData.ID_FULL, db.data.siprp_local.outer.TrabalhadoresData.NOME_FULL, db.data.siprp_local.outer.TrabalhadoresData.DATA_NASCIMENTO_FULL,
- db.data.siprp_local.outer.TrabalhadoresData.FUNCAO_PROPOSTA_FULL, db.data.siprp_local.outer.TrabalhadoresData.DATA_ADMISSAO_FULL, db.data.siprp_local.outer.TrabalhadoresData.NUMERO_MECANOGRAFICO_FULL,
- db.data.siprp_local.outer.EstabelecimentosData.ID_FULL, db.data.siprp_local.outer.EstabelecimentosData.NOME_FULL },
- expr,
- null,
- null,
- null,
- null );
+ new Select2( new String[]{ db.data.siprp_local.outer.TrabalhadoresData.TABLENAME,
+ db.data.siprp_local.outer.EstabelecimentosData.TABLENAME },
+ new Integer[]{ Select2.JOIN_INNER },
+ new Expression[]{ new Field( db.data.siprp_local.outer.TrabalhadoresData.ESTABELECIMENTO_ID_FULL )
+ .isEqual( new Field( EstabelecimentosData.ID_FULL ) ) },
+ new String[]{ db.data.siprp_local.outer.TrabalhadoresData.ID_FULL,
+ db.data.siprp_local.outer.TrabalhadoresData.NOME_FULL,
+ db.data.siprp_local.outer.TrabalhadoresData.DATA_NASCIMENTO_FULL,
+ db.data.siprp_local.outer.TrabalhadoresData.FUNCAO_PROPOSTA_FULL,
+ db.data.siprp_local.outer.TrabalhadoresData.DATA_ADMISSAO_FULL,
+ db.data.siprp_local.outer.TrabalhadoresData.NUMERO_MECANOGRAFICO_FULL,
+ db.data.siprp_local.outer.EstabelecimentosData.ID_FULL,
+ db.data.siprp_local.outer.EstabelecimentosData.NOME_FULL },
+ expr,
+ null,
+ null,
+ null,
+ null );
System.out.println( "TRABALHADORES SQL (NOVO) : " + select );
@@ -1270,18 +1509,18 @@ public class AnalisesDataProvider extends GenericDataProvider
{
try
{
- Trabalhador t = new Trabalhador();
- t.setId( ( Integer ) array.get( n, 0 ) );
- String nome_trab = array.get( n, 1 );
- t.setNome( utils.Utils.unicodeToHTML( nome_trab ) );
- t.setData_nascimento( ( java.sql.Date ) array.get( n, 2 ) );
- t.setFuncao( ( String ) array.get( n, 3 ) );
- t.setData_admissao( ( java.sql.Date ) array.get( n, 4 ) );
- t.setNumero_mecanografico( ( String ) array.get( n, 5 ) );
- t.setEstabelecimento_id( ( Integer ) array.get( n, 6 ) );
- t.setEstabelecimento( utils.Utils.unicodeToHTML( ( String ) array.get( n, 7 ) ) );
- list.add( t );
- System.out.println( nome_trab );
+ Trabalhador t = new Trabalhador();
+ t.setId( ( Integer ) array.get( n, 0 ) );
+ String nome_trab = array.get( n, 1 );
+ t.setNome( utils.Utils.unicodeToHTML( nome_trab ) );
+ t.setData_nascimento( ( java.sql.Date ) array.get( n, 2 ) );
+ t.setFuncao( ( String ) array.get( n, 3 ) );
+ t.setData_admissao( ( java.sql.Date ) array.get( n, 4 ) );
+ t.setNumero_mecanografico( ( String ) array.get( n, 5 ) );
+ t.setEstabelecimento_id( ( Integer ) array.get( n, 6 ) );
+ t.setEstabelecimento( utils.Utils.unicodeToHTML( ( String ) array.get( n, 7 ) ) );
+ list.add( t );
+ System.out.println( nome_trab );
}
catch( Exception ex )
{
@@ -1296,71 +1535,77 @@ public class AnalisesDataProvider extends GenericDataProvider
public Trabalhador getTrabalhador( Integer id ) throws Exception
{
return new Trabalhador( EvoBaseProvider.getInstance().
- getLocalProvider().load(
- db.data.siprp_local.outer.TrabalhadoresData.class,
- new Object[] { id },
- new String[] { db.data.siprp_local.outer.TrabalhadoresData.ID_FULL }, null ) );
+ getLocalProvider().load(
+ db.data.siprp_local.outer.TrabalhadoresData.class,
+ new Object[]{ id },
+ new String[]{ db.data.siprp_local.outer.TrabalhadoresData.ID_FULL }, null ) );
}
public Acidentado getAcidentado( Integer acidentado_id ) throws Exception
{
return new Acidentado( EvoBaseProvider.getInstance().
- getProvider().load(
- AcidentadosData.class,
- new Object[] { acidentado_id },
- new String[] { AcidentadosData.ID_FULL }, null )
+ getProvider().load(
+ AcidentadosData.class,
+ new Object[]{ acidentado_id },
+ new String[]{ AcidentadosData.ID_FULL }, null )
);
}
public String getEmpresaNome( Integer empresa_id ) throws Exception
{
Expression dataFilter = new Field( db.data.siprp_local.outer.EmpresasData.ID_FULL ).isEqual( empresa_id );
- Select select = new Select2( db.data.siprp_local.outer.EmpresasData.TABLENAME, dataFilter, db.data.siprp_local.outer.EmpresasData.DESIGNACAO_SOCIAL_FULL );
+ Select select = new Select2( db.data.siprp_local.outer.EmpresasData.TABLENAME, dataFilter,
+ db.data.siprp_local.outer.EmpresasData.DESIGNACAO_SOCIAL_FULL );
Virtual2DArray array = getLocalExecuter().executeQuery( select );
- return array.rowCount() > 0 ? Utils.unicodeToHTML( (String) array.get( 0, 0 ) ) : "";
+ return array.rowCount() > 0 ? Utils.unicodeToHTML( ( String ) array.get( 0, 0 ) ) : "";
}
public String getEstabelecimentoNome( Integer estabelecimento_id ) throws Exception
{
- Expression dataFilter = new Field( db.data.siprp_local.outer.EstabelecimentosData.ID_FULL ).isEqual( estabelecimento_id );
- Select select = new Select2( db.data.siprp_local.outer.EstabelecimentosData.TABLENAME, dataFilter, db.data.siprp_local.outer.EstabelecimentosData.NOME_FULL );
+ Expression dataFilter =
+ new Field( db.data.siprp_local.outer.EstabelecimentosData.ID_FULL ).isEqual( estabelecimento_id );
+ Select select = new Select2( db.data.siprp_local.outer.EstabelecimentosData.TABLENAME, dataFilter,
+ db.data.siprp_local.outer.EstabelecimentosData.NOME_FULL );
Virtual2DArray array = getLocalExecuter().executeQuery( select );
- return array.rowCount() > 0 ? Utils.unicodeToHTML( (String) array.get( 0, 0 ) ) : "";
+ return array.rowCount() > 0 ? Utils.unicodeToHTML( ( String ) array.get( 0, 0 ) ) : "";
}
@SuppressWarnings( "UnusedDeclaration" )
public String getMedicoNome( Integer medico_id ) throws Exception
{
Expression dataFilter = new Field( db.data.siprp_local.outer.MedicosData.ID_FULL ).isEqual( medico_id );
- Select select = new Select2( db.data.siprp_local.outer.MedicosData.TABLENAME, dataFilter, db.data.siprp_local.outer.MedicosData.NOME_FULL );
+ Select select = new Select2( db.data.siprp_local.outer.MedicosData.TABLENAME, dataFilter,
+ db.data.siprp_local.outer.MedicosData.NOME_FULL );
Virtual2DArray array = getLocalExecuter().executeQuery( select );
- return array.rowCount() > 0 ? Utils.unicodeToHTML( (String) array.get( 0, 0 ) ) : "";
+ return array.rowCount() > 0 ? Utils.unicodeToHTML( ( String ) array.get( 0, 0 ) ) : "";
}
public Medico getMedico( Integer id ) throws Exception
{
return new Medico( EvoBaseProvider.getInstance().
- getLocalProvider().load(
- db.data.siprp_local.outer.MedicosData.class,
- new Object[] { id },
- new String[] { db.data.siprp_local.outer.MedicosData.ID_FULL }, null )
+ getLocalProvider().load(
+ db.data.siprp_local.outer.MedicosData.class,
+ new Object[]{ id },
+ new String[]{ db.data.siprp_local.outer.MedicosData.ID_FULL }, null )
);
}
public String getTecnicoSaudeNome( Integer tecnico_id ) throws Exception
{
- Expression dataFilter = new Field( db.data.siprp_local.outer.MarcacoesTecnicosHstData.ID_FULL ).isEqual( tecnico_id );
- Select select = new Select2( db.data.siprp_local.outer.MarcacoesTecnicosHstData.TABLENAME, dataFilter, db.data.siprp_local.outer.MarcacoesTecnicosHstData.NOME_FULL );
+ Expression dataFilter = new Field( db.data.siprp_local.outer.MarcacoesTecnicosHstData.ID_FULL ).isEqual(
+ tecnico_id );
+ Select select = new Select2( db.data.siprp_local.outer.MarcacoesTecnicosHstData.TABLENAME, dataFilter,
+ db.data.siprp_local.outer.MarcacoesTecnicosHstData.NOME_FULL );
Virtual2DArray array = getLocalExecuter().executeQuery( select );
- return array.rowCount() > 0 ? Utils.unicodeToHTML( (String) array.get( 0, 0 ) ) : "";
+ return array.rowCount() > 0 ? Utils.unicodeToHTML( ( String ) array.get( 0, 0 ) ) : "";
}
public Integer createAcidentado( Acidentado a ) throws Exception
@@ -1383,7 +1628,7 @@ public class AnalisesDataProvider extends GenericDataProvider
cal.setTime( data_acidente );
int ano = cal.get( Calendar.YEAR );
Controle c = getControloByAno( ano );
- if ( c == null )
+ if( c == null )
{
c = createAnoNumeracao( ano );
}
@@ -1405,49 +1650,50 @@ public class AnalisesDataProvider extends GenericDataProvider
public void updateAnalise( AnaliseAcidente a ) throws Exception
{
- if ( a.getEspecif1().matches( "null" ) )
+ if( a.getEspecif1().matches( "null" ) )
{
a.setEspecif1( "" );
}
- if ( a.getEspecif2().matches( "null" ) )
+ if( a.getEspecif2().matches( "null" ) )
{
a.setEspecif2( "" );
}
- if ( a.getEspecif3().matches( "null" ) )
+ if( a.getEspecif3().matches( "null" ) )
{
a.setEspecif3( "" );
}
- if ( a.getEspecif4().matches( "null" ) )
+ if( a.getEspecif4().matches( "null" ) )
{
a.setEspecif4( "" );
}
- if ( a.getRestricao_outras().matches( "null" ) )
+ if( a.getRestricao_outras().matches( "null" ) )
{
a.setRestricao_outras( "" );
}
- if ( a.getTipo_lesao().matches( "null" ) )
+ if( a.getTipo_lesao().matches( "null" ) )
{
a.setTipo_lesao( "" );
}
- if ( a.getMed_observ().matches( "null" ) )
+ if( a.getMed_observ().matches( "null" ) )
{
a.setMed_observ( "" );
}
- if ( a.getFormacao_shst_nao_porque().matches( "null" ) )
+ if( a.getFormacao_shst_nao_porque().matches( "null" ) )
{
a.setFormacao_shst_nao_porque( "" );
}
- if ( a.getConcluido_por_desactivacao() == null )
+ if( a.getConcluido_por_desactivacao() == null )
{
a.setConcluido_por_desactivacao( Boolean.FALSE );
a.setData_desactivacao( null );
a.setComentario_desactivacao( null );
}
- if ( a.getConcluido_por_desactivacao() != null && a.getConcluido_por_desactivacao().equals( Boolean.TRUE ) && a.getData_desactivacao() == null )
+ if( a.getConcluido_por_desactivacao() != null && a.getConcluido_por_desactivacao().equals( Boolean.TRUE ) &&
+ a.getData_desactivacao() == null )
{
a.setData_desactivacao( new Date() );
}
- if ( a.getComentario_desactivacao() != null && "".equals( a.getComentario_desactivacao().trim() ) )
+ if( a.getComentario_desactivacao() != null && "".equals( a.getComentario_desactivacao().trim() ) )
{
a.setComentario_desactivacao( null );
}
@@ -1459,9 +1705,10 @@ public class AnalisesDataProvider extends GenericDataProvider
public void changeEstado( Correcao c ) throws Exception
{
-
+
AnalisesAcidentesData analisesAcidentesData = EvoBaseProvider
- .getInstance().getLocalProvider().load( AnalisesAcidentesData.class, new Object[]{ c.getAnalise_id() }, new String[]{ AnalisesAcidentesData.ID_FULL }, null );
+ .getInstance().getLocalProvider().load( AnalisesAcidentesData.class, new Object[]{ c.getAnalise_id() },
+ new String[]{ AnalisesAcidentesData.ID_FULL }, null );
analisesAcidentesData.update( c );
analisesAcidentesData.save();
@@ -1502,11 +1749,11 @@ public class AnalisesDataProvider extends GenericDataProvider
public void deleteRecomendacoesByAnalise( Integer analise_id ) throws Exception
{
-
+
for( RecomendacoesData recomendacoesData :
- EvoBaseProvider.getInstance().getProvider().listLoad(
- RecomendacoesData.class, new Object[]{ analise_id },
- new String[]{ RecomendacoesData.ANALISE_ID_FULL }, new String[]{ RecomendacoesData.ANALISE_ID_FULL } ) )
+ EvoBaseProvider.getInstance().getProvider().listLoad(
+ RecomendacoesData.class, new Object[]{ analise_id },
+ new String[]{ RecomendacoesData.ANALISE_ID_FULL }, new String[]{ RecomendacoesData.ANALISE_ID_FULL } ) )
{
recomendacoesData.delete();
}
@@ -1514,11 +1761,11 @@ public class AnalisesDataProvider extends GenericDataProvider
public void deleteAnaliseAcidente( Integer analise_id ) throws Exception
{
-
+
for( AnalisesAcidentesData analisesAcidentesData :
- EvoBaseProvider.getInstance().getProvider().listLoad(
- AnalisesAcidentesData.class, new Object[]{ analise_id },
- new String[]{ AnalisesAcidentesData.ID_FULL }, new String[]{ AnalisesAcidentesData.ID_FULL } ) )
+ EvoBaseProvider.getInstance().getProvider().listLoad(
+ AnalisesAcidentesData.class, new Object[]{ analise_id },
+ new String[]{ AnalisesAcidentesData.ID_FULL }, new String[]{ AnalisesAcidentesData.ID_FULL } ) )
{
analisesAcidentesData.setApagada( "y" );
analisesAcidentesData.save();
@@ -1528,11 +1775,11 @@ public class AnalisesDataProvider extends GenericDataProvider
@SuppressWarnings( "UnusedDeclaration" )
public void deleteAcidentado( Integer acidentado_id ) throws Exception
{
-
+
for( AcidentadosData acidentadosData :
- EvoBaseProvider.getInstance().getProvider().listLoad(
- AcidentadosData.class, new Object[]{ acidentado_id },
- new String[]{ AcidentadosData.ID_FULL }, new String[]{ AcidentadosData.ID_FULL } ) )
+ EvoBaseProvider.getInstance().getProvider().listLoad(
+ AcidentadosData.class, new Object[]{ acidentado_id },
+ new String[]{ AcidentadosData.ID_FULL }, new String[]{ AcidentadosData.ID_FULL } ) )
{
acidentadosData.delete();
}
@@ -1540,13 +1787,13 @@ public class AnalisesDataProvider extends GenericDataProvider
public ArrayList< Recomendacao > getRecomendacoesByAnalise( Integer analiseId ) throws Exception
{
-
+
ArrayList< Recomendacao > list = new ArrayList< Recomendacao >();
for( RecomendacoesData recomendacoesData :
- EvoBaseProvider.getInstance().getProvider().listLoad(
- RecomendacoesData.class, new Object[]{ analiseId },
- new String[]{ RecomendacoesData.ANALISE_ID_FULL }, new String[]{ RecomendacoesData.ID_FULL } ) )
+ EvoBaseProvider.getInstance().getProvider().listLoad(
+ RecomendacoesData.class, new Object[]{ analiseId },
+ new String[]{ RecomendacoesData.ANALISE_ID_FULL }, new String[]{ RecomendacoesData.ID_FULL } ) )
{
list.add( new Recomendacao( recomendacoesData ) );
}
@@ -1588,11 +1835,11 @@ public class AnalisesDataProvider extends GenericDataProvider
public void deleteMedidasByAnalise( Integer analise_id ) throws Exception
{
-
+
for( MedidasData medidasData :
- EvoBaseProvider.getInstance().getProvider().listLoad(
- MedidasData.class, new Object[]{ analise_id },
- new String[]{ MedidasData.ANALISE_ID_FULL }, new String[]{ MedidasData.ANALISE_ID_FULL } ) )
+ EvoBaseProvider.getInstance().getProvider().listLoad(
+ MedidasData.class, new Object[]{ analise_id },
+ new String[]{ MedidasData.ANALISE_ID_FULL }, new String[]{ MedidasData.ANALISE_ID_FULL } ) )
{
medidasData.delete();
}
@@ -1600,13 +1847,13 @@ public class AnalisesDataProvider extends GenericDataProvider
public ArrayList< Medida > getMedidasByAnalise( Integer analiseId ) throws Exception
{
-
+
ArrayList< Medida > list = new ArrayList< Medida >();
for( MedidasData medidasData :
- EvoBaseProvider.getInstance().getProvider().listLoad(
- MedidasData.class, new Object[]{ analiseId },
- new String[]{ MedidasData.ANALISE_ID_FULL }, new String[]{ MedidasData.ID_FULL } ) )
+ EvoBaseProvider.getInstance().getProvider().listLoad(
+ MedidasData.class, new Object[]{ analiseId },
+ new String[]{ MedidasData.ANALISE_ID_FULL }, new String[]{ MedidasData.ID_FULL } ) )
{
list.add( new Medida( medidasData ) );
}
@@ -1617,11 +1864,12 @@ public class AnalisesDataProvider extends GenericDataProvider
public String getNumeroCedula( Integer medico_id ) throws Exception
{
Expression dataFilter = new Field( db.data.siprp_local.outer.MedicosData.ID_FULL ).isEqual( medico_id );
- Select select = new Select2( db.data.siprp_local.outer.MedicosData.TABLENAME, dataFilter, db.data.siprp_local.outer.MedicosData.NUMERO_CEDULA_FULL );
+ Select select = new Select2( db.data.siprp_local.outer.MedicosData.TABLENAME, dataFilter,
+ db.data.siprp_local.outer.MedicosData.NUMERO_CEDULA_FULL );
Virtual2DArray array = getLocalExecuter().executeQuery( select );
- return array.rowCount() > 0 ? Utils.unicodeToHTML( (String) array.get( 0, 0 ) ) : "";
+ return array.rowCount() > 0 ? Utils.unicodeToHTML( ( String ) array.get( 0, 0 ) ) : "";
}
public String getTipoDescricao( Integer tipo ) throws Exception
@@ -1631,7 +1879,7 @@ public class AnalisesDataProvider extends GenericDataProvider
Virtual2DArray array = getLocalExecuter().executeQuery( select );
- return array.rowCount() > 0 ? Utils.unicodeToHTML( (String) array.get( 0, 0 ) ) : "";
+ return array.rowCount() > 0 ? Utils.unicodeToHTML( ( String ) array.get( 0, 0 ) ) : "";
}
public Option[] getTiposList() throws Exception
@@ -1644,9 +1892,9 @@ public class AnalisesDataProvider extends GenericDataProvider
list.add( t );
for( TiposUtilizadoresData tiposUtilizadoresData :
- EvoBaseProvider.getInstance().getProvider().listLoad(
- TiposUtilizadoresData.class, new Object[]{ "y" },
- new String[]{ TiposUtilizadoresData.ACTIVO_FULL }, new String[]{ TiposUtilizadoresData.ORDEM_FULL } ) )
+ EvoBaseProvider.getInstance().getProvider().listLoad(
+ TiposUtilizadoresData.class, new Object[]{ "y" },
+ new String[]{ TiposUtilizadoresData.ACTIVO_FULL }, new String[]{ TiposUtilizadoresData.ORDEM_FULL } ) )
{
list.add( new TipoUtilizador( tiposUtilizadoresData ) );
}
@@ -1657,10 +1905,10 @@ public class AnalisesDataProvider extends GenericDataProvider
private Option[] getOptions( ArrayList< TipoUtilizador > list )
{
TipoUtilizador t;
- Option[] listOptions = new Option[ list.size() ];
+ Option[] listOptions = new Option[list.size()];
ListIterator< TipoUtilizador > iter = list.listIterator();
int i = 0;
- while ( iter.hasNext() )
+ while( iter.hasNext() )
{
t = iter.next();
@@ -1680,9 +1928,9 @@ public class AnalisesDataProvider extends GenericDataProvider
list.add( t );
for( TiposUtilizadoresData tiposUtilizadoresData :
- EvoBaseProvider.getInstance().getProvider().listLoad(
- TiposUtilizadoresData.class, new Object[]{ "y" },
- new String[]{ TiposUtilizadoresData.ACTIVO_FULL }, new String[]{ TiposUtilizadoresData.ORDEM_FULL } ) )
+ EvoBaseProvider.getInstance().getProvider().listLoad(
+ TiposUtilizadoresData.class, new Object[]{ "y" },
+ new String[]{ TiposUtilizadoresData.ACTIVO_FULL }, new String[]{ TiposUtilizadoresData.ORDEM_FULL } ) )
{
list.add( new TipoUtilizador( tiposUtilizadoresData, permissao ) );
@@ -1700,7 +1948,7 @@ public class AnalisesDataProvider extends GenericDataProvider
e.setNome( "-Seleccionar-" );
list.add( e );
- if ( booGestor.equals( Boolean.TRUE ) )
+ if( booGestor.equals( Boolean.TRUE ) )
{
e = new Estabelecimento();
e.setId( 0 );
@@ -1710,10 +1958,11 @@ public class AnalisesDataProvider extends GenericDataProvider
}
for( db.data.siprp_local.outer.EstabelecimentosData estabelecimentosData :
- EvoBaseProvider.getInstance().getLocalProvider().listLoad(
- db.data.siprp_local.outer.EstabelecimentosData.class, new Object[]{ "n", empresa_id },
- new String[]{ db.data.siprp_local.outer.EstabelecimentosData.INACTIVO_FULL, db.data.siprp_local.outer.EstabelecimentosData.EMPRESA_ID_FULL },
- new String[]{ db.data.siprp_local.outer.EstabelecimentosData.NOME_PLAIN_FULL } ) )
+ EvoBaseProvider.getInstance().getLocalProvider().listLoad(
+ db.data.siprp_local.outer.EstabelecimentosData.class, new Object[]{ "n", empresa_id },
+ new String[]{ db.data.siprp_local.outer.EstabelecimentosData.INACTIVO_FULL,
+ db.data.siprp_local.outer.EstabelecimentosData.EMPRESA_ID_FULL },
+ new String[]{ db.data.siprp_local.outer.EstabelecimentosData.NOME_PLAIN_FULL } ) )
{
list.add( new Estabelecimento( estabelecimentosData ) );
@@ -1725,10 +1974,10 @@ public class AnalisesDataProvider extends GenericDataProvider
private Option[] getOptionsEstabelecimento( ArrayList< Estabelecimento > list )
{
Estabelecimento e;
- Option[] listOptions = new Option[ list.size() ];
+ Option[] listOptions = new Option[list.size()];
ListIterator< Estabelecimento > iter = list.listIterator();
int i = 0;
- while ( iter.hasNext() )
+ while( iter.hasNext() )
{
e = iter.next();
System.out.println( "ESTABELECIMENTOL : " + e.getId().toString() + " - " + e.getNome() );
@@ -1742,7 +1991,7 @@ public class AnalisesDataProvider extends GenericDataProvider
{
ArrayList< Estabelecimento > list = new ArrayList< Estabelecimento >();
- if ( booGestor.equals( Boolean.TRUE ) )
+ if( booGestor.equals( Boolean.TRUE ) )
{
Estabelecimento e = new Estabelecimento();
e.setId( 0 );
@@ -1752,10 +2001,11 @@ public class AnalisesDataProvider extends GenericDataProvider
}
for( db.data.siprp_local.outer.EstabelecimentosData estabelecimentosData :
- EvoBaseProvider.getInstance().getLocalProvider().listLoad(
- db.data.siprp_local.outer.EstabelecimentosData.class, new Object[]{ "n", empresa_id },
- new String[]{ db.data.siprp_local.outer.EstabelecimentosData.INACTIVO_FULL, db.data.siprp_local.outer.EstabelecimentosData.EMPRESA_ID_FULL },
- new String[]{ db.data.siprp_local.outer.EstabelecimentosData.NOME_PLAIN_FULL } ) )
+ EvoBaseProvider.getInstance().getLocalProvider().listLoad(
+ db.data.siprp_local.outer.EstabelecimentosData.class, new Object[]{ "n", empresa_id },
+ new String[]{ db.data.siprp_local.outer.EstabelecimentosData.INACTIVO_FULL,
+ db.data.siprp_local.outer.EstabelecimentosData.EMPRESA_ID_FULL },
+ new String[]{ db.data.siprp_local.outer.EstabelecimentosData.NOME_PLAIN_FULL } ) )
{
list.add( new Estabelecimento( estabelecimentosData ) );
@@ -1773,10 +2023,10 @@ public class AnalisesDataProvider extends GenericDataProvider
list.add( m );
for( db.data.siprp_local.outer.MedicosData medicosData :
- EvoBaseProvider.getInstance().getLocalProvider().listLoad(
- db.data.siprp_local.outer.MedicosData.class, new Object[]{ "n" },
- new String[]{ db.data.siprp_local.outer.MedicosData.INACTIVO_FULL },
- new String[]{ db.data.siprp_local.outer.MedicosData.NOME_FULL} ) )
+ EvoBaseProvider.getInstance().getLocalProvider().listLoad(
+ db.data.siprp_local.outer.MedicosData.class, new Object[]{ "n" },
+ new String[]{ db.data.siprp_local.outer.MedicosData.INACTIVO_FULL },
+ new String[]{ db.data.siprp_local.outer.MedicosData.NOME_FULL } ) )
{
list.add( new Medico( medicosData ) );
@@ -1788,10 +2038,10 @@ public class AnalisesDataProvider extends GenericDataProvider
private Option[] getOptionsMedicos( ArrayList< Medico > list )
{
Medico m;
- Option[] listOptions = new Option[ list.size() ];
+ Option[] listOptions = new Option[list.size()];
ListIterator< Medico > iter = list.listIterator();
int i = 0;
- while ( iter.hasNext() )
+ while( iter.hasNext() )
{
m = iter.next();
@@ -1810,10 +2060,10 @@ public class AnalisesDataProvider extends GenericDataProvider
list.add( t );
for( db.data.siprp_local.outer.MarcacoesTecnicosHstData marcacoesTecnicosHstData :
- EvoBaseProvider.getInstance().getLocalProvider().listLoad(
- db.data.siprp_local.outer.MarcacoesTecnicosHstData.class, new Object[]{ "n" },
- new String[]{ db.data.siprp_local.outer.MarcacoesTecnicosHstData.INACTIVO_FULL },
- new String[]{ db.data.siprp_local.outer.MarcacoesTecnicosHstData.NOME_FULL} ) )
+ EvoBaseProvider.getInstance().getLocalProvider().listLoad(
+ db.data.siprp_local.outer.MarcacoesTecnicosHstData.class, new Object[]{ "n" },
+ new String[]{ db.data.siprp_local.outer.MarcacoesTecnicosHstData.INACTIVO_FULL },
+ new String[]{ db.data.siprp_local.outer.MarcacoesTecnicosHstData.NOME_FULL } ) )
{
list.add( new TecnicoSaude( marcacoesTecnicosHstData ) );
@@ -1825,10 +2075,10 @@ public class AnalisesDataProvider extends GenericDataProvider
private Option[] getOptionsTecnicosSaude( ArrayList< TecnicoSaude > list )
{
TecnicoSaude t;
- Option[] listOptions = new Option[ list.size() ];
+ Option[] listOptions = new Option[list.size()];
ListIterator< TecnicoSaude > iter = list.listIterator();
int i = 0;
- while ( iter.hasNext() )
+ while( iter.hasNext() )
{
t = iter.next();
@@ -1844,24 +2094,24 @@ public class AnalisesDataProvider extends GenericDataProvider
Option[] options = null;
Select2 query = new Select2(
- new String[] { CausasData.TABLENAME },
- new Integer[] { },
- new Expression[] { },
- new String[] { CausasData.ID_FULL, CausasData.CAUSA_FULL },
+ new String[]{ CausasData.TABLENAME },
+ new Integer[]{ },
+ new Expression[]{ },
+ new String[]{ CausasData.ID_FULL, CausasData.CAUSA_FULL },
new Field( CausasData.ACTIVA_FULL ).isEqual( "y" ),
- new String[] { CausasData.ID_FULL, CausasData.CAUSA_FULL },
+ new String[]{ CausasData.ID_FULL, CausasData.CAUSA_FULL },
null, null, null
);
Virtual2DArray array = getExecuter().executeQuery( query );
- if ( array != null )
+ if( array != null )
{
- options = new Option[ array.rowCount() + 1 ];
- options[ 0 ] = toStatistics ? new Option( "", "" ) : new Option( 0, "-Seleccionar" );
- for ( int i = 0; i < array.rowCount(); i++ )
+ options = new Option[array.rowCount() + 1];
+ options[0] = toStatistics ? new Option( "", "" ) : new Option( 0, "-Seleccionar" );
+ for( int i = 0; i < array.rowCount(); i++ )
{
Integer causaID = array.get( i, 0 );
String causa = array.get( i, 1 );
- options[ (i+1) ] = new Option( causaID, causa );
+ options[( i + 1 )] = new Option( causaID, causa );
}
}
return options;
@@ -1877,10 +2127,10 @@ public class AnalisesDataProvider extends GenericDataProvider
list.add( d );
for( DepartamentosData departamentosData :
- EvoBaseProvider.getInstance().getProvider().listLoad(
- DepartamentosData.class, new Object[]{ "y" },
- new String[]{ DepartamentosData.ACTIVO_FULL },
- new String[]{ DepartamentosData.ID_FULL } ) )
+ EvoBaseProvider.getInstance().getProvider().listLoad(
+ DepartamentosData.class, new Object[]{ "y" },
+ new String[]{ DepartamentosData.ACTIVO_FULL },
+ new String[]{ DepartamentosData.ID_FULL } ) )
{
list.add( new Departamento( departamentosData ) );
}
@@ -1891,10 +2141,10 @@ public class AnalisesDataProvider extends GenericDataProvider
private Option[] getOptionsDepartamentos( ArrayList< Departamento > list )
{
Departamento d;
- Option[] listOptions = new Option[ list.size() ];
+ Option[] listOptions = new Option[list.size()];
ListIterator< Departamento > iter = list.listIterator();
int i = 0;
- while ( iter.hasNext() )
+ while( iter.hasNext() )
{
d = iter.next();
@@ -1918,19 +2168,19 @@ public class AnalisesDataProvider extends GenericDataProvider
if( departamento_id == null )
{
- values = new Object[] { "y" };
- names = new String[] { SeccoesData.ACTIVO_FULL };
+ values = new Object[]{ "y" };
+ names = new String[]{ SeccoesData.ACTIVO_FULL };
}
else
{
- values = new Object[] { "y", departamento_id };
- names = new String[] { SeccoesData.ACTIVO_FULL, SeccoesData.DEPARTAMENTO_ID_FULL };
+ values = new Object[]{ "y", departamento_id };
+ names = new String[]{ SeccoesData.ACTIVO_FULL, SeccoesData.DEPARTAMENTO_ID_FULL };
}
for( SeccoesData seccoesData :
- EvoBaseProvider.getInstance().getProvider().listLoad(
- SeccoesData.class, values, names,
- new String[]{ SeccoesData.ID_FULL } ) )
+ EvoBaseProvider.getInstance().getProvider().listLoad(
+ SeccoesData.class, values, names,
+ new String[]{ SeccoesData.ID_FULL } ) )
{
list.add( new Seccao( seccoesData ) );
}
@@ -1941,10 +2191,10 @@ public class AnalisesDataProvider extends GenericDataProvider
private Option[] getOptionsSeccoes( ArrayList< Seccao > list )
{
Seccao s;
- Option[] listOptions = new Option[ list.size() ];
+ Option[] listOptions = new Option[list.size()];
ListIterator< Seccao > iter = list.listIterator();
int i = 0;
- while ( iter.hasNext() )
+ while( iter.hasNext() )
{
s = iter.next();
@@ -1957,43 +2207,46 @@ public class AnalisesDataProvider extends GenericDataProvider
public Causa getCausa( Integer id ) throws Exception
{
return new Causa( EvoBaseProvider.getInstance().
- getProvider().load(
- CausasData.class,
- new Object[] { id },
- new String[] { CausasData.ID_FULL }, null )
+ getProvider().load(
+ CausasData.class,
+ new Object[]{ id },
+ new String[]{ CausasData.ID_FULL }, null )
);
}
public Seccao getSeccao( Integer id ) throws Exception
{
return new Seccao( EvoBaseProvider.getInstance().
- getProvider().load(
- SeccoesData.class,
- new Object[] { id },
- new String[] { SeccoesData.ID_FULL }, null )
+ getProvider().load(
+ SeccoesData.class,
+ new Object[]{ id },
+ new String[]{ SeccoesData.ID_FULL }, null )
);
}
- public List getDistinctYears( Integer excludeYear ) throws Exception
+ public List< Integer > getDistinctYears( Integer excludeYear ) throws Exception
{
- List result = new LinkedList();
+ List< Integer > result = new LinkedList< Integer >();
Expression where = new Field( AnalisesAcidentesData.APAGADA_FULL ).isEqual( "n" );
- if ( excludeYear != null )
+ if( excludeYear != null )
{
- where = where.and( new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" ).notIn( new Integer[] { excludeYear } ) );
+ where = where.and( new Field( "EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " )" )
+ .notIn( new Integer[]{ excludeYear } ) );
}
Select2 query = new Select2(
- new String[] { AnalisesAcidentesData.TABLENAME },
- new Integer[] { },
- new Expression[] { },
- new String[] { "DISTINCT( cast( EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " ) as integer ) ) AS ano" },
+ new String[]{ AnalisesAcidentesData.TABLENAME },
+ new Integer[]{ },
+ new Expression[]{ },
+ new String[]{
+ "DISTINCT( cast( EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " ) as integer ) ) AS " +
+ "ano" },
where,
- new String[] { "ano DESC" },
+ new String[]{ "ano DESC" },
null, null, null );
query.disableOrderFieldsVerification();
Virtual2DArray array = getExecuter().executeQuery( query );
- for ( int i = 0; i < array.rowCount(); i++ )
+ for( int i = 0; i < array.rowCount(); i++ )
{
Integer ano = array.get( i, 0 );
result.add( ano );
@@ -2006,20 +2259,22 @@ public class AnalisesDataProvider extends GenericDataProvider
ArrayList< Integer > list = new ArrayList< Integer >();
Expression where = new Field( AnalisesAcidentesData.APAGADA_FULL ).isEqual( "n" ).and(
- new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_CONCLUIDO )
+ new Field( AnalisesAcidentesData.ESTADO_FULL ).isEqual( Global.ESTADO_CONCLUIDO )
);
Select2 query = new Select2(
- new String[] { AnalisesAcidentesData.TABLENAME },
- new Integer[] { },
- new Expression[] { },
- new String[] { "DISTINCT( cast( EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " ) as integer ) ) AS ano" },
- where,
- new String[] { "ano DESC" },
- null, null, null );
+ new String[]{ AnalisesAcidentesData.TABLENAME },
+ new Integer[]{ },
+ new Expression[]{ },
+ new String[]{
+ "DISTINCT( cast( EXTRACT( year FROM " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + " ) as integer ) ) AS " +
+ "ano" },
+ where,
+ new String[]{ "ano DESC" },
+ null, null, null );
query.disableOrderFieldsVerification();
Virtual2DArray array = getExecuter().executeQuery( query );
- for ( int i = 0; i < array.rowCount(); i++ )
+ for( int i = 0; i < array.rowCount(); i++ )
{
Integer ano = array.get( i, 0 );
list.add( ano );
@@ -2029,39 +2284,39 @@ public class AnalisesDataProvider extends GenericDataProvider
public String getFase( int estado )
{
- if ( estado == Global.ESTADO_SEG )
+ if( estado == Global.ESTADO_SEG )
{
return "FASE 1 - SEG - ABERTURA";
}
- else if ( estado == Global.ESTADO_RH1 )
+ else if( estado == Global.ESTADO_RH1 )
{
return "FASE 2 - RH - ACOMPANHAMENTO";
}
- else if ( estado == Global.ESTADO_HS )
+ else if( estado == Global.ESTADO_HS )
{
return "FASE 3 - SIPRP - RECOMENDA\u00c7\u00d5ES";
}
- else if ( estado == Global.ESTADO_RH2 )
+ else if( estado == Global.ESTADO_RH2 )
{
return "FASE 4 - RH - MEDIDAS + LES\u00c3O";
}
- else if ( estado == Global.ESTADO_CONSOLIDACAO )
+ else if( estado == Global.ESTADO_CONSOLIDACAO )
{
return "FASE 5 - SIPRP - CONSOLIDA\u00c7\u00c3O";
}
- else if ( estado == Global.ESTADO_ASSINATURA_SEG )
+ else if( estado == Global.ESTADO_ASSINATURA_SEG )
{
return "FASE 6 - SEG - VERIFICA\u00c7\u00c3O SEG.";
}
- else if ( estado == Global.ESTADO_ASSINATURA_RH )
+ else if( estado == Global.ESTADO_ASSINATURA_RH )
{
return "FASE 7 - RH - VERIFICA\u00c7\u00c3O RH";
}
- else if ( estado == Global.ESTADO_FECHAR )
+ else if( estado == Global.ESTADO_FECHAR )
{
return "FASE 8 - SIPRP - CONCLUS\u00c3O";
}
- else if ( estado == Global.ESTADO_CONCLUIDO )
+ else if( estado == Global.ESTADO_CONCLUIDO )
{
return "FASE 9 - CONCLU\u00cdDO";
}
@@ -2070,13 +2325,14 @@ public class AnalisesDataProvider extends GenericDataProvider
private static final ModelProvider MODEL_PROVIDER;
- static {
+ static
+ {
ModelProvider tmp = null;
try
{
Connection connection = ( Connection ) Singleton.getInstance( "CONNECTION_OBJECT" );
- if ( connection == null )
+ if( connection == null )
{
String connectionURL = ( String ) Singleton.getInstance( DBConstants.CONNECTION_URL );
String username = DBPropertiesLoader.getInstance().findProperty( DBConstants.USERNAME_SIPRP );
@@ -2105,7 +2361,7 @@ public class AnalisesDataProvider extends GenericDataProvider
for( DBColumn column : MODEL_PROVIDER.getTableByName( table ).getColumns() )
{
- hash.put( (String) column.get( DBColumn.NAME ), ( Integer ) column.get( DBColumn.LENGTH ) );
+ hash.put( ( String ) column.get( DBColumn.NAME ), ( Integer ) column.get( DBColumn.LENGTH ) );
}
return hash;
}
@@ -2113,7 +2369,8 @@ public class AnalisesDataProvider extends GenericDataProvider
public byte[] getLogoByEmpresa( Integer empresaID ) throws Exception
{
Expression dataFilter = new Field( db.data.siprp_local.outer.EmpresasData.ID_FULL ).isEqual( empresaID );
- Select select = new Select2( db.data.siprp_local.outer.EmpresasData.TABLENAME, dataFilter, db.data.siprp_local.outer.EmpresasData.EMPRESA_LOGO_ID_FULL );
+ Select select = new Select2( db.data.siprp_local.outer.EmpresasData.TABLENAME, dataFilter,
+ db.data.siprp_local.outer.EmpresasData.EMPRESA_LOGO_ID_FULL );
Virtual2DArray array = getLocalExecuter().executeQuery( select );
@@ -2123,7 +2380,8 @@ public class AnalisesDataProvider extends GenericDataProvider
private byte[] getLogo( Integer logoID ) throws Exception
{
Expression dataFilter = new Field( db.data.siprp_local.outer.ImageData.ID_FULL ).isEqual( logoID );
- Select select = new Select2( db.data.siprp_local.outer.ImageData.TABLENAME, dataFilter, db.data.siprp_local.outer.ImageData.IMAGE_DATA_FULL );
+ Select select = new Select2( db.data.siprp_local.outer.ImageData.TABLENAME, dataFilter,
+ db.data.siprp_local.outer.ImageData.IMAGE_DATA_FULL );
Virtual2DArray array = getLocalExecuter().executeQuery( select );
@@ -2187,10 +2445,18 @@ public class AnalisesDataProvider extends GenericDataProvider
analise.setNr_relatorio_acidente_colaborador4( analiseBean.getNr_relatorio_acidente_colaborador4() );
analise.setAcidentes_outros_colaboradores( analiseBean.getAcidentes_outros_colaboradores() );
analise.setNr_acidentes_outros_colaboradores( analiseBean.getNr_acidentes_outros_colaboradores() );
- analise.setNr_relatorio_acidente_outros_colaboradores1( analiseBean.getNr_relatorio_acidente_outros_colaboradores1() );
- analise.setNr_relatorio_acidente_outros_colaboradores2( analiseBean.getNr_relatorio_acidente_outros_colaboradores2() );
- analise.setNr_relatorio_acidente_outros_colaboradores3( analiseBean.getNr_relatorio_acidente_outros_colaboradores3() );
- analise.setNr_relatorio_acidente_outros_colaboradores4( analiseBean.getNr_relatorio_acidente_outros_colaboradores4() );
+ analise
+ .setNr_relatorio_acidente_outros_colaboradores1( analiseBean.getNr_relatorio_acidente_outros_colaboradores1
+ () );
+ analise
+ .setNr_relatorio_acidente_outros_colaboradores2( analiseBean.getNr_relatorio_acidente_outros_colaboradores2
+ () );
+ analise
+ .setNr_relatorio_acidente_outros_colaboradores3( analiseBean.getNr_relatorio_acidente_outros_colaboradores3
+ () );
+ analise
+ .setNr_relatorio_acidente_outros_colaboradores4( analiseBean.getNr_relatorio_acidente_outros_colaboradores4
+ () );
analise.setLesao_cabeca( analiseBean.getLesao_cabeca() );
analise.setLesao_pescoco( analiseBean.getLesao_pescoco() );
analise.setLesao_tronco( analiseBean.getLesao_tronco() );
@@ -2339,39 +2605,42 @@ public class AnalisesDataProvider extends GenericDataProvider
joinConditions = null;
joinTypes = null;
- if ( nome != null || por != null )
+ if( nome != null || por != null )
{
- tables = new String[] { AnalisesAcidentesData.TABLENAME, AcidentadosData.TABLENAME };
- joinTypes = new Integer[] { Select2.JOIN_INNER };
- joinConditions = new Expression[] { new Field( AcidentadosData.ID_FULL ).isEqual( AnalisesAcidentesData.ACIDENTADO_ID_FULL ) };
+ tables = new String[]{ AnalisesAcidentesData.TABLENAME, AcidentadosData.TABLENAME };
+ joinTypes = new Integer[]{ Select2.JOIN_INNER };
+ joinConditions =
+ new Expression[]{ new Field( AcidentadosData.ID_FULL ).isEqual( AnalisesAcidentesData.ACIDENTADO_ID_FULL ) };
}
else
{
- tables = new String[] { AnalisesAcidentesData.TABLENAME };
+ tables = new String[]{ AnalisesAcidentesData.TABLENAME };
}
- if ( nome != null )
+ if( nome != null )
{
nome = StringPlainer.convertString( nome.trim() );
nome = nome.replaceAll( " ", "%" );
where = where.and( new Field( "plain_utf8( " + AcidentadosData.NOME_FULL + " )" ).isLike( "%" + nome + "%" ) );
}
- if ( visitaDate != null )
+ if( visitaDate != null )
{
where = where.and( new Field( AnalisesAcidentesData.DATA_ACIDENTE_FULL ).isEqual( visitaDate ) );
}
- if ( estabelecimentoID != null )
+ if( estabelecimentoID != null )
{
where = where.and( new Field( AnalisesAcidentesData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimentoID ) );
}
- if ( por != null )
+ if( por != null )
{
- where = where.and( new Field( AcidentadosData.NUMERO_MECANOGRAFICO_FULL ).isLike( "%" + por.toUpperCase() + "%" ) );
+ where =
+ where.and( new Field( AcidentadosData.NUMERO_MECANOGRAFICO_FULL ).isLike( "%" + por.toUpperCase() + "%" ) );
}
if( visitaDate == null )
{
- where = where.and( new Field( "EXTRACT( year from " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + ")" ).isEqual(fromYear) );
+ where = where.and(
+ new Field( "EXTRACT( year from " + AnalisesAcidentesData.DATA_ACIDENTE_FULL + ")" ).isEqual( fromYear ) );
}
return this;
}
diff --git a/trunk/AnaliseAcidentesTrabalho/src/db/providers/EstatisticasDataProvider.java b/trunk/AnaliseAcidentesTrabalho/src/db/providers/EstatisticasDataProvider.java
index b313a2ff..2c1dd200 100644
--- a/trunk/AnaliseAcidentesTrabalho/src/db/providers/EstatisticasDataProvider.java
+++ b/trunk/AnaliseAcidentesTrabalho/src/db/providers/EstatisticasDataProvider.java
@@ -18,6 +18,8 @@ import db.data.siprp.outer.AcidentadosData;
import db.data.siprp.outer.AnalisesAcidentesData;
import db.data.siprp.outer.CausasData;
import db.data.siprp.outer.SeccoesData;
+import db.data.siprp_local.outer.EmpresasData;
+import db.data.siprp_local.outer.EstabelecimentosData;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -66,6 +68,7 @@ public class EstatisticasDataProvider extends GenericDataProvider
String turno = ( String ) searchProperties.get( EstatisticasConstants.KEY_TURNO_TRABALHO );
Boolean formacao_shst = ( Boolean ) searchProperties.get( EstatisticasConstants.KEY_FORMACAO_SHST );
Boolean participado_seguro = ( Boolean ) searchProperties.get( EstatisticasConstants.KEY_PARTICIPADO_SEGURO );
+ Integer empresaID = (Integer) searchProperties.get( EstatisticasConstants.KEY_EMPRESA );
String[] tables;
Expression[] joins;
@@ -162,6 +165,11 @@ public class EstatisticasDataProvider extends GenericDataProvider
where = where.and( new Field( EstatisticasConstants.KEY_PARTICIPADO_SEGURO ).isEqual( participado_seguro ? "y" : "n" ) );
}
+ if( empresaID != null )
+ {
+ where = where.and( new Field( EstatisticasConstants.KEY_EMPRESA ).isEqual( empresaID ) );
+ }
+
Select select = new Select2( tables, joinTypes, joins,
new String[]{ AnalisesAcidentesData.ESTADO_FULL, "COUNT( analises_acidentes.* ) AS count" },
where, new String[]{ AnalisesAcidentesData.ESTADO_FULL }, new String[]{ AnalisesAcidentesData.ESTADO_FULL }, null, null );
@@ -254,12 +262,17 @@ public class EstatisticasDataProvider extends GenericDataProvider
return causa;
}
- public Option[] getEstabelecimentos( ) throws Exception
+ public Option[] getEstabelecimentos( Integer selectedEmpresa ) throws Exception
{
Option[] options = null;
Expression where = new Field( db.data.siprp_local.outer.EstabelecimentosData.INACTIVO_FULL ).isDifferent( "y" );
+ if( selectedEmpresa != null )
+ {
+ where = where.and( new Field( EstabelecimentosData.EMPRESA_ID_FULL ).isEqual( selectedEmpresa ) );
+ }
+
Select2 query = new Select2(
new String[] { db.data.siprp_local.outer.EstabelecimentosData.TABLENAME },
new Integer[] { },
@@ -296,5 +309,36 @@ public class EstatisticasDataProvider extends GenericDataProvider
return estabelecimento;
}
+ public Option[] getEmpresas( ) throws Exception
+ {
+ Option[] options = null;
+
+ Expression where = new Field( db.data.siprp_local.outer.EmpresasData.INACTIVO_FULL ).isDifferent( "y" )
+ .and( new Field( EmpresasData.ID_FULL ).in( new Integer[] { 142, 85, 219, 32 } ) );
+
+ Select2 query = new Select2(
+ new String[] { db.data.siprp_local.outer.EmpresasData.TABLENAME },
+ new Integer[] { },
+ new Expression[] {},
+ new String[] {
+ db.data.siprp_local.outer.EmpresasData.ID_FULL, EmpresasData.DESIGNACAO_SOCIAL_FULL
+ },
+ where,
+ new String[] { EmpresasData.DESIGNACAO_SOCIAL_FULL },
+ null, null, null );
+ Virtual2DArray array = getLocalExecuter().executeQuery( query );
+ if ( array != null )
+ {
+ options = new Option[ array.rowCount() + 1 ];
+ options[ 0 ] = new Option( "", "" );
+ for ( int i = 0; i < array.rowCount(); i++ )
+ {
+ Integer empresaID = array.get( i, 0 );
+ String empresaNome = array.get( i, 1 );
+ options[ ( i + 1 ) ] = new Option( empresaID, empresaNome );
+ }
+ }
+ return options;
+ }
}
diff --git a/trunk/AnaliseAcidentesTrabalho/src/db/providers/UtilizadoresDataProvider.java b/trunk/AnaliseAcidentesTrabalho/src/db/providers/UtilizadoresDataProvider.java
index 9d3b59d1..7bfd7b75 100644
--- a/trunk/AnaliseAcidentesTrabalho/src/db/providers/UtilizadoresDataProvider.java
+++ b/trunk/AnaliseAcidentesTrabalho/src/db/providers/UtilizadoresDataProvider.java
@@ -26,6 +26,8 @@ import db.data.siprp.outer.PermissoesData;
import db.data.siprp.outer.TiposUtilizadoresData;
import db.data.siprp.outer.UtilizadoresData;
import global.Global;
+
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedList;
@@ -330,10 +332,15 @@ public class UtilizadoresDataProvider extends GenericDataProvider
Select select = new Select2( EmpresasData.TABLENAME, new Field( EmpresasData.DESIGNACAO_SOCIAL_FULL ).isILike( "siprp%" )
.and( new Field( EmpresasData.ID_FULL ).isEqual( utilizador.getEmpresa_id() ) ), "1" );
- Select outer = new Select( "select exists( " + select.toString() + " )" );
+ Select outer = new Select( MessageFormat.format( "select exists( {0} )", select.toString() ) );
Virtual2DArray array = getExecuter().executeQuery( outer );
- return array.rowCount() > 0 ? ( Boolean ) array.get( 0, 1 ) : Boolean.FALSE;
+ Boolean result = Boolean.FALSE;
+ if( array.rowCount() > 0 )
+ {
+ result = array.get( 0, 0 );
+ }
+ return result;
}
}
diff --git a/trunk/AnaliseAcidentesTrabalho/src/utils/Utils.java b/trunk/AnaliseAcidentesTrabalho/src/utils/Utils.java
index 3121d4fb..e6cd6f74 100644
--- a/trunk/AnaliseAcidentesTrabalho/src/utils/Utils.java
+++ b/trunk/AnaliseAcidentesTrabalho/src/utils/Utils.java
@@ -569,7 +569,7 @@ public class Utils {
{
try
{
- Option[] estabelecimentos = EstatisticasDataProvider.getInstance().getEstabelecimentos();
+ Option[] estabelecimentos = EstatisticasDataProvider.getInstance().getEstabelecimentos( null );
if ( estabelecimentos != null )
{
for ( DropDown drop : drops )
@@ -584,18 +584,79 @@ public class Utils {
}
}
+ public static void fillEstabelecimentos( Integer empresaId, DropDown ... drops )
+ {
+ try
+ {
+ Option[] estabelecimentos = EstatisticasDataProvider.getInstance().getEstabelecimentos( empresaId );
+ if ( estabelecimentos != null )
+ {
+ Integer selected = null;
+ for ( DropDown drop : drops )
+ {
+ if( drop.getSelected() != null )
+ {
+ if( drop.getSelected() instanceof Integer )
+ {
+ selected = ( Integer ) drop.getSelected();
+ }
+ else
+ {
+ selected = getSelectedID( drop );
+ }
+ }
+ drop.setItems( estabelecimentos );
+ drop.setSelected( selected );
+ }
+ }
+ }
+ catch ( Exception e )
+ {
+ ErrorLogger.logException( e );
+ }
+ }
+
public static Integer getSelectedID( DropDown drop )
{
Integer selectedID = null;
if ( drop.getSelected() != null )
{
String value = ( String ) drop.getSelected();
- if ( value != null )
+ try { selectedID = Integer.parseInt( value ); }
+ catch ( Exception ignored ) { }
+ }
+ return selectedID;
+ }
+
+ public static void fillEmpresas( DropDown ... drops )
+ {
+ try
+ {
+ Option[] empresas = EstatisticasDataProvider.getInstance().getEmpresas();
+ if ( empresas != null )
{
- try { selectedID = Integer.parseInt( value ); }
- catch ( Exception e ) { }
+ Integer selected = null;
+ for ( DropDown drop : drops )
+ {
+ if( drop.getSelected() != null )
+ {
+ if( drop.getSelected() instanceof Integer )
+ {
+ selected = ( Integer ) drop.getSelected();
+ }
+ else
+ {
+ selected = getSelectedID( drop );
+ }
+ }
+ drop.setItems( empresas );
+ drop.setSelected( selected );
+ }
}
}
- return selectedID;
+ catch ( Exception e )
+ {
+ ErrorLogger.logException( e );
+ }
}
}
diff --git a/trunk/AnaliseAcidentesTrabalho/web/EstatisticasProcesso.jsp b/trunk/AnaliseAcidentesTrabalho/web/EstatisticasProcesso.jsp
index 5dc18bb7..65f918f3 100644
--- a/trunk/AnaliseAcidentesTrabalho/web/EstatisticasProcesso.jsp
+++ b/trunk/AnaliseAcidentesTrabalho/web/EstatisticasProcesso.jsp
@@ -1,139 +1,120 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/trunk/AnaliseAcidentesTrabalho/web/FormDirGerRh.jsp b/trunk/AnaliseAcidentesTrabalho/web/FormDirGerRh.jsp
index 48de301e..192b0d18 100644
--- a/trunk/AnaliseAcidentesTrabalho/web/FormDirGerRh.jsp
+++ b/trunk/AnaliseAcidentesTrabalho/web/FormDirGerRh.jsp
@@ -1,289 +1,235 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/trunk/AnaliseAcidentesTrabalho/web/FormDirSiprp.jsp b/trunk/AnaliseAcidentesTrabalho/web/FormDirSiprp.jsp
index 26a254ff..b7b02f28 100755
--- a/trunk/AnaliseAcidentesTrabalho/web/FormDirSiprp.jsp
+++ b/trunk/AnaliseAcidentesTrabalho/web/FormDirSiprp.jsp
@@ -1,297 +1,238 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/trunk/AnaliseAcidentesTrabalho/web/FormGestor.jsp b/trunk/AnaliseAcidentesTrabalho/web/FormGestor.jsp
index b6a018e0..c8caa119 100644
--- a/trunk/AnaliseAcidentesTrabalho/web/FormGestor.jsp
+++ b/trunk/AnaliseAcidentesTrabalho/web/FormGestor.jsp
@@ -1,287 +1,235 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/trunk/AnaliseAcidentesTrabalho/web/FormHS.jsp b/trunk/AnaliseAcidentesTrabalho/web/FormHS.jsp
index c15d574b..84ad2b41 100644
--- a/trunk/AnaliseAcidentesTrabalho/web/FormHS.jsp
+++ b/trunk/AnaliseAcidentesTrabalho/web/FormHS.jsp
@@ -1,345 +1,300 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/trunk/AnaliseAcidentesTrabalho/web/FormMedico.jsp b/trunk/AnaliseAcidentesTrabalho/web/FormMedico.jsp
index fbcddc28..f5a694e6 100644
--- a/trunk/AnaliseAcidentesTrabalho/web/FormMedico.jsp
+++ b/trunk/AnaliseAcidentesTrabalho/web/FormMedico.jsp
@@ -1,303 +1,216 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/trunk/AnaliseAcidentesTrabalho/web/FormRH.jsp b/trunk/AnaliseAcidentesTrabalho/web/FormRH.jsp
index 01f4acb6..a8842380 100644
--- a/trunk/AnaliseAcidentesTrabalho/web/FormRH.jsp
+++ b/trunk/AnaliseAcidentesTrabalho/web/FormRH.jsp
@@ -1,347 +1,254 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/trunk/AnaliseAcidentesTrabalho/web/FormSeguranca.jsp b/trunk/AnaliseAcidentesTrabalho/web/FormSeguranca.jsp
index 74e2da40..80d57e39 100644
--- a/trunk/AnaliseAcidentesTrabalho/web/FormSeguranca.jsp
+++ b/trunk/AnaliseAcidentesTrabalho/web/FormSeguranca.jsp
@@ -1,363 +1,257 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+