no message

git-svn-id: https://svn.coded.pt/svn/SIPRP@279 bb69d46d-e84e-40c8-a05a-06db0d633741
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Frederico Palma 19 years ago
parent 8158165e69
commit 7a43465bb5

@ -356,4 +356,28 @@ public class MedicinaDataProvider extends MetaProvider
}
return id;
}
public Object[][] getListaMarcacoesByData( 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 ) } )),
null,
null,
null,
null );
Virtual2DArray array = executer.executeQuery( select );
return array.getObjects();
}
}

@ -0,0 +1,114 @@
/*
* Presenca.java
*
* Created on February 1, 2007, 4:54 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package siprp.medicina.presencas;
import com.evolute.utils.data.IDObject;
import siprp.data.Marcacao;
/**
*
* @author fpalma
*/
public class Presenca
implements IDObject, Comparable
{
protected Integer id;
protected String nome;
protected String nomePlain;
protected String nomeEmpresa;
protected Integer tipo;
/** Creates a new instance of Presenca */
public Presenca( Integer id, String nome, String nomePlain, String nomeEmpresa,
Integer tipo )
{
this.setId(id);
this.setNome(nome);
this.setNomePlain(nomePlain);
this.setNomeEmpresa(nomeEmpresa);
this.setTipo(tipo);
}
public Integer getID()
{
return getId();
}
public int compareTo( Object other )
{
return getNomePlain().compareTo( ( ( Presenca ) other ).getNomePlain() );
}
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;
}
public Integer getId()
{
return id;
}
public void setId(Integer id)
{
this.id = id;
}
public String getNome()
{
return nome;
}
public void setNome(String nome)
{
this.nome = nome;
}
public String getNomePlain()
{
return nomePlain;
}
public void setNomePlain(String nomePlain)
{
this.nomePlain = nomePlain;
}
public String getNomeEmpresa()
{
return nomeEmpresa;
}
public void setNomeEmpresa(String nomeEmpresa)
{
this.nomeEmpresa = nomeEmpresa;
}
public Integer getTipo()
{
return tipo;
}
public void setTipo(Integer tipo)
{
this.tipo = tipo;
}
}

