git-svn-id: https://svn.coded.pt/svn/SIPRP@615 bb69d46d-e84e-40c8-a05a-06db0d633741

lxbfYeaa
Frederico Palma 18 years ago
parent 9b03f62a00
commit 2168b7e7a8

@ -7,7 +7,6 @@
<classpathentry kind="lib" path="SIPRPSoft/lib/jdo.jar"/> <classpathentry kind="lib" path="SIPRPSoft/lib/jdo.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/jdom.jar"/> <classpathentry kind="lib" path="SIPRPSoft/lib/jdom.jar"/>
<classpathentry kind="lib" path="lib.tools/servlet-api.jar"/> <classpathentry kind="lib" path="lib.tools/servlet-api.jar"/>
<classpathentry kind="lib" path="web/lib/commons-email-1.0-dev.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/TableLayout.jar"/> <classpathentry kind="lib" path="SIPRPSoft/lib/TableLayout.jar"/>
<classpathentry kind="lib" path="web/lib/commons-fileupload-1.0.jar"/> <classpathentry kind="lib" path="web/lib/commons-fileupload-1.0.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/jxl-2.6.jar"/> <classpathentry kind="lib" path="SIPRPSoft/lib/jxl-2.6.jar"/>
@ -26,6 +25,7 @@
<classpathentry kind="lib" path="SIPRPSoft/lib/commons-lang-2.1.jar"/> <classpathentry kind="lib" path="SIPRPSoft/lib/commons-lang-2.1.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/commons-logging-1.1.jar"/> <classpathentry kind="lib" path="SIPRPSoft/lib/commons-logging-1.1.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/postgresql-8.0-317.jdbc3.jar"/> <classpathentry kind="lib" path="SIPRPSoft/lib/postgresql-8.0-317.jdbc3.jar"/>
<classpathentry kind="lib" path="lib.common/mailapi.jar"/> <classpathentry kind="lib" path="web/lib/commons-email-1.0-dev.jar"/>
<classpathentry kind="lib" path="lib.common/mail.jar"/>
<classpathentry kind="output" path="build"/> <classpathentry kind="output" path="build"/>
</classpath> </classpath>

Binary file not shown.

@ -193,4 +193,13 @@ public class LocaisRealizacaoDataProvider
EXECUTER.executeQuery( update ); EXECUTER.executeQuery( update );
} }
} }
protected Object[][] getGruposEcdsEPrestadoresPorEstabelecimento( Integer estabelecimentoId )
throws Exception
{
return new Object[][]{ { new Integer( 1 ), "Sangue", new Integer( 1 ) },
{ new Integer( 2 ), "Sangue", new Integer( 1 ) },
{ new Integer( 3 ), "RX Torax", null },
{ new Integer( 4 ), "ECG", new Integer( 1 ) } };
}
} }

