no message

git-svn-id: https://svn.coded.pt/svn/SIPRP@404 bb69d46d-e84e-40c8-a05a-06db0d633741
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Luis Flores 19 years ago
parent a2c6488574
commit 8ad16c0e8f

@ -437,6 +437,40 @@ public class FichaDataProvider extends MetaProvider implements SearchExecuter {
return objects; return objects;
} }
public Integer getEstabelecimentoIDForTrabalhador( Integer trabalhadorID )
throws Exception
{
Select select = new Select( new String[]{ T_TRABALHADORES },
new String[]{ ESTABELECIMENTO_ID },
new Field( ID ).isEqual( trabalhadorID ).and(
new Field( INACTIVO ).isDifferent( "y" ) ),
null, null );
Virtual2DArray array = executer.executeQuery( select );
Integer estabelecimentoID = null;
if( array != null && array.columnLength() > 0 )
{
estabelecimentoID = ( Integer )array.get( 0, 0 );
}
return estabelecimentoID;
}
public Integer getEmpresaIDForEstabelecimento( Integer estabelecimentoID )
throws Exception
{
Select select = new Select( new String[]{ T_ESTABELECIMENTOS },
new String[]{ EMPRESA_ID },
new Field( ID ).isEqual( estabelecimentoID ).and(
new Field( INACTIVO ).isDifferent( "y" ) ),
null, null );
Virtual2DArray array = executer.executeQuery( select );
Integer empresaID = null;
if( array != null && array.columnLength() > 0 )
{
empresaID = ( Integer )array.get( 0, 0 );
}
return empresaID;
}
public Integer []getAvisosIDByTipoAndDate( Integer tipo, Date date ) public Integer []getAvisosIDByTipoAndDate( Integer tipo, Date date )
throws Exception throws Exception
{ {

@ -56,6 +56,9 @@ public class FichaWindow extends TabbedWindow
private static FichaWindow window = null; private static FichaWindow window = null;
private Integer imposedTrabalhadorID = null;
private SaveExameListener exameListener = null;
/** Creates a new instance of FichaWindow */ /** Creates a new instance of FichaWindow */
private FichaWindow() private FichaWindow()
throws Exception throws Exception
@ -311,7 +314,6 @@ public class FichaWindow extends TabbedWindow
{ {
iex.printStackTrace(); iex.printStackTrace();
} }
//
// createPDF( exame ); // createPDF( exame );
// print(); // print();
} }
@ -320,70 +322,90 @@ public class FichaWindow extends TabbedWindow
DialogException.showExceptionMessage( ex, "Erro a guardar", true ); DialogException.showExceptionMessage( ex, "Erro a guardar", true );
return false; return false;
} }
if( exameListener != null )
{
exameListener.exameSaved( trabalhadorID, ( Integer )exame.get( ExameData.ID ) );
exameListener = null;
}
return true; return true;
} }
public boolean newItem( int index ) public boolean newItem( int index )
{ {
fdpProvider.setSearch( FichaDataProvider.SEARCH_EMPRESAS ); exameListener = null;
SearchDialog search; if( imposedTrabalhadorID == null )
Integer oldID = empresaID; {
fdpProvider.setSearch( FichaDataProvider.SEARCH_EMPRESAS );
SearchDialog search;
Integer oldID = empresaID;
search = new SearchDialog( fdpProvider, null, false, null, true ); search = new SearchDialog( fdpProvider, null, false, null, true );
empresaID = ( Integer )search.getSelected(); empresaID = ( Integer )search.getSelected();
if( empresaID == null ) if( empresaID == null )
{
if( search.getIsNew() )
{ {
estabelecimentoID = null; if( search.getIsNew() )
trabalhadorID = null; {
clear( 0 ); estabelecimentoID = null;
return true; trabalhadorID = null;
} clear( 0 );
else return true;
{ }
return false; else
{
return false;
}
} }
}
fdpProvider.setSearch( FichaDataProvider.SEARCH_ESTABELECIMENTOS ); fdpProvider.setSearch( FichaDataProvider.SEARCH_ESTABELECIMENTOS );
fdpProvider.setSearchID( FichaDataProvider.SEARCH_EMPRESAS, empresaID.intValue() ); fdpProvider.setSearchID( FichaDataProvider.SEARCH_EMPRESAS, empresaID.intValue() );
search = new SearchDialog( fdpProvider, null, false, null, true ); search = new SearchDialog( fdpProvider, null, false, null, true );
estabelecimentoID = ( Integer )search.getSelected(); estabelecimentoID = ( Integer )search.getSelected();
if( estabelecimentoID == null ) if( estabelecimentoID == null )
{
if( search.getIsNew() )
{ {
trabalhadorID = null; if( search.getIsNew() )
reload(0); {
return true; trabalhadorID = null;
reload(0);
return true;
}
else
{
return false;
}
} }
else
fdpProvider.setSearch( FichaDataProvider.SEARCH_TRABALHADORES );
fdpProvider.setSearchID( FichaDataProvider.SEARCH_ESTABELECIMENTOS, estabelecimentoID.intValue() );
search = new SearchDialog( fdpProvider, null, false, null, true );
trabalhadorID = ( Integer )search.getSelected();
if( trabalhadorID == null && search.getIsNew() )
{ {
return false; reload(0);
return true;
} }
} }
else
fdpProvider.setSearch( FichaDataProvider.SEARCH_TRABALHADORES );
fdpProvider.setSearchID( FichaDataProvider.SEARCH_ESTABELECIMENTOS, estabelecimentoID.intValue() );
search = new SearchDialog( fdpProvider, null, false, null, true );
trabalhadorID = ( Integer )search.getSelected();
if( trabalhadorID == null )
{ {
if( search.getIsNew() ) trabalhadorID = imposedTrabalhadorID;
imposedTrabalhadorID = null;
try
{ {
reload(0); estabelecimentoID = fdpProvider.getEstabelecimentoIDForTrabalhador( trabalhadorID );
return true; empresaID = fdpProvider.getEmpresaIDForEstabelecimento( estabelecimentoID );
} }
else catch( Exception ex )
{ {
DialogException.showExceptionMessage( ex, "Erro a carregar dados.", true );
return false; return false;
} }
} }
if( trabalhadorID == null )
{
return false;
}
reload(0); reload(0);
return true; return true;
} }
@ -810,5 +832,20 @@ public class FichaWindow extends TabbedWindow
} }
} }
public void editTrabalhador( Integer trabalhadorID, SaveExameListener listener )
{
System.out.println( "edit trabalhador: " + trabalhadorID );
if( isVisible() )
{
toFront();
}
else
{
setVisible( true );
}
imposedTrabalhadorID = trabalhadorID;
executeAction( NEW_INDEX );
exameListener = listener;
}
} }