@ -22,7 +22,7 @@ import siprp.medicina.presencas.actions.RealizouParcialmenteAction;
*
* @author fpalma
*/
public class PresencasActionFactory implements ActionFactory
public class PresencasActionFactory implements ActionFactory<Presenca>
{
public static final int REALIZOU = 0;
public static final int REALIZOU_PARCIALMENTE = 1;
@ -38,7 +38,7 @@ public class PresencasActionFactory implements ActionFactory
TIPO = tipo;
}
public Action createAction(IDObject[] objects)
public Action createAction(Presenca[] objects)
{
switch( TIPO )
{
@ -53,7 +53,7 @@ public class PresencasActionFactory implements ActionFactory
}
}
public Action createAction(IDObject object)
public Action createAction(Presenca object)
{
switch( TIPO )
{
@ -61,7 +61,7 @@ public class PresencasActionFactory implements ActionFactory
return new RealizouAction();
case REALIZOU_PARCIALMENTE:
return new RealizouParcialmenteAction();
return new RealizouParcialmenteAction( object );
case TRABALHADOR_DESMARCOU:
return new DesmarcadoTrabalhadorAction();

@ -11,7 +11,9 @@ package siprp.medicina.presencas;
import com.evolute.utils.data.IDObject;
import com.evolute.utils.data.MappableObject;
import com.evolute.utils.strings.StringPlainer;
import com.evolute.utils.tracker.TrackableWindow;
import com.evolute.utils.ui.DialogException;
import com.evolute.utils.ui.calendar.JCalendarPanel;
import com.evolute.utils.ui.panel.multipleactionlist.MultipleActionListPanel;
import java.awt.BorderLayout;
@ -20,7 +22,14 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Vector;
import javax.swing.*;
import siprp.data.Marcacao;
import siprp.medicina.MedicinaDataProvider;
/**
*
@ -34,6 +43,8 @@ public class RegistarPresencasWindow extends JFrame
protected JScrollPane listScroll;
protected MultipleActionListPanel listPanel;
protected MedicinaDataProvider provider;
public static void main( String args[] )
throws Exception
{
@ -46,6 +57,7 @@ public class RegistarPresencasWindow extends JFrame
public RegistarPresencasWindow()
throws Exception
{
provider = ( MedicinaDataProvider ) MedicinaDataProvider.getProvider();
setupComponents();
}
@ -53,6 +65,7 @@ public class RegistarPresencasWindow extends JFrame
private void setupComponents()
{
setTitle( "Presen\u00e7as" );
setSize( 1000, 700 );
JLabel dataLabel = new JLabel( "Data" );
dataPanel = new JCalendarPanel( this );
carregarButton = new JButton( "Carregar" );
@ -64,7 +77,7 @@ public class RegistarPresencasWindow extends JFrame
PresencasActionFactory shstDesmarcouFactory = new PresencasActionFactory( PresencasActionFactory.SHST_DESMARCOU );
PresencasActionFactory faltouFactory = new PresencasActionFactory( PresencasActionFactory.FALTOU );
getContentPane().setLayout( new BorderLayout() );
getContentPane().setLayout( new BorderLayout( 5, 5 ) );
JPanel upperPanel = new JPanel();
getContentPane().add( upperPanel, BorderLayout.NORTH );
@ -89,16 +102,23 @@ public class RegistarPresencasWindow extends JFrame
{
close();
}
public void windowOpened( WindowEvent e )
{
// setExtendedState( getExtendedState() | MAXIMIZED_BOTH );
}
} );
}
public void actionPerformed( ActionEvent e )
{
listPanel.showList( new IDObject[]{
new MappableObject( new Integer( 1 ), "Sr. Fernando da loja ali da esquina" ),
new MappableObject( new Integer( 1 ), "Sr. Antonio da loja ao lado da do Sr. Fernando" ) } );
listScroll.setViewportView( listPanel );
Object source = e.getSource();
if( source.equals( carregarButton ) )
{
carregar();
}
}
public void refresh()
@ -108,7 +128,6 @@ public class RegistarPresencasWindow extends JFrame
public void open()
{
setVisible( true );
setExtendedState( getExtendedState() | MAXIMIZED_BOTH );
}
public void close()
@ -127,4 +146,31 @@ public class RegistarPresencasWindow extends JFrame
close();
return true;
}
protected void carregar()
{
try
{
Date data = dataPanel.getDate();
Object marcacoesArray[][] = provider.getListaMarcacoesByData( data );
List<Presenca> marcacoes = new Vector<Presenca>();
for( int n = 0; n < marcacoesArray.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 ) );
}
Collections.sort( marcacoes );
listPanel.showList( marcacoes.toArray( new Presenca[ marcacoes.size() ] ) );
listScroll.setViewportView( listPanel );
// setExtendedState( getExtendedState() | MAXIMIZED_BOTH );
}
catch( Exception ex )
{
DialogException.showExceptionMessage( ex, "Erro a carregar dados", true );
}
}
}

@ -11,6 +11,8 @@ package siprp.medicina.presencas.actions;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import siprp.data.Marcacao;
import siprp.medicina.presencas.Presenca;
/**
*
@ -18,11 +20,17 @@ import javax.swing.AbstractAction;
*/
public class RealizouParcialmenteAction extends AbstractAction
{
protected Presenca presenca;
/** Creates a new instance of RealizouParcialmenteAction */
public RealizouParcialmenteAction()
public RealizouParcialmenteAction( Presenca presenca )
{
super( "Realizou Parcialmente" );
super( "Parcialmente" );
this.presenca = presenca;
if( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA == presenca.getTipo().intValue() )
{
setEnabled( false );
}
}
public void actionPerformed(ActionEvent e)

Loading…
Cancel
Save