@ -9,20 +9,11 @@
package siprp.medicina.locais_realizacao; 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.TableLayout;
import info.clearthought.layout.TableLayoutConstraints; import info.clearthought.layout.TableLayoutConstraints;
import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
@ -30,6 +21,7 @@ import java.awt.event.WindowEvent;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.Vector; import java.util.Vector;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JComboBox; import javax.swing.JComboBox;
@ -44,9 +36,19 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import siprp.data.Marcacao; import siprp.data.Marcacao;
import siprp.medicina.prestadores.PrestadoresDataProvider; import siprp.medicina.prestadores.PrestadoresDataProvider;
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;
/** /**
* *
* @author fpalma * @author fpalma
@ -54,6 +56,11 @@ import siprp.medicina.prestadores.PrestadoresDataProvider;
public class LocaisRealizacaoWindow extends JFrame public class LocaisRealizacaoWindow extends JFrame
implements ActionListener, TrackableWindow, ListSelectionListener implements ActionListener, TrackableWindow, ListSelectionListener
{ {
/**
*
*/
private static final long serialVersionUID = 1L;
protected static final Integer PRESTADOR_ID_SIPRP = new Integer( -1 ); protected static final Integer PRESTADOR_ID_SIPRP = new Integer( -1 );
protected static final IDObject PRESTADOR_SIPRP = new MappableObject( PRESTADOR_ID_SIPRP, "SIPRP" ); protected static final IDObject PRESTADOR_SIPRP = new MappableObject( PRESTADOR_ID_SIPRP, "SIPRP" );
@ -69,10 +76,12 @@ public class LocaisRealizacaoWindow extends JFrame
protected JComboBox prestadoresConsultasCombo; protected JComboBox prestadoresConsultasCombo;
protected JButton enviarConsultasButton; protected JButton enviarConsultasButton;
protected JButton faxConsultasButton; protected JButton faxConsultasButton;
protected JLabel numeroECDsLabel; // protected JLabel numeroECDsLabel;
protected JComboBox prestadoresECDsCombo; protected Integer idsGruposEcds[];
protected JComboBox prestadoresECDsCombos[];
protected JButton enviarECDsButton; protected JButton enviarECDsButton;
protected JButton faxECDsButton; protected JScrollPane listaEcdsScroll;
// protected JButton faxECDsButton;
protected LocaisRealizacaoDataProvider provider; protected LocaisRealizacaoDataProvider provider;
@ -115,7 +124,7 @@ public class LocaisRealizacaoWindow extends JFrame
JPanel consultasPanel = new JPanel(); JPanel consultasPanel = new JPanel();
consultasPanel.setBorder( BorderFactory.createTitledBorder( consultasPanel.setBorder( BorderFactory.createTitledBorder(
BorderFactory.createEtchedBorder(), "Consultas" ) ); BorderFactory.createEtchedBorder(), "Consultas" ) );
JLabel consultasLabel = new JLabel( "Quantidade " ); JLabel consultasLabel = new JLabel( "N\u00ba de Consultas: " );
numeroConsultasLabel = new JLabel( " " ); numeroConsultasLabel = new JLabel( " " );
numeroConsultasLabel.setForeground( Color.green.darker() ); numeroConsultasLabel.setForeground( Color.green.darker() );
prestadoresConsultasCombo = new JComboBox(); prestadoresConsultasCombo = new JComboBox();
@ -126,14 +135,17 @@ public class LocaisRealizacaoWindow extends JFrame
JPanel ecdsPanel = new JPanel(); JPanel ecdsPanel = new JPanel();
ecdsPanel.setBorder( BorderFactory.createTitledBorder( ecdsPanel.setBorder( BorderFactory.createTitledBorder(
BorderFactory.createEtchedBorder(), "ECDs" ) ); BorderFactory.createEtchedBorder(), "ECDs" ) );
JLabel ecdsLabel = new JLabel( "Quantidade " ); // JLabel ecdsLabel = new JLabel( "Quantidade " );
numeroECDsLabel = new JLabel( " " ); // numeroECDsLabel = new JLabel( " " );
numeroECDsLabel.setForeground( Color.green.darker() ); // numeroECDsLabel.setForeground( Color.green.darker() );
prestadoresECDsCombo = new JComboBox(); // prestadoresECDsCombo = new JComboBox();
listaEcdsScroll = new JScrollPane();
listaEcdsScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED );
listaEcdsScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED );
enviarECDsButton = new JButton( "Atribuir" ); enviarECDsButton = new JButton( "Atribuir" );
enviarECDsButton.addActionListener( this ); enviarECDsButton.addActionListener( this );
faxECDsButton = new JButton( "Fax" ); // faxECDsButton = new JButton( "Fax" );
faxECDsButton.addActionListener( this ); // faxECDsButton.addActionListener( this );
dataPanel.addChangeListener( new ChangeListener(){ dataPanel.addChangeListener( new ChangeListener(){
public void stateChanged(ChangeEvent e) public void stateChanged(ChangeEvent e)
{ {
@ -144,11 +156,26 @@ public class LocaisRealizacaoWindow extends JFrame
} }
} ); } );
getContentPane().setLayout( new BorderLayout( 5, 5 ) ); TableLayout layout =
new TableLayout(
new double[]{ TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL },
new double[]{ TableLayout.MINIMUM, TableLayout.FILL, TableLayout.FILL } );
layout.setHGap( 5 );
layout.setVGap( 5 );
// getContentPane().setLayout( new BorderLayout( 5, 5 ) );
getContentPane().setLayout( layout );
JPanel upperPanel = new JPanel(); JPanel upperPanel = new JPanel();
getContentPane().add( upperPanel, BorderLayout.NORTH ); getContentPane().add( upperPanel, new TableLayoutConstraints( 0, 0, 3, 0 ) );
JPanel centerPanel = new JPanel(); getContentPane().add( empresasScp, new TableLayoutConstraints( 0, 1, 1, 1 ) );
getContentPane().add( centerPanel, BorderLayout.CENTER ); getContentPane().add( estabelecimentosScp, new TableLayoutConstraints( 2, 1, 3, 1 ) );
// JPanel detalhesPanel = new JPanel();
// getContentPane().add( detalhesPanel, new TableLayoutConstraints( 0, 2, 1, 2 ) );
getContentPane().add( consultasPanel, new TableLayoutConstraints( 0, 2 ) );
getContentPane().add( ecdsPanel, new TableLayoutConstraints( 1, 2, 3, 2 ) );
// getContentPane().add( upperPanel, BorderLayout.NORTH );
// JPanel centerPanel = new JPanel();
// getContentPane().add( centerPanel, BorderLayout.CENTER );
upperPanel.setLayout( new FlowLayout( FlowLayout.CENTER ) ); upperPanel.setLayout( new FlowLayout( FlowLayout.CENTER ) );
upperPanel.add( dataLabel ); upperPanel.add( dataLabel );
@ -156,11 +183,11 @@ public class LocaisRealizacaoWindow extends JFrame
upperPanel.add( carregarButton ); upperPanel.add( carregarButton );
upperPanel.add( recarregarPrestadoresButton ); upperPanel.add( recarregarPrestadoresButton );
centerPanel.setLayout( new GridLayout( 1, 3 ) ); // centerPanel.setLayout( new GridLayout( 1, 3 ) );
centerPanel.add( empresasScp ); // centerPanel.add( empresasScp );
centerPanel.add( estabelecimentosScp ); // centerPanel.add( estabelecimentosScp );
JPanel detalhesPanel = new JPanel(); // JPanel detalhesPanel = new JPanel();
centerPanel.add( detalhesPanel ); // centerPanel.add( detalhesPanel );
double cols[] = double cols[] =
new double[]{ TableLayout.MINIMUM, TableLayout.FILL }; new double[]{ TableLayout.MINIMUM, TableLayout.FILL };
@ -176,25 +203,26 @@ public class LocaisRealizacaoWindow extends JFrame
consultasPanel.add( enviarConsultasButton, new TableLayoutConstraints( 0, 2, 1, 2 ) ); consultasPanel.add( enviarConsultasButton, new TableLayoutConstraints( 0, 2, 1, 2 ) );
// consultasPanel.add( faxConsultasButton, new TableLayoutConstraints( 0, 3, 1, 3 ) ); // consultasPanel.add( faxConsultasButton, new TableLayoutConstraints( 0, 3, 1, 3 ) );
rows = new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM }; rows = new double[]{ TableLayout.FILL, TableLayout.MINIMUM };
tableLayout = new TableLayout( cols,rows ); tableLayout = new TableLayout( cols,rows );
ecdsPanel.setLayout( tableLayout ); 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( listaEcdsScroll, new TableLayoutConstraints( 0, 0, 1, 0 ) );
ecdsPanel.add( enviarECDsButton, new TableLayoutConstraints( 0, 1, 1, 1 ) );
// ecdsPanel.add( faxECDsButton, new TableLayoutConstraints( 0, 3, 1, 3 ) );
ecdsPanel.add( ecdsLabel, new TableLayoutConstraints( 0, 0 ) ); // cols = new double[]{ TableLayout.FILL };
ecdsPanel.add( numeroECDsLabel, new TableLayoutConstraints( 1, 0 ) ); // rows = new double[]{ TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL };
ecdsPanel.add( prestadoresECDsCombo, new TableLayoutConstraints( 0, 1, 1, 1 ) ); //
ecdsPanel.add( enviarECDsButton, new TableLayoutConstraints( 0, 2, 1, 2 ) ); // tableLayout = new TableLayout( cols,rows );
ecdsPanel.add( faxECDsButton, new TableLayoutConstraints( 0, 3, 1, 3 ) ); // detalhesPanel.setLayout( tableLayout );
//
cols = new double[]{ TableLayout.FILL }; // detalhesPanel.add( consultasPanel, new TableLayoutConstraints( 0, 0 ) );
rows = new double[]{ TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL }; // detalhesPanel.add( ecdsPanel, new TableLayoutConstraints( 0, 1 ) );
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 ); setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE );
addWindowListener( new WindowAdapter(){ addWindowListener( new WindowAdapter(){
@ -263,10 +291,10 @@ public class LocaisRealizacaoWindow extends JFrame
{ {
enviarECDs(); enviarECDs();
} }
else if( source.equals( faxECDsButton ) ) // else if( source.equals( faxECDsButton ) )
{ // {
faxECDs(); // faxECDs();
} // }
} }
@ -341,7 +369,7 @@ public class LocaisRealizacaoWindow extends JFrame
Date data = dataPanel.getDate(); Date data = dataPanel.getDate();
int selectedEstabelecimento = estabelecimentosTable.getSelectedRow(); int selectedEstabelecimento = estabelecimentosTable.getSelectedRow();
numeroConsultasLabel.setText( " " ); numeroConsultasLabel.setText( " " );
numeroECDsLabel.setText( " " ); // numeroECDsLabel.setText( " " );
enviarConsultasButton.setEnabled( false ); enviarConsultasButton.setEnabled( false );
enviarECDsButton.setEnabled( false ); enviarECDsButton.setEnabled( false );
if( data == null || selectedEstabelecimento == -1 ) if( data == null || selectedEstabelecimento == -1 )
@ -354,9 +382,9 @@ public class LocaisRealizacaoWindow extends JFrame
int countConsultas = int countConsultas =
provider.getNumeroMarcacoesByEstabelecimentoAndTipo( estabelecimentoID, provider.getNumeroMarcacoesByEstabelecimentoAndTipo( estabelecimentoID,
Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA, data ); Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA, data );
int countECDs = // int countECDs =
provider.getNumeroMarcacoesByEstabelecimentoAndTipo( estabelecimentoID, // provider.getNumeroMarcacoesByEstabelecimentoAndTipo( estabelecimentoID,
Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data ); // Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data );
if( countConsultas > 0 ) if( countConsultas > 0 )
{ {
numeroConsultasLabel.setText( "" + countConsultas ); numeroConsultasLabel.setText( "" + countConsultas );
@ -396,45 +424,70 @@ public class LocaisRealizacaoWindow extends JFrame
} }
} }
} }
if( countECDs > 0 ) Object ecds[][] = provider.getGruposEcdsEPrestadoresPorEstabelecimento( estabelecimentoID );
JPanel ecdsPanel = new JPanel();
double rows[] = new double[ ecds.length + 1 ];
for( int n = 0; n < rows.length - 1; n++ )
{ {
numeroECDsLabel.setText( "" + countECDs ); rows[ n ] = TableLayoutConstraints.MINIMUM;
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 );
}
}
}
} }
rows[ rows.length - 1 ] = TableLayoutConstraints.FILL;
TableLayout layout =
new TableLayout(
new double[]{ TableLayoutConstraints.FILL, TableLayoutConstraints.MINIMUM,
TableLayoutConstraints.FILL },
rows );
ecdsPanel.setLayout( layout );
for( int n = 0; n < ecds.length; n++ )
{
JLabel ecdLabel = new JLabel( "" + ecds[ n ][ 1 ] );
JLabel numeroLabel = new JLabel( "" + ( ( n * 23 ) % 7 ), JLabel.RIGHT );
JComboBox prestadorCombo = new JComboBox();
prestadorCombo.addItem( "SIPRP" );
ecdsPanel.add( ecdLabel, new TableLayoutConstraints( 0, n ) );
ecdsPanel.add( numeroLabel, new TableLayoutConstraints( 1, n ) );
ecdsPanel.add( prestadorCombo, new TableLayoutConstraints( 2, n ) );
}
listaEcdsScroll.setViewportView( ecdsPanel );
// 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 ) catch( Exception ex )
{ {
@ -454,12 +507,12 @@ public class LocaisRealizacaoWindow extends JFrame
{ {
prestadoresConsultasCombo.addItem( prestadoresConsultas[ n ] ); prestadoresConsultasCombo.addItem( prestadoresConsultas[ n ] );
} }
prestadoresECDsCombo.removeAllItems(); // prestadoresECDsCombo.removeAllItems();
prestadoresECDsCombo.addItem( PRESTADOR_SIPRP ); // prestadoresECDsCombo.addItem( PRESTADOR_SIPRP );
for( int n = 0; n < prestadoresECDs.length; n++ ) // for( int n = 0; n < prestadoresECDs.length; n++ )
{ // {
prestadoresECDsCombo.addItem( prestadoresECDs[ n ] ); // prestadoresECDsCombo.addItem( prestadoresECDs[ n ] );
} // }
} }
catch( Exception ex ) catch( Exception ex )
{ {
@ -478,13 +531,13 @@ public class LocaisRealizacaoWindow extends JFrame
Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selectedEstabelecimento ) ).getID(); Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selectedEstabelecimento ) ).getID();
try try
{ {
Integer prestadorID = ( ( IDObject ) prestadoresECDsCombo.getSelectedItem() ).getID(); // Integer prestadorID = ( ( IDObject ) prestadoresECDsCombo.getSelectedItem() ).getID();
if( PRESTADOR_ID_SIPRP.equals( prestadorID ) ) // if( PRESTADOR_ID_SIPRP.equals( prestadorID ) )
{ // {
prestadorID = null; // prestadorID = null;
} // }
provider.setPrestadorIDForEstabelecimentoAndTipo( estabelecimentoID, // provider.setPrestadorIDForEstabelecimentoAndTipo( estabelecimentoID,
Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data, prestadorID ); // Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data, prestadorID );
} }
catch( Exception ex ) catch( Exception ex )
{ {
@ -492,30 +545,30 @@ public class LocaisRealizacaoWindow extends JFrame
} }
} }
protected void faxECDs() // protected void faxECDs()
{ // {
Date data = dataPanel.getDate(); // Date data = dataPanel.getDate();
int selectedEstabelecimento = estabelecimentosTable.getSelectedRow(); // int selectedEstabelecimento = estabelecimentosTable.getSelectedRow();
if( data == null || selectedEstabelecimento == -1 ) // if( data == null || selectedEstabelecimento == -1 )
{ // {
return; // return;
} // }
Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selectedEstabelecimento ) ).getID(); // Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selectedEstabelecimento ) ).getID();
try // try
{ // {
Integer prestadorID = ( ( IDObject ) prestadoresECDsCombo.getSelectedItem() ).getID(); // Integer prestadorID = ( ( IDObject ) prestadoresECDsCombo.getSelectedItem() ).getID();
if( PRESTADOR_ID_SIPRP.equals( prestadorID ) ) // if( PRESTADOR_ID_SIPRP.equals( prestadorID ) )
{ // {
prestadorID = null; // prestadorID = null;
} // }
provider.setPrestadorIDForEstabelecimentoAndTipo( estabelecimentoID, // provider.setPrestadorIDForEstabelecimentoAndTipo( estabelecimentoID,
Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data, prestadorID ); // Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data, prestadorID );
} // }
catch( Exception ex ) // catch( Exception ex )
{ // {
DialogException.showExceptionMessage( ex, "Erro a atribuir", true ); // DialogException.showExceptionMessage( ex, "Erro a atribuir", true );
} // }
} // }
protected void enviarConsultas() protected void enviarConsultas()
{ {

@ -12,6 +12,9 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
import java.util.Vector; import java.util.Vector;
@ -23,6 +26,7 @@ import javax.swing.JButton;
import javax.swing.JComboBox; import javax.swing.JComboBox;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JTextField; import javax.swing.JTextField;
@ -40,6 +44,7 @@ import com.evolute.utils.images.ImageIconLoader;
import com.evolute.utils.tables.BaseTable; import com.evolute.utils.tables.BaseTable;
import com.evolute.utils.tables.VectorTableModel; import com.evolute.utils.tables.VectorTableModel;
import com.evolute.utils.ui.CustomJDialog; import com.evolute.utils.ui.CustomJDialog;
import com.evolute.utils.ui.DialogException;
public class MailDialog extends CustomJDialog public class MailDialog extends CustomJDialog
{ {
@ -493,63 +498,63 @@ public class MailDialog extends CustomJDialog
public void send() public void send()
{ {
close(); // close();
// String to = toText.getText(); String to = toText.getText();
// String bcc = bccText.getText(); String bcc = bccText.getText();
// String subject = subjectText.getText(); String subject = subjectText.getText();
// String body = bodyPane.getText(); String body = bodyPane.getText();
// String attachmentList[] = new String[ attachmentsTable.getRowCount() ]; String attachmentList[] = new String[ attachmentsTable.getRowCount() ];
// byte attachments[][] = new byte[ attachmentsTable.getRowCount() ][]; byte attachments[][] = new byte[ attachmentsTable.getRowCount() ][];
// Vector values = attachmentsModel.getValues(); Vector values = attachmentsModel.getValues();
// for( int n = 0; n < attachmentList.length; n++ ) for( int n = 0; n < attachmentList.length; n++ )
// { {
// String str = ( String ) values.elementAt( n ); String str = ( String ) values.elementAt( n );
// String name = str.substring( 0, str.indexOf( "(") - 1 ); String name = str.substring( 0, str.indexOf( "(") - 1 );
// String path = str.substring( str.indexOf( "(") + 1, str.indexOf( ")") ); String path = str.substring( str.indexOf( "(") + 1, str.indexOf( ")") );
// try try
// { {
// FileInputStream fis = new FileInputStream( path + name ); FileInputStream fis = new FileInputStream( path + name );
// Vector<byte[]> bytes = new Vector<byte[]>(); Vector<byte[]> bytes = new Vector<byte[]>();
// int available = 0; int available = 0;
// int total = 0; int total = 0;
// while( ( available = fis.available() ) > 0 ) while( ( available = fis.available() ) > 0 )
// { {
// byte b[] = new byte[ available ]; byte b[] = new byte[ available ];
// fis.read( b ); fis.read( b );
// bytes.add( b ); bytes.add( b );
// total += available; total += available;
// } }
// attachments[ n ] = new byte[ total ]; attachments[ n ] = new byte[ total ];
// int pos = 0; int pos = 0;
// for( byte[] chunk : bytes ) for( byte[] chunk : bytes )
// { {
// System.arraycopy( chunk, 0, attachments[ n ], pos, chunk.length ); System.arraycopy( chunk, 0, attachments[ n ], pos, chunk.length );
// pos += chunk.length; pos += chunk.length;
// } }
// } }
// catch( FileNotFoundException fnfex ) catch( FileNotFoundException fnfex )
// { {
// JOptionPane.showMessageDialog( owner, JOptionPane.showMessageDialog( owner,
// "O ficheiro " + path + name + " n\u00e3o existe.", "O ficheiro " + path + name + " n\u00e3o existe.",
// "Ficheiro inexistente", "Ficheiro inexistente",
// JOptionPane.ERROR_MESSAGE ); JOptionPane.ERROR_MESSAGE );
// return; return;
// } }
// catch( IOException ioex ) catch( IOException ioex )
// { {
// DialogException.showExceptionMessage( ioex, "Erro a ler ficheiro " + path + name, true ); DialogException.showExceptionMessage( ioex, "Erro a ler ficheiro " + path + name, true );
// return; return;
// } }
// } }
// MailSender sender = new MailSender(); MailSender sender = new MailSender();
// try try
// { {
// sender.send( to, bcc, subject, body, attachmentList, attachments ); sender.send( to, bcc, subject, body, attachmentList, attachments );
// } }
// catch( Exception ex ) catch( Exception ex )
// { {
// ex.printStackTrace(); ex.printStackTrace();
// } }
} }
public void close() public void close()

@ -16,7 +16,7 @@ public class MailSender
protected String from = "fpalma@evolute.pt"; protected String from = "fpalma@evolute.pt";
protected String mailServer = "mail2.evolute.pt"; protected String mailServer = "mail2.evolute.pt";
protected String userName = "fpalma@evolute.pt"; protected String userName = "fpalma@evolute.pt";
protected String password = "UNIX.Luvs.U"; protected String password = "";
public MailSender() public MailSender()
{ {

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save