|
|
|
|
@ -17,6 +17,7 @@ import java.sql.ResultSet;
|
|
|
|
|
import java.sql.Statement;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.GregorianCalendar;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import utils.Utils;
|
|
|
|
|
|
|
|
|
|
@ -31,7 +32,7 @@ public class PlanosDataProvider extends GenericDataProvider{
|
|
|
|
|
{
|
|
|
|
|
Statement st = createStatement();
|
|
|
|
|
Integer newId = getMaxTableId("planos_actuacao");
|
|
|
|
|
String sql = "insert into planos_actuacao (id, estabelecimento_id, fase, data_visita, nome_estabelecimento, empresa_id, nome_empresa, data_controlo) values (";
|
|
|
|
|
String sql = "insert into planos_actuacao (id, estabelecimento_id, fase, data_visita, nome_estabelecimento, empresa_id, nome_empresa, data_controlo, tecnico_hs_id, tecnico_hs_nome) values (";
|
|
|
|
|
sql += newId + ", ";
|
|
|
|
|
sql += p.getEstabelecimento_id() + ", ";
|
|
|
|
|
sql += p.getFase() + ", '";
|
|
|
|
|
@ -42,7 +43,17 @@ public class PlanosDataProvider extends GenericDataProvider{
|
|
|
|
|
sql += p.getNome_empresa() + "', '";
|
|
|
|
|
Date today = new Date();
|
|
|
|
|
sqlDate = new java.sql.Date(today.getTime());
|
|
|
|
|
sql += sqlDate + "'";
|
|
|
|
|
sql += sqlDate + "', ";
|
|
|
|
|
sql += p.getTecnico_hs_id() + ", ";
|
|
|
|
|
if(p.getTecnico_hs_nome() == null)
|
|
|
|
|
{
|
|
|
|
|
sql += null;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sql += "'" + p.getTecnico_hs_nome() + "'";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sql += ")";
|
|
|
|
|
|
|
|
|
|
System.out.println("SQL CREATE PLANO : " + sql);
|
|
|
|
|
@ -277,7 +288,10 @@ public class PlanosDataProvider extends GenericDataProvider{
|
|
|
|
|
|
|
|
|
|
public List<Date> getPlanosOnline() throws Exception
|
|
|
|
|
{
|
|
|
|
|
GregorianCalendar xmas = new GregorianCalendar(1990, 11, 25);
|
|
|
|
|
Date dummyDate = xmas.getTime();
|
|
|
|
|
ArrayList list = new ArrayList();
|
|
|
|
|
list.add(dummyDate);
|
|
|
|
|
Statement st = createStatement();
|
|
|
|
|
String sql = "select data_visita from planos_actuacao";
|
|
|
|
|
ResultSet rs = st.executeQuery(sql);
|
|
|
|
|
@ -403,7 +417,8 @@ public class PlanosDataProvider extends GenericDataProvider{
|
|
|
|
|
pa.setUser_dns(new Integer(rs.getInt("user_dns")));
|
|
|
|
|
pa.setData_validacao_hs(rs.getDate("data_validacao_hs"));
|
|
|
|
|
pa.setUser_hs(new Integer(rs.getInt("user_hs")));
|
|
|
|
|
|
|
|
|
|
pa.setTecnico_hs_id(new Integer(rs.getInt("tecnico_hs_id")));
|
|
|
|
|
pa.setTecnico_hs_nome(rs.getString("tecnico_hs_nome"));
|
|
|
|
|
list.add(pa);
|
|
|
|
|
|
|
|
|
|
}while(rs.next());
|
|
|
|
|
@ -488,7 +503,15 @@ public class PlanosDataProvider extends GenericDataProvider{
|
|
|
|
|
Valor v = new Valor();
|
|
|
|
|
v.setId( new Integer(rs.getInt("id")) );
|
|
|
|
|
v.setRisco_id(new Integer( rs.getInt("risco_id") ));
|
|
|
|
|
v.setValor(new Integer(rs.getInt("valor")));
|
|
|
|
|
Object oValor = rs.getObject("valor");
|
|
|
|
|
if(oValor == null)
|
|
|
|
|
{
|
|
|
|
|
v.setValor(null);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
v.setValor(new Integer(rs.getInt("valor")));
|
|
|
|
|
}
|
|
|
|
|
v.setMedidas(getMedidasByValor(v));
|
|
|
|
|
|
|
|
|
|
v.setResponsavel_execucao(rs.getString("responsavel_execucao"));
|
|
|
|
|
|