forked from Coded/SIPRP
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							549 lines
						
					
					
						
							17 KiB
						
					
					
				
			
		
		
	
	
							549 lines
						
					
					
						
							17 KiB
						
					
					
				| /*
 | |
|  * LocaisRealizacaoWindow.java
 | |
|  *
 | |
|  * Created on February 22, 2007, 10:19 AM
 | |
|  *
 | |
|  * To change this template, choose Tools | Template Manager
 | |
|  * and open the template in the editor.
 | |
|  */
 | |
| 
 | |
| package siprp.medicina.locais_realizacao;
 | |
| 
 | |
| import com.evolute.utils.data.IDObject;
 | |
| import com.evolute.utils.data.MappableObject;
 | |
| import com.evolute.utils.tables.BaseTable;
 | |
| import com.evolute.utils.tables.ColumnizedMappable;
 | |
| import com.evolute.utils.tables.VectorTableModel;
 | |
| import com.evolute.utils.tracker.TrackableWindow;
 | |
| import com.evolute.utils.ui.DialogException;
 | |
| import com.evolute.utils.ui.calendar.JCalendarPanel;
 | |
| import info.clearthought.layout.TableLayout;
 | |
| import info.clearthought.layout.TableLayoutConstraints;
 | |
| import java.awt.BorderLayout;
 | |
| import java.awt.Color;
 | |
| import java.awt.FlowLayout;
 | |
| import java.awt.GridLayout;
 | |
| import java.awt.event.ActionEvent;
 | |
| import java.awt.event.ActionListener;
 | |
| import java.awt.event.WindowAdapter;
 | |
| import java.awt.event.WindowEvent;
 | |
| import java.util.Arrays;
 | |
| import java.util.Date;
 | |
| import java.util.Vector;
 | |
| import javax.swing.BorderFactory;
 | |
| import javax.swing.JButton;
 | |
| import javax.swing.JComboBox;
 | |
| import javax.swing.JFrame;
 | |
| import javax.swing.JLabel;
 | |
| import javax.swing.JPanel;
 | |
| import javax.swing.JScrollPane;
 | |
| import javax.swing.ListSelectionModel;
 | |
| import javax.swing.SwingUtilities;
 | |
| import javax.swing.WindowConstants;
 | |
| import javax.swing.event.ChangeEvent;
 | |
| import javax.swing.event.ChangeListener;
 | |
| import javax.swing.event.ListSelectionEvent;
 | |
| import javax.swing.event.ListSelectionListener;
 | |
| import siprp.data.Marcacao;
 | |
| import siprp.medicina.prestadores.PrestadoresDataProvider;
 | |
| 
 | |
| /**
 | |
|  *
 | |
|  * @author fpalma
 | |
|  */
 | |
| public class LocaisRealizacaoWindow extends JFrame
 | |
| 		implements ActionListener, TrackableWindow, ListSelectionListener
 | |
