git-svn-id: https://svn.coded.pt/svn/SIPRP@693 bb69d46d-e84e-40c8-a05a-06db0d633741
lxbfYeaa
L Luís = 18 years ago
parent 1d29721495
commit fcbd8749a6

@ -139,6 +139,7 @@ public class AnaliseAcidente {
private String nome_resp_consolidacao; private String nome_resp_consolidacao;
private Date data_inicio_processo; private Date data_inicio_processo;
private Integer rh_fase4;
/** Creates a new instance of AnaliseAcidente */ /** Creates a new instance of AnaliseAcidente */
public AnaliseAcidente() { public AnaliseAcidente() {
@ -1035,5 +1036,15 @@ public class AnaliseAcidente {
public void setSeccao_id(Integer seccao_id) { public void setSeccao_id(Integer seccao_id) {
this.seccao_id = seccao_id; this.seccao_id = seccao_id;
} }
public Integer getRh_fase4()
{
return rh_fase4;
}
public void setRh_fase4(Integer rh_fase4)
{
this.rh_fase4 = rh_fase4;
}
} }

@ -57,17 +57,17 @@ import javax.mail.BodyPart;
import javax.mail.Message; import javax.mail.Message;
import javax.mail.Multipart; import javax.mail.Multipart;
import javax.mail.Session; import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress; import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart; import javax.mail.internet.MimeMultipart;
import javax.mail.*; import javax.mail.*;
import javax.mail.internet.*; import javax.mail.util.ByteArrayDataSource;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import pagestate.AnaliseAcidenteTrabalhoState; import pagestate.AnaliseAcidenteTrabalhoState;
import pdf.Pdf; import pdf.Pdf;
import pdf.PdfGenerator;
import utils.Utils; import utils.Utils;
/** /**
@ -7504,8 +7504,8 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
break; break;
case Global.ESTADO_ASSINATURA_RH: case Global.ESTADO_ASSINATURA_RH:
//butGravar.setRendered(false); butGravar.setRendered(false);
butGravar.setText("Imprimir"); //butGravar.setText("Imprimir");
butCorrecao.setRendered(false); butCorrecao.setRendered(false);
butImprimir.setRendered(false); butImprimir.setRendered(false);
butEnviar.setText("Enviar a Conclusão"); butEnviar.setText("Enviar a Conclusão");
@ -10637,6 +10637,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
else if(estado == Global.ESTADO_RH2) else if(estado == Global.ESTADO_RH2)
{ {
meds = fillAnaliseMedidasRh(a); meds = fillAnaliseMedidasRh(a);
a.setRh_fase4(getSessionBean1().getCurrentUser().getId());
} }
try try
{ {
@ -10732,6 +10733,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
else if(estado == Global.ESTADO_RH2) else if(estado == Global.ESTADO_RH2)
{ {
meds = fillAnaliseMedidasRh(a); meds = fillAnaliseMedidasRh(a);
a.setRh_fase4(getSessionBean1().getCurrentUser().getId());
} }
int novo_estado = a.getEstado().intValue(); int novo_estado = a.getEstado().intValue();
@ -10774,6 +10776,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
else if(a.getEstado().intValue() == Global.ESTADO_CONCLUIDO) else if(a.getEstado().intValue() == Global.ESTADO_CONCLUIDO)
{ {
sendEmailFimProcesso(a); sendEmailFimProcesso(a);
sendEmailToRhFase4(a);
} }
String navFrom = getSessionBean1().getNavFrom(); String navFrom = getSessionBean1().getNavFrom();
if(navFrom.matches("FormSeguranca")) if(navFrom.matches("FormSeguranca"))
@ -13978,6 +13981,37 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
} }
} }
private void sendEmailToRhFase4(AnaliseAcidente a)
{
Acidentado ac = getSessionBean1().getAcidentado();
String assunto = "SIPRP Fecho do Processo de Análise de Acidente de Trabalho nº " + a.getAnalise_nr() + " Ficheiro para Impressão";
UtilizadoresDataProvider udp = new UtilizadoresDataProvider();
try
{
Utilizador urh = udp.getUtilizador(a.getRh_fase4());
String texto_email = "<p>Exmo. (a) Senhor(a), </p>";
texto_email += "<p>Confirmamos que o processo de An&aacute;lise de Acidente de Trabalho n&#186 " + a.getAnalise_nr()+ " se encontra encerrado ap&oacute;s o preenchimento e valida&ccedil;&atilde;o de todos os intervenientes.</p>";
texto_email += "<p>Sugerimos que imprima o ficheiro que enviamos em anexo e o junte &agrave; Participa&ccedil;&atilde;o de Sinistro &agrave; Seguradora para dar conhecimento ao M&eacute;dico do Trabalho do seu estabelecimento. Ap&oacute;s o seu conhecimento, aconselhamos que entregue uma c&oacute;pia da Ficha de An&aacute;lise de Acidente de Trabalho &agrave; equipa de Sa&uacute;de Ocupacional, para que esta a arquive no processo cl&iacute;nico do trabalhador antes de juntar toda a documenta&ccedil;&atilde;o no processo individual do colaborador nos Recursos Humanos.</p>";
texto_email += "<p>Agradecemos a sua colabora&ccedil;&atilde;o e ficamos ao dispor para qualquer esclarecimento atrav&eacute;s dos telefones 213 504 544 (Catarina Leonardo) ou 213 504 542 (S&oacute;nia Campos).</p>";
texto_email += "<p>Os melhores cumprimentos,</p>";
texto_email += "<p>A equipa da SIPRP</p>";
try
{
sendEmailWithPdf(a, urh.getEmail(), Global.ENDERECO_ENVIO, assunto, texto_email);
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
// private void sendEmail(String emailTo, String emailFrom, String assunto, String texto_email) throws Exception // private void sendEmail(String emailTo, String emailFrom, String assunto, String texto_email) throws Exception
// { // {
// Properties props = new Properties(); // Properties props = new Properties();
@ -14055,6 +14089,49 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
////////Transport.send(msg); ////////Transport.send(msg);
////////System.out.println("Email Enviado !!!! "); ////////System.out.println("Email Enviado !!!! ");
}
private void sendEmailWithPdf(AnaliseAcidente a, String emailTo, String emailFrom, String assunto, String texto_email) throws Exception
{
PdfGenerator pdf = new PdfGenerator(a);
ByteArrayDataSource ds = new ByteArrayDataSource(pdf.generatePdf(),
"application/pdf");
Properties props = new Properties();
//props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.host", "mail2.evolute.pt");
props.put("mail.from", emailFrom);
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.user", "lluis");
props.put("mail.smtp.password", "654321");
// Session session1 = Session.getInstance(props);
Authenticator auth = new SMTPAuthenticator();
Session session = Session.getDefaultInstance(props, auth);
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(emailFrom));
InternetAddress[] address = {new InternetAddress(emailTo)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject(assunto);
msg.setSentDate(new Date());
Multipart multipart = new MimeMultipart();
BodyPart msgBodyPart = new MimeBodyPart();
String html;
html="<html><head> <meta content='text/html;charset=ISO-8859-1' http-equiv='Content-Type'></head>";
html+="<body bgcolor='#ffffff' text='#000000'>";
html+= texto_email;
html+="<body></html>";
msgBodyPart.setContent(html, "text/html");
multipart.addBodyPart(msgBodyPart);
MimeBodyPart pdfPart = new MimeBodyPart();
pdfPart.setContent(ds,"application/pdf");
pdfPart.setHeader("Content-Transfer-Encoding","base64");
pdfPart.setHeader("Content-Disposition","attachment");
pdfPart.setFileName("AnaliseAcidente" + a.getAnalise_nr());
multipart.addBodyPart(pdfPart,1);
msg.setContent(multipart);
Transport.send(msg);
System.out.println("Email Enviado !!!! ");
} }
public String butImprimir_action() { public String butImprimir_action() {
@ -14264,7 +14341,8 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
a.setNumero_mecanografico(t.getNumero_mecanografico()); a.setNumero_mecanografico(t.getNumero_mecanografico());
getSessionBean1().setAcidentado(a); getSessionBean1().setAcidentado(a);
gridSiprp.setRendered(true); gridSiprp.setRendered(true);
gridDadosAcidenteSeg.setRendered(true); gridDadosAcidenteSeg.setRendered(true);
gridTrabalhadores.setRendered(false);
} }
else else
{ {
@ -14278,9 +14356,12 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
} }
catch(Exception ex) catch(Exception ex)
{ {
getSessionBean1().setMsg("Trabalhador inexistente !"); getSessionBean1().setMsg("Trabalhador inexistente ! ");
tblTrabalhadores.setRendered(false); tblTrabalhadores.setRendered(false);
//ex.printStackTrace(); txtTrabalhador.setText("");
gridSiprp.setRendered(false);
gridDadosAcidenteSeg.setRendered(false);
ex.printStackTrace();
} }
return null; return null;

@ -1109,7 +1109,7 @@ public class FormSeguranca extends AbstractPageBean {
* this page.</p> * this page.</p>
*/ */
public void prerender() { public void prerender() {
lblUser.setText( getSessionBean1().getCurrentUser().getLogin() ); lblUser.setText( getSessionBean1().getCurrentUser().getLogin());
String responsavel_loja = getSessionBean1().getCurrentUser().getResponsavel_loja(); String responsavel_loja = getSessionBean1().getCurrentUser().getResponsavel_loja();
AnalisesDataProvider adp = new AnalisesDataProvider(); AnalisesDataProvider adp = new AnalisesDataProvider();
try try

@ -393,7 +393,13 @@ public class LoadImage extends AbstractPageBean {
// realImageFilePath += "/" + justFileName; // realImageFilePath += "/" + justFileName;
System.out.println("FILES : " + files); System.out.println("FILES : " + files);
justFileName = new Integer(firstImageNr + files.length + 1).toString(); int imageName = firstImageNr + files.length + 1;
justFileName = new Integer(imageName).toString();
if(imageName < 10)
{
justFileName = "0" + justFileName;
}
//this.txtFileName.setValue(justFileName); //this.txtFileName.setValue(justFileName);
Long uploadedFileSize = new Long(uploadedFile.getSize()); Long uploadedFileSize = new Long(uploadedFile.getSize());
//this.txtFileSize.setValue(uploadedFileSize); //this.txtFileSize.setValue(uploadedFileSize);

@ -1356,6 +1356,7 @@ public class NovoUtilizador extends AbstractPageBean {
u.setCap(cap); u.setCap(cap);
u.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id()); u.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id());
u.setResponsavel_loja("n"); u.setResponsavel_loja("n");
u.setEstabelecimento(null);
getSessionBean1().setNewUser(u); getSessionBean1().setNewUser(u);
getSessionBean1().setModoEdicaoUtilizador("new"); getSessionBean1().setModoEdicaoUtilizador("new");
getSessionBean1().setNavFrom("NovoUtilizador"); getSessionBean1().setNavFrom("NovoUtilizador");
@ -1872,21 +1873,21 @@ public class NovoUtilizador extends AbstractPageBean {
u.setTipo(new Integer(7)); u.setTipo(new Integer(7));
} }
} }
else if(rbCatGestao.getSelected() != null) if(rbCatGestao.getSelected() != null)
{ {
if(rbCatGestao.getSelected().equals(new Boolean(true))) if(rbCatGestao.getSelected().equals(new Boolean(true)))
{ {
u.setTipo(new Integer(6)); u.setTipo(new Integer(6));
} }
} }
else if(rbCatRh.getSelected() != null) if(rbCatRh.getSelected() != null)
{ {
if(rbCatRh.getSelected().equals(new Boolean(true))) if(rbCatRh.getSelected().equals(new Boolean(true)))
{ {
u.setTipo(new Integer(2)); u.setTipo(new Integer(2));
} }
} }
else if(rbCatSeg.getSelected() != null) if(rbCatSeg.getSelected() != null)
{ {
if(rbCatSeg.getSelected().equals(new Boolean(true))) if(rbCatSeg.getSelected().equals(new Boolean(true)))
{ {

@ -1080,13 +1080,24 @@ public class UtilizadorFields extends AbstractPageBean {
private void initializeNew() private void initializeNew()
{ {
//drpTipo.setStyleClass("hidden"); //drpTipo.setStyleClass("hidden");
drpEstabelecimentos.setStyleClass("hidden"); //drpEstabelecimentos.setStyleClass("hidden");
NewUser u = getSessionBean1().getNewUser();
if(u.getEstabelecimento() == null)
{
drpEstabelecimentos.setDisabled(true);
}
else
{
drpEstabelecimentos.setSelected(u.getEstabelecimento());
}
drpNome.setStyleClass("hidden"); drpNome.setStyleClass("hidden");
txtNome.setStyleClass("hidden"); txtNome.setStyleClass("hidden");
NewUser u = getSessionBean1().getNewUser();
stTipo.setText(u.getTipo_descricao()); stTipo.setText(u.getTipo_descricao());
stEstabelecimento.setText(u.getEstabelecimento_descricao()); //stEstabelecimento.setText(u.getEstabelecimento_descricao());
stEstabelecimento.setStyleClass("hidden");
stNome.setText(Utils.unicodeToHTML(u.getNome())); stNome.setText(Utils.unicodeToHTML(u.getNome()));
txtLogin.setText(""); txtLogin.setText("");
@ -1574,7 +1585,11 @@ public class UtilizadorFields extends AbstractPageBean {
u.setAdministrador("n"); u.setAdministrador("n");
u.setTipo(nu.getTipo()); u.setTipo(nu.getTipo());
u.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id()); u.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id());
u.setEstabelecimento_id( nu.getEstabelecimento() ); //u.setEstabelecimento_id( nu.getEstabelecimento() );
if(nu.getEstabelecimento() != null)
{
u.setEstabelecimento_id((Integer) drpEstabelecimentos.getSelected());
}
u.setNome(Utils.unicodeToHTML(nu.getNome())); u.setNome(Utils.unicodeToHTML(nu.getNome()));
u.setLogin( (String) txtLogin.getText() ); u.setLogin( (String) txtLogin.getText() );
u.setPassword( (String) txtPassword.getText() ); u.setPassword( (String) txtPassword.getText() );
@ -1682,5 +1697,10 @@ public class UtilizadorFields extends AbstractPageBean {
return null; return null;
} }
public void drpEstabelecimentos_processValueChange(ValueChangeEvent event) {
// TODO: Replace with your code
}
} }

@ -740,7 +740,8 @@ public class AnalisesDataProvider {
a.setData_assinatura_superior(rs.getDate("data_assinatura_superior")); a.setData_assinatura_superior(rs.getDate("data_assinatura_superior"));
a.setData_inicio_processo(rs.getDate("data_inicio_processo")); a.setData_inicio_processo(rs.getDate("data_inicio_processo"));
a.setNome_resp_consolidacao(rs.getString("nome_resp_consolidacao")); a.setNome_resp_consolidacao(rs.getString("nome_resp_consolidacao"));
//System.out.println("ANALISE NR : " + a.getAnalise_nr()); //System.out.println("ANALISE NR : " + a.getAnalise_nr());
a.setRh_fase4(new Integer( rs.getInt("rh_fase4") ));
list.add(a); list.add(a);
}while(rs.next()); }while(rs.next());
dblocal.close(); dblocal.close();
@ -763,18 +764,18 @@ public class AnalisesDataProvider {
{ {
if(nome != null) if(nome != null)
{ {
sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND estabelecimento_id = " + estabelecimento_id + " AND (trabalhadores.nome LIKE '%" + nome + "%' OR LOWER(numero_mecanografico) LIKE '%" + nrMecanografico.toLowerCase() + "%') AND estabelecimentos.empresa_id = " + empresa_id; sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND estabelecimento_id = " + estabelecimento_id + " AND (trabalhadores.nome LIKE '%" + nome + "%' OR LOWER(numero_mecanografico) LIKE '%" + nrMecanografico.toLowerCase() + "%') AND estabelecimentos.empresa_id = " + empresa_id + " AND trabalhadores.inactivo = 'n'";
} }
else else
{ {
sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND estabelecimento_id = " + estabelecimento_id + " AND LOWER(numero_mecanografico) LIKE '%" + nrMecanografico.toLowerCase() + "%' AND estabelecimentos.empresa_id = " + empresa_id; sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND estabelecimento_id = " + estabelecimento_id + " AND LOWER(numero_mecanografico) LIKE '%" + nrMecanografico.toLowerCase() + "%' AND estabelecimentos.empresa_id = " + empresa_id + " AND trabalhadores.inactivo = 'n'";
} }
} }
else else
{ {
if(nome != null) if(nome != null)
{ {
sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND estabelecimento_id = " + estabelecimento_id + " AND trabalhadores.nome LIKE '%" + nome + "%' AND estabelecimentos.empresa_id = " + empresa_id; sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND estabelecimento_id = " + estabelecimento_id + " AND trabalhadores.nome LIKE '%" + nome + "%' AND estabelecimentos.empresa_id = " + empresa_id + " AND trabalhadores.inactivo = 'n'";
} }
} }
@ -805,23 +806,22 @@ public class AnalisesDataProvider {
//restantes trabalhadores //restantes trabalhadores
if(nrMecanografico != null) if(nrMecanografico != null)
{ {
if(nome != null) if(nome != null)
{ {
sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND estabelecimento_id <> " + estabelecimento_id + " AND (trabalhadores.nome LIKE '%" + nome + "%' OR LOWER(numero_mecanografico) LIKE '%" + nrMecanografico.toLowerCase() + "%') AND estabelecimentos.empresa_id = " + empresa_id; sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND estabelecimento_id <> " + estabelecimento_id + " AND (trabalhadores.nome LIKE '%" + nome + "%' OR LOWER(numero_mecanografico) LIKE '%" + nrMecanografico.toLowerCase() + "%') AND estabelecimentos.empresa_id = " + empresa_id + " AND trabalhadores.inactivo = 'n'";
} }
else else
{ {
sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND estabelecimento_id <> " + estabelecimento_id + " AND LOWER(numero_mecanografico) LIKE '%" + nrMecanografico.toLowerCase() + "%' AND estabelecimentos.empresa_id = " + empresa_id; sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND estabelecimento_id <> " + estabelecimento_id + " AND LOWER(numero_mecanografico) LIKE '%" + nrMecanografico.toLowerCase() + "%' AND estabelecimentos.empresa_id = " + empresa_id + " AND trabalhadores.inactivo = 'n'";
} }
} }
else else
{ {
if(nome != null) if(nome != null)
{ {
sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND estabelecimento_id <> " + estabelecimento_id + " AND trabalhadores.nome LIKE '%" + nome + "%' AND estabelecimentos.empresa_id = " + empresa_id; sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND estabelecimento_id <> " + estabelecimento_id + " AND trabalhadores.nome LIKE '%" + nome + "%' AND estabelecimentos.empresa_id = " + empresa_id + " AND trabalhadores.inactivo = 'n'";
} }
} }
@ -836,25 +836,28 @@ public class AnalisesDataProvider {
// } // }
System.out.println("TRABALHADORES SQL : " + sql); System.out.println("TRABALHADORES SQL : " + sql);
rslocal = stlocal.executeQuery(sql); rslocal = stlocal.executeQuery(sql);
rslocal.first(); if(rslocal.isBeforeFirst())
do {
{ rslocal.first();
Trabalhador t = new Trabalhador(); do
t.setId(new Integer(rslocal.getInt(1))); //id {
String nome_trab = rslocal.getString(2); Trabalhador t = new Trabalhador();
t.setNome(utils.Utils.unicodeToHTML(nome_trab)); t.setId(new Integer(rslocal.getInt(1))); //id
t.setData_nascimento(rslocal.getDate("data_nascimento")); String nome_trab = rslocal.getString(2);
t.setFuncao(rslocal.getString("funcao_proposta")); t.setNome(utils.Utils.unicodeToHTML(nome_trab));
t.setData_admissao(rslocal.getDate("data_admissao")); t.setData_nascimento(rslocal.getDate("data_nascimento"));
t.setNumero_mecanografico(rslocal.getString("numero_mecanografico")); t.setFuncao(rslocal.getString("funcao_proposta"));
t.setEstabelecimento_id(new Integer( rslocal.getInt(7) )); t.setData_admissao(rslocal.getDate("data_admissao"));
//if(nome != null) t.setNumero_mecanografico(rslocal.getString("numero_mecanografico"));
//{ t.setEstabelecimento_id(new Integer( rslocal.getInt(7) ));
t.setEstabelecimento(utils.Utils.unicodeToHTML(rslocal.getString(8))); //if(nome != null)
//} //{
t.setEstabelecimento(utils.Utils.unicodeToHTML(rslocal.getString(8)));
//}
list.add(t); list.add(t);
}while(rslocal.next()); }while(rslocal.next());
}
dblocal.close(); dblocal.close();
return list; return list;
} }
@ -875,7 +878,7 @@ public class AnalisesDataProvider {
{ {
String sql1 = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND ("; String sql1 = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND (";
String sql2 = ""; String sql2 = "";
String sql3 = ") AND LOWER(numero_mecanografico) LIKE '%" + nrMecanografico.toLowerCase() + "%' AND estabelecimentos.empresa_id = " + empresa_id; String sql3 = ") AND LOWER(numero_mecanografico) LIKE '%" + nrMecanografico.toLowerCase() + "%' AND estabelecimentos.empresa_id = " + empresa_id + " AND trabalhadores.inactivo = 'n'";
st = new StringTokenizer (nome); st = new StringTokenizer (nome);
int n = 0; int n = 0;
while (st.hasMoreTokens ()) { while (st.hasMoreTokens ()) {
@ -891,7 +894,7 @@ public class AnalisesDataProvider {
} }
else else
{ {
sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND LOWER(numero_mecanografico) LIKE '%" + nrMecanografico.toLowerCase() + "%' AND estabelecimentos.empresa_id = " + empresa_id; sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND LOWER(numero_mecanografico) LIKE '%" + nrMecanografico.toLowerCase() + "%' AND estabelecimentos.empresa_id = " + empresa_id + " AND trabalhadores.inactivo = 'n'";
} }
} }
else else
@ -901,7 +904,7 @@ public class AnalisesDataProvider {
//sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND trabalhadores.nome LIKE '%" + nome + "%' AND estabelecimentos.empresa_id = " + empresa_id; //sql = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND trabalhadores.nome LIKE '%" + nome + "%' AND estabelecimentos.empresa_id = " + empresa_id;
String sql1 = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND ("; String sql1 = "SELECT trabalhadores.id, trabalhadores.nome, data_nascimento, funcao_proposta, data_admissao, numero_mecanografico , estabelecimentos.id, estabelecimentos.nome FROM trabalhadores, estabelecimentos WHERE estabelecimento_id = estabelecimentos.id AND (";
String sql2 = ""; String sql2 = "";
String sql3 = ") AND estabelecimentos.empresa_id = " + empresa_id; String sql3 = ") AND estabelecimentos.empresa_id = " + empresa_id + " AND trabalhadores.inactivo = 'n'";
st = new StringTokenizer (nome); st = new StringTokenizer (nome);
int n = 0; int n = 0;
while (st.hasMoreTokens ()) { while (st.hasMoreTokens ()) {
@ -1520,12 +1523,13 @@ public class AnalisesDataProvider {
sql += "nome_resp_consolidacao = '" + a.getNome_resp_consolidacao() + "', "; sql += "nome_resp_consolidacao = '" + a.getNome_resp_consolidacao() + "', ";
if(a.getData_assinatura_superior() == null) if(a.getData_assinatura_superior() == null)
{ {
sql += "data_assinatura_superior = " + null + " "; sql += "data_assinatura_superior = " + null + ", ";
} }
else else
{ {
sql += "data_assinatura_superior = '" + a.getData_assinatura_superior() + "' "; sql += "data_assinatura_superior = '" + a.getData_assinatura_superior() + "', ";
} }
sql += "rh_fase4 = " + a.getRh_fase4() + " ";
sql += "WHERE id = " + a.getId(); sql += "WHERE id = " + a.getId();
System.out.println("SQL UPDATE : " + sql); System.out.println("SQL UPDATE : " + sql);
st.execute(sql); st.execute(sql);

@ -21,8 +21,8 @@ import javax.servlet.http.HttpSession;
* @author lluis * @author lluis
*/ */
public class Db { public class Db {
//String connectionURL = "jdbc:postgresql://storage:5432/siprp"; String connectionURL = "jdbc:postgresql://storage:5432/siprp"; //testes
String connectionURL = "jdbc:postgresql://localhost:5436/siprp"; //String connectionURL = "jdbc:postgresql://localhost:5436/siprp"; //real
String User = "postgres"; String User = "postgres";
String Pass = null; String Pass = null;
Connection connection = null; Connection connection = null;

@ -21,8 +21,8 @@ import javax.servlet.http.HttpSession;
* @author lluis * @author lluis
*/ */
public class Dblocal { public class Dblocal {
//String connectionURL = "jdbc:postgresql://storage:5432/siprp_local"; String connectionURL = "jdbc:postgresql://storage:5432/siprp_local"; //testes
String connectionURL = "jdbc:postgresql://localhost:5436/siprp_local_3"; //String connectionURL = "jdbc:postgresql://localhost:5436/siprp_local_3";
String User = "postgres"; String User = "postgres";
String Pass = null; String Pass = null;
Connection connection = null; Connection connection = null;

@ -92,7 +92,8 @@
<h:panelGrid binding="#{UtilizadorFields.gridPanel8}" columnClasses="gridColLeft" columns="1" id="gridPanel8" <h:panelGrid binding="#{UtilizadorFields.gridPanel8}" columnClasses="gridColLeft" columns="1" id="gridPanel8"
style="height: 24px" width="336"> style="height: 24px" width="336">
<ui:dropDown binding="#{UtilizadorFields.drpEstabelecimentos}" id="drpEstabelecimentos" <ui:dropDown binding="#{UtilizadorFields.drpEstabelecimentos}" id="drpEstabelecimentos"
items="#{SessionBean1.estabelecimentosOptions}" selected="#{SessionBean1.estabelecimentoChoice}" style="height: 24px; width: 300px"/> items="#{SessionBean1.estabelecimentosOptions}" selected="#{SessionBean1.estabelecimentoChoice}"
style="height: 24px; width: 300px" valueChangeListener="#{UtilizadorFields.drpEstabelecimentos_processValueChange}"/>
<ui:staticText binding="#{UtilizadorFields.stEstabelecimento}" escape="false" id="stEstabelecimento" style="height: 24px; width: 192px"/> <ui:staticText binding="#{UtilizadorFields.stEstabelecimento}" escape="false" id="stEstabelecimento" style="height: 24px; width: 192px"/>
</h:panelGrid> </h:panelGrid>
<ui:staticText binding="#{UtilizadorFields.staticText11}" id="staticText11" style="height: 24px; width: 144px" <ui:staticText binding="#{UtilizadorFields.staticText11}" id="staticText11" style="height: 24px; width: 144px"

Loading…
Cancel
Save