no message

git-svn-id: https://svn.coded.pt/svn/SIPRP@142 bb69d46d-e84e-40c8-a05a-06db0d633741
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Frederico Palma 21 years ago
parent b45ed8ccea
commit 861e223f04

@ -122,7 +122,7 @@ public class FichaDataProvider extends MetaProvider implements SearchExecuter {
OUTRO_TIPO, RESULTADO, OUTRA_FUNCAO_1, OUTRO_TIPO, RESULTADO, OUTRA_FUNCAO_1,
OUTRA_FUNCAO_2, OUTRA_FUNCAO_3, OUTRA_FUNCAO_2, OUTRA_FUNCAO_3,
OUTRA_FUNCAO_4, PROXIMO_EXAME, OUTRA_FUNCAO_4, PROXIMO_EXAME,
OUTRAS_RECOMENDACOES, TRABALHADOR_ID, MEDICO_ID, PDF }, OUTRAS_RECOMENDACOES, TRABALHADOR_ID, MEDICO_ID, PDF, INACTIVO },
ID ); ID );
public static DBReference R_ESTABELECIMENTO_EMPRESA = new DBReference( ESTABELECIMENTOS.getFieldByName( EMPRESA_ID ) ); public static DBReference R_ESTABELECIMENTO_EMPRESA = new DBReference( ESTABELECIMENTOS.getFieldByName( EMPRESA_ID ) );
@ -357,7 +357,8 @@ public class FichaDataProvider extends MetaProvider implements SearchExecuter {
{ {
Select select = Select select =
new Select( new String[]{ T_EXAMES }, new String[]{ "MAX("+ID+")", DATA }, new Select( new String[]{ T_EXAMES }, new String[]{ "MAX("+ID+")", DATA },
new Field( TRABALHADOR_ID ).isEqual( trabalhadorID ), new Field( TRABALHADOR_ID ).isEqual( trabalhadorID ).and(
new Field( INACTIVO ).isEqual( "n" ) ),
new String[]{ DATA + " DESC" }, new String[]{ DATA } ); new String[]{ DATA + " DESC" }, new String[]{ DATA } );
Virtual2DArray array = executer.executeQuery( select ); Virtual2DArray array = executer.executeQuery( select );
IDObject exames[] = new IDObject[ array.columnLength() ]; IDObject exames[] = new IDObject[ array.columnLength() ];
@ -519,4 +520,5 @@ public class FichaDataProvider extends MetaProvider implements SearchExecuter {
} }
return objects; return objects;
} }
} }

@ -140,6 +140,22 @@ public class FichaWindow extends TabbedWindow
"Imprimir Fichas Anteriores", null, "Imprimir Fichas Anteriores", null,
0, false ); 0, false );
registerAction( new ActionHandler(){
public void execute()
{
deleteOld();
}
public boolean activate( boolean newAction, boolean editAction,
boolean cancelAction, boolean saveAction,
boolean deleteAction, boolean selectAction )
{
return saveAction || editAction;
}
}, "Apagar Fichas Anteriores",
"Apagar Fichas Anteriores", null,
0, false );
registerAction( new ActionHandler(){ registerAction( new ActionHandler(){
public void execute() public void execute()
{ {
@ -347,6 +363,53 @@ public class FichaWindow extends TabbedWindow
return true; return true;
} }
public void deleteOld()
{
if( trabalhadorID == null )
{
return;
}
Vector linhas;
try
{
IDObject fichas[] = fdpProvider.getAllFichasForTrabalhador( trabalhadorID );
linhas = new Vector( Arrays.asList( fichas ) );
}
catch( Exception ex )
{
DialogException.showExceptionMessage( ex, "Erro a criar lista de Fichas anteriores", true );
return;
}
ListActionDialog dialog =
new ListActionDialog( this, "Apagar Fichas Anteriores", new String[]{ "Data" }, linhas,
new ListAction(){
public String getListActionName()
{
return "Apagar";
}
public boolean executeListAction( int line, Object value )
{
if( value == null )
{
return true;
}
try
{
delete( ( ( IDObject )value ).getID() );
}
catch( Exception ex )
{
DialogException.showExceptionMessage( ex, "Erro a Apagar Ficha", true );
return false;
}
return true;
}
} );
dialog.setSize( 250, 200 );
dialog.show();
}
public void reload( int index ) public void reload( int index )
{ {
Integer upperData[] = new Integer[]{ empresaID, estabelecimentoID, trabalhadorID }; Integer upperData[] = new Integer[]{ empresaID, estabelecimentoID, trabalhadorID };
@ -524,12 +587,16 @@ public class FichaWindow extends TabbedWindow
case 6: case 6:
ht.put( "tipo_trabalho", "" ); ht.put( "tipo_trabalho", "" );
break; break;
case 10:
aux = (String)exame.getProperty( fdpProvider.OUTRO_TIPO );
ht.put( "tipo_outro", aux != null ? aux : "" );
break;
} }
break; break;
case 4: // case 4:
aux = (String)exame.getProperty( fdpProvider.OUTRO_TIPO ); // aux = (String)exame.getProperty( fdpProvider.OUTRO_TIPO );
ht.put( "tipo_outro", aux != null ? aux : "" ); // ht.put( "tipo_outro", aux != null ? aux : "" );
break; // break;
} }
tipo = (Integer)exame.getProperty( fdpProvider.RESULTADO ); tipo = (Integer)exame.getProperty( fdpProvider.RESULTADO );
switch( tipo.intValue() ) switch( tipo.intValue() )
@ -646,4 +713,21 @@ public class FichaWindow extends TabbedWindow
{ {
return "Imprimir"; return "Imprimir";
} }
private void delete( Integer exameID )
throws Exception
{
MetaObject exame = fdpProvider.load( fdpProvider.EXAMES, new DBKey( exameID ) );
if( exame == null )
{
throw new Exception( "N\u00e3o existe exame" );
}
if( JOptionPane.showConfirmDialog( this,
"Tem a certeza que quer apagar o exame de " + exame.getProperty( fdpProvider.DATA ) + "?",
"...", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null ) == 0 )
{
exame.setProperty( fdpProvider.INACTIVO, "y" );
exame.save();
}
}
} }

Loading…
Cancel
Save