| {
 | |
| 	protected static final Integer PRESTADOR_ID_SIPRP = new Integer( -1 );
 | |
| 	
 | |
| 	protected static final IDObject PRESTADOR_SIPRP = new MappableObject( PRESTADOR_ID_SIPRP, "SIPRP" );
 | |
| 	
 | |
| 	protected JCalendarPanel dataPanel;
 | |
| 	protected JButton carregarButton;
 | |
| 	protected JButton recarregarPrestadoresButton;
 | |
| 	protected VectorTableModel empresasModel;
 | |
| 	protected BaseTable empresasTable;
 | |
| 	protected VectorTableModel estabelecimentosModel;
 | |
| 	protected BaseTable estabelecimentosTable;
 | |
| 	protected JLabel numeroConsultasLabel;
 | |
| 	protected JComboBox prestadoresConsultasCombo;
 | |
| 	protected JButton enviarConsultasButton;
 | |
| 	protected JButton faxConsultasButton;
 | |
| 	protected JLabel numeroECDsLabel;
 | |
| 	protected JComboBox prestadoresECDsCombo;
 | |
| 	protected JButton enviarECDsButton;
 | |
| 	protected JButton faxECDsButton;
 | |
| 	
 | |
| 	
 | |
| 	protected LocaisRealizacaoDataProvider provider;
 | |
| 	protected PrestadoresDataProvider prestadoresProvider;
 | |
| 	
 | |
| 	/**
 | |
| 	 * Creates a new instance of LocaisRealizacaoWindow
 | |
| 	 */
 | |
| 	public LocaisRealizacaoWindow()
 | |
| 		throws Exception
 | |
| 	{
 | |
| 		provider = LocaisRealizacaoDataProvider.getProvider();
 | |
| 		prestadoresProvider = PrestadoresDataProvider.getProvider();
 | |
| 		setupComponents();
 | |
| 	}
 | |
| 	
 | |
| 	private void setupComponents()
 | |
| 	{
 | |
| 		setTitle( "Locais de Realiza\u00e7\u00e3o" );
 | |
| 		setSize( 1000, 700 );
 | |
| 		JLabel dataLabel = new JLabel( "Data" );
 | |
| 		dataPanel = new JCalendarPanel( this );
 | |
| 		
 | |
| 		carregarButton = new JButton( "Carregar" );
 | |
| 		carregarButton.addActionListener( this );
 | |
| 		recarregarPrestadoresButton = new JButton( "Recarregar Prestadores" );
 | |
| 		recarregarPrestadoresButton.addActionListener( this );
 | |
| 		empresasModel = new VectorTableModel( new String[]{ "empresa" } );
 | |
| 		empresasTable = new BaseTable( empresasModel );
 | |
| 		empresasTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
 | |
| 		empresasTable.getSelectionModel().addListSelectionListener( this );
 | |
| 		JScrollPane empresasScp = new JScrollPane( empresasTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
 | |
| 													JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
 | |
| 		estabelecimentosModel = new VectorTableModel( new String[]{ "estabelecimento" } );
 | |
| 		estabelecimentosTable = new BaseTable( estabelecimentosModel );
 | |
| 		estabelecimentosTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
 | |
| 		estabelecimentosTable.getSelectionModel().addListSelectionListener( this );
 | |
| 		JScrollPane estabelecimentosScp = new JScrollPane( estabelecimentosTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
 | |
| 													JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
 | |
| 		JPanel consultasPanel = new JPanel();
 | |
| 		consultasPanel.setBorder( BorderFactory.createTitledBorder( 
 | |
| 					BorderFactory.createEtchedBorder(), "Consultas" ) );
 | |
| 		JLabel consultasLabel = new JLabel( "Quantidade " );
 | |
| 		numeroConsultasLabel = new JLabel( "   " );
 | |
| 		numeroConsultasLabel.setForeground( Color.green.darker() );
 | |
| 		prestadoresConsultasCombo = new JComboBox();
 | |
| 		enviarConsultasButton = new JButton( "Atribuir" );
 | |
| 		enviarConsultasButton.addActionListener( this );
 | |
| 		faxConsultasButton = new JButton( "Fax" );
 | |
| 		faxConsultasButton.addActionListener( this );
 | |
| 		JPanel ecdsPanel = new JPanel();
 | |
| 		ecdsPanel.setBorder( BorderFactory.createTitledBorder( 
 | |
| 					BorderFactory.createEtchedBorder(), "ECDs" ) );
 | |
| 		JLabel ecdsLabel = new JLabel( "Quantidade " );
 | |
| 		numeroECDsLabel = new JLabel( "   " );
 | |
| 		numeroECDsLabel.setForeground( Color.green.darker() );
 | |
| 		prestadoresECDsCombo = new JComboBox();
 | |
| 		enviarECDsButton = new JButton( "Atribuir" );
 | |
| 		enviarECDsButton.addActionListener( this );
 | |
| 		faxECDsButton = new JButton( "Fax" );
 | |
| 		faxECDsButton.addActionListener( this );
 | |
| 		dataPanel.addChangeListener( new ChangeListener(){
 | |
| 			public void stateChanged(ChangeEvent e)
 | |
| 			{
 | |
| 				empresasTable.clearSelection();
 | |
| 				Vector values = empresasModel.getValues();
 | |
| 				values.clear();
 | |
| 				empresasModel.setValues( values );
 | |
| 			}
 | |
| 		} );
 | |
| 		
 | |
| 		getContentPane().setLayout( new BorderLayout( 5, 5 ) );
 | |
| 		JPanel upperPanel = new JPanel();
 | |
| 		getContentPane().add( upperPanel, BorderLayout.NORTH );
 | |
| 		JPanel centerPanel = new JPanel();
 | |
| 		getContentPane().add( centerPanel, BorderLayout.CENTER );
 | |
| 		
 | |
| 		upperPanel.setLayout( new FlowLayout( FlowLayout.CENTER ) );
 | |
| 		upperPanel.add( dataLabel );
 | |
| 		upperPanel.add( dataPanel );
 | |
| 		upperPanel.add( carregarButton );
 | |
| 		upperPanel.add( recarregarPrestadoresButton );
 | |
| 		
 | |
| 		centerPanel.setLayout( new GridLayout( 1, 3 ) );
 | |
| 		centerPanel.add( empresasScp );
 | |
| 		centerPanel.add( estabelecimentosScp );
 | |
| 		JPanel detalhesPanel = new JPanel();
 | |
| 		centerPanel.add( detalhesPanel );
 | |
| 		
 | |
| 		double cols[] = 
 | |
| 				new double[]{ TableLayout.MINIMUM, TableLayout.FILL };
 | |
| 		double rows[] = 
 | |
| 				new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM };
 | |
| 		
 | |
| 		TableLayout tableLayout = new TableLayout( cols,rows );
 | |
| 		consultasPanel.setLayout( tableLayout );
 | |
| 		
 | |
| 		consultasPanel.add( consultasLabel, new TableLayoutConstraints( 0, 0 ) );
 | |
| 		consultasPanel.add( numeroConsultasLabel, new TableLayoutConstraints( 1, 0 ) );
 | |
| 		consultasPanel.add( prestadoresConsultasCombo, new TableLayoutConstraints( 0, 1, 1, 1 ) );
 | |
| 		consultasPanel.add( enviarConsultasButton, new TableLayoutConstraints( 0, 2, 1, 2 ) );
 | |
| //		consultasPanel.add( faxConsultasButton, new TableLayoutConstraints( 0, 3, 1, 3 ) );
 | |
| 		
 | |
| 		rows = new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM };
 | |
| 						
 | |
| 		tableLayout = new TableLayout( cols,rows );
 | |
| 		ecdsPanel.setLayout( tableLayout );
 | |
| 		
 | |
| 		ecdsPanel.add( ecdsLabel, new TableLayoutConstraints( 0, 0 ) );
 | |
| 		ecdsPanel.add( numeroECDsLabel, new TableLayoutConstraints( 1, 0 ) );
 | |
| 		ecdsPanel.add( prestadoresECDsCombo, new TableLayoutConstraints( 0, 1, 1, 1 ) );
 | |
| 		ecdsPanel.add( enviarECDsButton, new TableLayoutConstraints( 0, 2, 1, 2 ) );
 | |
| 		ecdsPanel.add( faxECDsButton, new TableLayoutConstraints( 0, 3, 1, 3 ) );
 | |
| 		
 | |
| 		cols = new double[]{ TableLayout.FILL };
 | |
| 		rows = new double[]{ TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL };
 | |
| 		
 | |
| 		tableLayout = new TableLayout( cols,rows );
 | |
| 		detalhesPanel.setLayout( tableLayout );
 | |
| 		
 | |
| 		detalhesPanel.add( consultasPanel, new TableLayoutConstraints( 0, 0 ) );
 | |
| 		detalhesPanel.add( ecdsPanel, new TableLayoutConstraints( 0, 1 ) );
 | |
| 		
 | |
| 		setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE );
 | |
| 		addWindowListener( new WindowAdapter(){
 | |
| 			public void windowClosing( WindowEvent e )
 | |
| 			{
 | |
| 				close();
 | |
| 			}
 | |
| 			
 | |
| 			public void windowOpened( WindowEvent e )
 | |
| 			{
 | |
| //				setExtendedState( getExtendedState() | MAXIMIZED_BOTH );
 | |
| 			}
 | |
| 			
 | |
| 		} );
 | |
| 		dataPanel.setDate( new Date() );
 | |
| 		recarregarPrestadores();
 | |
| 		carregar();
 | |
| 	}
 | |
