@ -58,11 +58,12 @@ public class doGetListaTrabalhadoresPendentes
//con = DriverManager.getConnection( super.bdUrl, super.bdUsername, super.bdPassword );
//con = DriverManager.getConnection( super.bdUrl, super.bdUsername, super.bdPassword );
dbQuery = new StringBuffer ( ) ;
dbQuery = new StringBuffer ( ) ;
dbQuery . append ( "SELECT trabalhadores.id, trabalhadores.nome, "
dbQuery . append ( "SELECT trabalhadores.id, trabalhadores.nome, "
+ "marcacoes_trabalhador.tipo, marcacoes_trabalhador.data, marcacoes_trabalhador.realizada "
+ "marcacoes_trabalhador.tipo, marcacoes_trabalhador.data, marcacoes_trabalhador.realizada, "
+ " trabalhadores.nome_plain "
+ "FROM trabalhadores LEFT JOIN marcacoes_trabalhador ON ( marcacoes_trabalhador.trabalhador_id = trabalhadores.id )"
+ "FROM trabalhadores LEFT JOIN marcacoes_trabalhador ON ( marcacoes_trabalhador.trabalhador_id = trabalhadores.id )"
+ "WHERE estabelecimento_id = " + estabelecimentoId
+ "WHERE estabelecimento_id = " + estabelecimentoId
+ " AND trabalhadores.inactivo <> 'y' AND data_demissao IS NULL "
+ " AND trabalhadores.inactivo <> 'y' AND data_demissao IS NULL "
+ "ORDER BY 2 , 3, 4 DESC " ) ;
+ "ORDER BY 6 , 3, 4 DESC " ) ;
// dbQuery.append( "SELECT id, nome, ( ultima_consulta IS NOT NULL AND realizada = 'y' ),"
// dbQuery.append( "SELECT id, nome, ( ultima_consulta IS NOT NULL AND realizada = 'y' ),"
// + " ( ultimo_exame IS NOT NULL AND realizado = 'y' ),"
// + " ( ultimo_exame IS NOT NULL AND realizado = 'y' ),"
// + " proxima_consulta IS NOT NULL, proximo_exame IS NOT NULL, "
// + " proxima_consulta IS NOT NULL, proximo_exame IS NOT NULL, "