no message

git-svn-id: https://svn.coded.pt/svn/SIPRP@214 bb69d46d-e84e-40c8-a05a-06db0d633741
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Frederico Palma 20 years ago
parent 241cafd675
commit 9e0233bdc1

@ -19,6 +19,8 @@ import com.evolute.utils.ui.search.*;
import com.evolute.utils.sql.*;
import com.evolute.utils.strings.*;
import siprp.data.*;
/**
*
* @author pars
@ -523,4 +525,37 @@ public class FichaDataProvider extends MetaProvider implements SearchExecuter {
return objects;
}
public Object[] getDadosUltimaMarcacao( Integer trabalhadorID )
throws Exception
{
Select select =
new Select( new String[]{ "marcacoes_trabalhador" },
new String[]{ "MAX( data )" },
new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and(
new Field( "tipo" ).isEqual( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ).and(
new Field( "realizada" ).isEqual( "y" ).or(
new Field( "estado" ).isEqual( new Integer( 2 ) ) ) ) );
Virtual2DArray array = executer.executeQuery( select );
if( array.columnLength() == 0 || array.get( 0, 0 ) == null )
{
return new Object[]{ null, null };
}
Date data = ( Date ) array.get( 0, 0 );
select =
new Select( new String[]{ "marcacoes_trabalhador" },
new String[]{ "motivo", "id" },
new Field( "data" ).isEqual( data ).and(
new Field( "trabalhador_id" ).isEqual( trabalhadorID ) ).and(
new Field( "tipo" ).isEqual( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ).and(
new Field( "realizada" ).isEqual( "y" ).or(
new Field( "estado" ).isEqual( new Integer( 2 ) ) ) ),
new String[]{ "id" }, null );
array = executer.executeQuery( select );
Integer tipo = ( Integer ) array.get( 0, 0 );
if( tipo.intValue() == 5 )
{
tipo = new Integer( 2 );
}
return new Object[]{ data, tipo };
}
}

@ -303,8 +303,14 @@ public class ExamePanel extends JPanel
try
{
Integer marcacaoID = provider.getMarcacaoIDByTrabalhador( trabalhadorID );
if( marcacaoID == null )
{
Object dadosMarcacao[] = provider.getDadosUltimaMarcacao( trabalhadorID );
dataExamePanel.setDate( ( Date ) dadosMarcacao[ 0 ] );
Integer tipo = ( Integer ) dadosMarcacao[ 1 ];
int tipoValue = tipo != null ? tipo.intValue() : 0;
tipoGroup.setIntSelected( tipoValue > 0 ? tipoValue - 1 : 0 );
return;
}
marcacao = ( MarcacaoTrabalhadorData ) JDO.load( MarcacaoTrabalhadorData.class, marcacaoID );

Loading…
Cancel
Save