| 
 | |
| 	public void refresh()
 | |
| 	{
 | |
| 	}
 | |
| 
 | |
| 	public void open()
 | |
| 	{
 | |
| 		setVisible( true );
 | |
| 	}
 | |
| 	
 | |
| 	public void close()
 | |
| 	{
 | |
| 		SwingUtilities.invokeLater( new Runnable() {
 | |
| 			public void run()
 | |
| 			{
 | |
| 				setVisible( false );
 | |
| 				dispose();
 | |
| 			}
 | |
| 		} );
 | |
| 	}
 | |
| 
 | |
| 	public boolean closeIfPossible()
 | |
| 	{
 | |
| 		close();
 | |
| 		return true;
 | |
| 	}
 | |
| 
 | |
| 	public void actionPerformed(ActionEvent e)
 | |
| 	{
 | |
| 		Object source = e.getSource();
 | |
| 		if( source.equals( carregarButton ) )
 | |
| 		{
 | |
| 			carregar();
 | |
| 		}
 | |
| 		else if( source.equals( recarregarPrestadoresButton ) )
 | |
| 		{
 | |
| 			recarregarPrestadores();
 | |
| 		}
 | |
| 		else if( source.equals( enviarConsultasButton ) )
 | |
| 		{
 | |
| 			enviarConsultas();
 | |
| 		}
 | |
| 		else if( source.equals( faxConsultasButton ) )
 | |
| 		{
 | |
| 			faxConsultas();
 | |
| 		}
 | |
| 		else if( source.equals( enviarECDsButton ) )
 | |
| 		{
 | |
| 			enviarECDs();
 | |
| 		}
 | |
| 		else if( source.equals( faxECDsButton ) )
 | |
| 		{
 | |
| 			faxECDs();
 | |
| 		}
 | |
| 		
 | |
| 	}
 | |
