no message

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

@ -357,7 +357,7 @@ public class MedicinaDataProvider extends MetaProvider
return id;
}
public Object[][] getListaMarcacoesByData( Date data )
public Object[][] getListaConsultasByData( Date data )
throws Exception
{
Select2 select =
@ -372,7 +372,33 @@ public class MedicinaDataProvider extends MetaProvider
new Field( "marcacoes_trabalhador.data" ).isEqual( data ).and(
new Field( "marcacoes_trabalhador.estado" ).notIn(
new Integer[]{ new Integer( Marcacao.ESTADO_DESMARCADA_TRABALHADOR ),
new Integer( Marcacao.ESTADO_DESMARCADA_SHST ) } )),
new Integer( Marcacao.ESTADO_DESMARCADA_SHST ) } ) ).and(
new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ),
null,
null,
null,
null );
Virtual2DArray array = executer.executeQuery( select );
return array.getObjects();
}
public Object[][] getListaECDsByData( Date data )
throws Exception
{
Select2 select =
new Select2( new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos", "empresas" },
new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER },
new Expression[]{
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ),
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ),
new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) },
new String[]{ "marcacoes_trabalhador.id", "trabalhadores.nome", "trabalhadores.nome_plain",
"empresas.designacao_social", "marcacoes_trabalhador.tipo"},
new Field( "marcacoes_trabalhador.data" ).isEqual( data ).and(
new Field( "marcacoes_trabalhador.estado" ).notIn(
new Integer[]{ new Integer( Marcacao.ESTADO_DESMARCADA_TRABALHADOR ),
new Integer( Marcacao.ESTADO_DESMARCADA_SHST ) } ) ).and(
new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ),
null,
null,
null,

@ -48,17 +48,7 @@ public class Presenca
public String toString()
{
String str = "";
if( tipo.intValue() == Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA )
{
str = "consulta";
}
else if( tipo.intValue() == Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES )
{
str = "ecds";
}
str += " - " + getNome();
return str;
return getNome();
}
public Integer getId()

@ -40,8 +40,10 @@ public class RegistarPresencasWindow extends JFrame
{
protected JCalendarPanel dataPanel;
protected JButton carregarButton;
protected JScrollPane listScroll;
protected MultipleActionListPanel listPanel;
protected JScrollPane listECDsScroll;
protected JScrollPane listConsultasScroll;
protected MultipleActionListPanel listECDsPanel;
protected MultipleActionListPanel listConsultasPanel;
protected MedicinaDataProvider provider;
@ -80,16 +82,28 @@ public class RegistarPresencasWindow extends JFrame
getContentPane().setLayout( new BorderLayout( 5, 5 ) );
JPanel upperPanel = new JPanel();
getContentPane().add( upperPanel, BorderLayout.NORTH );
JTabbedPane tabbedPane = new JTabbedPane();
getContentPane().add( tabbedPane, BorderLayout.CENTER );
listPanel =
listECDsPanel =
new MultipleActionListPanel(
new PresencasActionFactory[]{ shstDesmarcouFactory, faltouFactory },
new PresencasActionFactory[]{ realizouFactory, realizouParcialmenteFactory,
trabalhadorDesmarcouFactory, shstDesmarcouFactory,
faltouFactory } );
listScroll = new JScrollPane( listPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
listECDsScroll = new JScrollPane( listECDsPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
getContentPane().add( listScroll, BorderLayout.CENTER );
listConsultasPanel =
new MultipleActionListPanel(
new PresencasActionFactory[]{ shstDesmarcouFactory, faltouFactory },
new PresencasActionFactory[]{ realizouFactory, trabalhadorDesmarcouFactory,
shstDesmarcouFactory, faltouFactory } );
listConsultasScroll = new JScrollPane( listConsultasPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
tabbedPane.add( "ECDs", listECDsScroll );
tabbedPane.add( "Consultas", listConsultasScroll );
upperPanel.setLayout( new FlowLayout( FlowLayout.CENTER ) );
upperPanel.add( dataLabel );
@ -152,20 +166,35 @@ public class RegistarPresencasWindow extends JFrame
try
{
Date data = dataPanel.getDate();
Object marcacoesArray[][] = provider.getListaMarcacoesByData( data );
List<Presenca> marcacoes = new Vector<Presenca>();
for( int n = 0; n < marcacoesArray.length; n++ )
Object ecdsArray[][] = provider.getListaECDsByData( data );
List<Presenca> ecds = new Vector<Presenca>();
for( int n = 0; n < ecdsArray.length; n++ )
{
Integer id = ( Integer ) ecdsArray[ n ][ 0 ];
String nome = ( String ) ecdsArray[ n ][ 1 ];
String nomePlain = ( String ) ecdsArray[ n ][ 2 ];
String empresa = ( String ) ecdsArray[ n ][ 3 ];
int tipo = ( ( Integer )ecdsArray[ n ][ 4 ] ).intValue();
ecds.add( new Presenca( id, nome, nomePlain, empresa, tipo ) );
}
Collections.sort( ecds );
listECDsPanel.showList( ecds.toArray( new Presenca[ ecds.size() ] ) );
listECDsScroll.setViewportView( listECDsPanel );
Object consultasArray[][] = provider.getListaConsultasByData( data );
List<Presenca> consultas = new Vector<Presenca>();
for( int n = 0; n < consultasArray.length; n++ )
{
Integer id = ( Integer ) marcacoesArray[ n ][ 0 ];
String nome = ( String ) marcacoesArray[ n ][ 1 ];
String nomePlain = ( String ) marcacoesArray[ n ][ 2 ];
String empresa = ( String ) marcacoesArray[ n ][ 3 ];
int tipo = ( ( Integer )marcacoesArray[ n ][ 4 ] ).intValue();
marcacoes.add( new Presenca( id, nome, nomePlain, empresa, tipo ) );
Integer id = ( Integer ) consultasArray[ n ][ 0 ];
String nome = ( String ) consultasArray[ n ][ 1 ];
String nomePlain = ( String ) consultasArray[ n ][ 2 ];
String empresa = ( String ) consultasArray[ n ][ 3 ];
int tipo = ( ( Integer )consultasArray[ n ][ 4 ] ).intValue();
consultas.add( new Presenca( id, nome, nomePlain, empresa, tipo ) );
}
Collections.sort( marcacoes );
listPanel.showList( marcacoes.toArray( new Presenca[ marcacoes.size() ] ) );
listScroll.setViewportView( listPanel );
Collections.sort( consultas );
listConsultasPanel.showList( consultas.toArray( new Presenca[ ecds.size() ] ) );
listConsultasScroll.setViewportView( listConsultasPanel );
// setExtendedState( getExtendedState() | MAXIMIZED_BOTH );
}
catch( Exception ex )

Loading…
Cancel
Save