@ -0,0 +1,19 @@
/*
* SaveExameListener.java
*
* Created on May 17, 2007, 12:33 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package siprp.ficha;
/**
*
* @author lflores
*/
public interface SaveExameListener
{
public void exameSaved( Integer trabalhadorID, Integer exameID );
}

@ -23,6 +23,8 @@ import java.util.HashMap;
import java.util.Locale; import java.util.Locale;
import java.util.Vector; import java.util.Vector;
import javax.swing.*; import javax.swing.*;
import siprp.ficha.FichaWindow;
import siprp.ficha.SaveExameListener;
import siprp.medicina.MedicinaConstants; import siprp.medicina.MedicinaConstants;
import siprp.medicina.MedicinaDataProvider; import siprp.medicina.MedicinaDataProvider;
import siprp.medicina.processo.data.TrabalhadoresProcessoData; import siprp.medicina.processo.data.TrabalhadoresProcessoData;
@ -33,7 +35,7 @@ import siprp.medicina.processo.data.TrabalhadoresProcessoData;
*/ */
public class ProcessoPanel extends JPanel public class ProcessoPanel extends JPanel
implements ActionListener, ControllableComponent, implements ActionListener, ControllableComponent,
MedicinaConstants, ProcessoConstants MedicinaConstants, ProcessoConstants, SaveExameListener
{ {
private static final String ECDS_ICON_PATH = "siprp/medicina/processo/icons/ecds.png"; private static final String ECDS_ICON_PATH = "siprp/medicina/processo/icons/ecds.png";
private static final String CONSULTA_ICON_PATH = "siprp/medicina/processo/icons/consulta.png"; private static final String CONSULTA_ICON_PATH = "siprp/medicina/processo/icons/consulta.png";
@ -204,6 +206,17 @@ public class ProcessoPanel extends JPanel
protected void emitirFA() protected void emitirFA()
{ {
if( trabalhadorID != null )
{
try
{
FichaWindow.getWindow().editTrabalhador( trabalhadorID, this );
}
catch( Exception ex )
{
DialogException.showException( ex );
}
}
} }
protected void fecharProcesso() protected void fecharProcesso()
@ -360,4 +373,12 @@ public class ProcessoPanel extends JPanel
{ {
this.trabalhadorID = trabalhadorID; this.trabalhadorID = trabalhadorID;
} }
public void exameSaved( Integer trabalhadorID, Integer exameID )
{
if( trabalhadorID.equals( this.trabalhadorID ) )
{
System.out.println( "NOTIFIED EXAME: " + exameID );
}
}
} }

Loading…
Cancel
Save