| 
 | |
| 	public void valueChanged(ListSelectionEvent e)
 | |
| 	{
 | |
| 		Object source = e.getSource();
 | |
| 		if( e.getValueIsAdjusting() )
 | |
| 		{
 | |
| 			return;
 | |
| 		}
 | |
| 		if( source.equals( empresasTable.getSelectionModel() ) )
 | |
| 		{
 | |
| 			mudarEmpresa();
 | |
| 		}
 | |
| 		else if( source.equals( estabelecimentosTable.getSelectionModel() ) )
 | |
| 		{
 | |
| 			mudarEstabelecimento();
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	protected void carregar()
 | |
| 	{
 | |
| 		empresasTable.clearSelection();
 | |
| 		Date data = dataPanel.getDate();
 | |
| 		if( data == null )
 | |
| 		{
 | |
| 			empresasModel.clearAll();
 | |
| 			return;
 | |
| 		}
 | |
| 		try
 | |
| 		{
 | |
| 			ColumnizedMappable empresas[] = provider.getEmpresasComMarcacoes( data );
 | |
| 			Vector values = empresasModel.getValues();
 | |
| 			values.clear();
 | |
| 			values.addAll( Arrays.asList( empresas ) );
 | |
| 			empresasModel.setValues( values );
 | |
| 		}
 | |
| 		catch( Exception ex )
 | |
| 		{
 | |
| 			DialogException.showExceptionMessage( ex, "Erro a carregar empresas", true );
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	protected void mudarEmpresa()
 | |
| 	{
 | |
| 		estabelecimentosTable.clearSelection();
 | |
| 		Date data = dataPanel.getDate();
 | |
| 		int selected = empresasTable.getSelectedRow();
 | |
| 		if( data == null || selected == -1 )
 | |
| 		{
 | |
| 			estabelecimentosModel.clearAll();
 | |
| 			return;
 | |
| 		}
 | |
| 		Integer empresaID = ( ( ColumnizedMappable ) empresasModel.getRowAt( selected ) ).getID();
 | |
| 		try
 | |
| 		{
 | |
| 			ColumnizedMappable estabelecimentos[] = 
 | |
| 					provider.getEstabelecimentosComMarcacoesByEmpresa( empresaID, data );
 | |
| 			Vector values = estabelecimentosModel.getValues();
 | |
| 			values.clear();
 | |
| 			values.addAll( Arrays.asList( estabelecimentos ) );
 | |
| 			estabelecimentosModel.setValues( values );
 | |
| 		}
 | |
| 		catch( Exception ex )
 | |
| 		{
 | |
| 			DialogException.showExceptionMessage( ex, "Erro a carregar estabelecimentos", true );
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	protected void mudarEstabelecimento()
 | |
| 	{
 | |
| 		Date data = dataPanel.getDate();
 | |
| 		int selectedEstabelecimento = estabelecimentosTable.getSelectedRow();
 | |
| 		numeroConsultasLabel.setText( "   " );
 | |
| 		numeroECDsLabel.setText( "   " );
 | |
| 		enviarConsultasButton.setEnabled( false );
 | |
| 		enviarECDsButton.setEnabled( false );
 | |
| 		if( data == null || selectedEstabelecimento == -1 )
 | |
| 		{
 | |
| 			return;
 | |
| 		}
 | |
| 		Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selectedEstabelecimento ) ).getID();
 | |
| 		try
 | |
| 		{
 | |
| 			int countConsultas = 
 | |
| 					provider.getNumeroMarcacoesByEstabelecimentoAndTipo( estabelecimentoID, 
 | |
| 							Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA, data );
 | |
| 			int countECDs = 
 | |
| 					provider.getNumeroMarcacoesByEstabelecimentoAndTipo( estabelecimentoID, 
 | |
| 							Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data );
 | |
| 			if( countConsultas > 0 )
 | |
| 			{
 | |
| 				numeroConsultasLabel.setText( "" + countConsultas );
 | |
| 				enviarConsultasButton.setEnabled( true );
 | |
| 				Integer[] escolhidos =
 | |
| 						provider.getPrestadoresIDByEstabelecimentoAndTipo( estabelecimentoID, 
 | |
| 											Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA, data );
 | |
| 				if( escolhidos.length == 1 )
 | |
| 				{
 | |
| 					numeroConsultasLabel.setForeground( Color.green.darker() );
 | |
| 				}
 | |
| 				else
 | |
| 				{
 | |
| 					numeroConsultasLabel.setForeground( Color.red.darker() );
 | |
| 				}
 | |
| 				int e;
 | |
| 				for( e = 0; e < escolhidos.length; e++ )
 | |
| 				{
 | |
| 					if( escolhidos[ e ] != null )
 | |
| 					{
 | |
| 						break;
 | |
| 					}
 | |
| 				}
 | |
| 				if( e == escolhidos.length || escolhidos[ e ] == null )
 | |
| 				{
 | |
| 					prestadoresConsultasCombo.setSelectedIndex( 0 );
 | |
| 				}
 | |
| 				else
 | |
| 				{
 | |
| 					for( int p = 0; p < prestadoresConsultasCombo.getItemCount(); p++ )
 | |
| 					{
 | |
| 						IDObject prestador = ( IDObject ) prestadoresConsultasCombo.getItemAt( p );
 | |
| 						if( prestador.getID().equals( escolhidos[ e ] ) )
 | |
| 						{
 | |
| 							prestadoresConsultasCombo.setSelectedIndex( p );
 | |
| 						}
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 			if( countECDs > 0 )
 | |
| 			{
 | |
| 				numeroECDsLabel.setText( "" + countECDs );
 | |
| 				enviarECDsButton.setEnabled( true );
 | |
| 				Integer[] escolhidos =
 | |
| 						provider.getPrestadoresIDByEstabelecimentoAndTipo( estabelecimentoID, 
 | |
| 											Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data );
 | |
| 				if( escolhidos.length == 1 )
 | |
| 				{
 | |
| 					numeroECDsLabel.setForeground( Color.green.darker() );
 | |
| 				}
 | |
| 				else
 | |
| 				{
 | |
| 					numeroECDsLabel.setForeground( Color.red.darker() );
 | |
| 				}
 | |
| 				int e;
 | |
| 				for( e = 0; e < escolhidos.length; e++ )
 | |
| 				{
 | |
| 					if( escolhidos[ e ] != null )
 | |
| 					{
 | |
| 						break;
 | |
| 					}
 | |
| 				}
 | |
| 				if( e == escolhidos.length || escolhidos[ e ] == null )
 | |
| 				{
 | |
| 					prestadoresECDsCombo.setSelectedIndex( 0 );
 | |
| 				}
 | |
| 				else
 | |
| 				{
 | |
| 					for( int p = 0; p < prestadoresECDsCombo.getItemCount(); p++ )
 | |
| 					{
 | |
| 						IDObject prestador = ( IDObject ) prestadoresECDsCombo.getItemAt( p );
 | |
| 						if( prestador.getID().equals( escolhidos[ e ] ) )
 | |
| 						{
 | |
| 							prestadoresECDsCombo.setSelectedIndex( p );
 | |
| 						}
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 		}
 | |
| 		catch( Exception ex )
 | |
| 		{
 | |
| 			DialogException.showExceptionMessage( ex, "Erro a carregar detalhes", true );
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	protected void recarregarPrestadores()
 | |
| 	{
 | |
| 		try
 | |
| 		{
 | |
| 			IDObject prestadoresConsultas[] = prestadoresProvider.getPrestadoresConsultasActivos();
 | |
| 			IDObject prestadoresECDs[] = prestadoresProvider.getPrestadoresECDsActivos();
 | |
| 			prestadoresConsultasCombo.removeAllItems();
 | |
| 			prestadoresConsultasCombo.addItem( PRESTADOR_SIPRP );
 | |
| 			for( int n = 0; n < prestadoresConsultas.length; n++ )
 | |
| 			{
 | |
| 				prestadoresConsultasCombo.addItem( prestadoresConsultas[ n ] );
 | |
| 			}
 | |
| 			prestadoresECDsCombo.removeAllItems();
 | |
| 			prestadoresECDsCombo.addItem( PRESTADOR_SIPRP );
 | |
| 			for( int n = 0; n < prestadoresECDs.length; n++ )
 | |
| 			{
 | |
| 				prestadoresECDsCombo.addItem( prestadoresECDs[ n ] );
 | |
| 			}
 | |
| 		}
 | |
| 		catch( Exception ex )
 | |
| 		{
 | |
| 			DialogException.showExceptionMessage( ex, "Erro a carregar prestadores", true );
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	protected void enviarECDs()
 | |
| 	{
 | |
| 		Date data = dataPanel.getDate();
 | |
| 		int selectedEstabelecimento = estabelecimentosTable.getSelectedRow();
 | |
| 		if( data == null || selectedEstabelecimento == -1 )
 | |
| 		{
 | |
| 			return;
 | |
| 		}
 | |
| 		Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selectedEstabelecimento ) ).getID();
 | |
| 		try
 | |
| 		{
 | |
| 			Integer prestadorID = ( ( IDObject ) prestadoresECDsCombo.getSelectedItem() ).getID();
 | |
| 			if( PRESTADOR_ID_SIPRP.equals( prestadorID ) )
 | |
| 			{
 | |
| 				prestadorID = null;
 | |
| 			}
 | |
| 			provider.setPrestadorIDForEstabelecimentoAndTipo( estabelecimentoID, 
 | |
| 					Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data, prestadorID );
 | |
| 		}
 | |
| 		catch( Exception ex )
 | |
| 		{
 | |
| 			DialogException.showExceptionMessage( ex, "Erro a atribuir", true );
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	protected void faxECDs()
 | |
| 	{
 | |
| 		Date data = dataPanel.getDate();
 | |
| 		int selectedEstabelecimento = estabelecimentosTable.getSelectedRow();
 | |
| 		if( data == null || selectedEstabelecimento == -1 )
 | |
| 		{
 | |
| 			return;
 | |
| 		}
 | |
| 		Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selectedEstabelecimento ) ).getID();
 | |
| 		try
 | |
| 		{
 | |
| 			Integer prestadorID = ( ( IDObject ) prestadoresECDsCombo.getSelectedItem() ).getID();
 | |
| 			if( PRESTADOR_ID_SIPRP.equals( prestadorID ) )
 | |
| 			{
 | |
| 				prestadorID = null;
 | |
| 			}
 | |
| 			provider.setPrestadorIDForEstabelecimentoAndTipo( estabelecimentoID, 
 | |
| 					Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data, prestadorID );
 | |
| 		}
 | |
| 		catch( Exception ex )
 | |
| 		{
 | |
| 			DialogException.showExceptionMessage( ex, "Erro a atribuir", true );
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	protected void enviarConsultas()
 | |
| 	{
 | |
| 		Date data = dataPanel.getDate();
 | |
| 		int selectedEstabelecimento = estabelecimentosTable.getSelectedRow();
 | |
| 		if( data == null || selectedEstabelecimento == -1 )
 | |
| 		{
 | |
| 			return;
 | |
| 		}
 | |
| 		Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selectedEstabelecimento ) ).getID();
 | |
| 		try
 | |
| 		{
 | |
| 			Integer prestadorID = ( ( IDObject ) prestadoresConsultasCombo.getSelectedItem() ).getID();
 | |
| 			if( PRESTADOR_ID_SIPRP.equals( prestadorID ) )
 | |
| 			{
 | |
| 				prestadorID = null;
 | |
| 			}
 | |
| 			provider.setPrestadorIDForEstabelecimentoAndTipo( estabelecimentoID, 
 | |
| 					Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA, data, prestadorID );
 | |
| 		}
 | |
| 		catch( Exception ex )
 | |
| 		{
 | |
| 			DialogException.showExceptionMessage( ex, "Erro a atribuir", true );
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	protected void faxConsultas()
 | |
| 	{
 | |
| 	}
 | |
| }
 |