forked from Coded/SIPRP
git-svn-id: https://svn.coded.pt/svn/SIPRP@1519 bb69d46d-e84e-40c8-a05a-06db0d633741
parent
275f3163f1
commit
8ece47d6b7
Binary file not shown.
@ -1,745 +0,0 @@
|
||||
/*
|
||||
* FichaDataProvider.java
|
||||
*
|
||||
* Created on 30 de Marco de 2004, 11:31
|
||||
*/
|
||||
|
||||
package siprp;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import shst.data.AvisoConstants;
|
||||
import shst.data.Marcacao;
|
||||
import shst.data.outer.MarcacoesTrabalhadorData;
|
||||
|
||||
import com.evolute.utils.Singleton;
|
||||
import com.evolute.utils.arrays.Virtual2DArray;
|
||||
import com.evolute.utils.data.IDObject;
|
||||
import com.evolute.utils.data.MappableObject;
|
||||
import com.evolute.utils.db.DBManager;
|
||||
import com.evolute.utils.db.Executer;
|
||||
import com.evolute.utils.sql.Assignment;
|
||||
import com.evolute.utils.sql.Expression;
|
||||
import com.evolute.utils.sql.Field;
|
||||
import com.evolute.utils.sql.Select;
|
||||
import com.evolute.utils.sql.Select2;
|
||||
import com.evolute.utils.sql.Update;
|
||||
import com.evolute.utils.strings.StringPlainer;
|
||||
import com.evolute.utils.ui.search.SearchDialog;
|
||||
import com.evolute.utils.ui.search.SearchExecuter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author pars
|
||||
*/
|
||||
public class FichaDataProvider
|
||||
implements SearchExecuter {
|
||||
|
||||
private static final Object LOCK = new Object();
|
||||
private static FichaDataProvider instance = null;
|
||||
private final Executer executer;
|
||||
|
||||
public static final String SIPRP = "SIPRP - Sociedade Ib\u00e9rica de Preven\u00e7\u00e3o de Riscos Profissionais";
|
||||
|
||||
// empresas
|
||||
public static final String T_EMPRESAS = "empresas";
|
||||
public static final String ID = "id";
|
||||
public static final String DESIGNACAO_SOCIAL = "designacao_social";
|
||||
public static final String SERVICO_SAUDE_TIPO = "servico_saude_tipo";
|
||||
public static final String SERVICO_SAUDE_DESIGNACAO = "servico_saude_designacao";
|
||||
public static final String SERVICO_HIGIENE_TIPO = "servico_higiene_tipo";
|
||||
public static final String SERVICO_HIGIENE_DESIGNACAO = "servico_higiene_designacao";
|
||||
public static final String INACTIVO = "inactivo";
|
||||
|
||||
// public static final DBTable EMPRESAS =
|
||||
// new DBTable( T_EMPRESAS,
|
||||
// new String[]{ DESIGNACAO_SOCIAL,
|
||||
// SERVICO_SAUDE_TIPO,
|
||||
// SERVICO_SAUDE_DESIGNACAO,
|
||||
// SERVICO_HIGIENE_TIPO,
|
||||
// SERVICO_HIGIENE_DESIGNACAO,
|
||||
// INACTIVO },
|
||||
// ID );
|
||||
|
||||
// estabelecimentos
|
||||
public static final String T_ESTABELECIMENTOS = "estabelecimentos";
|
||||
// ID
|
||||
public static final String NOME = "nome";
|
||||
public static final String LOCALIDADE = "localidade";
|
||||
public static final String EMPRESA_ID = "empresa_id";
|
||||
// INACTIVO
|
||||
|
||||
// public static final DBTable ESTABELECIMENTOS =
|
||||
// new DBTable( T_ESTABELECIMENTOS,
|
||||
// new String[]{ NOME, LOCALIDADE, EMPRESA_ID, INACTIVO },
|
||||
// ID );
|
||||
|
||||
// trabalhadores
|
||||
public static final String T_TRABALHADORES = "trabalhadores";
|
||||
// ID
|
||||
// public static final String NOME = "nome";
|
||||
public static final String SEXO = "sexo";
|
||||
public static final String DATA_NASCIMENTO = "data_nascimento";
|
||||
public static final String NACIONALIDADE = "nacionalidade";
|
||||
public static final String NUMERO_MECANOGRAFICO = "numero_mecanografico";
|
||||
public static final String DATA_ADMISSAO = "data_admissao";
|
||||
public static final String CATEGORIA = "categoria";
|
||||
public static final String LOCAL_TRABALHO = "local_trabalho";
|
||||
public static final String FUNCAO_PROPOSTA = "funcao_proposta";
|
||||
public static final String DATA_ADMISSAO_FUNCAO = "data_admissao_funcao";
|
||||
public static final String OBSERVACOES = "observacoes";
|
||||
public static final String ESTABELECIMENTO_ID = "estabelecimento_id";
|
||||
// INACTIVO
|
||||
|
||||
// public static final DBTable TRABALHADORES =
|
||||
// new DBTable( T_TRABALHADORES,
|
||||
// new String[]{ NOME, SEXO, DATA_NASCIMENTO,
|
||||
// NACIONALIDADE, NUMERO_MECANOGRAFICO,
|
||||
// DATA_ADMISSAO, CATEGORIA, LOCAL_TRABALHO,
|
||||
// FUNCAO_PROPOSTA, DATA_ADMISSAO_FUNCAO,
|
||||
// OBSERVACOES, ESTABELECIMENTO_ID, INACTIVO },
|
||||
// ID );
|
||||
|
||||
//medicos
|
||||
public static final String T_MEDICOS = "medicos";
|
||||
|
||||
public static final String NUMERO_CEDULA = "numero_cedula";
|
||||
|
||||
// public static final DBTable MEDICOS =
|
||||
// new DBTable( T_MEDICOS,
|
||||
// new String[]{ NOME, NUMERO_CEDULA }, ID );
|
||||
|
||||
// exames
|
||||
public static final String T_EXAMES = "exames";
|
||||
// ID
|
||||
public static final String DATA = "data";
|
||||
public static final String TIPO = "tipo";
|
||||
public static final String OCASIONAL = "ocasional";
|
||||
public static final String OUTRO_TIPO = "outro_tipo";
|
||||
public static final String RESULTADO = "resultado";
|
||||
public static final String OUTRA_FUNCAO_1 = "outra_funcao_1";
|
||||
public static final String OUTRA_FUNCAO_2 = "outra_funcao_2";
|
||||
public static final String OUTRA_FUNCAO_3 = "outra_funcao_3";
|
||||
public static final String OUTRA_FUNCAO_4 = "outra_funcao_4";
|
||||
public static final String PROXIMO_EXAME = "proximo_exame";
|
||||
public static final String OUTRAS_RECOMENDACOES = "outras_recomendacoes";
|
||||
public static final String TRABALHADOR_ID = "trabalhador_id";
|
||||
public static final String MEDICO_ID = "medico_id";
|
||||
public static final String PDF = "pdf";
|
||||
|
||||
// public static final DBTable EXAMES =
|
||||
// new DBTable( T_EXAMES,
|
||||
// new String[]{ DATA, TIPO, OCASIONAL,
|
||||
// OUTRO_TIPO, RESULTADO, OUTRA_FUNCAO_1,
|
||||
// OUTRA_FUNCAO_2, OUTRA_FUNCAO_3,
|
||||
// OUTRA_FUNCAO_4, PROXIMO_EXAME,
|
||||
// OUTRAS_RECOMENDACOES, TRABALHADOR_ID, MEDICO_ID, PDF, INACTIVO },
|
||||
// ID );
|
||||
//
|
||||
// public static DBReference R_ESTABELECIMENTO_EMPRESA = new DBReference( ESTABELECIMENTOS.getFieldByName( EMPRESA_ID ) );
|
||||
// public static DBReference R_TRABALHADOR_ESTABELECIMENTO = new DBReference( TRABALHADORES.getFieldByName( ESTABELECIMENTO_ID ) );
|
||||
// public static DBReference R_EXAME_TRABALHADOR = new DBReference( EXAMES.getFieldByName( TRABALHADOR_ID ) );
|
||||
// public static DBReference R_EXAME_MEDICO = new DBReference( EXAMES.getFieldByName( MEDICO_ID ) );
|
||||
// static
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// EXAMES.addRelation( MEDICOS,
|
||||
// new DBField[]{ EXAMES.getFieldByName( MEDICO_ID ) },
|
||||
// "R_EXAMES_MEDICOS" );
|
||||
// EXAMES.addRelation( TRABALHADORES,
|
||||
// new DBField[]{ EXAMES.getFieldByName( TRABALHADOR_ID ) },
|
||||
// "R_EXAMES_TRABALHADORES" );
|
||||
// TRABALHADORES.addRelation( ESTABELECIMENTOS,
|
||||
// new DBField[]{ TRABALHADORES.getFieldByName( ESTABELECIMENTO_ID ) },
|
||||
// "R_TRABALHADORES_ESTABELECIMENTOS" );
|
||||
// ESTABELECIMENTOS.addRelation( EMPRESAS,
|
||||
// new DBField[]{ ESTABELECIMENTOS.getFieldByName( EMPRESA_ID ) },
|
||||
// "R_ESTABELECIMENTOS_EMPRESAS" );
|
||||
// EMPRESAS.disableSave( INACTIVO );
|
||||
// ESTABELECIMENTOS.disableSave( INACTIVO );
|
||||
// TRABALHADORES.disableSave( INACTIVO );
|
||||
// EXAMES.disableSave( PDF );
|
||||
// }
|
||||
// catch( Exception e )
|
||||
// {
|
||||
// throw new RuntimeException( e );
|
||||
// }
|
||||
// }
|
||||
|
||||
public static final int SEARCH_EMPRESAS = 0;
|
||||
public static final int SEARCH_ESTABELECIMENTOS = 1;
|
||||
public static final int SEARCH_TRABALHADORES = 2;
|
||||
public static final int SEARCH_EXAMES = 3;
|
||||
private int SEARCH = 0;
|
||||
private int SEARCH_EMPRESAS_ID = -1;
|
||||
private int SEARCH_ESTABELECIMENTOS_ID = -1;
|
||||
private int SEARCH_TRABALHADORES_ID = -1;
|
||||
private int SEARCH_EXAMES_ID = -1;
|
||||
|
||||
protected final Map<Integer,Integer> medicosEstabelecimentosHash = new HashMap<Integer,Integer>();
|
||||
|
||||
/** Creates a new instance of FichaDataProvider */
|
||||
private FichaDataProvider()
|
||||
throws Exception
|
||||
{
|
||||
DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ );
|
||||
executer = dbm.getSharedExecuter( this );
|
||||
|
||||
// setDBTable( EXAMES );
|
||||
|
||||
}
|
||||
|
||||
// public static MetaProvider getProvider()
|
||||
// throws Exception
|
||||
// {
|
||||
// synchronized( LOCK )
|
||||
// {
|
||||
// if( instance == null )
|
||||
// {
|
||||
// instance = new FichaDataProvider();
|
||||
// }
|
||||
// }
|
||||
// return instance;
|
||||
// }
|
||||
|
||||
public static FichaDataProvider getProvider()
|
||||
throws Exception
|
||||
{
|
||||
synchronized( LOCK )
|
||||
{
|
||||
if( instance == null )
|
||||
{
|
||||
instance = new FichaDataProvider();
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public String[] getColumnNames() {
|
||||
return new String[]{ "Nome" };
|
||||
}
|
||||
|
||||
public String getSearchTitle() {
|
||||
switch( SEARCH )
|
||||
{
|
||||
case SEARCH_EMPRESAS:
|
||||
return "Procurar empresa";
|
||||
case SEARCH_ESTABELECIMENTOS:
|
||||
return "Procurar estabelecimento";
|
||||
case SEARCH_TRABALHADORES:
|
||||
return "Procurar trabalhador";
|
||||
case SEARCH_EXAMES:
|
||||
return "Procurar exame";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public boolean hasDetails() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setSearch( int what )
|
||||
{
|
||||
switch( what )
|
||||
{
|
||||
case SEARCH_EMPRESAS:
|
||||
case SEARCH_ESTABELECIMENTOS:
|
||||
case SEARCH_TRABALHADORES:
|
||||
case SEARCH_EXAMES:
|
||||
SEARCH = what;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void setSearchID( int what, int id )
|
||||
{
|
||||
switch( what )
|
||||
{
|
||||
case SEARCH_EMPRESAS:
|
||||
SEARCH_EMPRESAS_ID = id;
|
||||
break;
|
||||
case SEARCH_ESTABELECIMENTOS:
|
||||
SEARCH_ESTABELECIMENTOS_ID = id;
|
||||
break;
|
||||
case SEARCH_TRABALHADORES:
|
||||
SEARCH_TRABALHADORES_ID = id;
|
||||
break;
|
||||
case SEARCH_EXAMES:
|
||||
SEARCH_EXAMES_ID = id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public Virtual2DArray search( String pattern ) throws Exception {
|
||||
switch( SEARCH )
|
||||
{
|
||||
case SEARCH_EMPRESAS:
|
||||
return searchEmpresas( pattern );
|
||||
case SEARCH_ESTABELECIMENTOS:
|
||||
return searchEstabelecimentos( pattern );
|
||||
case SEARCH_TRABALHADORES:
|
||||
return searchTrabalhadores( pattern );
|
||||
case SEARCH_EXAMES:
|
||||
return searchExames( pattern );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Virtual2DArray searchEmpresas( String pattern ) throws Exception {
|
||||
Select select = new Select( new String[]{ T_EMPRESAS },
|
||||
new String[]{ ID, DESIGNACAO_SOCIAL, "designacao_social_plain" },
|
||||
new Field( "designacao_social_plain" ).isLike( "%" + StringPlainer.convertString( pattern, false, false ) + "%" ).and(
|
||||
new Field( INACTIVO ).isDifferent( "y" ) ),
|
||||
new String[]{ "designacao_social_plain" }, null );
|
||||
// Select select = new Select( "SELECT e.id, e.designacao_social FROM empresas e ORDER BY lower( e.designacao_social );" );
|
||||
return executer.executeQuery( select );
|
||||
}
|
||||
|
||||
public Virtual2DArray searchEstabelecimentos( String pattern ) throws Exception {
|
||||
// Select select = new Select( "SELECT e.id, e.nome FROM estabelecimentos e WHERE empresa_id = " + SEARCH_EMPRESAS_ID
|
||||
// + " ORDER BY lower( e.nome )");
|
||||
Select select = new Select( new String[]{ T_ESTABELECIMENTOS },
|
||||
new String[]{ ID, NOME, "nome_plain" },
|
||||
new Field( "nome_plain" ).isLike( "%" + StringPlainer.convertString( pattern, false, false ) + "%" ).and(
|
||||
new Field( EMPRESA_ID ).isEqual( new Integer( SEARCH_EMPRESAS_ID ) ) ).and(
|
||||
new Field( INACTIVO ).isDifferent( "y" ) ),
|
||||
new String[]{ "nome_plain" }, null );
|
||||
return executer.executeQuery( select );
|
||||
}
|
||||
|
||||
public Virtual2DArray searchTrabalhadores( String pattern ) throws Exception {
|
||||
// Select select =
|
||||
// new Select( "SELECT t.id, t.nome FROM trabalhadores t, estabelecimentos es "
|
||||
// + " WHERE t.estabelecimento_id = es.id "
|
||||
// + " AND es.empresa_id = " + SEARCH_EMPRESAS_ID + " ORDER BY lower(t.nome);" );
|
||||
Select select = new Select( new String[]{ T_TRABALHADORES, T_ESTABELECIMENTOS },
|
||||
new String[]{ T_TRABALHADORES + "." + ID, T_TRABALHADORES + "." + NOME },
|
||||
new Field( T_TRABALHADORES + ".nome_plain" ).isLike( "%" + StringPlainer.convertString( pattern, false, false ) + "%" ).and(
|
||||
new Field( ESTABELECIMENTO_ID ).isEqual( new Field( T_ESTABELECIMENTOS + "." + ID ) ) ).and(
|
||||
new Field( ESTABELECIMENTO_ID ).isEqual( new Integer( SEARCH_ESTABELECIMENTOS_ID ) ) ).and(
|
||||
new Field( EMPRESA_ID ).isEqual( new Integer( SEARCH_EMPRESAS_ID ) ) ).and(
|
||||
new Field( T_TRABALHADORES + "." + INACTIVO ).isDifferent( "y" ) ),
|
||||
new String[]{ T_TRABALHADORES + ".nome_plain" }, null );
|
||||
return executer.executeQuery( select );
|
||||
}
|
||||
|
||||
public Virtual2DArray searchExames( String pattern ) throws Exception {
|
||||
Select select = new Select( "SELECT e.id, e.data FROM exames e "
|
||||
+ " WHERE e.trabalhador_id = " + SEARCH_TRABALHADORES_ID
|
||||
+ " ORDER BY e.data DESC;" );
|
||||
return executer.executeQuery( select );
|
||||
}
|
||||
|
||||
public void showDetails(SearchDialog dialog, Object o) throws Exception {
|
||||
}
|
||||
|
||||
public Object [][]getAllMedicos()
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ T_MEDICOS },
|
||||
new String[]{ ID, NOME, NUMERO_CEDULA },
|
||||
null, new String[]{ NOME }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
return array.getObjects();
|
||||
}
|
||||
|
||||
// public void savePDF( MetaObject exame )
|
||||
// throws Exception
|
||||
// {
|
||||
// if( exame == null )
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// DBKey key = exame.getPrimaryKeyValue();
|
||||
// DBField fields[] = EXAMES.getPrimaryKey();
|
||||
// Integer id = new Integer( ((Number)key.getFieldValue( fields[ 0 ] )).intValue() );
|
||||
// if( id == null )
|
||||
// {
|
||||
// throw new Exception( "Error saving pdf: id is null" );
|
||||
// }
|
||||
// byte []pdf = (byte[]) exame.getProperty( PDF );
|
||||
// BlobUpdate bUpdate = new BlobUpdate( T_EXAMES, PDF, pdf, new Field( ID ).isEqual( id ) );
|
||||
// executer.executeQuery( bUpdate );
|
||||
// }
|
||||
|
||||
public Integer getLastExameIDForTrabalhador( Integer trabalhadorID )
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ T_EXAMES },
|
||||
new String[]{ ID, DATA },
|
||||
new Field( TRABALHADOR_ID ).isEqual( trabalhadorID ),
|
||||
new String[]{ DATA + " DESC", ID + " DESC" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 0 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Integer( ( (Number) array.get( 0, 0 ) ).intValue() );
|
||||
}
|
||||
|
||||
public IDObject []getAllFichasForTrabalhador( Integer trabalhadorID )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ T_EXAMES }, new String[]{ "MAX("+ID+")", DATA },
|
||||
new Field( TRABALHADOR_ID ).isEqual( trabalhadorID ).and(
|
||||
new Field( INACTIVO ).isEqual( "n" ) ),
|
||||
new String[]{ DATA + " DESC" }, new String[]{ DATA } );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
IDObject exames[] = new IDObject[ array.columnLength() ];
|
||||
DateFormat df = DateFormat.getDateInstance( DateFormat.SHORT );
|
||||
for( int n = 0; n < exames.length; n++ )
|
||||
{
|
||||
Date date = (Date)array.get( n, 1 );
|
||||
Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() );
|
||||
exames[ n ] = new MappableObject( id, date != null? df.format( date ): "" );
|
||||
}
|
||||
return exames;
|
||||
}
|
||||
|
||||
public IDObject []getAllEstabelecimentosForEmpresa( Integer empresaID )
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ T_ESTABELECIMENTOS },
|
||||
new String[]{ ID, NOME, "nome_plain" },
|
||||
new Field( EMPRESA_ID ).isEqual( empresaID ).and(
|
||||
new Field( INACTIVO ).isDifferent( "y" ) ),
|
||||
new String[]{ "nome_plain" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
IDObject objects[] = new IDObject[ array.columnLength() ];
|
||||
for( int n = 0; n < objects.length; n++ )
|
||||
{
|
||||
Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() );
|
||||
String desc = (String)array.get( n, 1 );
|
||||
objects[ n ] = new MappableObject( id, desc );
|
||||
}
|
||||
return objects;
|
||||
}
|
||||
|
||||
public IDObject []getAllTrabalhadoresForEmpresa( Integer empresaID )
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ T_TRABALHADORES, T_ESTABELECIMENTOS },
|
||||
new String[]{ T_TRABALHADORES + "." + ID,
|
||||
T_TRABALHADORES + "." + NOME,
|
||||
T_TRABALHADORES + ".nome_plain" },
|
||||
new Field( T_ESTABELECIMENTOS + "." + EMPRESA_ID ).isEqual( empresaID ).and(
|
||||
new Field( T_TRABALHADORES + "." + ESTABELECIMENTO_ID ).isEqual(
|
||||
new Field( T_ESTABELECIMENTOS + "." + ID ) ) ),
|
||||
new String[]{ T_TRABALHADORES + ".nome_plain" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
IDObject objects[] = new IDObject[ array.columnLength() ];
|
||||
for( int n = 0; n < objects.length; n++ )
|
||||
{
|
||||
Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() );
|
||||
String desc = (String)array.get( n, 1 );
|
||||
objects[ n ] = new MappableObject( id, desc );
|
||||
}
|
||||
return objects;
|
||||
}
|
||||
|
||||
public IDObject []getAllTrabalhadoresForEstabelecimento( Integer estabelecimentoID )
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ T_TRABALHADORES },
|
||||
new String[]{ ID, NOME, "nome_plain" },
|
||||
new Field( ESTABELECIMENTO_ID ).isEqual( estabelecimentoID ).and(
|
||||
new Field( INACTIVO ).isDifferent( "y" ) ),
|
||||
new String[]{ "nome_plain" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
IDObject objects[] = new IDObject[ array.columnLength() ];
|
||||
for( int n = 0; n < objects.length; n++ )
|
||||
{
|
||||
Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() );
|
||||
String desc = (String)array.get( n, 1 );
|
||||
objects[ n ] = new MappableObject( id, desc );
|
||||
}
|
||||
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 )
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ "avisos" }, new String[]{ "id", "data_evento" },
|
||||
new Field( "tipo" ).isEqual( tipo ).and(
|
||||
new Field( "data_aviso" ).isLessOrEqual( date )),
|
||||
new String[]{ "data_evento" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
Integer ids[] = new Integer[ array.columnLength() ];
|
||||
for( int n = 0; n < ids.length; n++ )
|
||||
{
|
||||
ids[ n ] = new Integer( ((Number)array.get( n, 0 )).intValue() );
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
public Object [][]getAvisosTrabalhadorByDate( Date date )
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ "avisos", "empresas", "estabelecimentos", "trabalhadores" },
|
||||
new String[]{ "avisos.id", "avisos.data_evento", "avisos.descricao",
|
||||
"empresas.designacao_social", "estabelecimentos.nome",
|
||||
"trabalhadores.nome", "data_aviso" },
|
||||
new Field( "tipo" ).isEqual( new Integer( AvisoConstants.TIPO_TRABALHADOR ) ).and(
|
||||
new Field( "data_aviso" ).isLessOrEqual( date ) ).and(
|
||||
new Field( "avisos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) ).and(
|
||||
new Field( "avisos.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
new Field( "avisos.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ),
|
||||
new String[]{ "data_evento" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
return array.getObjects();
|
||||
}
|
||||
|
||||
public Object [][]getAvisosEstabelecimentoByDate( Date date )
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ "avisos", "empresas", "estabelecimentos" },
|
||||
new String[]{ "avisos.id", "avisos.data_evento", "avisos.descricao",
|
||||
"empresas.designacao_social", "estabelecimentos.nome", "data_aviso" },
|
||||
new Field( "tipo" ).isEqual( new Integer( AvisoConstants.TIPO_ESTABELECIMENTO ) ).and(
|
||||
new Field( "data_aviso" ).isLessOrEqual( date ) ).and(
|
||||
new Field( "avisos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) ).and(
|
||||
new Field( "avisos.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ),
|
||||
new String[]{ "data_evento" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
return array.getObjects();
|
||||
}
|
||||
|
||||
public Object [][]getAvisosEmpresaByDate( Date date )
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ "avisos", "empresas" },
|
||||
new String[]{ "avisos.id", "avisos.data_evento", "avisos.descricao",
|
||||
"empresas.designacao_social", "data_aviso" },
|
||||
new Field( "tipo" ).isEqual( new Integer( AvisoConstants.TIPO_EMPRESA ) ).and(
|
||||
new Field( "data_aviso" ).isLessOrEqual( date ) ).and(
|
||||
new Field( "avisos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) ),
|
||||
new String[]{ "data_evento" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
return array.getObjects();
|
||||
}
|
||||
|
||||
public Integer getMarcacaoIDByTrabalhador( Integer trabalhadorID )
|
||||
throws Exception
|
||||
{
|
||||
Select realizadaSelect =
|
||||
new Select( new String[]{ "marcacoes_trabalhador" },
|
||||
new String[]{ "MAX(data)" },
|
||||
new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and(
|
||||
new Field( "estado" ).isEqual( new Integer( 2 ) ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( MarcacoesTrabalhadorData.TIPO_CONSULTA ) ) ) );
|
||||
Virtual2DArray realizadaArray = executer.executeQuery( realizadaSelect );
|
||||
Date realizada = (Date) realizadaArray.get( 0, 0 );
|
||||
Select select;
|
||||
if( realizada == null )
|
||||
{
|
||||
select = new Select( new String[]{ "marcacoes_trabalhador" },
|
||||
new String[]{ "MIN(id)" },
|
||||
new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and(
|
||||
new Field( "estado" ).isEqual( new Integer( 0 ) ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( MarcacoesTrabalhadorData.TIPO_CONSULTA ) ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
select = new Select( new String[]{ "marcacoes_trabalhador" },
|
||||
new String[]{ "MIN(id)" },
|
||||
new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and(
|
||||
new Field( "estado" ).isEqual( new Integer( 0 ) ) ).and(
|
||||
new Field( "data" ).isGreater( realizada ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( MarcacoesTrabalhadorData.TIPO_CONSULTA ) ) ) );
|
||||
}
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 0 || array.get( 0, 0 ) == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Integer( ( ( Number ) array.get( 0, 0 ) ).intValue() );
|
||||
}
|
||||
|
||||
public IDObject[] getAllEmpresasDeleted()
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ T_EMPRESAS },
|
||||
new String[]{ ID, DESIGNACAO_SOCIAL, "designacao_social_plain" },
|
||||
new Field( INACTIVO ).isEqual( "y" ),
|
||||
new String[]{ "designacao_social_plain" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
IDObject empresas[] = new IDObject[ array.columnLength() ];
|
||||
for( int n = 0; n < array.columnLength(); n++ )
|
||||
{
|
||||
Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() );
|
||||
String designacao = ( String ) array.get( n, 1 );
|
||||
empresas[ n ] = new MappableObject( id, designacao );
|
||||
}
|
||||
return empresas;
|
||||
}
|
||||
|
||||
public IDObject []getAllEstabelecimentosDeletedForEmpresa( Integer empresaID )
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ T_ESTABELECIMENTOS },
|
||||
new String[]{ ID, NOME, "nome_plain" },
|
||||
new Field( EMPRESA_ID ).isEqual( empresaID ).and(
|
||||
new Field( INACTIVO ).isEqual( "y" ) ),
|
||||
new String[]{ "nome_plain" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
IDObject objects[] = new IDObject[ array.columnLength() ];
|
||||
for( int n = 0; n < objects.length; n++ )
|
||||
{
|
||||
Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() );
|
||||
String desc = (String)array.get( n, 1 );
|
||||
objects[ n ] = new MappableObject( id, desc );
|
||||
}
|
||||
return objects;
|
||||
}
|
||||
|
||||
public IDObject []getAllTrabalhadoresDeletedForEstabelecimento( Integer estabelecimentoID )
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ T_TRABALHADORES },
|
||||
new String[]{ ID, NOME, "nome_plain" },
|
||||
new Field( ESTABELECIMENTO_ID ).isEqual( estabelecimentoID ).and(
|
||||
new Field( INACTIVO ).isEqual( "y" ) ),
|
||||
new String[]{ "nome_plain" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
IDObject objects[] = new IDObject[ array.columnLength() ];
|
||||
for( int n = 0; n < objects.length; n++ )
|
||||
{
|
||||
Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() );
|
||||
String desc = (String)array.get( n, 1 );
|
||||
objects[ n ] = new MappableObject( id, desc );
|
||||
}
|
||||
return objects;
|
||||
}
|
||||
|
||||
public Object[] getDadosUltimaMarcacao( Integer trabalhadorID )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador" },
|
||||
new String[]{ "MAX( data )" },
|
||||
new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and(
|
||||
new Field( "realizada" ).isEqual( "y" ).or(
|
||||
new Field( "estado" ).isEqual( new Integer( 2 ) ) ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 0 || array.get( 0, 0 ) == null )
|
||||
{
|
||||
return new Object[]{ null, null };
|
||||
}
|
||||
Date data = ( Date ) array.get( 0, 0 );
|
||||
select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador" },
|
||||
new String[]{ "motivo", "id" },
|
||||
new Field( "data" ).isEqual( data ).and(
|
||||
new Field( "trabalhador_id" ).isEqual( trabalhadorID ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and(
|
||||
new Field( "realizada" ).isEqual( "y" ).or(
|
||||
new Field( "estado" ).isEqual( new Integer( 2 ) ) ) ),
|
||||
new String[]{ "id" }, null );
|
||||
array = executer.executeQuery( select );
|
||||
Integer tipo = ( Integer ) array.get( 0, 0 );
|
||||
if( tipo.intValue() == 5 )
|
||||
{
|
||||
tipo = new Integer( 2 );
|
||||
}
|
||||
return new Object[]{ data, tipo };
|
||||
}
|
||||
|
||||
public void setMedicoForEstabelecimento( Integer estabelecimentoID, Integer medicoID )
|
||||
throws Exception
|
||||
{
|
||||
Integer medicoAntigo = medicosEstabelecimentosHash.get( estabelecimentoID );
|
||||
if( !medicoID.equals( medicoAntigo ) )
|
||||
{
|
||||
Update update =
|
||||
new Update( "estabelecimentos",
|
||||
new Assignment[]{
|
||||
new Assignment( new Field( "medico_id" ), medicoID ) },
|
||||
new Field( "id" ).isEqual( estabelecimentoID ) );
|
||||
executer.executeQuery( update );
|
||||
medicosEstabelecimentosHash.put( estabelecimentoID, medicoID );
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getMedicoForEstabelecimento( Integer estabelecimentoID )
|
||||
throws Exception
|
||||
{
|
||||
if( !medicosEstabelecimentosHash.containsKey( estabelecimentoID ) )
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "estabelecimentos" },
|
||||
new String[]{ "medico_id" },
|
||||
new Field( "id" ).isEqual( estabelecimentoID ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
Integer medicoID = ( Integer ) array.get( 0, 0 );
|
||||
if( medicoID == null )
|
||||
{
|
||||
medicoID = new Integer( -1 );
|
||||
}
|
||||
medicosEstabelecimentosHash.put( estabelecimentoID, medicoID );
|
||||
}
|
||||
return ( Integer ) medicosEstabelecimentosHash.get( estabelecimentoID );
|
||||
}
|
||||
|
||||
public Long countTrabalhadoresActivosForEmpresa( Integer empresaID )
|
||||
throws Exception
|
||||
{
|
||||
Long result = 0L;
|
||||
Select2 query = new Select2( new String[]{ "trabalhadores", "estabelecimentos", "empresas" },
|
||||
new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER },
|
||||
new Expression[]{
|
||||
new Field("estabelecimentos.id").isEqual(new Field("trabalhadores.estabelecimento_id")),
|
||||
new Field("empresas.id").isEqual( new Field("estabelecimentos.empresa_id") ) },
|
||||
new String[]{"count(trabalhadores.id)" },
|
||||
new Field("empresas.id").isEqual( empresaID ).
|
||||
and( new Field("trabalhadores.inactivo").isEqual( "n" ) ).
|
||||
and( new Field("trabalhadores.data_demissao").isEqual( null ) ).
|
||||
and( new Field("estabelecimentos.inactivo").isEqual( "n" ) ),
|
||||
null, null, null, null );
|
||||
Virtual2DArray returned = executer.executeQuery( query );
|
||||
if( returned.columnLength() > 0 )
|
||||
{
|
||||
result = (Long) returned.get( 0, 0 );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -1,797 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.1" exclude-result-prefixes="fo">
|
||||
<xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes" />
|
||||
<xsl:template match="AnaliseAcidente">
|
||||
<fo:root>
|
||||
<fo:layout-master-set>
|
||||
<fo:simple-page-master master-name="simpleA4" page-height="29.7cm" page-width="21cm" margin-top="1.5cm" margin-bottom="1.5cm" margin-left="2cm" margin-right="2cm">
|
||||
<fo:region-body margin-bottom="16pt" />
|
||||
<fo:region-after extent="10pt" display-align="after" />
|
||||
</fo:simple-page-master>
|
||||
</fo:layout-master-set>
|
||||
<fo:page-sequence master-reference="simpleA4">
|
||||
<fo:static-content flow-name="xsl-region-after">
|
||||
<fo:block font-size="8pt" text-align="right">
|
||||
Página
|
||||
<fo:inline>
|
||||
<fo:page-number />
|
||||
</fo:inline>
|
||||
de
|
||||
<fo:inline>
|
||||
<fo:page-number-citation ref-id="endofdoc" />
|
||||
</fo:inline>
|
||||
</fo:block>
|
||||
</fo:static-content>
|
||||
<fo:flow flow-name="xsl-region-body">
|
||||
<fo:block>
|
||||
<!-- TABELA 1 -->
|
||||
<fo:table table-layout="fixed" width="100%">
|
||||
<fo:table-column column-width="proportional-column-width(25)" />
|
||||
<fo:table-column column-width="proportional-column-width(25)" />
|
||||
<fo:table-column column-width="proportional-column-width(25)" />
|
||||
<fo:table-column column-width="proportional-column-width(25)" />
|
||||
<fo:table-body>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" border-width="thin" number-columns-spanned="1">
|
||||
<fo:block>
|
||||
<!--fo:external-graphic src="url('siprp_logo.gif')"/-->
|
||||
imagem1
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
<fo:table-cell border-color="black" border-style="solid" border-width="thin" number-columns-spanned="2">
|
||||
<fo:block font-size="8pt" text-align="center" space-before="0.3cm" space-before.conditionality="retain" space-after="0.3cm" margin-left="0.2cm" font-weight="bold">ANÁLISE DE ACIDENTE DE TRABALHO</fo:block>
|
||||
<fo:block>
|
||||
<fo:table table-layout="fixed" width="100%">
|
||||
<fo:table-column column-width="proportional-column-width(50)" />
|
||||
<fo:table-column column-width="proportional-column-width(50)" />
|
||||
<fo:table-body>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-top-color="black" border-top-style="solid" border-top-width="thin" number-columns-spanned="1">
|
||||
<fo:block text-align="start" font-size="8pt" space-before="0.3cm" space-after="0.3cm" space-before.conditionality="retain" margin-left="0.2cm" font-weight="bold">
|
||||
N.º
|
||||
<xsl:value-of select="Numero" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
<fo:table-cell border-left-color="black" border-left-style="solid" border-left-width="thin" border-top-color="black" border-top-style="solid" border-top-width="thin" number-columns-spanned="1">
|
||||
<fo:block text-align="start" font-size="8pt" space-before="0.3cm" space-after="0.3cm" space-before.conditionality="retain" margin-left="0.2cm" font-weight="bold">
|
||||
DATA:
|
||||
<xsl:value-of select="Data/Ano" />
|
||||
/
|
||||
<xsl:value-of select="Data/Mes" />
|
||||
/
|
||||
<xsl:value-of select="Data/Dia" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
</fo:table-body>
|
||||
</fo:table>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
<fo:table-cell border-color="black" border-style="solid" border-width="thin" number-columns-spanned="1">
|
||||
<fo:block font-size="8pt" space-before="0.3cm" space-after="0.3cm" margin-left="0.2cm" font-weight="bold">
|
||||
imagem2
|
||||
<!--<fo:external-graphic src="url('auchan_logo.gif')"/> -->
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
</fo:table-body>
|
||||
</fo:table>
|
||||
<!-- TABELA 2 -->
|
||||
<fo:table table-layout="fixed" space-before="5mm" width="100%">
|
||||
<fo:table-column />
|
||||
<fo:table-body>
|
||||
<fo:table-row background-color="rgb(165,0,33)" font-weight="bold">
|
||||
<fo:table-cell padding="2pt" border-color="black" border-style="solid" margin-left="0.2cm" font-size="8pt" number-columns-spanned="1">
|
||||
<fo:block margin-left="0.2cm" space-before="0.1cm">IDENTIFICAÇÃO DA
|
||||
ENTIDADE EMPREGADORA</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row background-color="rgb(255,204,153)">
|
||||
<fo:table-cell border-color="black" border-style="solid">
|
||||
<fo:block space-before="0.1cm" margin-left="0.2cm" font-size="8pt" number-columns-spanned="1">
|
||||
<fo:inline font-weight="bold">Identificação
|
||||
completa:</fo:inline>
|
||||
<xsl:value-of select="EntidadeEmpregadora/IdentificacaoCompleta" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row background-color="rgb(255,204,153)">
|
||||
<fo:table-cell border-color="black" border-style="solid">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt" number-columns-spanned="1">
|
||||
<fo:inline font-weight="bold">Actividade desenvolvida:</fo:inline>
|
||||
<xsl:value-of select="EntidadeEmpregadora/Actividade" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid">
|
||||
<fo:block font-size="8pt" space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" number-columns-spanned="1">
|
||||
<fo:inline font-weight="bold">Loja:</fo:inline>
|
||||
<xsl:value-of select="EntidadeEmpregadora/Loja" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
</fo:table-body>
|
||||
</fo:table>
|
||||
<!-- TABELA 3 -->
|
||||
<fo:table table-layout="fixed" space-before="5mm" width="100%">
|
||||
<fo:table-column />
|
||||
<fo:table-body>
|
||||
<fo:table-row background-color="rgb(165,0,33)" font-weight="bold">
|
||||
<fo:table-cell border-color="black" border-style="solid">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">EMPRESA SEGURADORA</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row background-color="rgb(255,204,153)">
|
||||
<fo:table-cell border-color="black" border-style="solid">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Identificação
|
||||
completa:</fo:inline>
|
||||
<xsl:value-of select="Seguro/Empresa" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row background-color="rgb(255,204,153)">
|
||||
<fo:table-cell border-color="black" border-style="solid">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Nº de Apólice:</fo:inline>
|
||||
<xsl:value-of select="Seguro/Apolice" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
</fo:table-body>
|
||||
</fo:table>
|
||||
<!-- TABELA 4 -->
|
||||
<fo:table table-layout="fixed" space-before="5mm" width="100%">
|
||||
<fo:table-column column-width="proportional-column-width(70)" />
|
||||
<fo:table-column column-width="proportional-column-width(30)" />
|
||||
<fo:table-body>
|
||||
<fo:table-row background-color="rgb(165,0,33)" font-weight="bold">
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">EMPRESA PRESTADORA DE
|
||||
SERVIÇOS DE
|
||||
SEGURANÇA, HIGIENE E
|
||||
SAÚDE DO TRABALHO</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row background-color="rgb(255,204,153)">
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Identificação
|
||||
completa:</fo:inline>
|
||||
<xsl:value-of select="EmpresaSHST/IdentificacaoCompleta" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Técnico(a) Superior
|
||||
de HST:</fo:inline>
|
||||
<xsl:value-of select="EmpresaSHST/TecnicoSuperiorHST/Nome" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
<fo:table-cell border-color="black" border-style="solid">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">C.A.P. nº::</fo:inline>
|
||||
<xsl:value-of select="EmpresaSHST/TecnicoSuperiorHST/CAP" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Médico(a) do
|
||||
Trabalho:</fo:inline>
|
||||
<xsl:value-of select="EmpresaSHST/MedicoTrabalho/Nome" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
<fo:table-cell border-color="black" border-style="solid">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Cédula Prof. nº:</fo:inline>
|
||||
<xsl:value-of select="EmpresaSHST/MedicoTrabalho/Cedula" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
</fo:table-body>
|
||||
</fo:table>
|
||||
<!--Table5-->
|
||||
<fo:table table-layout="fixed" space-before="5mm" width="100%">
|
||||
<fo:table-column column-width="proportional-column-width(50)" />
|
||||
<fo:table-column column-width="proportional-column-width(50)" />
|
||||
<fo:table-body>
|
||||
<fo:table-row background-color="rgb(165,0,33)" font-weight="bold">
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt" font-weight="bold">ACIDENTADO (A)</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Nome:</fo:inline>
|
||||
<xsl:value-of select="Acidentado/Nome" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Estabelecimento de
|
||||
origem:</fo:inline>
|
||||
<xsl:value-of select="Acidentado/EstabelecimentoOrigem/Nome" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Data Nascimento:</fo:inline>
|
||||
<xsl:value-of select="Acidentado/DataNascimento/Ano" />
|
||||
/
|
||||
<xsl:value-of select="Acidentado/DataNascimento/Mes" />
|
||||
/
|
||||
<xsl:value-of select="Acidentado/DataNascimento/Dia" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Bilhete de Identidade
|
||||
N°:</fo:inline>
|
||||
<xsl:value-of select="Acidentado/BilheteIdentidade/Numero" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Morada</fo:inline>
|
||||
<xsl:value-of select="Acidentado/Morada" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Contacto
|
||||
telefónico:</fo:inline>
|
||||
<xsl:value-of select="Acidentado/Telefone" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Data admissão:</fo:inline>
|
||||
<xsl:value-of select="Acidentado/DataAdmissao/Ano" />
|
||||
/
|
||||
<xsl:value-of select="Acidentado/DataAdmissao/Mes" />
|
||||
/
|
||||
<xsl:value-of select="Acidentado/DataAdmissao/Dia" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Função:</fo:inline>
|
||||
<xsl:value-of select="Acidentado/Funcao" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Turno de Trabalho:</fo:inline>
|
||||
<xsl:value-of select="Acidentado/Turno" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-left-color="black" border-left-style="solid" border-right-color="black" border-right-style="solid" border-top-color="black" border-top-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt" font-weight="bold">Identificação do superior
|
||||
hierárquico/Responsável do
|
||||
posto de trabalho</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-left-color="black" border-left-style="solid" border-bottom-color="black" border-bottom-style="solid" number-columns-spanned="1">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Nome:</fo:inline>
|
||||
<xsl:value-of select="Acidentado/Superior/Nome" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
<fo:table-cell border-bottom-color="black" border-bottom-style="solid" border-right-color="black" border-right-style="solid" number-columns-spanned="1">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">E-mail:</fo:inline>
|
||||
<xsl:value-of select="Acidentado/Superior/Email" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
</fo:table-body>
|
||||
</fo:table>
|
||||
<!--Table6-->
|
||||
<fo:table table-layout="fixed" space-before="5mm" width="100%">
|
||||
<fo:table-column column-width="proportional-column-width(50)" />
|
||||
<fo:table-column column-width="proportional-column-width(50)" />
|
||||
<fo:table-body>
|
||||
<fo:table-row background-color="rgb(165,0,33)" font-weight="bold">
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt" font-weight="bold">DADOS DO ACIDENTE DE
|
||||
TRABALHO</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Averiguador:</fo:inline>
|
||||
<xsl:value-of select="Acidente/Averiguador/Nome" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="1">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Data da ocorrência:</fo:inline>
|
||||
<xsl:value-of select="Acidente/DataOcorrencia/Ano" />
|
||||
/
|
||||
<xsl:value-of select="Acidente/DataOcorrencia/Mes" />
|
||||
/
|
||||
<xsl:value-of select="Acidente/DataOcorrencia/Dia" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="1">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Hora do acidente:</fo:inline>
|
||||
<xsl:value-of select="Acidente/HoraOcorrencia/Horas" />
|
||||
h
|
||||
<xsl:value-of select="Acidente/HoraOcorrencia/Minutos" />
|
||||
m
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Nº horas trabalhadas no
|
||||
turno:</fo:inline>
|
||||
<xsl:value-of select="Acidente/HorasTrabalhadas" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="1">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Secção:</fo:inline>
|
||||
<xsl:value-of select="Acidente/Local/Seccao" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="1">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Local específico:</fo:inline>
|
||||
<xsl:value-of select="Acidente/Local/LocalEspecifico" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Tarefa/Actividade que se
|
||||
encontrava a realizar:</fo:inline>
|
||||
<xsl:value-of select="Acidente/Actividade/Descricao" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Substâncias,
|
||||
equipamentos,
|
||||
ferramentas e objectos
|
||||
utilizados:</fo:inline>
|
||||
<xsl:value-of select="Acidente/Actividade/Objectos" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Condições que
|
||||
contribuíram para o
|
||||
acidente e respectiva
|
||||
explicação da
|
||||
sua existência:</fo:inline>
|
||||
<xsl:value-of select="Acidente/Actividade/Condicoes" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Testemunhas:</fo:inline>
|
||||
<xsl:value-of select="Acidente/Testemunhas" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Causas do acidente:</fo:inline>
|
||||
<xsl:value-of select="Acidente/Causas" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Descrição do
|
||||
acidente:</fo:inline>
|
||||
<xsl:value-of select="Acidente/Descricao" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Fotografia(s) e/ou
|
||||
croqui(s) do local do
|
||||
acidente:</fo:inline>
|
||||
<xsl:for-each select="Acidente/Imagens/Imagem">
|
||||
<!-- Inserir Imagem-->
|
||||
</xsl:for-each>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Conclusões:</fo:inline>
|
||||
<xsl:value-of select="Acidente/Conclusoes" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Acções Imediatas
|
||||
tomadas:</fo:inline>
|
||||
<xsl:value-of select="Acidente/AccoesTomadas" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<xsl:choose>
|
||||
<xsl:when test="self::node()[Acidente/FormacaoSHST/TeveFormacao='y']">
|
||||
<fo:inline font-weight="bold">O colaborador
|
||||
teve formação em SHST</fo:inline>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<fo:inline font-weight="bold">O colaborador não
|
||||
teve formação em SHST</fo:inline>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</fo:block>
|
||||
<xsl:choose>
|
||||
<xsl:when test="self::node()[Acidente/FormacaoSHST/TeveFormacao='y']">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Motivo:</fo:inline>
|
||||
<xsl:value-of select="Acidente/FormacaoSHST/Motivo" />
|
||||
</fo:block>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<xsl:choose>
|
||||
<xsl:when test="self::node()[Acidente/OutrasOcorrenciasMesmoPosto/Quantidade>0]">
|
||||
<fo:inline font-weight="bold">Verificaram-se outras
|
||||
ocorrências/incidências
|
||||
no mesmo posto de
|
||||
trabalho com o
|
||||
colaborador acidentado.</fo:inline>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<fo:inline font-weight="bold">Não se verificaram outras
|
||||
ocorrências/incidências
|
||||
no mesmo posto de
|
||||
trabalho com o
|
||||
colaborador acidentado.</fo:inline>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</fo:block>
|
||||
<xsl:choose>
|
||||
<xsl:when test="self::node()[Acidente/OutrasOcorrenciasMesmoPosto/Quantidade>0]">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Quantidade:</fo:inline>
|
||||
<xsl:value-of select="Acidente/OutrasOcorrenciasMesmoPosto/Quantidade" />
|
||||
<fo:inline font-weight="bold">Relatórios de acidente nº:</fo:inline>
|
||||
<xsl:for-each select="Acidente/OutrasOcorrenciasMesmoPosto/Relatorios/Relatorio">
|
||||
<xsl:value-of select="." />
|
||||
;
|
||||
</xsl:for-each>
|
||||
</fo:block>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<xsl:choose>
|
||||
<xsl:when test="self::node()[Acidente/OutrasOcorrenciasOutrosTrabalhadores/Quantidade>0]">
|
||||
<fo:inline font-weight="bold">Verificaram-se
|
||||
ocorrências/incidentes
|
||||
semelhantes com outros
|
||||
colaboradores.</fo:inline>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<fo:inline font-weight="bold">Não se verificaram
|
||||
ocorrências/incidentes
|
||||
semelhantes com outros
|
||||
colaboradores.</fo:inline>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</fo:block>
|
||||
<xsl:choose>
|
||||
<xsl:when test="self::node()[Acidente/OutrasOcorrenciasOutrosTrabalhadores/Quantidade>0]">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Quantidade:</fo:inline>
|
||||
<xsl:value-of select="Acidente/OutrasOcorrenciasOutrosTrabalhadores/Quantidade" />
|
||||
<fo:inline font-weight="bold">Relatórios de acidente nº:</fo:inline>
|
||||
<xsl:for-each select="Acidente/OutrasOcorrenciasOutrosTrabalhadores/Relatorios/Relatorio">
|
||||
<xsl:value-of select="." />
|
||||
;
|
||||
</xsl:for-each>
|
||||
</fo:block>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row background-color="rgb(165,0,33)" font-weight="bold">
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">LESÃO</fo:inline>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Áreas corporais
|
||||
específicas
|
||||
lesionadas:</fo:inline>
|
||||
</fo:block>
|
||||
<xsl:for-each select="Acidente/Lesao/Areas/Area">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<xsl:value-of select="Nome" />
|
||||
<xsl:value-of select="Detalhe" />
|
||||
</fo:block>
|
||||
</xsl:for-each>
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">
|
||||
Tipo de Lesão:
|
||||
<xsl:value-of select="Acidente/Lesao/Tipo" />
|
||||
</fo:inline>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row background-color="rgb(165,0,33)" font-weight="bold">
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">INCAPACIDADE</fo:inline>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="1">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Tipo de Incapacidade:</fo:inline>
|
||||
<xsl:value-of select="Acidente/Incapacidade/Tipo" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="1">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Coeficiente de
|
||||
Incapacidade</fo:inline>
|
||||
<xsl:value-of select="Acidente/Incapacidade/Coeficiente" />
|
||||
%
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="1">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Avaliação de
|
||||
Incapacidade realizada
|
||||
em</fo:inline>
|
||||
<xsl:value-of select="Acidente/Incapacidade/DataAvaliacao/Ano" />
|
||||
/
|
||||
<xsl:value-of select="Acidente/Incapacidade/DataAvaliacao/Mes" />
|
||||
/
|
||||
<xsl:value-of select="Acidente/Incapacidade/DataAvaliacao/Dia" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="1">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Revisão de
|
||||
Incapacidade</fo:inline>
|
||||
<xsl:value-of select="Acidente/Incapacidade/DataRevisao/Ano" />
|
||||
/
|
||||
<xsl:value-of select="Acidente/Incapacidade/DataRevisao/Mes" />
|
||||
/
|
||||
<xsl:value-of select="Acidente/Incapacidade/DataRevisao/Dia" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="2">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">Período da Incapacidade
|
||||
Temporária: de</fo:inline>
|
||||
<xsl:value-of select="Acidente/Incapacidade/PeriodoIncapacidade/Inicio/Ano" />
|
||||
/
|
||||
<xsl:value-of select="Acidente/Incapacidade/PeriodoIncapacidade/Inicio/Mes" />
|
||||
/
|
||||
<xsl:value-of select="Acidente/Incapacidade/PeriodoIncapacidade/Inicio/Dia" />
|
||||
<fo:inline font-weight="bold">a</fo:inline>
|
||||
<xsl:value-of select="Acidente/Incapacidade/PeriodoIncapacidade/Fim/Ano" />
|
||||
/
|
||||
<xsl:value-of select="Acidente/Incapacidade/PeriodoIncapacidade/Fim/Mes" />
|
||||
/
|
||||
<xsl:value-of select="Acidente/Incapacidade/PeriodoIncapacidade/Fim/Dia" />
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
</fo:table-body>
|
||||
</fo:table>
|
||||
<!--Table8-->
|
||||
<fo:table table-layout="fixed" space-before="5mm" width="100%">
|
||||
<fo:table-column />
|
||||
<fo:table-body>
|
||||
<fo:table-row background-color="rgb(165,0,33)" font-weight="bold">
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="1">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">RECOMENDAÇÕES PROPOSTAS
|
||||
pela SIPRP</fo:inline>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<xsl:for-each select="RecomendacoesSIPRP/Recomendacao">
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="1">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">
|
||||
<xsl:value-of select="position()" />
|
||||
.
|
||||
<xsl:value-of select="." />
|
||||
</fo:inline>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
</xsl:for-each>
|
||||
</fo:table-body>
|
||||
</fo:table>
|
||||
<!--Table9-->
|
||||
<fo:table table-layout="fixed" space-before="5mm" border="0.5pt solid black" width="100%">
|
||||
<fo:table-column />
|
||||
<fo:table-header background-color="rgb(165,0,33)" font-weight="bold">
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="1">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">MEDIDAS A ADOPTAR PELA
|
||||
ENTIDADE EMPREGADORA</fo:inline>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
</fo:table-header>
|
||||
<fo:table-body>
|
||||
<xsl:for-each select="MedidasAdoptar/Medida">
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="1">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">
|
||||
<xsl:value-of select="position()" />
|
||||
.
|
||||
<xsl:value-of select="." />
|
||||
</fo:inline>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
</xsl:for-each>
|
||||
<table-row xmlns="http://www.w3.org/1999/XSL/Format">
|
||||
<table-cell />
|
||||
</table-row>
|
||||
</fo:table-body>
|
||||
</fo:table>
|
||||
<fo:table table-layout="fixed" space-before="5mm" border="0.5pt solid black" width="100%">
|
||||
<fo:table-column />
|
||||
<fo:table-header background-color="rgb(165,0,33)" font-weight="bold">
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="1">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
<fo:inline font-weight="bold">TOMADA DE CONHECIMENTO /
|
||||
TERMO DE
|
||||
RESPONSABILIDADE</fo:inline>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
</fo:table-header>
|
||||
<fo:table-body>
|
||||
<fo:table-row>
|
||||
<fo:table-cell border-color="black" border-style="solid" number-columns-spanned="1">
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
Averiguado por
|
||||
<xsl:value-of select="TomadaConhecimento/DepartamentoSeguranca/Nome" />
|
||||
(Departamento de Segurança)
|
||||
a
|
||||
<xsl:value-of select="TomadaConhecimento/DepartamentoSeguranca/Data/Ano" />
|
||||
/
|
||||
<xsl:value-of select="TomadaConhecimento/DepartamentoSeguranca/Data/Mes" />
|
||||
/
|
||||
<xsl:value-of select="TomadaConhecimento/DepartamentoSeguranca/Data/Dia" />
|
||||
.
|
||||
</fo:block>
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
Verificado por
|
||||
<xsl:value-of select="TomadaConhecimento/TecnicoHST/Nome" />
|
||||
(Técnico
|
||||
de HST) a
|
||||
<xsl:value-of select="TomadaConhecimento/TecnicoHST/Data/Ano" />
|
||||
/
|
||||
<xsl:value-of select="TomadaConhecimento/TecnicoHST/Data/Mes" />
|
||||
/
|
||||
<xsl:value-of select="TomadaConhecimento/TecnicoHST/Data/Dia" />
|
||||
.
|
||||
</fo:block>
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
Verificado por
|
||||
<xsl:value-of select="TomadaConhecimento/ResponsavelSeguranca/Nome" />
|
||||
(Responsável de Segurança) a
|
||||
<xsl:value-of select="TomadaConhecimento/ResponsavelSeguranca/Data/Ano" />
|
||||
/
|
||||
<xsl:value-of select="TomadaConhecimento/ResponsavelSeguranca/Data/Mes" />
|
||||
/
|
||||
<xsl:value-of select="TomadaConhecimento/ResponsavelSeguranca/Data/Dia" />
|
||||
.
|
||||
</fo:block>
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
Verificado por
|
||||
<xsl:value-of select="TomadaConhecimento/ResponsavelRH/Nome" />
|
||||
(Responsável de RH) a
|
||||
<xsl:value-of select="TomadaConhecimento/ResponsavelRH/Data/Ano" />
|
||||
/
|
||||
<xsl:value-of select="TomadaConhecimento/ResponsavelRH/Data/Mes" />
|
||||
/
|
||||
<xsl:value-of select="TomadaConhecimento/ResponsavelRH/Data/Dia" />
|
||||
.
|
||||
</fo:block>
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
|
||||
Com conhecimento de
|
||||
<xsl:value-of select="TomadaConhecimento/SuperiorHierarquico/Nome" />
|
||||
(Superior hierárquico) a
|
||||
<xsl:value-of select="TomadaConhecimento/SuperiorHierarquico/Data/Ano" />
|
||||
/
|
||||
<xsl:value-of select="TomadaConhecimento/SuperiorHierarquico/Data/Mes" />
|
||||
/
|
||||
<xsl:value-of select="TomadaConhecimento/SuperiorHierarquico/Data/Dia" />
|
||||
.
|
||||
</fo:block>
|
||||
<fo:block space-before="0.1cm" space-after="0.1cm" margin-left="0.2cm" font-size="8pt">- processamento informático
|
||||
- acesso autenticado -</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
</fo:table-body>
|
||||
</fo:table>
|
||||
</fo:block>
|
||||
<fo:block id="endofdoc" />
|
||||
</fo:flow>
|
||||
</fo:page-sequence>
|
||||
</fo:root>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
|
||||
@ -1,20 +0,0 @@
|
||||
package siprp.cursos;
|
||||
|
||||
import shst.cursos.CursosInit;
|
||||
import siprp.cursos.provider.CursosTemplatesProvider;
|
||||
|
||||
import com.evolute.genericpeople.TemplateProviderFactory;
|
||||
|
||||
public class SIPRPCursosInit
|
||||
{
|
||||
|
||||
public static void initFactory() throws Exception
|
||||
{
|
||||
//default init
|
||||
CursosInit.initFactory();
|
||||
|
||||
//replace templates provider
|
||||
TemplateProviderFactory.setProvider( new CursosTemplatesProvider() );
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,175 +0,0 @@
|
||||
package siprp.cursos.provider;
|
||||
|
||||
import static com.evolute.utils.strings.UnicodeLatin1Map.atilde;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import shst.cursos.provider.PessoasProvider;
|
||||
|
||||
import com.evolute.genericpeople.AutorizacaoProviderInterface;
|
||||
import com.evolute.genericpeople.DefaultTemplateProvider;
|
||||
import com.evolute.genericpeople.PessoaDocumentoConstants;
|
||||
import com.evolute.genericpeople.PessoaDocumentoInterface;
|
||||
import com.evolute.genericpeople.PessoaInterface;
|
||||
import com.evolute.genericpeople.TemplateConstants;
|
||||
import com.evolute.module.cursos.CursosDataProvider;
|
||||
import com.evolute.module.cursos.CursosLogic;
|
||||
import com.evolute.module.cursos.data.CurCursosData;
|
||||
import com.evolute.module.cursos.data.CurFormandosData;
|
||||
import com.evolute.swing.frame.EvoFrame;
|
||||
import com.evolute.utils.Singleton;
|
||||
import com.evolute.utils.error.ErrorLogger;
|
||||
import com.evolute.utils.tables.ColumnizedObjectArray;
|
||||
import com.evolute.utils.xml.SimpleXMLElement;
|
||||
|
||||
public class CursosTemplatesProvider extends DefaultTemplateProvider
|
||||
{
|
||||
private CursosDataProvider cursosProvider = CursosDataProvider.getProvider();
|
||||
|
||||
public CursosTemplatesProvider()
|
||||
{
|
||||
setTemplate( TemplateConstants.SUMARIOS, "com/evolute/module/cursos/templates/sumarios.xsl" );
|
||||
setTemplate( TemplateConstants.LISTA_PRESENCAS, "com/evolute/module/cursos/templates/lista_presencas.xsl" );
|
||||
setTemplate( TemplateConstants.TOPICOS_FILE, "com/evolute/module/cursos/templates/topicos.xsl" );
|
||||
|
||||
setTemplate( TemplateConstants.CERTIFICADO_FORMANDO, "siprp/cursos/templates/certificado_formando.xsl" );
|
||||
setTemplate( TemplateConstants.CERTIFICADO_FORMADOR, "siprp/cursos/templates/certificado_formador.xsl" );
|
||||
|
||||
setTemplate( TemplateConstants.INSCRICAO_ACEITE, "com/evolute/module/cursos/templates/inscricao_aceite.xsl" );
|
||||
setTemplate( TemplateConstants.INSCRICAO_ACEITE_POPH, "com/evolute/module/cursos/templates/inscricao_aceite_POPH.xsl" );
|
||||
setTemplate( TemplateConstants.INSCRICAO_REJEITADA, "com/evolute/module/cursos/templates/inscricao_rejeitada.xsl" );
|
||||
setTemplate( TemplateConstants.CONFIRMAR_INSCRICAO, "com/evolute/module/cursos/templates/confirmar_inscricao.xsl" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleXMLElement getXMLForImpressaoFormador( boolean visualizar, CurCursosData curso, EvoFrame parent, List< ColumnizedObjectArray > formadores )
|
||||
throws Exception
|
||||
{
|
||||
return super.getXMLForImpressaoFormador( visualizar, curso, parent, formadores );
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleXMLElement getXMLForImpressaoFormando( boolean visualizar, CurCursosData curso, EvoFrame parent, List< ColumnizedObjectArray > formandos )
|
||||
throws Exception
|
||||
{
|
||||
SimpleXMLElement xml = null;
|
||||
if( formandos != null && !formandos.isEmpty() )
|
||||
{
|
||||
CurFormandosData formando = cursosProvider.getFormandoByID( formandos.get( 0 ).getID() );
|
||||
PessoaInterface pessoa = cursosProvider.getPessoaFromFormando( formando );
|
||||
|
||||
Integer numero = super.getNumeroCertificado( formando.getId(), curso.getId() );
|
||||
if( numero == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
String numCertificado = numero.toString();
|
||||
Calendar cal = Calendar.getInstance();
|
||||
String year = "" + cal.get( Calendar.YEAR );
|
||||
year = year.substring( 2, year.length() );
|
||||
numCertificado += "/" + year;
|
||||
|
||||
String nomePessoa = super.getNomePessoa( pessoa );
|
||||
if( nomePessoa == null )
|
||||
{
|
||||
JOptionPane.showMessageDialog( parent, "O nome do formando tem de estar preenchido!", "Erro", JOptionPane.ERROR_MESSAGE, null );
|
||||
return null;
|
||||
}
|
||||
|
||||
String sexo = pessoa.getSexo();
|
||||
if( sexo == null )
|
||||
{
|
||||
JOptionPane.showMessageDialog( parent, "O formador tem de ter o campo sexo preenchido", "Erro", JOptionPane.ERROR_MESSAGE, null);
|
||||
return null;
|
||||
}
|
||||
|
||||
String profissao = pessoa.getProfissao();
|
||||
if( profissao == null )
|
||||
{
|
||||
JOptionPane.showMessageDialog( parent, "A profiss" + atilde + "o do formando tem de estar preenchida!", "Erro", JOptionPane.ERROR_MESSAGE, null );
|
||||
return null;
|
||||
}
|
||||
|
||||
String naturalidade = pessoa.getNaturalidade();
|
||||
if( naturalidade == null )
|
||||
{
|
||||
JOptionPane.showMessageDialog( parent, "A naturalidade do formando tem de estar preenchida!", "Erro", JOptionPane.ERROR_MESSAGE, null );
|
||||
return null;
|
||||
}
|
||||
|
||||
String dataNascimento = super.getDataNascimento( pessoa );
|
||||
if( dataNascimento == null )
|
||||
{
|
||||
JOptionPane.showMessageDialog( parent, "A data de nascimento do formando tem de estar preenchida", "Erro", JOptionPane.ERROR_MESSAGE, null);
|
||||
return null;
|
||||
}
|
||||
|
||||
String nacionalidade = super.getNacionalidade( pessoa );
|
||||
if( nacionalidade == null )
|
||||
{
|
||||
JOptionPane.showMessageDialog( parent, "A nacionalidade do formando tem de estar preenchida", "Erro", JOptionPane.ERROR_MESSAGE, null);
|
||||
return null;
|
||||
}
|
||||
|
||||
PessoaDocumentoInterface doc = PessoasProvider.getProvider().getDocumentoByPessoaID( pessoa.getId(), PessoaDocumentoConstants.TIPO_DOCUMENTO_BI );
|
||||
String bi_numero = doc == null || "".equals( doc.getNumero().trim() ) ? "" : "portadora do Bilhete de Identidade nº " + doc.getNumero() + ", ";
|
||||
String bi_emissao = doc == null || "".equals( doc.getLocal_emissao().trim() ) ? "" : " emitido em " + doc.getLocal_emissao() + ", ";
|
||||
String bi_data_emissao = doc == null ? "" : "em " + DefaultTemplateProvider.D_F.format( doc.getData_emissao() ) + ", ";
|
||||
// String bi_numero = pessoa.getBINumero() == null || "".equals( pessoa.getBINumero().trim() ) ? "" : "portadora do Bilhete de Identidade nº " + pessoa.getBINumero() + ", ";
|
||||
// String bi_emissao = pessoa.getBIArquivo() == null || "".equals( pessoa.getBIArquivo().trim() ) ? "" : " emitido em " + pessoa.getBIArquivo() + ", ";
|
||||
// String bi_data_emissao = pessoa.getBIData() == null ? "" : "em " + DefaultTemplateProvider.D_F.format( pessoa.getBIData() ) + ", ";
|
||||
|
||||
|
||||
xml = new SimpleXMLElement( CERTIFICADO_FORMANDO_XML_NAME );
|
||||
xml.addElement( new SimpleXMLElement( "numero_certificado", numCertificado ) );
|
||||
xml.addElement( new SimpleXMLElement( "signature_filename1", visualizar ? "": AutorizacaoProviderInterface.ASSINATURA1_FILENAME ) );
|
||||
|
||||
xml.addElement( new SimpleXMLElement( "nome_pessoa", nomePessoa ) );
|
||||
xml.addElement( new SimpleXMLElement( "profissao", profissao ) );
|
||||
xml.addElement( new SimpleXMLElement( "naturalidade", naturalidade ) );
|
||||
xml.addElement( new SimpleXMLElement( "data_nascimento", dataNascimento ) );
|
||||
xml.addElement( new SimpleXMLElement( "nacionalidade", nacionalidade ) );
|
||||
xml.addElement( new SimpleXMLElement( "sexo", sexo ) );
|
||||
xml.addElement( new SimpleXMLElement( "bi_numero", bi_numero ) );
|
||||
xml.addElement( new SimpleXMLElement( "bi_emissao", bi_emissao ) );
|
||||
xml.addElement( new SimpleXMLElement( "bi_data_emissao", bi_data_emissao ) );
|
||||
|
||||
xml.addElement( new SimpleXMLElement( "nome_formadora", "TODO - nome formadora" ) );
|
||||
xml.addElement( new SimpleXMLElement( "nome_formadora_e_responsavel", "TODO - nome formadora e responsavel" ) );
|
||||
|
||||
//TODO : numero de Livro de Registo de Formação
|
||||
xml.addElement( new SimpleXMLElement( "nr_livro_registo", " " ) );
|
||||
xml.addElement( new SimpleXMLElement( "numero_certificado", numCertificado ) );
|
||||
try
|
||||
{
|
||||
if( CursosLogic.getInstance().fillDadosCurso( parent, xml, curso, null ) )
|
||||
{
|
||||
Date today = (Date) Singleton.getInstance( Singleton.TODAY );
|
||||
SimpleXMLElement dataCorrenteElement = new SimpleXMLElement( "data_corrente", new SimpleDateFormat( "dd' de 'MMMM' de 'yyyy", new Locale( "pt", "PT" ) ).format( today ) );
|
||||
xml.addElement( dataCorrenteElement );
|
||||
System.out.println( xml );
|
||||
}
|
||||
else
|
||||
{
|
||||
xml = null;
|
||||
}
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
ErrorLogger.logException( ex );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xml = super.generateXMLTesteFormando( parent, curso );
|
||||
}
|
||||
return xml;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,777 +0,0 @@
|
||||
/*
|
||||
* EstatisticaDataProvider.java
|
||||
*
|
||||
* Created on 16 de Dezembro de 2004, 12:50
|
||||
*/
|
||||
|
||||
package siprp.estatistica;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import shst.data.Marcacao;
|
||||
import shst.data.outer.MarcacoesTrabalhadorData;
|
||||
|
||||
import com.evolute.utils.Singleton;
|
||||
import com.evolute.utils.arrays.Virtual2DArray;
|
||||
import com.evolute.utils.db.DBManager;
|
||||
import com.evolute.utils.db.Executer;
|
||||
import com.evolute.utils.metadb.MetaProvider;
|
||||
import com.evolute.utils.sql.Field;
|
||||
import com.evolute.utils.sql.Select;
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class EstatisticaDataProvider extends MetaProvider
|
||||
{
|
||||
private static final Object LOCK = new Object();
|
||||
private static EstatisticaDataProvider instance = null;
|
||||
private final Executer executer;
|
||||
|
||||
public static final DateFormat DF = DateFormat.getDateInstance( DateFormat.SHORT );
|
||||
|
||||
/** Creates a new instance of EstatisticaDataProvider */
|
||||
public EstatisticaDataProvider()
|
||||
throws Exception
|
||||
{
|
||||
DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ );
|
||||
executer = dbm.getSharedExecuter( this );
|
||||
}
|
||||
|
||||
public static MetaProvider getProvider()
|
||||
throws Exception
|
||||
{
|
||||
synchronized( LOCK )
|
||||
{
|
||||
if( instance == null )
|
||||
{
|
||||
instance = new EstatisticaDataProvider();
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public String[][] getMarcacoesPeriodo( Date dataInicio, Date dataFim )
|
||||
throws Exception
|
||||
{
|
||||
String [][]result = null;
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador" },
|
||||
new String[]{ MarcacoesTrabalhadorData.DATA,
|
||||
"trabalhador_id",
|
||||
MarcacoesTrabalhadorData.REALIZADA,
|
||||
MarcacoesTrabalhadorData.TIPO },
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ),
|
||||
new String[]{ "data" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
result = new String[ array.columnLength() ][ 5 ];
|
||||
for( int n = 0; n < result.length; n++ )
|
||||
{
|
||||
Date data = ( Date ) array.get( n, 0 );
|
||||
int trabalhadorID = ( ( Number ) array.get( n, 1 ) ).intValue();
|
||||
boolean realizada = "y".equals( array.get( n, 2 ) );
|
||||
int tipo = ( ( Number ) array.get( n, 3 ) ).intValue();
|
||||
String nomeEstabEmp[] = getNomeEstabelecimentoEmpresaForTrabalhador( trabalhadorID );
|
||||
result[ n ][ 0 ] = nomeEstabEmp[ 2 ];
|
||||
result[ n ][ 1 ] = nomeEstabEmp[ 0 ];
|
||||
result[ n ][ 2 ] = nomeEstabEmp[ 1 ];
|
||||
result[ n ][ 3 ] = DF.format( data );
|
||||
result[ n ][ 4 ] = ( tipo == Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ? "(Exame)" : "(Consulta)" );
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public String[] getNomeEstabelecimentoEmpresaForTrabalhador( int trabalhadorID )
|
||||
throws Exception
|
||||
{
|
||||
String data[] = new String[ 3 ];
|
||||
Select select =
|
||||
new Select( new String[]{ "trabalhadores", "estabelecimentos", "empresas"},
|
||||
new String[]{ "trabalhadores.nome", "estabelecimentos.nome", "empresas.designacao_social" },
|
||||
new Field( "trabalhadores.id" ).isEqual( new Integer( trabalhadorID ) ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 1 )
|
||||
{
|
||||
data[ 0 ] = ( String ) array.get( 0, 0 );
|
||||
data[ 1 ] = ( String ) array.get( 0, 1 );
|
||||
data[ 2 ] = ( String ) array.get( 0, 2 );
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public int countExamesPeriodo( Date dataInicio, Date dataFim )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador" },
|
||||
new String[]{ "count(*)" },
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 0 || array.get( 0, 0 ) == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return ( ( Number ) array.get( 0, 0 ) ).intValue();
|
||||
}
|
||||
|
||||
public int countConsultasPeriodo( Date dataInicio, Date dataFim )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador" },
|
||||
new String[]{ "count(*)" },
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 0 || array.get( 0, 0 ) == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return ( ( Number ) array.get( 0, 0 ) ).intValue();
|
||||
}
|
||||
|
||||
public int countExamesPeriodoForEmpresa( Date dataInicio, Date dataFim, Integer empresaID )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos" },
|
||||
new String[]{ "count(*)" },
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
new Field( "estabelecimentos.empresa_id" ).isEqual( empresaID ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 0 || array.get( 0, 0 ) == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return ( ( Number ) array.get( 0, 0 ) ).intValue();
|
||||
}
|
||||
|
||||
public int countConsultasPeriodoForEmpresa( Date dataInicio, Date dataFim, Integer empresaID )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos" },
|
||||
new String[]{ "count(*)" },
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
new Field( "estabelecimentos.empresa_id" ).isEqual( empresaID ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 0 || array.get( 0, 0 ) == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return ( ( Number ) array.get( 0, 0 ) ).intValue();
|
||||
}
|
||||
|
||||
public String[][] getMarcacoesPeriodoForEstabelecimento( Date dataInicio, Date dataFim, Integer estabelecimentoID )
|
||||
throws Exception
|
||||
{
|
||||
String [][]result = null;
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" },
|
||||
new String[]{ MarcacoesTrabalhadorData.DATA,
|
||||
"trabalhador_id",
|
||||
MarcacoesTrabalhadorData.REALIZADA,
|
||||
MarcacoesTrabalhadorData.TIPO },
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ),
|
||||
new String[]{ "data" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
result = new String[ array.columnLength() ][ 5 ];
|
||||
for( int n = 0; n < result.length; n++ )
|
||||
{
|
||||
Date data = ( Date ) array.get( n, 0 );
|
||||
int trabalhadorID = ( ( Number ) array.get( n, 1 ) ).intValue();
|
||||
boolean realizada = "y".equals( array.get( n, 2 ) );
|
||||
int tipo = ( ( Number ) array.get( n, 3 ) ).intValue();
|
||||
String nomeEstabEmp[] = getNomeEstabelecimentoEmpresaForTrabalhador( trabalhadorID );
|
||||
result[ n ][ 0 ] = nomeEstabEmp[ 2 ];
|
||||
result[ n ][ 1 ] = nomeEstabEmp[ 0 ];
|
||||
result[ n ][ 2 ] = nomeEstabEmp[ 1 ];
|
||||
result[ n ][ 3 ] = DF.format( data );
|
||||
result[ n ][ 4 ] = ( tipo == Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ? "(Exame)" : "(Consulta)" );
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public int countExamesPeriodoForEstabelecimento( Date dataInicio, Date dataFim, Integer estabelecimentoID )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" },
|
||||
new String[]{ "count(*)" },
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 0 || array.get( 0, 0 ) == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return ( ( Number ) array.get( 0, 0 ) ).intValue();
|
||||
}
|
||||
|
||||
public int countConsultasPeriodoForEstabelecimento( Date dataInicio, Date dataFim, Integer estabelecimentoID )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" },
|
||||
new String[]{ "count(*)" },
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() == 0 || array.get( 0, 0 ) == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return ( ( Number ) array.get( 0, 0 ) ).intValue();
|
||||
}
|
||||
|
||||
public String[][] getTrabalhadoresSemExamesOuConsultas( Date dataInicio, Date dataFim, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
// Select subSelect =
|
||||
// new Select( new String[]{ "marcacoes_trabalhador" },
|
||||
// new String[]{ "trabalhador_id" },
|
||||
// new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ).and(
|
||||
// new Field( "realizada" ).isEqual( "y" ) ) );
|
||||
Select select =
|
||||
new Select( new String[]{ "empresas", "estabelecimentos",
|
||||
"trabalhadores LEFT OUTER JOIN marcacoes_trabalhador ON "
|
||||
+ "( trabalhadores.id = marcacoes_trabalhador.trabalhador_id AND marcacoes_trabalhador.tipo = "
|
||||
+ (exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA) + " AND marcacoes_trabalhador.realizada = 'y' )" },
|
||||
new String[]{ "empresas.designacao_social", "estabelecimentos.nome", "trabalhadores.nome",
|
||||
"empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" },
|
||||
new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( null ) ).and(
|
||||
new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isDifferent( "y" ).or(
|
||||
new Field( "marcacoes_trabalhador.realizada" ).isDifferent( "y" ) ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ),
|
||||
new String[]{ "empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
String data[][] = new String[ array.columnLength() ][ 3 ];
|
||||
for( int r = 0; r < array.columnLength(); r++ )
|
||||
{
|
||||
for( int c = 0; c < 3; c++ )
|
||||
{
|
||||
data[ r ][ c ] = (String) array.get( r, c );
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int countTrabalhadoresSemExamesOuConsultas( Date dataInicio, Date dataFim, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "trabalhadores" }, new String[]{ "COUNT(*)" },
|
||||
new Field( "inactivo" ).isDifferent( "y" ) );
|
||||
int totalCount = 0;
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() > 0 && array.rowLength() > 0 )
|
||||
{
|
||||
Number n = (Number) array.get( 0, 0 );
|
||||
if( n != null )
|
||||
{
|
||||
totalCount = n.intValue();
|
||||
}
|
||||
}
|
||||
|
||||
// select =
|
||||
// new Select( new String[]{ "marcacoes_trabalhador" },
|
||||
// new String[]{ "COUNT(*)" },
|
||||
// new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ).and(
|
||||
// new Field( "realizada" ).isEqual( "y" ) ).and(
|
||||
// new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) );
|
||||
// int subCount = 0;
|
||||
// array = executer.executeQuery( select );
|
||||
// if( array.columnLength() > 0 && array.rowLength() > 0 )
|
||||
// {
|
||||
// Number n = (Number) array.get( 0, 0 );
|
||||
// if( n != null )
|
||||
// {
|
||||
// subCount = n.intValue();
|
||||
// }
|
||||
// }
|
||||
|
||||
return totalCount - countTrabalhadoresComExamesOuConsultasPeriodo( dataInicio, dataFim, exames );
|
||||
}
|
||||
|
||||
public String[][] getTrabalhadoresSemExamesOuConsultasEstabelecimento( Integer estabelecimentoID, Date dataInicio, Date dataFim, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador" },
|
||||
new String[]{ "trabalhador_id" },
|
||||
new Field( "tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ).and(
|
||||
new Field( "realizada" ).isEqual( "y" ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
Integer ids[] = new Integer[ array.columnLength() ];
|
||||
for( int n = 0; n < ids.length; n++ )
|
||||
{
|
||||
ids[ n ] = ( Integer ) array.get( n, 0 );
|
||||
}
|
||||
if( ids.length == 0 )
|
||||
{
|
||||
ids = new Integer[]{ new Integer( -1 ) };
|
||||
}
|
||||
select =
|
||||
new Select( new String[]{ "estabelecimentos",
|
||||
"trabalhadores" },
|
||||
new String[]{ "estabelecimentos.nome", "trabalhadores.nome" },
|
||||
new Field( "estabelecimentos.id" ).isEqual( estabelecimentoID ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "trabalhadores.id" ).notIn( ids ) ),
|
||||
new String[]{ "trabalhadores.nome" }, null );
|
||||
// Select select =
|
||||
// new Select( new String[]{ "estabelecimentos",
|
||||
// "trabalhadores LEFT OUTER JOIN marcacoes_trabalhador ON "
|
||||
// + "( trabalhadores.id = marcacoes_trabalhador.trabalhador_id AND marcacoes_trabalhador.tipo = "
|
||||
// + (exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA) + " AND marcacoes_trabalhador.realizada = 'y' )" },
|
||||
// new String[]{ "estabelecimentos.nome", "trabalhadores.nome" },
|
||||
// new Field( "estabelecimentos.id" ).isEqual( estabelecimentoID ).and(
|
||||
// new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
// new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and(
|
||||
// new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( null ).or(
|
||||
// new Field( "marcacoes_trabalhador.realizada" ).isDifferent( "y" ) ) ).and(
|
||||
// new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
// new Field( "data" ).isLessOrEqual( dataFim ) ).and(
|
||||
// new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ),
|
||||
// new String[]{ "trabalhadores.nome" }, null );
|
||||
array = executer.executeQuery( select );
|
||||
String data[][] = new String[ array.columnLength() ][ 2 ];
|
||||
for( int r = 0; r < array.columnLength(); r++ )
|
||||
{
|
||||
for( int c = 0; c < 2; c++ )
|
||||
{
|
||||
data[ r ][ c ] = (String) array.get( r, c );
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public Object[][] getCountTrabalhadoresSemExamesOuConsultasPeriodoForAllEmpresas( Date dataInicio, Date dataFim, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "empresas" },
|
||||
new String[]{ "id", "designacao_social", "designacao_social_plain" },
|
||||
new Field( "inactivo" ).isDifferent( "y" ),
|
||||
new String[]{ "designacao_social_plain" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
Object data[][] = new Object[ array.columnLength() ][ 3 ];
|
||||
for( int n = 0; n < data.length; n++ )
|
||||
{
|
||||
data[ n ][ 0 ] = array.get( n, 1 );
|
||||
Integer empresaID = (Integer)array.get( n, 0 );
|
||||
data[ n ][ 1 ] = new Integer( countTrabalhadoresSemExamesOuConsultasEmpresa( empresaID, dataInicio, dataFim, exames ) );
|
||||
data[ n ][ 2 ] = empresaID;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public int countTrabalhadoresSemExamesOuConsultasEmpresa( Integer empresaID, Date dataInicio, Date dataFim, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "trabalhadores", "estabelecimentos" }, new String[]{ "COUNT(*)" },
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ).and(
|
||||
new Field( "estabelecimentos.empresa_id" ).isEqual( empresaID ) ).and(
|
||||
new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) );
|
||||
int totalCount = 0;
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() > 0 && array.rowLength() > 0 )
|
||||
{
|
||||
Number n = (Number) array.get( 0, 0 );
|
||||
if( n != null )
|
||||
{
|
||||
totalCount = n.intValue();
|
||||
}
|
||||
}
|
||||
|
||||
// select =
|
||||
// new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos" },
|
||||
// new String[]{ "COUNT(*)" },
|
||||
// new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
// new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
// new Field( "estabelecimentos.empresa_id" ).isEqual( empresaID ) ).and(
|
||||
// new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ).and(
|
||||
// new Field( "realizada" ).isEqual( "y" ) ).and(
|
||||
// new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) );
|
||||
// int subCount = 0;
|
||||
// array = executer.executeQuery( select );
|
||||
// if( array.columnLength() > 0 && array.rowLength() > 0 )
|
||||
// {
|
||||
// Number n = (Number) array.get( 0, 0 );
|
||||
// if( n != null )
|
||||
// {
|
||||
// subCount = n.intValue();
|
||||
// }
|
||||
// }
|
||||
return totalCount - countTrabalhadoresComExamesOuConsultasPeriodoForEmpresa( dataInicio, dataFim, empresaID, exames );
|
||||
}
|
||||
|
||||
public int countTrabalhadoresSemExamesOuConsultasEstabelecimento( Integer estabelecimentoID, Date dataInicio, Date dataFim, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "trabalhadores" }, new String[]{ "COUNT(*)" },
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) );
|
||||
int totalCount = 0;
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() > 0 && array.rowLength() > 0 )
|
||||
{
|
||||
Number n = (Number) array.get( 0, 0 );
|
||||
if( n != null )
|
||||
{
|
||||
totalCount = n.intValue();
|
||||
}
|
||||
}
|
||||
|
||||
// select =
|
||||
// new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" },
|
||||
// new String[]{ "COUNT(*)" },
|
||||
// new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
// new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and(
|
||||
// new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ).and(
|
||||
// new Field( "realizada" ).isEqual( "y" ) ).and(
|
||||
// new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) );
|
||||
// int subCount = 0;
|
||||
// array = executer.executeQuery( select );
|
||||
// if( array.columnLength() > 0 && array.rowLength() > 0 )
|
||||
// {
|
||||
// Number n = (Number) array.get( 0, 0 );
|
||||
// if( n != null )
|
||||
// {
|
||||
// subCount = n.intValue();
|
||||
// }
|
||||
// }
|
||||
return totalCount - countTrabalhadoresComExamesOuConsultasPeriodoForEstabelecimento( dataInicio, dataFim, estabelecimentoID, exames );
|
||||
}
|
||||
|
||||
public String[][]getTrabalhadoresComExamesOuConsultasPeriodo( Date dataInicio, Date dataFim, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "empresas", "estabelecimentos",
|
||||
"trabalhadores", "marcacoes_trabalhador" },
|
||||
new String[]{ "empresas.designacao_social", "estabelecimentos.nome", "trabalhadores.nome",
|
||||
"empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" },
|
||||
new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ).and(
|
||||
new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and(
|
||||
new Field( "marcacoes_trabalhador.realizada" ).isEqual( "y" ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ),
|
||||
new String[]{ "empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
String data[][] = new String[ array.columnLength() ][ 3 ];
|
||||
for( int r = 0; r < array.columnLength(); r++ )
|
||||
{
|
||||
for( int c = 0; c < 3; c++ )
|
||||
{
|
||||
data[ r ][ c ] = (String) array.get( r, c );
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public int countTrabalhadoresComExamesOuConsultasPeriodo( Date dataInicio, Date dataFim, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" },
|
||||
new String[]{ "COUNT(*)" },
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and(
|
||||
new Field( "realizada" ).isEqual( "y" ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ) );
|
||||
int count = 0;
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() > 0 && array.rowLength() > 0 )
|
||||
{
|
||||
Number n = (Number) array.get( 0, 0 );
|
||||
if( n != null )
|
||||
{
|
||||
count = n.intValue();
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public String[][]getTrabalhadoresComExamesOuConsultasPeriodoForEstabelecimento( Date dataInicio, Date dataFim, Integer estabelecimentoID, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "estabelecimentos",
|
||||
"trabalhadores", "marcacoes_trabalhador" },
|
||||
new String[]{ "estabelecimentos.nome", "trabalhadores.nome" },
|
||||
new Field( "estabelecimentos.id" ).isEqual( estabelecimentoID ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ).and(
|
||||
new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and(
|
||||
new Field( "marcacoes_trabalhador.realizada" ).isEqual( "y" ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ),
|
||||
new String[]{ "estabelecimentos.nome", "trabalhadores.nome" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
String data[][] = new String[ array.columnLength() ][ 2 ];
|
||||
for( int r = 0; r < array.columnLength(); r++ )
|
||||
{
|
||||
for( int c = 0; c < 2; c++ )
|
||||
{
|
||||
data[ r ][ c ] = (String) array.get( r, c );
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public Object[][] getCountTrabalhadoresComExamesOuConsultasPeriodoForAllEmpresas( Date dataInicio, Date dataFim, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "empresas" },
|
||||
new String[]{ "id", "designacao_social", "designacao_social_plain" },
|
||||
new Field( "inactivo" ).isDifferent( "y" ),
|
||||
new String[]{ "designacao_social_plain" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
Object data[][] = new Object[ array.columnLength() ][ 3 ];
|
||||
for( int n = 0; n < data.length; n++ )
|
||||
{
|
||||
data[ n ][ 0 ] = array.get( n, 1 );
|
||||
Integer empresaID = (Integer)array.get( n, 0 );
|
||||
data[ n ][ 1 ] = new Integer( countTrabalhadoresComExamesOuConsultasPeriodoForEmpresa( dataInicio, dataFim, empresaID, exames ) );
|
||||
data[ n ][ 2 ] = empresaID;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public int countTrabalhadoresComExamesOuConsultasPeriodoForEmpresa( Date dataInicio, Date dataFim, Integer empresaID, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos" },
|
||||
new String[]{ "COUNT(*)" },
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
new Field( "estabelecimentos.empresa_id" ).isEqual( empresaID ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and(
|
||||
new Field( "realizada" ).isEqual( "y" ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ) );
|
||||
int count = 0;
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() > 0 && array.rowLength() > 0 )
|
||||
{
|
||||
Number n = (Number) array.get( 0, 0 );
|
||||
if( n != null )
|
||||
{
|
||||
count = n.intValue();
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public int countTrabalhadoresComExamesOuConsultasPeriodoForEstabelecimento( Date dataInicio, Date dataFim, Integer estabelecimentoID, boolean exames )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" },
|
||||
new String[]{ "COUNT(*)" },
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and(
|
||||
new Field( "tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and(
|
||||
new Field( "realizada" ).isEqual( "y" ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and(
|
||||
new Field( "data" ).isLessOrEqual( dataFim ) ) );
|
||||
int count = 0;
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.columnLength() > 0 && array.rowLength() > 0 )
|
||||
{
|
||||
Number n = (Number) array.get( 0, 0 );
|
||||
if( n != null )
|
||||
{
|
||||
count = n.intValue();
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public String [][]getDadosTrabalhadoresPeriodo( Date dataInicio, Date dataFim )
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "empresas", "estabelecimentos", "trabalhadores" },
|
||||
new String[]{ "empresas.designacao_social", "estabelecimentos.nome", "trabalhadores.nome", "trabalhadores.id",
|
||||
"empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" },
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ).and(
|
||||
new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) ).and(
|
||||
new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ),
|
||||
new String[]{ "empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" }, null );
|
||||
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
String data[][] = new String[ array.columnLength() ][ 7 ];
|
||||
for( int n = 0; n < array.columnLength(); n++ )
|
||||
{
|
||||
data[ n ][ 0 ] = ( String ) array.get( n, 0 );
|
||||
data[ n ][ 1 ] = ( String ) array.get( n, 1 );
|
||||
data[ n ][ 2 ] = ( String ) array.get( n, 2 );
|
||||
Integer id = new Integer( ( (Number) array.get( n, 3 ) ).intValue() );
|
||||
Select exameSelect =
|
||||
new Select( new String[]{ "trabalhadores", "marcacoes_trabalhador" },
|
||||
new String[]{ "data", "realizada" },
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
new Field( "trabalhadores.id" ).isEqual( id ) ).and(
|
||||
new Field( "marcacoes_trabalhador.data" ).isLessOrEqual( dataFim ) ).and(
|
||||
new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ),
|
||||
new String[]{ "data desc" }, null );
|
||||
Virtual2DArray exameArray = executer.executeQuery( exameSelect );
|
||||
if( exameArray.columnLength() > 0 )
|
||||
{
|
||||
Date dataExame = ( Date ) exameArray.get( 0, 0 );
|
||||
String estado = ( String ) exameArray.get( 0, 1 );
|
||||
data[ n ][ 3 ] = DF.format( dataExame );
|
||||
data[ n ][ 4 ] = "y".equals( estado ) ? "Realizado" : "Faltou";
|
||||
}
|
||||
else
|
||||
{
|
||||
data[ n ][ 3 ] = "--";
|
||||
data[ n ][ 4 ] = "--";
|
||||
}
|
||||
|
||||
Select consultaSelect =
|
||||
new Select( new String[]{ "trabalhadores", "marcacoes_trabalhador" },
|
||||
new String[]{ "data", "realizada" },
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
new Field( "trabalhadores.id" ).isEqual( id ) ).and(
|
||||
new Field( "marcacoes_trabalhador.data" ).isLessOrEqual( dataFim ) ).and(
|
||||
new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ),
|
||||
new String[]{ "data desc" }, null );
|
||||
Virtual2DArray consultaArray = executer.executeQuery( consultaSelect );
|
||||
if( consultaArray.columnLength() > 0 )
|
||||
{
|
||||
Date dataConsulta = ( Date ) consultaArray.get( 0, 0 );
|
||||
String estado = ( String ) consultaArray.get( 0, 1 );
|
||||
data[ n ][ 5 ] = DF.format( dataConsulta );
|
||||
data[ n ][ 6 ] = "y".equals( estado ) ? "Realizada" : "Faltou";
|
||||
}
|
||||
else
|
||||
{
|
||||
data[ n ][ 5 ] = "--";
|
||||
data[ n ][ 6 ] = "--";
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public String[][]getDadosHigieneSeguranca()
|
||||
throws Exception
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "empresas", "estabelecimentos" },
|
||||
new String[]{ "empresas.designacao_social", "estabelecimentos.nome", "estabelecimentos.id",
|
||||
"empresas.designacao_social_plain", "estabelecimentos.nome_plain" },
|
||||
new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ).and(
|
||||
new Field( "empresas.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ),
|
||||
new String[]{ "empresas.designacao_social_plain", "estabelecimentos.nome_plain" }, null );
|
||||
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
String data[][] = new String[ array.columnLength() ][ 6 ];
|
||||
for( int n = 0; n < array.columnLength(); n++ )
|
||||
{
|
||||
data[ n ][ 0 ] = ( String ) array.get( n, 0 );
|
||||
data[ n ][ 1 ] = ( String ) array.get( n, 1 );
|
||||
Integer id = new Integer( ( (Number) array.get( n, 2 ) ).intValue() );
|
||||
Select ultimaSelect =
|
||||
new Select( new String[]{ "marcacoes_estabelecimento" },
|
||||
new String[]{ "data", "realizada", "data_relatorio" },
|
||||
new Field( "marcacoes_estabelecimento.estabelecimento_id" ).isEqual( id ).and(
|
||||
new Field( "marcacoes_estabelecimento.data" ).isLessOrEqual( new Date() ) ),
|
||||
new String[]{ "data desc" }, null );
|
||||
Virtual2DArray ultimaArray = executer.executeQuery( ultimaSelect );
|
||||
if( ultimaArray.columnLength() > 0 )
|
||||
{
|
||||
Date dataAud = ( Date ) ultimaArray.get( 0, 0 );
|
||||
String estado = ( String ) ultimaArray.get( 0, 1 );
|
||||
Date dataRel = ( Date ) ultimaArray.get( 0, 2 );
|
||||
data[ n ][ 2 ] = DF.format( dataAud );
|
||||
data[ n ][ 3 ] = "y".equals( estado ) ? "Realizada" : "Não Realizada";
|
||||
data[ n ][ 4 ] = dataRel != null ? DF.format( dataRel ) : "--";
|
||||
}
|
||||
else
|
||||
{
|
||||
data[ n ][ 2 ] = "--";
|
||||
data[ n ][ 3 ] = "--";
|
||||
data[ n ][ 4 ] = "--";
|
||||
}
|
||||
|
||||
Select proximaSelect =
|
||||
new Select( new String[]{ "marcacoes_estabelecimento" },
|
||||
new String[]{ "data" },
|
||||
new Field( "marcacoes_estabelecimento.estabelecimento_id" ).isEqual( id ).and(
|
||||
new Field( "marcacoes_estabelecimento.data" ).isGreaterOrEqual( new Date() ) ),
|
||||
new String[]{ "data desc" }, null );
|
||||
Virtual2DArray proximaArray = executer.executeQuery( proximaSelect );
|
||||
if( proximaArray.columnLength() > 0 )
|
||||
{
|
||||
Date dataProx = ( Date ) proximaArray.get( 0, 0 );
|
||||
data[ n ][ 5 ] = DF.format( dataProx );
|
||||
}
|
||||
else
|
||||
{
|
||||
data[ n ][ 5 ] = "--";
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,505 +0,0 @@
|
||||
/*
|
||||
* EmpresaPanel.java
|
||||
*
|
||||
* Created on 29 de Marco de 2004, 11:53
|
||||
*/
|
||||
|
||||
package siprp.ficha;
|
||||
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import shst.SHSTPropertiesConstants;
|
||||
import shst.data.outer.EmpresasData;
|
||||
import shst.data.outer.EstabelecimentosData;
|
||||
import siprp.FichaDataProvider;
|
||||
|
||||
import com.evolute.entity.ProviderInterface;
|
||||
import com.evolute.utils.Singleton;
|
||||
import com.evolute.utils.data.IDObject;
|
||||
import com.evolute.utils.data.MappableObject;
|
||||
import com.evolute.utils.dataui.ComponentController;
|
||||
import com.evolute.utils.dataui.ComponentsHashtable;
|
||||
import com.evolute.utils.dataui.ControllableComponent;
|
||||
import com.evolute.utils.ui.DialogException;
|
||||
import com.evolute.utils.ui.panel.RadioButtonFixedPanel;
|
||||
import com.evolute.utils.ui.panel.RadioButtonPanel;
|
||||
import com.evolute.utils.ui.text.CopyPasteHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class EmpresaPanel extends JPanel
|
||||
implements ControllableComponent< Object >
|
||||
{
|
||||
private ProviderInterface JDO;
|
||||
private JTextField designacaoSocialText;
|
||||
private JTextField estabelecimentoText;
|
||||
private JTextField localidadeText;
|
||||
private RadioButtonFixedPanel servicoSaudeTipoPanel;
|
||||
private JTextField designacaoServicoSaudeText;
|
||||
private JButton defaultServicoSaudeButton;
|
||||
private RadioButtonFixedPanel servicoHigieneTipoPanel;
|
||||
private JTextField designacaoText;
|
||||
private JButton defaultServicoHigieneButton;
|
||||
|
||||
private FichaDataProvider provider;
|
||||
private ComponentsHashtable empresaComponents;
|
||||
private ComponentsHashtable estabelecimentoComponents;
|
||||
|
||||
private EstabelecimentosData estabelecimento;
|
||||
private EmpresasData empresa;
|
||||
|
||||
|
||||
/** Creates a new instance of EmpresaPanel */
|
||||
public EmpresaPanel()
|
||||
throws Exception
|
||||
{
|
||||
provider = (FichaDataProvider)FichaDataProvider.getProvider();
|
||||
JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_EVO_DATA_PROVIDER );
|
||||
setupComponents();
|
||||
setupComponentsHashtable();
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
{
|
||||
setBorder( BorderFactory.createTitledBorder(
|
||||
BorderFactory.createEtchedBorder(),
|
||||
"Empresa/Entidade" ) );
|
||||
|
||||
JLabel designacaoSocialLabel = new JLabel( "Designa\u00e7\u00e3o Social" );
|
||||
designacaoSocialText = new JTextField();
|
||||
// JPanel servicoSaudePanel = new JPanel();
|
||||
JLabel estabelecimentoLabel = new JLabel( "Estabelecimento" );
|
||||
estabelecimentoText = new JTextField();
|
||||
JLabel localidadeLabel = new JLabel( "Localidade" );
|
||||
localidadeText = new JTextField();
|
||||
JLabel servicoSaudeLabel = new JLabel( "Servi\u00e7o de Sa\u00fade: Tipo" );
|
||||
servicoSaudeTipoPanel =
|
||||
new RadioButtonFixedPanel( new IDObject[]{ new MappableObject( new Integer(1), "Interno" ),
|
||||
new MappableObject( new Integer(2), "Interempresas" ),
|
||||
new MappableObject( new Integer(3), "Externo" ),
|
||||
new MappableObject( new Integer(4), "Servi\u00e7o Nacional de Sa\u00fade" ) },
|
||||
1, 4, RadioButtonPanel.ORIENTATION_HORIZONTAL, false );
|
||||
JLabel designacaoServicoSaudeLabel = new JLabel( "Designa\u00e7\u00e3o" );
|
||||
designacaoServicoSaudeText = new JTextField();
|
||||
defaultServicoSaudeButton = new JButton("-");
|
||||
defaultServicoSaudeButton.addActionListener( new ActionListener(){
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
designacaoServicoSaudeText.setText( (String) Singleton.getInstance( SHSTPropertiesConstants.COMPANY_NAME ) );
|
||||
}
|
||||
} );
|
||||
|
||||
JLabel servicoHigieneLabel = new JLabel( "Servi\u00e7o de Higiene e Seguran\u00e7a: Tipo" );
|
||||
servicoHigieneTipoPanel =
|
||||
new RadioButtonFixedPanel( new IDObject[]{ new MappableObject( new Integer(1), "Interno" ),
|
||||
new MappableObject( new Integer(2), "Interempresas" ),
|
||||
new MappableObject( new Integer(3), "Externo" ),
|
||||
new MappableObject( new Integer(4), "Outro" ) },
|
||||
1, 4, RadioButtonPanel.ORIENTATION_HORIZONTAL, false );
|
||||
JLabel designacaoLabel = new JLabel( "Designa\u00e7\u00e3o" );
|
||||
designacaoText = new JTextField();
|
||||
defaultServicoHigieneButton = new JButton("-");
|
||||
defaultServicoHigieneButton.addActionListener( new ActionListener(){
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
designacaoText.setText( (String) Singleton.getInstance( SHSTPropertiesConstants.COMPANY_NAME ) );
|
||||
}
|
||||
} );
|
||||
|
||||
GridBagLayout gridbag = new GridBagLayout();
|
||||
setLayout( gridbag );
|
||||
GridBagConstraints constraints = new GridBagConstraints();
|
||||
constraints.insets = new Insets( 0, 1, 0, 1 );
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.gridwidth = 1;
|
||||
constraints.weightx = 0;
|
||||
constraints.gridheight = 1;
|
||||
constraints.weighty = 0;
|
||||
|
||||
gridbag.setConstraints( designacaoSocialLabel, constraints );
|
||||
add( designacaoSocialLabel );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( designacaoSocialText, constraints );
|
||||
add( designacaoSocialText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( estabelecimentoLabel, constraints );
|
||||
add( estabelecimentoLabel );
|
||||
|
||||
constraints.weightx = 0.6;
|
||||
constraints.gridwidth = 3;
|
||||
gridbag.setConstraints( estabelecimentoText, constraints );
|
||||
add( estabelecimentoText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( localidadeLabel, constraints );
|
||||
add( localidadeLabel );
|
||||
|
||||
constraints.weightx = 0.4;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( localidadeText, constraints );
|
||||
add( localidadeText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 2;
|
||||
gridbag.setConstraints( servicoSaudeLabel, constraints );
|
||||
add( servicoSaudeLabel );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( servicoSaudeTipoPanel, constraints );
|
||||
add( servicoSaudeTipoPanel );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( designacaoServicoSaudeLabel, constraints );
|
||||
add( designacaoServicoSaudeLabel );
|
||||
|
||||
JPanel designacaoServicoSaudePanel = new JPanel();
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( designacaoServicoSaudePanel, constraints );
|
||||
add( designacaoServicoSaudePanel );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 3;
|
||||
gridbag.setConstraints( servicoHigieneLabel, constraints );
|
||||
add( servicoHigieneLabel );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( servicoHigieneTipoPanel, constraints );
|
||||
add( servicoHigieneTipoPanel );
|
||||
|
||||
constraints.gridwidth = 1;
|
||||
constraints.weightx = 0;
|
||||
constraints.weighty = 1;
|
||||
constraints.gridheight = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( designacaoLabel, constraints );
|
||||
add( designacaoLabel );
|
||||
|
||||
JPanel designacaoServicoHigienePanel = new JPanel();
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( designacaoServicoHigienePanel, constraints );
|
||||
add( designacaoServicoHigienePanel );
|
||||
|
||||
gridbag = new GridBagLayout();
|
||||
designacaoServicoSaudePanel.setLayout( gridbag );
|
||||
constraints.insets = new Insets( 0, 0, 0, 0 );
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.gridwidth = 1;
|
||||
constraints.weightx = 1;
|
||||
constraints.weighty = 1;
|
||||
constraints.gridheight = GridBagConstraints.REMAINDER;
|
||||
|
||||
gridbag.setConstraints( designacaoServicoSaudeText, constraints );
|
||||
designacaoServicoSaudePanel.add( designacaoServicoSaudeText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( defaultServicoSaudeButton, constraints );
|
||||
designacaoServicoSaudePanel.add( defaultServicoSaudeButton );
|
||||
|
||||
|
||||
gridbag = new GridBagLayout();
|
||||
designacaoServicoHigienePanel.setLayout( gridbag );
|
||||
constraints.insets = new Insets( 0, 0, 0, 0 );
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.gridwidth = 1;
|
||||
constraints.weightx = 1;
|
||||
constraints.weighty = 1;
|
||||
constraints.gridheight = GridBagConstraints.REMAINDER;
|
||||
|
||||
gridbag.setConstraints( designacaoText, constraints );
|
||||
designacaoServicoHigienePanel.add( designacaoText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( defaultServicoHigieneButton, constraints );
|
||||
designacaoServicoHigienePanel.add( defaultServicoHigieneButton );
|
||||
|
||||
new CopyPasteHandler( designacaoSocialText );
|
||||
new CopyPasteHandler( estabelecimentoText );
|
||||
new CopyPasteHandler( localidadeText );
|
||||
new CopyPasteHandler( designacaoServicoSaudeText );
|
||||
new CopyPasteHandler( designacaoText );
|
||||
}
|
||||
|
||||
private void setupComponentsHashtable()
|
||||
{
|
||||
empresaComponents = new ComponentsHashtable();
|
||||
empresaComponents.putComponent( EmpresasData.DESIGNACAO_SOCIAL, designacaoSocialText );
|
||||
empresaComponents.putComponent( EmpresasData.SERVICO_SAUDE_TIPO, servicoSaudeTipoPanel );
|
||||
empresaComponents.putComponent( EmpresasData.SERVICO_SAUDE_DESIGNACAO, designacaoServicoSaudeText );
|
||||
empresaComponents.putComponent( EmpresasData.SERVICO_HIGIENE_TIPO, servicoHigieneTipoPanel );
|
||||
empresaComponents.putComponent( EmpresasData.SERVICO_HIGIENE_DESIGNACAO, designacaoText );
|
||||
|
||||
empresaComponents.putDummy( EmpresasData.MORADA );
|
||||
empresaComponents.putDummy( EmpresasData.CODIGO_POSTAL );
|
||||
empresaComponents.putDummy( EmpresasData.LOCALIDADE );
|
||||
empresaComponents.putDummy( EmpresasData.DISTRITO );
|
||||
empresaComponents.putDummy( EmpresasData.CONCELHO );
|
||||
empresaComponents.putDummy( EmpresasData.DATA_PROPOSTA );
|
||||
empresaComponents.putDummy( EmpresasData.DATA_ACEITACAO );
|
||||
empresaComponents.putDummy( EmpresasData.PERFIL_1 );
|
||||
empresaComponents.putDummy( EmpresasData.PERFIL_2 );
|
||||
empresaComponents.putDummy( EmpresasData.DATA_ENVIO_CONTRATO );
|
||||
empresaComponents.putDummy( EmpresasData.DATA_RECEPCAO_CONTRATO );
|
||||
empresaComponents.putDummy( EmpresasData.DATA_ENVIO_IDICT );
|
||||
empresaComponents.putDummy( EmpresasData.DATA_RELATORIO_ANUAL );
|
||||
empresaComponents.putDummy( EmpresasData.CODIGO_1 );
|
||||
empresaComponents.putDummy( EmpresasData.CODIGO_2 );
|
||||
empresaComponents.putDummy( EmpresasData.CODIGO_3 );
|
||||
empresaComponents.putDummy( EmpresasData.CAE );
|
||||
empresaComponents.putDummy( EmpresasData.ACTIVIDADE );
|
||||
empresaComponents.putDummy( EmpresasData.CONTRIBUINTE );
|
||||
empresaComponents.putDummy( EmpresasData.SEGURANCA_SOCIAL );
|
||||
empresaComponents.putDummy( EmpresasData.CONTACTO_1 );
|
||||
empresaComponents.putDummy( EmpresasData.CONTACTO_2 );
|
||||
empresaComponents.putDummy( EmpresasData.SERVICOS );
|
||||
// empresaComponents.putDummy( EmpresasData.PRECO_HIGIENE );
|
||||
// empresaComponents.putDummy( EmpresasData.PRECO_MEDICINA );
|
||||
empresaComponents.putDummy( EmpresasData.PERIODICIDADE );
|
||||
empresaComponents.putDummy( EmpresasData.DESIGNACAO_SOCIAL_PLAIN );
|
||||
empresaComponents.putDummy( EmpresasData.DATA_CANCELAMENTO );
|
||||
empresaComponents.putDummy( EmpresasData.A_CONSULTAS );
|
||||
empresaComponents.putDummy( EmpresasData.A_EXAMES );
|
||||
empresaComponents.putDummy( EmpresasData.B_CONSULTAS );
|
||||
empresaComponents.putDummy( EmpresasData.B_EXAMES );
|
||||
empresaComponents.putDummy( EmpresasData.INICIO_CONTRATO );
|
||||
empresaComponents.putDummy( EmpresasData.DURACAO );
|
||||
|
||||
estabelecimentoComponents = new ComponentsHashtable();
|
||||
estabelecimentoComponents.putComponent( EstabelecimentosData.NOME, estabelecimentoText );
|
||||
estabelecimentoComponents.putComponent( EstabelecimentosData.LOCALIDADE, localidadeText );
|
||||
estabelecimentoComponents.putDummy( EstabelecimentosData.MORADA );
|
||||
estabelecimentoComponents.putDummy( EstabelecimentosData.CODIGO_POSTAL );
|
||||
estabelecimentoComponents.putDummy( EstabelecimentosData.CONTACTO_ID );
|
||||
estabelecimentoComponents.putDummy( EstabelecimentosData.HISTORICO );
|
||||
estabelecimentoComponents.putDummy( EstabelecimentosData.EMPRESA_ID );
|
||||
estabelecimentoComponents.putDummy( EstabelecimentosData.NOME_PLAIN );
|
||||
|
||||
// components.putComponent( FichaDataProvider.T_EMPRESAS + "." + FichaDataProvider.DESIGNACAO_SOCIAL, designacaoSocialText );
|
||||
// components.put( FichaDataProvider.T_EMPRESAS + "." + FichaDataProvider.SERVICO_SAUDE_TIPO, servicoSaudeTipoPanel );
|
||||
// components.putComponent( FichaDataProvider.T_EMPRESAS + "." + FichaDataProvider.SERVICO_SAUDE_DESIGNACAO, designacaoServicoSaudeText );
|
||||
// components.put( FichaDataProvider.T_EMPRESAS + "." + FichaDataProvider.SERVICO_HIGIENE_TIPO, servicoHigieneTipoPanel );
|
||||
// components.putComponent( FichaDataProvider.T_EMPRESAS + "." + FichaDataProvider.SERVICO_HIGIENE_DESIGNACAO, designacaoText );
|
||||
//
|
||||
// components.putComponent( FichaDataProvider.T_ESTABELECIMENTOS + "." + FichaDataProvider.NOME, estabelecimentoText );
|
||||
// components.putComponent( FichaDataProvider.T_ESTABELECIMENTOS + "." + FichaDataProvider.LOCALIDADE, localidadeText );
|
||||
//
|
||||
// components.putDummy( FichaDataProvider.T_EMPRESAS + "." + FichaDataProvider.INACTIVO );
|
||||
// components.putDummy( FichaDataProvider.T_ESTABELECIMENTOS + "." + FichaDataProvider.EMPRESA_ID );
|
||||
// components.putDummy( FichaDataProvider.T_ESTABELECIMENTOS + "." + FichaDataProvider.INACTIVO );
|
||||
}
|
||||
|
||||
public void fill(Object value)
|
||||
{
|
||||
clear();
|
||||
empresa = null;
|
||||
estabelecimento = null;
|
||||
if( value != null )
|
||||
{
|
||||
Integer empresaID = (Integer)((Object[])value)[0];
|
||||
Integer estabelecimentoID = (Integer)((Object[])value)[1];
|
||||
if( empresaID != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
empresa = (EmpresasData)JDO.load( EmpresasData.class, empresaID );
|
||||
String names[] = (String[])empresaComponents.keySet().toArray( new String[0] );
|
||||
ComponentController.fill( names, empresa.getHashData(), empresaComponents );
|
||||
|
||||
if( estabelecimentoID != null )
|
||||
{
|
||||
estabelecimento = (EstabelecimentosData)JDO.load( EstabelecimentosData.class, estabelecimentoID );
|
||||
names = (String[])estabelecimentoComponents.keySet().toArray( new String[0] ); //estabelecimento.getFieldNames();
|
||||
ComponentController.fill( names, estabelecimento.getHashData(), estabelecimentoComponents );
|
||||
}
|
||||
|
||||
// DBField fields[] = provider.EMPRESAS.getInsertFields();
|
||||
// String empresaFields[] = new String[ fields.length ];
|
||||
// Hashtable data = new Hashtable();
|
||||
// for( int i = 0; i < empresaFields.length; ++i )
|
||||
// {
|
||||
// empresaFields[ i ] = fields[ i ].FULL_NAME;
|
||||
// Object fieldValue = empresa.getProperty( empresaFields[ i ] );
|
||||
// if( fieldValue != null )
|
||||
// {
|
||||
// data.put( empresaFields[ i ], fieldValue );
|
||||
// }
|
||||
// }
|
||||
// ComponentController.fill( empresaFields, data, components );
|
||||
// if( estabelecimentoID != null )
|
||||
// {
|
||||
// estabelecimento = provider.load( provider.ESTABELECIMENTOS, new DBKey( estabelecimentoID ) );
|
||||
// fields = provider.ESTABELECIMENTOS.getInsertFields();
|
||||
// String estabelecimentoFields[] = new String[ fields.length ];
|
||||
// for( int i = 0; i < estabelecimentoFields.length; ++i )
|
||||
// {
|
||||
// estabelecimentoFields[ i ] = fields[ i ].FULL_NAME;
|
||||
// Object fieldValue = estabelecimento.getProperty( estabelecimentoFields[ i ] );
|
||||
// if( fieldValue != null )
|
||||
// {
|
||||
// data.put( estabelecimentoFields[ i ], fieldValue );
|
||||
// }
|
||||
// }
|
||||
// ComponentController.fill( estabelecimentoFields, data, components );
|
||||
// }
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a carregar os dados da Empresa", true );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
estabelecimentoText.setText( "Sede" );
|
||||
}
|
||||
}
|
||||
|
||||
public Object save()
|
||||
{
|
||||
StringBuffer msg = new StringBuffer();
|
||||
boolean hasMsg = false;
|
||||
try
|
||||
{
|
||||
if( estabelecimento == null )
|
||||
{
|
||||
// estabelecimento = provider.createObject( provider.ESTABELECIMENTOS );
|
||||
estabelecimento = new EstabelecimentosData();
|
||||
}
|
||||
if( empresa == null )
|
||||
{
|
||||
// empresa = provider.createObject( provider.EMPRESAS );
|
||||
empresa = new EmpresasData();
|
||||
}
|
||||
// DBField fields[] = provider.EMPRESAS.getInsertFields();
|
||||
// String empresaFields[] = new String[ fields.length ];
|
||||
// for( int i = 0; i < empresaFields.length; ++i )
|
||||
// {
|
||||
// empresaFields[ i ] = fields[ i ].FULL_NAME;
|
||||
// }
|
||||
// Hashtable hash = new Hashtable();
|
||||
// ComponentController.save( empresaFields, hash, components );
|
||||
// Enumeration enum = hash.keys();
|
||||
// while( enum.hasMoreElements() )
|
||||
// {
|
||||
// String name = ( String )enum.nextElement();
|
||||
// empresa.setProperty( name, hash.get( name ) );
|
||||
// }
|
||||
// fields = provider.ESTABELECIMENTOS.getInsertFields();
|
||||
// String estabelecimentoFields[] = new String[ fields.length ];
|
||||
// for( int i = 0; i < estabelecimentoFields.length; ++i )
|
||||
// {
|
||||
// estabelecimentoFields[ i ] = fields[ i ].FULL_NAME;
|
||||
// }
|
||||
// hash = new Hashtable();
|
||||
// ComponentController.save( estabelecimentoFields, hash, components );
|
||||
// enum = hash.keys();
|
||||
// while( enum.hasMoreElements() )
|
||||
// {
|
||||
// String name = ( String )enum.nextElement();
|
||||
// estabelecimento.setProperty( name, hash.get( name ) );
|
||||
// }
|
||||
|
||||
String names[] = (String[])empresaComponents.keySet().toArray( new String[0] );
|
||||
// String names[] = new String[]{ EmpresasData.DESIGNACAO_SOCIAL, EmpresasData.SERVICO_SAUDE_TIPO,
|
||||
// EmpresasData.SERVICO_SAUDE_DESIGNACAO, EmpresasData.SERVICO_HIGIENE_TIPO,
|
||||
// EmpresasData.SERVICO_HIGIENE_DESIGNACAO };
|
||||
Map<String,Object> hash = empresa.getHashData();
|
||||
ComponentController.save( names, hash, empresaComponents );
|
||||
empresa.setHashData( hash );
|
||||
|
||||
// names = estabelecimento.getFieldNames();
|
||||
names = (String[])estabelecimentoComponents.keySet().toArray( new String[0] );
|
||||
hash = estabelecimento.getHashData();
|
||||
ComponentController.save( names, hash, estabelecimentoComponents );
|
||||
estabelecimento.setHashData( hash );
|
||||
estabelecimento.setToEmpresa_id( empresa );
|
||||
|
||||
// estabelecimento.setProperty( provider.R_ESTABELECIMENTO_EMPRESA, empresa );
|
||||
|
||||
// if( ((String)empresa.getProperty( provider.DESIGNACAO_SOCIAL )).trim().length() == 0 )
|
||||
if( ((String)empresa.get( EmpresasData.DESIGNACAO_SOCIAL )).trim().length() == 0 )
|
||||
{
|
||||
msg.append( "A empresa tem de ter uma design\u00e7\u00e3o social\n" );
|
||||
hasMsg = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
empresa.set( EmpresasData.DESIGNACAO_SOCIAL_PLAIN,
|
||||
com.evolute.utils.strings.StringPlainer.convertString( ( String )
|
||||
empresa.get( EmpresasData.DESIGNACAO_SOCIAL ) ) );
|
||||
}
|
||||
// if( empresa.getProperty( provider.SERVICO_SAUDE_TIPO ) == null )
|
||||
if( empresa.get( EmpresasData.SERVICO_SAUDE_TIPO ) == null )
|
||||
{
|
||||
msg.append( "A empresa tem de ter um tipo de seri\00e7o de sa\u00fade\n" );
|
||||
hasMsg = true;
|
||||
}
|
||||
// if( empresa.getProperty( provider.SERVICO_HIGIENE_TIPO ) == null )
|
||||
if( empresa.get( EmpresasData.SERVICO_HIGIENE_TIPO ) == null )
|
||||
{
|
||||
msg.append( "A empresa tem de ter um tipo de seri\00e7o de higiene\n" );
|
||||
hasMsg = true;
|
||||
}
|
||||
// if( ((String)estabelecimento.getProperty( provider.NOME )).trim().length() == 0 )
|
||||
if( ((String)estabelecimento.get( EstabelecimentosData.NOME )).trim().length() == 0 )
|
||||
{
|
||||
msg.append( "O estabelecimento tem de ter nome\n" );
|
||||
hasMsg = true;
|
||||
}
|
||||
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
if( hasMsg )
|
||||
{
|
||||
throw new ValuesException( msg.toString() );
|
||||
}
|
||||
return estabelecimento;
|
||||
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
String names[] = (String[])empresaComponents.keySet().toArray( new String[0] );
|
||||
ComponentController.clear( names, empresaComponents );
|
||||
names = (String[])estabelecimentoComponents.keySet().toArray( new String[0] );
|
||||
ComponentController.clear( names, estabelecimentoComponents );
|
||||
estabelecimentoText.setText( "Sede" );
|
||||
empresa = null;
|
||||
estabelecimento = null;
|
||||
}
|
||||
|
||||
public void setEnabled( boolean enable )
|
||||
{
|
||||
String names[] = (String[])empresaComponents.keySet().toArray( new String[0] );
|
||||
ComponentController.setEnabled( names, enable, empresaComponents );
|
||||
names = (String[])estabelecimentoComponents.keySet().toArray( new String[0] );
|
||||
ComponentController.setEnabled( names, enable, estabelecimentoComponents );
|
||||
}
|
||||
}
|
||||
@ -1,524 +0,0 @@
|
||||
package siprp.ficha;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
import shst.SHSTPropertiesConstants;
|
||||
|
||||
import com.evolute.utils.Singleton;
|
||||
import com.lowagie.text.Cell;
|
||||
import com.lowagie.text.Chunk;
|
||||
import com.lowagie.text.Document;
|
||||
import com.lowagie.text.Element;
|
||||
import com.lowagie.text.Font;
|
||||
import com.lowagie.text.FontFactory;
|
||||
import com.lowagie.text.PageSize;
|
||||
import com.lowagie.text.Paragraph;
|
||||
import com.lowagie.text.Phrase;
|
||||
import com.lowagie.text.Table;
|
||||
import com.lowagie.text.pdf.BaseFont;
|
||||
import com.lowagie.text.pdf.PdfWriter;
|
||||
|
||||
public class ExamePDF implements FichaAptidaoConstants
|
||||
{
|
||||
private final Font FONT_BOLD = FontFactory.getFont( "Arial", 8, Font.BOLD );
|
||||
private final Font FONT_NORMAL = FontFactory.getFont( "Arial", 8, Font.NORMAL );
|
||||
private final Font FONT_ZAPFDINGBATS = new Font( Font.ZAPFDINGBATS , 12, Font.NORMAL, new Color( 0, 0, 0 ) );
|
||||
|
||||
private BaseFont BASE_WINGDINGS;
|
||||
private Font FONT_WINGDINGS;
|
||||
|
||||
// static
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// //BASE_WINGDINGS = BaseFont.createFont("C:\\WINNT\\Fonts\\WINGDING.TTF", BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
|
||||
// BASE_WINGDINGS = BaseFont.createFont("WingDings", BaseFont.CP1252, BaseFont.EMBEDDED);
|
||||
// InputStream stream = BaseFont.getResourceStream( "WING", ClassLoader loader)
|
||||
// BASE_WINGDINGS = BaseFont.createFont("WingDings", BaseFont.CP1252, BaseFont.EMBEDDED,
|
||||
// true, byte[] ttfAfm, null );
|
||||
// FONT_WINGDINGS = new Font(BASE_WINGDINGS, 12);
|
||||
// }
|
||||
// catch( Exception ex )
|
||||
// {
|
||||
// FONT_WINGDINGS = FONT_NORMAL;
|
||||
// System.out.println( "NO FONT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" );
|
||||
// }
|
||||
// }
|
||||
|
||||
public ExamePDF()
|
||||
{
|
||||
FontFactory.registerDirectories();
|
||||
String possibleNames[] = new String[]{ "Wingdings", "WingDings", "wingdings", "WINGDINGS" };
|
||||
|
||||
for( int n = 0; n < 4; n++ )
|
||||
{
|
||||
FONT_WINGDINGS = FontFactory.getFont( possibleNames[ n ] );
|
||||
if( FONT_WINGDINGS.getFamilyname().toLowerCase().equals( "wingdings" ) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main( String[] args )
|
||||
{
|
||||
try
|
||||
{
|
||||
HashMap<String,String> ht = new HashMap<String,String>();
|
||||
// designacao_social
|
||||
// estabelecimentos.nome
|
||||
// estabelecimentos.localidade
|
||||
// servico_saude_tipo_interno
|
||||
// servico_saude_tipo_interempresas
|
||||
// servico_saude_tipo_externo
|
||||
// servico_saude_tipo_sns
|
||||
// servico_saude_designacao
|
||||
// servico_higiene_tipo_interno
|
||||
// servico_higiene_tipo_interempresas
|
||||
// servico_higiene_tipo_externo
|
||||
// servico_higiene_outro
|
||||
// servico_higiene_designacao
|
||||
// trabalhadores.nome
|
||||
// sexo
|
||||
// data_nascimento
|
||||
// nacionalidade
|
||||
// numero_mecanografico
|
||||
// data_admissao
|
||||
// categoria
|
||||
// local_trabalho
|
||||
// funcao_proposta
|
||||
// data_admissao_funcao
|
||||
// observacoes
|
||||
// exames.data
|
||||
// tipo_admissao
|
||||
// tipo_periodico
|
||||
// tipo_ocasional
|
||||
// tipo_apos_doenca
|
||||
// tipo_apos_acidente
|
||||
// tipo_pedido_trabalhador
|
||||
// tipo_pedido_empresa
|
||||
// tipo_mudanca_funcao
|
||||
// tipo_trabalho
|
||||
// tipo_outro
|
||||
// resultado_apto
|
||||
// resultado_apto_condicionalmente
|
||||
// resultado_inapto_temp
|
||||
// resultado_inapto_def
|
||||
// outra_funcao_1
|
||||
// outra_funcao_2
|
||||
// outra_funcao_3
|
||||
// outra_funcao_4
|
||||
// proximo_exame
|
||||
// outras_recomendacoes
|
||||
// medicos.nome
|
||||
// numero_cedula
|
||||
|
||||
ht.put( TRABALHADORES_NOME, "Trabalhador do com\u00e9rcio" );
|
||||
ht.put( SERVICO_SAUDE_DESIGNACAO, "Designacao servico saude" );
|
||||
ht.put( SERVICO_SAUDE_TIPO_EXTERNO, "" + Boolean.TRUE );
|
||||
ht.put( TIPO_PERIODICO, "" + Boolean.TRUE );
|
||||
ht.put( RESULTADO_INAPTO_TEMP, "" + Boolean.TRUE );
|
||||
FileOutputStream fos = new FileOutputStream( System.getProperty( "user.home" ) + "\\report.pdf" );
|
||||
fos.write( new ExamePDF().createPDF( ht ) );
|
||||
fos.close();
|
||||
System.out.println( "File saved." );
|
||||
Process proc = Runtime.getRuntime().exec( "cmd.exe /c \"" + System.getProperty( "user.home" ) + "\\report.pdf\"" );
|
||||
proc.waitFor();
|
||||
new File( System.getProperty( "user.home" ) + "\\report.pdf" ).delete();
|
||||
System.out.println( "Done." );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void print( byte []pdf, String nome )
|
||||
throws Exception
|
||||
{
|
||||
// new PDFFilePrinter( pdf, false );
|
||||
|
||||
// if( true )
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
long time = System.currentTimeMillis();
|
||||
// FileOutputStream fos = new FileOutputStream( System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + "report_ficha" + time + ".pdf" );
|
||||
FileOutputStream fos = new FileOutputStream( System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf" );
|
||||
fos.write( pdf );
|
||||
fos.close();
|
||||
System.out.println( "File saved ( " + nome + "_" + time + " )." );
|
||||
Process proc;
|
||||
if( System.getProperty( "os.name" ).startsWith( "Windows" ) )
|
||||
{
|
||||
//System.out.println( "cmd.exe /c \"" + System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + "report_ficha.pdf\"" );
|
||||
proc = Runtime.getRuntime().exec( "cmd.exe /c \"" + System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf\"" );
|
||||
|
||||
// proc = Runtime.getRuntime().exec( new String[]{ System.getProperty( "user.home" ) + "\\open.bat", System.getProperty( "user.home" ) + "\\" + nome + "_" + time + ".pdf" });
|
||||
|
||||
|
||||
proc.waitFor();
|
||||
if( !new File( System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf" ).delete() )
|
||||
{
|
||||
System.err.println( "File: report_ficha" + time + ".pdf - NOT DELETED" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//System.out.println( "/usr/bin/open \"" + System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + "report_ficha.pdf\"" );
|
||||
try{
|
||||
proc = Runtime.getRuntime().exec( new String[]{"/usr/bin/open", "" + System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf" } );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
// proc = Runtime.getRuntime().exec( "/usr/bin/open \"/Users/Shared/teste.pdf.pdf\"" );
|
||||
}
|
||||
}
|
||||
|
||||
public void printSilent( byte []pdf, String nome, String printerName ) throws InterruptedException, IOException
|
||||
// throws Exception
|
||||
{
|
||||
long time = System.currentTimeMillis();
|
||||
// FileOutputStream fos = new FileOutputStream( System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + "report_ficha" + time + ".pdf" );
|
||||
|
||||
if( System.getProperty( "os.name" ).startsWith( "Windows" ) )
|
||||
{
|
||||
Process proc;
|
||||
|
||||
// FileOutputStream fos = new FileOutputStream( System.getProperty( "user.home" ) + "\\print_fichas_temp\\" + nome + "_" + time + ".pdf" );
|
||||
FileOutputStream fos = new FileOutputStream( "c:\\temp\\" + nome + "_" + time + ".pdf" );
|
||||
fos.write( pdf );
|
||||
fos.close();
|
||||
|
||||
System.out.println( "File saved ( " + nome + "_" + time + " )." );
|
||||
//System.out.println("cmd /c \"c:\\temp\\acrord32.lnk /t \"c:" + System.getProperty( "file.separator" ) + "temp" + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf\" \"" + printerName + "\"\"");
|
||||
// proc = Runtime.getRuntime().exec( new String[]{ System.getProperty( "user.home" ) + "\\print.bat",
|
||||
// System.getProperty( "user.home" ) + "\\print_fichas_temp\\" + nome + "_" + time + ".pdf",
|
||||
// printerName });
|
||||
proc = Runtime.getRuntime().exec( new String[]{ System.getProperty( "user.home" ) + "\\print.bat",
|
||||
"c:\\temp\\" + nome + "_" + time + ".pdf",
|
||||
printerName });
|
||||
proc.waitFor();
|
||||
// if( !new File( "c:\\temp\\" + nome + "_" + time + ".pdf" ).delete() )
|
||||
// {
|
||||
// System.err.println( "File: " + nome + "_" + ".pdf - NOT DELETED" );
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void cleanSilentPrint()
|
||||
throws Exception
|
||||
{
|
||||
Process proc;
|
||||
proc = Runtime.getRuntime().exec( "cmd /c \"del c:\\temp\\*.pdf\"" );
|
||||
proc.waitFor();
|
||||
}
|
||||
|
||||
public byte[] createPDF( HashMap<String,String> values )
|
||||
{
|
||||
Document document = new Document();
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
|
||||
document.setPageSize( PageSize.A4 );
|
||||
try {
|
||||
PdfWriter pdfw = PdfWriter.getInstance( document, bos );
|
||||
// try {
|
||||
|
||||
|
||||
document.addTitle( "Ficha de Aptid\u00e3o" );
|
||||
String acronym = (String) Singleton.getInstance( SHSTPropertiesConstants.COMPANY_ACRONYM );
|
||||
document.addAuthor( acronym != null ? acronym: "n/a" );
|
||||
document.addCreator( "Evolute" );
|
||||
|
||||
document.open();
|
||||
|
||||
Paragraph conteudo = new Paragraph();
|
||||
|
||||
conteudo.add( new Chunk( "\n\nFICHA DE APTID\u00c3O\n",
|
||||
FontFactory.getFont( "Arial", 10, Font.BOLD ) ) );
|
||||
conteudo.add( new Chunk( "(Portaria n.\u00ba 299/2007, de 16 de Mar\u00e7o)",
|
||||
// conteudo.add( new Chunk( "(Portaria n\u00ba1031/2002, de 10 de Agosto)",
|
||||
FontFactory.getFont( "Arial", 7, Font.BOLD ) ) );
|
||||
|
||||
conteudo.setAlignment( Element.ALIGN_CENTER );
|
||||
|
||||
document.add( conteudo );
|
||||
|
||||
Table table = new Table( 1 );
|
||||
table.setBorderWidth( 1 );
|
||||
table.setPadding( 5 );
|
||||
table.setOffset( 0 );
|
||||
table.setWidth( 100 );
|
||||
|
||||
table.addCell( new Phrase( "Empresa/Entidade", FONT_BOLD ) );
|
||||
|
||||
StringBuilder texto = new StringBuilder();
|
||||
Phrase ph = new Phrase( 12f );
|
||||
|
||||
Cell cell = new Cell();
|
||||
texto.append( "DESIGNA\u00c7\u00c3O SOCIAL: " + values.get( DESIGNACAO_SOCIAL ) + "\n" );
|
||||
texto.append( "ESTABELECIMENTO: " + values.get( ESTABELECIMENTOS_NOME )
|
||||
+ " LOCALIDADE: " + values.get( ESTABELECIMENTOS_LOCALIDADE ) + "\n" );
|
||||
texto.append( "SERVI\u00c7O DE SA\u00DaDE: Tipo " );
|
||||
ph.add( new Chunk( texto.toString(), FONT_NORMAL ) );
|
||||
|
||||
texto = new StringBuilder( "Interno" );
|
||||
ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_SAUDE_TIPO_INTERNO ) ) );
|
||||
|
||||
texto = new StringBuilder( "Interempresas" );
|
||||
ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_SAUDE_TIPO_INTEREMPRESAS ), true ) );
|
||||
|
||||
texto = new StringBuilder( "Externo" );
|
||||
ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_SAUDE_TIPO_EXTERNO ), true ) );
|
||||
|
||||
texto = new StringBuilder( "Servi\u00e7o Nacional de Sa\u00fade\n" );
|
||||
ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_SAUDE_TIPO_SNS ), true ) );
|
||||
|
||||
texto = new StringBuilder();
|
||||
|
||||
texto.append( "DESIGNA\u00c7\u00c3O: " + values.get( SERVICO_SAUDE_DESIGNACAO ) + "\n" );
|
||||
texto.append( "SERVI\u00c7O DE HIGIENE E SEGURAN\u00c7A: Tipo " );
|
||||
ph.add( new Chunk( texto.toString(), FONT_NORMAL ) );
|
||||
|
||||
texto = new StringBuilder( "Interno" );
|
||||
ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_HIGIENE_TIPO_INTERNO ) ) );
|
||||
|
||||
texto = new StringBuilder( "Interempresas" );
|
||||
ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_HIGIENE_TIPO_INTEREMPRESAS ), true ) );
|
||||
|
||||
texto = new StringBuilder( "Externo" );
|
||||
ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_HIGIENE_TIPO_EXTERNO ), true ) );
|
||||
|
||||
texto = new StringBuilder( "Outro\n" );
|
||||
ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_HIGIENE_TIPO_OUTRO ), true ) );
|
||||
|
||||
texto = new StringBuilder();
|
||||
|
||||
texto.append( "DESIGNA\u00c7\u00c3O: " + values.get( SERVICO_HIGIENE_DESIGNACAO ) + "" );
|
||||
|
||||
ph.add( new Chunk( texto.toString(), FONT_NORMAL ) );
|
||||
|
||||
cell.addElement( ph );
|
||||
table.addCell( cell );
|
||||
document.add( table );
|
||||
|
||||
table = new Table( 1 );
|
||||
table.setBorderWidth( 1 );
|
||||
table.setPadding( 5 );
|
||||
table.setOffset( 0 );
|
||||
table.setWidth( 100 );
|
||||
|
||||
table.addCell( new Phrase( "Trabalhador",
|
||||
FONT_BOLD ) );
|
||||
|
||||
texto = new StringBuilder();
|
||||
|
||||
texto.append( "NOME: " + values.get( TRABALHADORES_NOME ) + "\n" );
|
||||
texto.append( "SEXO: " + values.get( SEXO ) + " DATA DE NASCIMENTO: "
|
||||
+ values.get( DATA_NASCIMENTO ) + " NACIONALIDADE: "
|
||||
+ values.get( NACIONALIDADE ) + "\n" );
|
||||
texto.append( "N\u00daMERO MECANOGR\u00c1FICO/OUTRO: " + values.get( NUMERO_MECANOGRAFICO )
|
||||
+ " DATA DE ADMISS\u00c3O: " + values.get( DATA_ADMISSAO ) + "\n" );
|
||||
texto.append( "CATEGORIA PROFISSIONAL: " + values.get( CATEGORIA )
|
||||
+ " LOCAL DE TRABALHO: " + values.get( LOCAL_TRABALHO ) + "\n" );
|
||||
texto.append( "FUN\u00c7\u00c3O PROPOSTA: " + values.get( FUNCAO_PROPOSTA )
|
||||
+ " DATA DE ADMISS\u00c3O NA FUN\u00c7\u00c3O: "
|
||||
+ values.get( DATA_ADMISSAO_FUNCAO ) + "" );
|
||||
|
||||
table.addCell( new Phrase( 12f, texto.toString(), FONT_NORMAL ) );
|
||||
document.add( table );
|
||||
|
||||
table = new Table( 1 );
|
||||
table.setBorderWidth( 1 );
|
||||
table.setOffset( 0 );
|
||||
table.setPadding( 5 );
|
||||
table.setWidth( 100 );
|
||||
|
||||
table.addCell( new Phrase( "Observa\u00e7\u00f5es",
|
||||
FONT_BOLD ) );
|
||||
|
||||
texto = new StringBuilder();
|
||||
texto.append( values.get( OBSERVACOES ) );
|
||||
|
||||
table.addCell( new Phrase( 12f, texto.toString(), FONT_NORMAL ) );
|
||||
document.add( table );
|
||||
|
||||
table = new Table( 2 );
|
||||
table.setBorderWidth( 1 );
|
||||
table.setOffset( 0 );
|
||||
table.setPadding( 5 );
|
||||
table.setWidth( 100 );
|
||||
|
||||
cell = new Cell( new Phrase( "Exame M\u00e9dico",
|
||||
FONT_BOLD ) );
|
||||
|
||||
cell.setColspan( 2 );
|
||||
table.addCell( cell );
|
||||
|
||||
texto = new StringBuilder();
|
||||
ph = new Phrase( 12f );
|
||||
texto.append( "DATA DO EXAME: " + values.get( EXAMES_DATA ) + "\n" );
|
||||
texto.append( "TIPO\n" );
|
||||
ph.add( new Chunk( texto.toString(), FONT_NORMAL ) );
|
||||
|
||||
ph.add( doCheckedPhrase( "ADMISS\u00c3O\n", values.get( TIPO_ADMISSAO ) ) );
|
||||
|
||||
ph.add( doCheckedPhrase( "PERI\u00d3DICO\n", values.get( TIPO_PERIODICO ) ) );
|
||||
|
||||
ph.add( doCheckedPhrase( "OCASIONAL\n", values.get( TIPO_OCASIONAL ) ) );
|
||||
|
||||
ph.add( doCheckedPhrase( "AP\u00d3S DOEN\u00c7A\n", values.get( TIPO_APOS_DOENCA ), true ) );
|
||||
|
||||
ph.add( doCheckedPhrase( "AP\u00d3S ACIDENTE\n", values.get( TIPO_APOS_ACIDENTE ), true ) );
|
||||
|
||||
ph.add( doCheckedPhrase( "A PEDIDO DO TRABALHADOR\n", values.get( TIPO_PEDIDO_TRABALHADOR ), true ) );
|
||||
|
||||
ph.add( doCheckedPhrase( "A PEDIDO DO SERVI\u00c7O\n", values.get( TIPO_PEDIDO_EMPRESA ), true ) );
|
||||
|
||||
ph.add( doCheckedPhrase( "POR MUDAN\u00c7A DE FUN\u00c7\u00c3O\n", values.get( TIPO_MUDANCA_FUNCAO ), true ) );
|
||||
|
||||
ph.add( doCheckedPhrase( "POR ALTERA\u00c7\u00c3O DAS CONDI\u00c7\u00d5ES DE TRABALHO\n", values.get( TIPO_TRABALHO ), true ) );
|
||||
|
||||
ph.add( doCheckedPhrase( "OUTRO\n", values.get( TIPO_OUTRO ), true ) );
|
||||
|
||||
texto = new StringBuilder();
|
||||
texto.append( " ESPECIFIQUE: " + values.get( TIPO_OUTRO_TEXTO ) );
|
||||
|
||||
ph.add( new Chunk( texto.toString(), FONT_NORMAL ) );
|
||||
|
||||
table.addCell( ph );
|
||||
|
||||
ph = new Phrase( 12f );
|
||||
ph.add( new Chunk( "RESULTADO\n", FONT_NORMAL ) );
|
||||
ph.add( doCheckedPhrase( "APTO\n", values.get( RESULTADO_APTO ) ) );
|
||||
|
||||
ph.add( doCheckedPhrase( "APTO CONDICIONALMENTE\n\n", values.get( RESULTADO_APTO_CONDICIONALMENTE ) ) );
|
||||
|
||||
ph.add( doCheckedPhrase( "INAPTO TEMPORARIAMENTE\n", values.get( RESULTADO_INAPTO_TEMP ) ) );
|
||||
|
||||
ph.add( doCheckedPhrase( "INAPTO DEFINITIVAMENTE\n\n", values.get( RESULTADO_INAPTO_DEF ) ) );
|
||||
|
||||
texto = new StringBuilder();
|
||||
texto.append( "OUTRAS FUN\u00c7\u00d5ES QUE PODE DESEMPENHAR\n" );
|
||||
texto.append( " 1 " + values.get( OUTRA_FUNCAO_1 ) + "\n" );
|
||||
texto.append( " 2 " + values.get( OUTRA_FUNCAO_2 ) + "\n" );
|
||||
texto.append( " 3 " + values.get( OUTRA_FUNCAO_3 ) + "\n" );
|
||||
texto.append( " 4 " + values.get( OUTRA_FUNCAO_4 ) + "\n" );
|
||||
ph.add( new Chunk( texto.toString(), FONT_NORMAL ) );
|
||||
table.addCell( ph );
|
||||
|
||||
document.add( table );
|
||||
|
||||
table = new Table( 1 );
|
||||
table.setBorderWidth( 1 );
|
||||
table.setOffset( 0 );
|
||||
table.setPadding( 5 );
|
||||
table.setWidth( 100 );
|
||||
|
||||
table.addCell( new Phrase( "Outras Recomenda\u00e7\u00f5es",
|
||||
FONT_BOLD ) );
|
||||
|
||||
texto = new StringBuilder();
|
||||
if( ( (Boolean) Singleton.getInstance( SHSTPropertiesConstants.FICHA_MARCA_EXAMES ) ).booleanValue() )
|
||||
{
|
||||
System.out.println( "ficha marca exames" );
|
||||
texto.append( "PR\u00d3XIMO EXAME: " + values.get( PROXIMO_EXAME ) + "\n" );
|
||||
}
|
||||
texto.append( "" + values.get( OUTRAS_RECOMENDACOES ) + "" );
|
||||
|
||||
table.addCell( new Phrase( 12f, texto.toString(), FONT_NORMAL ) );
|
||||
document.add( table );
|
||||
|
||||
|
||||
table = new Table( 1 );
|
||||
table.setBorderWidth( 1 );
|
||||
table.setOffset( 0 );
|
||||
table.setPadding( 5 );
|
||||
table.setWidth( 100 );
|
||||
|
||||
texto = new StringBuilder();
|
||||
|
||||
texto.append( "M\u00c9DICO DO TRABALHO: "
|
||||
+ values.get( MEDICOS_NOME ) + " C.P. " + values.get( NUMERO_CEDULA ) + "\n" );
|
||||
texto.append( "ASSINATURA _____________________________________________________________________________________\n\n" );
|
||||
texto.append( "TOMEI CONHECIMENTO ___________________________________________________________ DATA:____/____/________\n" );
|
||||
texto.append( " O RESPONS\u00c1VEL DOS RECURSOS HUMANOS" );
|
||||
|
||||
table.addCell( new Phrase( 18f, texto.toString(), FONT_NORMAL ) );
|
||||
document.add( table );
|
||||
|
||||
// }
|
||||
// catch( Exception e ) {
|
||||
// e.printStackTrace();
|
||||
// return null;
|
||||
// }
|
||||
|
||||
document.close();
|
||||
// PdfWriter pdfw = PdfWriter.getInstance( document, bos );
|
||||
// PdfContentByte pdfcb = new PdfContentByte( pdfw );
|
||||
//
|
||||
// PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
|
||||
// // Step 2: Obtain a print job.
|
||||
// PrinterJob pj = PrinterJob.getPrinterJob();
|
||||
// Graphics2D graphics = pdfcb.createPrinterGraphics( 100.0F, 100.0F, pj );
|
||||
// // Step 3: Find print services.
|
||||
// PrintService []services = PrinterJob.lookupPrintServices();
|
||||
// PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();
|
||||
// if(services.length > 0)
|
||||
// {
|
||||
// System.out.println("selected printer: " + services[0]);
|
||||
// try
|
||||
// {
|
||||
// PrintService service = defaultService;
|
||||
//// PrintService service = ServiceUI.printDialog(null, 200, 200,
|
||||
//// services, defaultService, DocFlavor.SERVICE_FORMATTED.PAGEABLE, aset);
|
||||
// pj.setPrintService(service);
|
||||
// // Step 2: Pass the settings to a page dialog and print dialog.
|
||||
//// pj.pageDialog(aset);
|
||||
//// if (pj.printDialog(aset))
|
||||
//// {
|
||||
// // Step 4: Update the settings made by the user in the dialogs.
|
||||
// // Step 5: Pass the final settings into the print request.
|
||||
// pj.print(aset);
|
||||
//// }
|
||||
// }
|
||||
// catch (PrinterException pe ) {
|
||||
// System.err.println(pe);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
catch( Exception e ) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
return bos.toByteArray();
|
||||
}
|
||||
|
||||
private Phrase doCheckedPhrase( String text, String phrase, boolean indent )
|
||||
{
|
||||
boolean checked = CHECKED.equals( phrase );
|
||||
Phrase p = new Phrase( 12f );
|
||||
//p.add( new Chunk( ( indent ? " " : "" ) + ( char )( checked? 110: 111) + " ", FONT_ZAPFDINGBATS ) );
|
||||
//System.out.println( "FAMILY: " + FONT_WINGDINGS.getFamilyname() );
|
||||
p.add( new Chunk( ( indent ? " " : "" ) + ( char )( checked? 0xfe: 0xa8), FONT_WINGDINGS ) );
|
||||
// p.add( new Chunk( ( indent ? " " : "" ) + ( char )( checked? 'X': '_'), FONT_WINGDINGS ) );
|
||||
p.add( new Chunk( text, FONT_NORMAL ) );
|
||||
return p;
|
||||
}
|
||||
|
||||
private Phrase doCheckedPhrase( String text, String phrase )
|
||||
{
|
||||
return doCheckedPhrase( text, phrase, false );
|
||||
}
|
||||
}
|
||||
@ -1,557 +0,0 @@
|
||||
/*
|
||||
* ExamePanel.java
|
||||
*
|
||||
* Created on 29 de Marco de 2004, 11:57
|
||||
*/
|
||||
|
||||
package siprp.ficha;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.Insets;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JRadioButton;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
|
||||
import shst.MedicinaConstants;
|
||||
import shst.SHSTPropertiesConstants;
|
||||
import shst.data.Marcacao;
|
||||
import shst.data.outer.ExamesData;
|
||||
import shst.data.outer.MarcacoesTrabalhadorData;
|
||||
import siprp.FichaDataProvider;
|
||||
|
||||
import com.evolute.entity.ProviderInterface;
|
||||
import com.evolute.utils.Singleton;
|
||||
import com.evolute.utils.data.IDObject;
|
||||
import com.evolute.utils.data.MappableObject;
|
||||
import com.evolute.utils.dataui.ComponentController;
|
||||
import com.evolute.utils.dataui.ComponentsHashtable;
|
||||
import com.evolute.utils.dataui.ControllableComponent;
|
||||
import com.evolute.utils.documents.MaximumLengthDocument;
|
||||
import com.evolute.utils.ui.button.BetterButtonGroup;
|
||||
import com.evolute.utils.ui.calendar.JCalendarPanel;
|
||||
import com.evolute.utils.ui.panel.RadioButtonFixedPanel;
|
||||
import com.evolute.utils.ui.text.CopyPasteHandler;
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class ExamePanel extends JPanel
|
||||
implements ChangeListener, ControllableComponent<Object>, ListSelectionListener
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private ProviderInterface JDO;
|
||||
|
||||
private JCalendarPanel dataExamePanel;
|
||||
private BetterButtonGroup tipoGroup;
|
||||
private JRadioButton admissaoRadio;
|
||||
private JRadioButton periodicoRadio;
|
||||
private JRadioButton ocasionalRadio;
|
||||
// private JRadioButton outroRadio;
|
||||
private RadioButtonFixedPanel ocasionalPanel;
|
||||
private JTextField especificarText;
|
||||
private RadioButtonFixedPanel tipoProximoPanel;
|
||||
private JCalendarPanel proximoExamePanel;
|
||||
private RadioButtonFixedPanel resultadoPanel;
|
||||
private JTextField outrasFuncoesTexts[];
|
||||
private JTextArea recomendacoesText;
|
||||
|
||||
private FichaDataProvider provider;
|
||||
private ComponentsHashtable components;
|
||||
|
||||
private Integer trabalhadorID;
|
||||
private MarcacoesTrabalhadorData marcacao;
|
||||
|
||||
/** Creates a new instance of ExamePanel */
|
||||
public ExamePanel()
|
||||
throws Exception
|
||||
{
|
||||
provider = (FichaDataProvider)FichaDataProvider.getProvider();
|
||||
JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_EVO_DATA_PROVIDER );
|
||||
setupComponents();
|
||||
setupComponentsHashtable();
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
{
|
||||
setBorder( BorderFactory.createTitledBorder(
|
||||
BorderFactory.createEtchedBorder(),
|
||||
"Exame M\u00e9dico" ) );
|
||||
|
||||
JPanel leftPanel = new JPanel();
|
||||
JPanel rightPanel = new JPanel();
|
||||
JPanel dataExameOuterPanel = new JPanel();
|
||||
JLabel dataExameLabel = new JLabel( "Data do Exame" );
|
||||
dataExamePanel = new JCalendarPanel( null );
|
||||
JPanel tipoPanel = new JPanel();
|
||||
tipoPanel.setBorder( BorderFactory.createTitledBorder(
|
||||
BorderFactory.createEtchedBorder(), "Tipo" ) );
|
||||
tipoGroup = new BetterButtonGroup( false );
|
||||
admissaoRadio = new JRadioButton( "Admiss\u00e3o" );
|
||||
tipoGroup.add( admissaoRadio );
|
||||
periodicoRadio = new JRadioButton( "Peri\u00f3dico" );
|
||||
tipoGroup.add( periodicoRadio );
|
||||
ocasionalRadio = new JRadioButton( "Ocasional" );
|
||||
tipoGroup.add( ocasionalRadio );
|
||||
ocasionalRadio.addChangeListener( this );
|
||||
// outroRadio = new JRadioButton( "Outro" );
|
||||
// tipoGroup.add( outroRadio );
|
||||
// outroRadio.addChangeListener( this );
|
||||
ocasionalPanel = new RadioButtonFixedPanel(
|
||||
new IDObject[]{ new MappableObject( new Integer( 1 ), "Ap\u00f3s doen\u00e7a" ),
|
||||
new MappableObject( new Integer( 2 ), "Ap\u00f3s acidente" ),
|
||||
new MappableObject( new Integer( 3 ), "A pedido do trabalhador" ),
|
||||
new MappableObject( new Integer( 4 ), "A pedido do servi\u00e7o" ),
|
||||
new MappableObject( new Integer( 5 ), "Por mudan\u00e7a de fun\u00e7\u00e3o" ),
|
||||
new MappableObject( new Integer( 6 ), "Por altera\u00e7\u00e3o das condi\u00e7\u00f5es de trabalho" ),
|
||||
new MappableObject( new Integer( 10 ), "Outro" ) },
|
||||
false );
|
||||
ocasionalPanel.addListSelectionListener( this );
|
||||
ocasionalPanel.setEnabled( false );
|
||||
especificarText = new JTextField();
|
||||
especificarText.setEnabled( false );
|
||||
JPanel proximoExameOuterPanel = new JPanel();
|
||||
proximoExameOuterPanel.setBorder( BorderFactory.createTitledBorder(
|
||||
BorderFactory.createEtchedBorder(), "Pr\u00f3ximo Exame" ) );
|
||||
proximoExamePanel = new JCalendarPanel( null );
|
||||
tipoProximoPanel = new RadioButtonFixedPanel(
|
||||
new IDObject[]{ new MappableObject( new Integer( 2 ), "Peri\u00f3dico" ),
|
||||
new MappableObject( new Integer( 3 ), "Ocasional" ) },
|
||||
RadioButtonFixedPanel.ORIENTATION_HORIZONTAL, 1, 2, false );
|
||||
// JLabel proximoExameLabel = new JLabel( "Pr\u00f3ximo Exame" );
|
||||
|
||||
JPanel resultadoOuterPanel = new JPanel();
|
||||
resultadoOuterPanel.setBorder( BorderFactory.createTitledBorder(
|
||||
BorderFactory.createEtchedBorder(), "Resultado" ) );
|
||||
resultadoPanel = new RadioButtonFixedPanel(
|
||||
new IDObject[]{ new MappableObject( new Integer( 1 ), "Apto" ),
|
||||
new MappableObject( new Integer( 2 ), "Apto condicionalmente" ),
|
||||
new MappableObject( new Integer( 3 ), "Inapto temporariamente" ),
|
||||
new MappableObject( new Integer( 4 ), "Inapto definitivamente" ) },
|
||||
false );
|
||||
JLabel outrasFuncoesLabel = new JLabel( "Outras fun\u00e7\u00f5es que pode desempenhar", JLabel.CENTER );
|
||||
JPanel outrasFuncoesPanel = new JPanel();
|
||||
JLabel outrasFuncoesLabels[] = new JLabel[ 4 ];
|
||||
outrasFuncoesTexts = new JTextField[ 4 ];
|
||||
for( int n = 0; n < 4; n++ )
|
||||
{
|
||||
outrasFuncoesLabels[ n ] = new JLabel( "" + ( n + 1 ) );
|
||||
outrasFuncoesTexts[ n ] = new JTextField();
|
||||
}
|
||||
JScrollPane recomendacoesScp = new JScrollPane();
|
||||
recomendacoesScp.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
|
||||
recomendacoesScp.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
|
||||
recomendacoesText = new JTextArea();
|
||||
recomendacoesText.setLineWrap( true );
|
||||
recomendacoesText.setWrapStyleWord( true );
|
||||
recomendacoesText.setDocument( new MaximumLengthDocument( 300 ) );
|
||||
recomendacoesScp.setViewportView( recomendacoesText );
|
||||
|
||||
setLayout( new GridLayout( 1, 2 ) );
|
||||
add( leftPanel );
|
||||
add( rightPanel );
|
||||
|
||||
leftPanel.setLayout( new BorderLayout() );
|
||||
|
||||
dataExameOuterPanel.setLayout( new BorderLayout() );
|
||||
dataExameOuterPanel.add( dataExameLabel, BorderLayout.WEST );
|
||||
dataExameOuterPanel.add( dataExamePanel, BorderLayout.CENTER );
|
||||
leftPanel.add( dataExameOuterPanel, BorderLayout.NORTH );
|
||||
leftPanel.add( tipoPanel, BorderLayout.CENTER );
|
||||
proximoExameOuterPanel.setLayout( new BorderLayout() );
|
||||
// proximoExameOuterPanel.add( proximoExameLabel, BorderLayout.WEST );
|
||||
proximoExameOuterPanel.add( proximoExamePanel, BorderLayout.CENTER );
|
||||
proximoExameOuterPanel.add( tipoProximoPanel, BorderLayout.SOUTH );
|
||||
if( ( ( Boolean ) Singleton.getInstance( SHSTPropertiesConstants.FICHA_MARCA_EXAMES ) ).booleanValue() )
|
||||
{
|
||||
leftPanel.add( proximoExameOuterPanel, BorderLayout.SOUTH );
|
||||
}
|
||||
|
||||
GridBagLayout gridbag = new GridBagLayout();
|
||||
tipoPanel.setLayout( gridbag );
|
||||
GridBagConstraints constraints = new GridBagConstraints();
|
||||
constraints.insets = new Insets( 0, 1, 0, 1 );
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.weighty = 0;
|
||||
constraints.gridheight = 1;
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
|
||||
gridbag.setConstraints( admissaoRadio, constraints );
|
||||
tipoPanel.add( admissaoRadio );
|
||||
|
||||
gridbag.setConstraints( periodicoRadio, constraints );
|
||||
tipoPanel.add( periodicoRadio );
|
||||
|
||||
gridbag.setConstraints( ocasionalRadio, constraints );
|
||||
tipoPanel.add( ocasionalRadio );
|
||||
|
||||
constraints.weightx = 0.1;
|
||||
constraints.gridwidth = 1;
|
||||
JPanel pad = new JPanel();
|
||||
gridbag.setConstraints( pad, constraints );
|
||||
tipoPanel.add( pad );
|
||||
|
||||
constraints.weightx = 0.9;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( ocasionalPanel, constraints );
|
||||
tipoPanel.add( ocasionalPanel );
|
||||
|
||||
// constraints.weightx = 0;
|
||||
// constraints.gridwidth = 1;
|
||||
// gridbag.setConstraints( outroRadio, constraints );
|
||||
// tipoPanel.add( outroRadio );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( especificarText, constraints );
|
||||
tipoPanel.add( especificarText );
|
||||
|
||||
|
||||
gridbag = new GridBagLayout();
|
||||
rightPanel.setLayout( gridbag );
|
||||
constraints.fill = GridBagConstraints.BOTH;
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
constraints.gridheight = 1;
|
||||
constraints.weighty = 0;
|
||||
|
||||
gridbag.setConstraints( resultadoOuterPanel, constraints );
|
||||
rightPanel.add( resultadoOuterPanel );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
//constraints.gridheight = GridBagConstraints.REMAINDER;
|
||||
constraints.weighty = 1;
|
||||
// JPanel recomendacoesOuterPanel = new JPanel();
|
||||
// recomendacoesOuterPanel.setLayout( new GridLayout( 1, 1 ) );
|
||||
// recomendacoesOuterPanel.add( recomendacoesScp );
|
||||
JPanel recomendacoesPanel = new JPanel( new BorderLayout() );
|
||||
gridbag.setConstraints( recomendacoesPanel, constraints );
|
||||
recomendacoesPanel.add( recomendacoesScp, BorderLayout.CENTER );
|
||||
recomendacoesPanel.setBorder( BorderFactory.createTitledBorder( "Outras recomenda\u00e7\u00f5es" ) );
|
||||
rightPanel.add( recomendacoesPanel );
|
||||
|
||||
gridbag = new GridBagLayout();
|
||||
resultadoOuterPanel.setLayout( gridbag );
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
constraints.gridheight = 1;
|
||||
constraints.weighty = 0;
|
||||
|
||||
gridbag.setConstraints( resultadoPanel, constraints );
|
||||
resultadoOuterPanel.add( resultadoPanel );
|
||||
|
||||
gridbag.setConstraints( outrasFuncoesLabel, constraints );
|
||||
resultadoOuterPanel.add( outrasFuncoesLabel );
|
||||
|
||||
gridbag.setConstraints( outrasFuncoesPanel, constraints );
|
||||
resultadoOuterPanel.add( outrasFuncoesPanel );
|
||||
|
||||
for( int n = 0; n < outrasFuncoesTexts.length; n++ )
|
||||
{
|
||||
constraints.weightx = 0.1;
|
||||
constraints.gridwidth = 1;
|
||||
pad = new JPanel();
|
||||
gridbag.setConstraints( pad, constraints );
|
||||
resultadoOuterPanel.add( pad );
|
||||
|
||||
constraints.weightx = 0;
|
||||
gridbag.setConstraints( outrasFuncoesLabels[ n ], constraints );
|
||||
resultadoOuterPanel.add( outrasFuncoesLabels[ n ] );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( outrasFuncoesTexts[ n ], constraints );
|
||||
resultadoOuterPanel.add( outrasFuncoesTexts[ n ] );
|
||||
new CopyPasteHandler( outrasFuncoesTexts[ n ] );
|
||||
}
|
||||
|
||||
new CopyPasteHandler( especificarText );
|
||||
new CopyPasteHandler( recomendacoesText );
|
||||
}
|
||||
|
||||
private void setupComponentsHashtable()
|
||||
{
|
||||
components = new ComponentsHashtable();
|
||||
components.putDummy( ExamesData.TIPO );
|
||||
components.putComponent( ExamesData.DATA, dataExamePanel );
|
||||
components.putComponent( ExamesData.OCASIONAL, ocasionalPanel );
|
||||
components.putComponent( ExamesData.OUTRO_TIPO, especificarText );
|
||||
components.putComponent( ExamesData.PROXIMO_EXAME, proximoExamePanel );
|
||||
components.putComponent( ExamesData.RESULTADO, resultadoPanel );
|
||||
components.putComponent( ExamesData.OUTRA_FUNCAO_1, outrasFuncoesTexts[ 0 ] );
|
||||
components.putComponent( ExamesData.OUTRA_FUNCAO_2, outrasFuncoesTexts[ 1 ] );
|
||||
components.putComponent( ExamesData.OUTRA_FUNCAO_3, outrasFuncoesTexts[ 2 ] );
|
||||
components.putComponent( ExamesData.OUTRA_FUNCAO_4, outrasFuncoesTexts[ 3 ] );
|
||||
components.putComponent( ExamesData.OUTRAS_RECOMENDACOES, recomendacoesText );
|
||||
components.putDummy( ExamesData.INACTIVO );
|
||||
components.putDummy( ExamesData.TRABALHADOR_ID );
|
||||
components.putDummy( ExamesData.MEDICO_ID );
|
||||
components.putDummy( ExamesData.PDF );
|
||||
components.putDummy( ExamesData.FO );
|
||||
}
|
||||
|
||||
public void stateChanged( ChangeEvent e )
|
||||
{
|
||||
if( e.getSource().equals( ocasionalRadio ) )
|
||||
{
|
||||
ocasionalPanel.setEnabled( ocasionalRadio.isSelected() && ocasionalRadio.isEnabled() ) ;
|
||||
}
|
||||
// else if( e.getSource().equals( outroRadio ) )
|
||||
// {
|
||||
// especificarText.setEnabled( outroRadio.isSelected() && outroRadio.isEnabled() );
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
public void fill( Object value )
|
||||
{
|
||||
clear();
|
||||
trabalhadorID = ( Integer ) value;
|
||||
if( trabalhadorID == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
Integer marcacaoID = provider.getMarcacaoIDByTrabalhador( trabalhadorID );
|
||||
|
||||
if( marcacaoID != null )
|
||||
{
|
||||
marcacao = ( MarcacoesTrabalhadorData ) JDO.load( MarcacoesTrabalhadorData.class, marcacaoID );
|
||||
proximoExamePanel.setDate( (Date) marcacao.get( Marcacao.DATA ) );
|
||||
}
|
||||
Object dadosMarcacao[] = provider.getDadosUltimaMarcacao( trabalhadorID );
|
||||
if( dadosMarcacao != null )
|
||||
{
|
||||
dataExamePanel.setDate( ( Date ) dadosMarcacao[ 0 ] );
|
||||
Integer tipo = ( Integer ) dadosMarcacao[ 1 ];
|
||||
int tipoValue = tipo != null ? tipo.intValue() : 0;
|
||||
tipoGroup.setIntSelected( tipoValue > 0 ? tipoValue - 1 : 0 );
|
||||
}
|
||||
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
ex.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
// Integer trabID = (Integer) value;
|
||||
// if( trabID == null )
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// try
|
||||
// {
|
||||
// Integer id = provider.getLastExameIDForTrabalhador( trabID );
|
||||
// if( id == null )
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// MetaObject exame = provider.load( provider.EXAMES, new DBKey( id ) );
|
||||
// byte pdf[] = (byte []) exame.getProperty( provider.PDF );
|
||||
// if( pdf != null )
|
||||
// {
|
||||
// FileOutputStream fos = new FileOutputStream( "C:\\teste.pdf" );
|
||||
// fos.write( pdf );
|
||||
// fos.close();
|
||||
// }
|
||||
// }
|
||||
// catch( Exception ex )
|
||||
// {
|
||||
// ex.printStackTrace();
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
|
||||
public Object save()
|
||||
{
|
||||
StringBuffer msg = new StringBuffer();
|
||||
boolean hasMsg = false;
|
||||
boolean hasData = false;
|
||||
ExamesData exame;
|
||||
Date dataExame = dataExamePanel.getDate();
|
||||
if( dataExame == null )
|
||||
{
|
||||
dataExame = new Date();
|
||||
}
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.add( Calendar.DAY_OF_MONTH, 1 );
|
||||
if( !cal.getTime().after( dataExame ) )
|
||||
{
|
||||
throw new ValuesException( "N\u00E3o \u00E9 poss\u00EDvel gravar exames com datas futuras." );
|
||||
}
|
||||
try
|
||||
{
|
||||
String recomendacoes = recomendacoesText.getText();
|
||||
String linhas[] = recomendacoes.split( "\\n" );
|
||||
Vector linhasV = new Vector();
|
||||
for( int n = 0; n < linhas.length; n++ )
|
||||
{
|
||||
if( linhas[ n ].trim().length() > 0 )
|
||||
{
|
||||
linhasV.add( linhas[ n ] );
|
||||
}
|
||||
}
|
||||
if( linhasV.size() > 0 )
|
||||
{
|
||||
linhas = ( String[] ) linhasV.toArray( new String[0] );
|
||||
boolean compress = false;
|
||||
if( linhas.length == 2 )
|
||||
{
|
||||
linhas[ 0 ] += " ";
|
||||
}
|
||||
recomendacoes = "";
|
||||
for( int n = 0; n < linhas.length; n++ )
|
||||
{
|
||||
recomendacoes += linhas[ n ];
|
||||
}
|
||||
}
|
||||
recomendacoesText.setText( recomendacoes.trim() );
|
||||
|
||||
exame = new ExamesData();
|
||||
|
||||
|
||||
exame.setHashData( ComponentController.save( components ) );
|
||||
|
||||
int tipo = 0;
|
||||
if( admissaoRadio.isSelected() )
|
||||
{
|
||||
tipo = 1;
|
||||
}
|
||||
else if( periodicoRadio.isSelected() )
|
||||
{
|
||||
tipo = 2;
|
||||
}
|
||||
else if( ocasionalRadio.isSelected() )
|
||||
{
|
||||
tipo = 3;
|
||||
}
|
||||
// else if( outroRadio.isSelected() )
|
||||
// {
|
||||
// tipo = 4;
|
||||
// }
|
||||
// exame.setProperty( FichaDataProvider.TIPO, new Integer( tipo ) );
|
||||
exame.set( ExamesData.TIPO, new Integer( tipo ) );
|
||||
if( tipo != 3 )
|
||||
{
|
||||
// exame.setProperty( FichaDataProvider.EXAMES.getFieldByName( FichaDataProvider.OCASIONAL ).FULL_NAME, null );
|
||||
exame.set( ExamesData.OCASIONAL, null );
|
||||
// exame.setProperty( FichaDataProvider.EXAMES.getFieldByName( FichaDataProvider.OUTRO_TIPO ).FULL_NAME, "" );
|
||||
exame.set( ExamesData.OUTRO_TIPO, "" );
|
||||
}
|
||||
else
|
||||
{
|
||||
Integer ocasionalID = ( Integer )ocasionalPanel.save();
|
||||
if( ocasionalID == null || ocasionalID.intValue() != 10 )
|
||||
{
|
||||
// exame.setProperty( FichaDataProvider.EXAMES.getFieldByName( FichaDataProvider.OUTRO_TIPO ).FULL_NAME, "" );
|
||||
exame.set( ExamesData.OUTRO_TIPO, "" );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
if( hasMsg )
|
||||
{
|
||||
throw new ValuesException( msg.toString() );
|
||||
}
|
||||
return exame;
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
String names[] = (String[])components.keySet().toArray( new String[0] );
|
||||
ComponentController.clear( names, components );
|
||||
tipoGroup.setIntSelected( 0 );
|
||||
dataExamePanel.setDate( new Date() );
|
||||
tipoProximoPanel.setSelected( new Integer( 2 ) );
|
||||
marcacao = null;
|
||||
}
|
||||
|
||||
public void setEnabled( boolean enable )
|
||||
{
|
||||
String names[] = (String[])components.keySet().toArray( new String[0] );
|
||||
ComponentController.setEnabled( names, enable, components );
|
||||
admissaoRadio.setEnabled( enable );
|
||||
periodicoRadio.setEnabled( enable );
|
||||
ocasionalRadio.setEnabled( enable );
|
||||
// outroRadio.setEnabled( enable );
|
||||
ocasionalPanel.setEnabled( ocasionalRadio.isSelected() && ocasionalRadio.isEnabled() ) ;
|
||||
// especificarText.setEnabled( outroRadio.isSelected() && outroRadio.isEnabled() );
|
||||
setEspecificarState();
|
||||
}
|
||||
|
||||
public void valueChanged(javax.swing.event.ListSelectionEvent listSelectionEvent)
|
||||
{
|
||||
setEspecificarState();
|
||||
}
|
||||
|
||||
public void setEspecificarState()
|
||||
{
|
||||
Integer id = ( Integer )ocasionalPanel.save();
|
||||
if( id != null && id.intValue() == 10 )
|
||||
{
|
||||
especificarText.setEnabled( ocasionalRadio.isSelected() && ocasionalRadio.isEnabled() );
|
||||
}
|
||||
else
|
||||
{
|
||||
especificarText.setEnabled( false );
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getMotivoProximoExame()
|
||||
{
|
||||
return tipoProximoPanel.getSelected();
|
||||
}
|
||||
|
||||
public void setup( Date fichaDate, Integer motivoProcesso )
|
||||
{
|
||||
if( fichaDate != null )
|
||||
{
|
||||
dataExamePanel.setDate( fichaDate );
|
||||
Calendar proximo = Calendar.getInstance();
|
||||
proximo.setTime( fichaDate );
|
||||
proximo.add( Calendar.YEAR, 2 );
|
||||
proximoExamePanel.setDate( proximo.getTime() );
|
||||
}
|
||||
if( motivoProcesso != null )
|
||||
{
|
||||
switch( motivoProcesso.intValue() )
|
||||
{
|
||||
case MedicinaConstants.MOTIVO_ADMISSAO:
|
||||
admissaoRadio.setSelected( true );
|
||||
break;
|
||||
case MedicinaConstants.MOTIVO_PERIODICO:
|
||||
periodicoRadio.setSelected( true );
|
||||
break;
|
||||
case MedicinaConstants.MOTIVO_PERIODICO_INICIAL:
|
||||
periodicoRadio.setSelected( true );
|
||||
break;
|
||||
case MedicinaConstants.MOTIVO_OCASIONAL:
|
||||
ocasionalRadio.setSelected( true );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,78 +0,0 @@
|
||||
/*
|
||||
* FichaAptidaoConstants.java
|
||||
*
|
||||
* Created on May 14, 2007, 5:12 PM
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package siprp.ficha;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author lflores
|
||||
*/
|
||||
public interface FichaAptidaoConstants
|
||||
{
|
||||
/* unicode
|
||||
private final String SQUARE = "☐";
|
||||
private final String CHECKED = "☑";*/
|
||||
/* windows arial circle (full circle) */
|
||||
public static final String SQUARE = "○";
|
||||
public static final String CHECKED = "●";
|
||||
|
||||
public static final String PORTARIA = "portaria";
|
||||
public static final String DESIGNACAO_SOCIAL = "designacao_social";
|
||||
public static final String ESTABELECIMENTOS_NOME = "estabelecimentos.nome";
|
||||
public static final String ESTABELECIMENTOS_LOCALIDADE = "estabelecimentos.localidade";
|
||||
public static final String SERVICO_SAUDE_TIPO_INTERNO = "servico_saude_tipo_interno";
|
||||
public static final String SERVICO_SAUDE_TIPO_INTEREMPRESAS = "servico_saude_tipo_interempresas";
|
||||
public static final String SERVICO_SAUDE_TIPO_EXTERNO = "servico_saude_tipo_externo";
|
||||
public static final String SERVICO_SAUDE_TIPO_SNS = "servico_saude_tipo_sns";
|
||||
public static final String SERVICO_SAUDE_DESIGNACAO = "servico_saude_designacao";
|
||||
public static final String SERVICO_HIGIENE_TIPO_INTERNO = "servico_higiene_tipo_interno";
|
||||
public static final String SERVICO_HIGIENE_TIPO_INTEREMPRESAS = "servico_higiene_tipo_interempresas";
|
||||
public static final String SERVICO_HIGIENE_TIPO_EXTERNO = "servico_higiene_tipo_externo";
|
||||
public static final String SERVICO_HIGIENE_TIPO_OUTRO = "servico_higiene_tipo_outro";
|
||||
public static final String SERVICO_HIGIENE_DESIGNACAO = "servico_higiene_designacao";
|
||||
public static final String TRABALHADORES_NOME = "trabalhadores.nome";
|
||||
public static final String SEXO = "sexo";
|
||||
public static final String DATA_NASCIMENTO = "data_nascimento";
|
||||
public static final String NACIONALIDADE = "nacionalidade";
|
||||
public static final String NUMERO_MECANOGRAFICO = "numero_mecanografico";
|
||||
public static final String DATA_ADMISSAO = "data_admissao";
|
||||
public static final String CATEGORIA = "categoria";
|
||||
public static final String LOCAL_TRABALHO = "local_trabalho";
|
||||
public static final String FUNCAO_PROPOSTA = "funcao_proposta";
|
||||
public static final String DATA_ADMISSAO_FUNCAO = "data_admissao_funcao";
|
||||
public static final String OBSERVACOES = "observacoes";
|
||||
public static final String EXAMES_DATA = "exames.data";
|
||||
public static final String TIPO_ADMISSAO = "tipo_admissao";
|
||||
public static final String TIPO_PERIODICO = "tipo_periodico";
|
||||
public static final String TIPO_OCASIONAL = "tipo_ocasional";
|
||||
public static final String TIPO_APOS_DOENCA = "tipo_apos_doenca";
|
||||
public static final String TIPO_APOS_ACIDENTE = "tipo_apos_acidente";
|
||||
public static final String TIPO_PEDIDO_TRABALHADOR = "tipo_pedido_trabalhador";
|
||||
public static final String TIPO_PEDIDO_EMPRESA = "tipo_pedido_empresa";
|
||||
public static final String TIPO_MUDANCA_FUNCAO = "tipo_mudanca_funcao";
|
||||
public static final String TIPO_TRABALHO = "tipo_trabalho";
|
||||
public static final String TIPO_OUTRO = "tipo_outro";
|
||||
public static final String TIPO_OUTRO_TEXTO = "tipo_outro_texto";
|
||||
public static final String RESULTADO_APTO = "resultado_apto";
|
||||
public static final String RESULTADO_APTO_CONDICIONALMENTE = "resultado_apto_condicionalmente";
|
||||
public static final String RESULTADO_INAPTO_TEMP = "resultado_inapto_temp";
|
||||
public static final String RESULTADO_INAPTO_DEF = "resultado_inapto_def";
|
||||
public static final String OUTRA_FUNCAO_1 = "outra_funcao_1";
|
||||
public static final String OUTRA_FUNCAO_2 = "outra_funcao_2";
|
||||
public static final String OUTRA_FUNCAO_3 = "outra_funcao_3";
|
||||
public static final String OUTRA_FUNCAO_4 = "outra_funcao_4";
|
||||
public static final String OUTRAS_RECOMENDACOES = "outras_recomendacoes";
|
||||
public static final String PROXIMO_EXAME = "proximo_exame";
|
||||
public static final String MEDICOS_NOME = "medicos.nome";
|
||||
public static final String NUMERO_CEDULA = "numero_cedula";
|
||||
|
||||
public static final int CODIGO_TIPO_ADMISSAO = 1;
|
||||
public static final int CODIGO_TIPO_PERIODICO = 2;
|
||||
public static final int CODIGO_TIPO_OCASIONAL = 3;
|
||||
}
|
||||
@ -1,115 +0,0 @@
|
||||
/*
|
||||
* FichaAptidaoCreator.java
|
||||
*
|
||||
* Created on May 14, 2007, 4:50 PM
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package siprp.ficha;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
|
||||
import com.evolute.utils.fop.FOPCreator;
|
||||
import com.evolute.utils.fop.FOPPrinter;
|
||||
import com.evolute.utils.fop.PDFCreator;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author lflores
|
||||
*/
|
||||
public class FichaAptidaoCreator implements FichaAptidaoConstants
|
||||
{
|
||||
private final FOPCreator fopCreator;
|
||||
private final PDFCreator pdfCreator;
|
||||
private final FOPPrinter fopPrinter;
|
||||
|
||||
private static FichaAptidaoCreator creator = null;
|
||||
|
||||
/** Creates a new instance of FichaAptidaoCreator */
|
||||
private FichaAptidaoCreator()
|
||||
{
|
||||
fopCreator = FOPCreator.getFOPCreator();
|
||||
pdfCreator = PDFCreator.getPDFCreator();
|
||||
fopPrinter = FOPPrinter.getFOPPrinter();
|
||||
}
|
||||
|
||||
public static FichaAptidaoCreator getCreator()
|
||||
{
|
||||
if( creator == null )
|
||||
{
|
||||
creator = new FichaAptidaoCreator();
|
||||
}
|
||||
return creator;
|
||||
}
|
||||
|
||||
public void print( byte fo[] )
|
||||
throws Exception
|
||||
{
|
||||
ByteArrayInputStream in = new ByteArrayInputStream( fo );
|
||||
fopPrinter.printFO( in, true, true, null );
|
||||
// System.out.println( "DONE" );
|
||||
}
|
||||
|
||||
public void printSilent( byte fo[], String printerName )
|
||||
throws Exception
|
||||
{
|
||||
ByteArrayInputStream in = new ByteArrayInputStream( fo );
|
||||
fopPrinter.printFO( in, true, false, null );
|
||||
}
|
||||
|
||||
// public byte[] createFO( HashMap<String,String> values )
|
||||
// throws Exception
|
||||
// {
|
||||
// StringBuilder buff = new StringBuilder( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<FichaAptidao>\n" );
|
||||
//
|
||||
// values.put( PORTARIA, "Portaria n. 299/2007, de 16 de Março" );
|
||||
//
|
||||
//// ☐ square
|
||||
//// ☑ checked square
|
||||
//
|
||||
// for( String key: values.keySet() )
|
||||
// {
|
||||
// buff.append( "\t<" + key + ">" );
|
||||
// String val = values.get( key );
|
||||
// buff.append( UnicodeChecker.parseToUnicode( "&#x", ";", val, true ) );
|
||||
// buff.append( "</" + key + ">\n" );
|
||||
// }
|
||||
// buff.append( "</FichaAptidao>" );
|
||||
// String xml = buff.toString();
|
||||
//
|
||||
// System.out.println( "XML: " + xml );
|
||||
//
|
||||
// ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
// InputStream xmlIn = new ByteArrayInputStream( xml.getBytes() );
|
||||
//
|
||||
// InputStream xslStream = getClass().getClassLoader().getResourceAsStream( "siprp/ficha/ficha_aptidao.xsl" );
|
||||
// fopCreator.createFOfromXML( xmlIn, xslStream, out );
|
||||
// // System.out.println( "FO created" );
|
||||
//
|
||||
// return out.toByteArray();
|
||||
// }
|
||||
|
||||
public byte[] createFO( byte []xml )
|
||||
throws Exception
|
||||
{
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
InputStream xmlIn = new ByteArrayInputStream( xml );
|
||||
|
||||
InputStream xslStream = getClass().getClassLoader().getResourceAsStream( "siprp/ficha/ficha_aptidao.xsl" );
|
||||
fopCreator.createFOfromXML( xmlIn, xslStream, out );
|
||||
// System.out.println( "FO created" );
|
||||
|
||||
return out.toByteArray();
|
||||
}
|
||||
|
||||
public byte[] createPDF( byte[] fo )
|
||||
throws Exception
|
||||
{
|
||||
return pdfCreator.createPdfFromFo( fo );
|
||||
}
|
||||
}
|
||||
@ -1,207 +0,0 @@
|
||||
/*
|
||||
* FichaAptidaoEditorManager.java
|
||||
*
|
||||
* Created on 30 de Marco de 2004, 19:23
|
||||
*/
|
||||
|
||||
package siprp.ficha;
|
||||
|
||||
import com.evolute.utils.editormanager.Editor;
|
||||
import com.evolute.utils.editormanager.EditorManager;
|
||||
import com.evolute.utils.editormanager.EditorManagerFactory;
|
||||
import com.evolute.utils.editormanager.EditorManagerInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class FichaAptidaoEditorManager extends EditorManager
|
||||
{
|
||||
private static final EditorManagerFactory FACTORY = new FichaAptidaoEditorManagerFactory();
|
||||
|
||||
public static EditorManagerFactory getEditorManagerFactory()
|
||||
{
|
||||
return FACTORY;
|
||||
}
|
||||
|
||||
/** Creates a new instance of FichaAptidaoEditorManager */
|
||||
public FichaAptidaoEditorManager( Editor ed, int i )
|
||||
{
|
||||
super( ed, i );
|
||||
}
|
||||
|
||||
/** Creates a new instance of FichaAptidaoEditorManager */
|
||||
public FichaAptidaoEditorManager( Editor ed, int i, EditorManagerInterface subMan )
|
||||
{
|
||||
super( ed, i, subMan );
|
||||
throw new RuntimeException( "FichaAptidaoEditorManager cannot have subManagers" );
|
||||
}
|
||||
|
||||
/** Creates a new instance of FichaAptidaoEditorManager */
|
||||
public FichaAptidaoEditorManager( Editor ed, int i, EditorManagerInterface subMan[] )
|
||||
{
|
||||
super( ed, i, subMan );
|
||||
throw new RuntimeException( "FichaAptidaoEditorManager cannot have subManagers" );
|
||||
}
|
||||
|
||||
public boolean isEditing()
|
||||
{
|
||||
if( state != STATE_UNSELECT )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void enable()
|
||||
{
|
||||
// System.out.println( "EditorManager: enable " + this );
|
||||
editor.enableComponents( index, false );
|
||||
// new, edit, cancel, save, delete, select
|
||||
editor.actions( index, true, false, false, false, false, true );
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
public void disable()
|
||||
{
|
||||
// System.out.println( "EditorManager: disable " + this );
|
||||
editor.clear( index );
|
||||
editor.enableComponents( index, false );
|
||||
// new, edit, cancel, save, delete, select
|
||||
editor.actions( index, false, false, false, false, false, false );
|
||||
enabled = false;
|
||||
state = STATE_UNSELECT;
|
||||
}
|
||||
|
||||
public void unlock(boolean direction)
|
||||
{
|
||||
editor.enableComponents( index, false );
|
||||
if( enabled )
|
||||
{
|
||||
if( state == STATE_UNSELECT )
|
||||
{
|
||||
// new, edit, cancel, save, delete, select
|
||||
editor.actions( index, true, false, false, false, false, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
// new, edit, cancel, save, delete, select
|
||||
editor.actions( index, true, true, false, false, true, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void select()
|
||||
{
|
||||
// System.out.println( "EditorManager: select " + this );
|
||||
// new, edit, cancel, save, delete, select
|
||||
editor.actions( index, true, true, true, true, true, true );
|
||||
state = STATE_EDIT;
|
||||
}
|
||||
|
||||
public void unselect()
|
||||
{
|
||||
// System.out.println( "EditorManager: select " + this );
|
||||
// new, edit, cancel, save, delete, select
|
||||
editor.actions( index, true, false, false, false, false, true );
|
||||
state = STATE_UNSELECT;
|
||||
}
|
||||
|
||||
public void newItem()
|
||||
{
|
||||
// System.out.println( "EditorManager: new " + this );
|
||||
editor.enableComponents( index, true );
|
||||
// new, edit, cancel, save, delete, select
|
||||
editor.actions( index, false, false, true, true, true, false );
|
||||
state = STATE_NEW;
|
||||
}
|
||||
|
||||
public void cancelItem()
|
||||
{
|
||||
// System.out.println( "EditorManager: cancel " + this );
|
||||
if( state == STATE_NEW )
|
||||
{
|
||||
editor.clear( index );
|
||||
editor.enableComponents( index, false );
|
||||
// new, edit, cancel, save, delete, select
|
||||
editor.actions( index, true, false, false, false, false, true );
|
||||
state = STATE_UNSELECT;
|
||||
}
|
||||
else if( state == STATE_EDIT )
|
||||
{
|
||||
editor.reload( index );
|
||||
editor.enableComponents( index, true );
|
||||
// new, edit, cancel, save, delete, select
|
||||
editor.actions( index, true, true, true, true, true, true );
|
||||
state = STATE_EDIT;
|
||||
}
|
||||
}
|
||||
|
||||
public void saveItem()
|
||||
{
|
||||
// System.out.println( "EditorManager: save " + this );
|
||||
if( ! editor.save( index ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
editor.enableComponents( index, false );
|
||||
// new, edit, cancel, save, delete, select
|
||||
editor.actions( index, true, true, false, false, true, true );
|
||||
state = STATE_EDIT;
|
||||
}
|
||||
|
||||
public void deleteItem()
|
||||
{
|
||||
// System.out.println( "EditorManager: delete " + this );
|
||||
if( editor.delete( index ) )
|
||||
{
|
||||
editor.clear( index );
|
||||
editor.enableComponents( index, false );
|
||||
// new, edit, cancel, save, delete, select
|
||||
editor.actions( index, true, false, false, false, false, true );
|
||||
state = STATE_UNSELECT;
|
||||
}
|
||||
}
|
||||
|
||||
public void refresh()
|
||||
{
|
||||
// System.out.println( "EditorManager: refresh " + this );
|
||||
if( !enabled )
|
||||
{
|
||||
disable();
|
||||
return;
|
||||
}
|
||||
switch( state )
|
||||
{
|
||||
case STATE_NEW:
|
||||
editItem();
|
||||
state = STATE_NEW;
|
||||
break;
|
||||
case STATE_EDIT:
|
||||
editItem();
|
||||
break;
|
||||
case STATE_SELECT:
|
||||
throw new RuntimeException( "FichaAptidaoEditorManager cannot be in STATE_SELECT" );
|
||||
case STATE_UNSELECT:
|
||||
enable();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void editItem()
|
||||
{
|
||||
state = STATE_EDIT;
|
||||
editor.actions( index, false, false, true, true, true, false );
|
||||
}
|
||||
|
||||
public void lock(boolean direction)
|
||||
{
|
||||
throw new RuntimeException( "lock cannot be called on FichaAptidaoEditorManager" );
|
||||
}
|
||||
|
||||
public void registerMain(EditorManagerInterface mainMan)
|
||||
{
|
||||
throw new RuntimeException( "registerMain cannot be called on FichaAptidaoEditorManager" );
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* FichaAptidaoEditorManagerFactory.java
|
||||
*
|
||||
* Created on 30 de Marco de 2004, 20:48
|
||||
*/
|
||||
|
||||
package siprp.ficha;
|
||||
|
||||
import com.evolute.utils.editormanager.Editor;
|
||||
import com.evolute.utils.editormanager.EditorManagerFactory;
|
||||
import com.evolute.utils.editormanager.EditorManagerInterface;
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class FichaAptidaoEditorManagerFactory
|
||||
implements EditorManagerFactory
|
||||
{
|
||||
|
||||
/** Creates a new instance of FichaAptidaoEditorManagerFactory */
|
||||
public FichaAptidaoEditorManagerFactory()
|
||||
{
|
||||
}
|
||||
|
||||
public EditorManagerInterface createEditorManager(Editor ed, int i)
|
||||
{
|
||||
return new FichaAptidaoEditorManager( ed, i );
|
||||
}
|
||||
|
||||
public EditorManagerInterface createEditorManager(Editor ed, int i, EditorManagerInterface[] subMan)
|
||||
{
|
||||
return new FichaAptidaoEditorManager( ed, i, subMan );
|
||||
}
|
||||
|
||||
public EditorManagerInterface createEditorManager(Editor ed, int i, EditorManagerInterface subMan)
|
||||
{
|
||||
return new FichaAptidaoEditorManager( ed, i, subMan );
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* MedicoColumnizedObject.java
|
||||
*
|
||||
* Created on 12 de Abril de 2004, 11:53
|
||||
*/
|
||||
|
||||
package siprp.ficha;
|
||||
|
||||
import com.evolute.utils.tables.ColumnizedObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class MedicoColumnizedObject implements ColumnizedObject
|
||||
{
|
||||
private Integer id;
|
||||
private String nome;
|
||||
private String numero;
|
||||
|
||||
/** Creates a new instance of MedicoColumnizedObject */
|
||||
public MedicoColumnizedObject( Integer id, String nome, String numero )
|
||||
{
|
||||
this.id = id;
|
||||
this.nome = nome;
|
||||
this.numero = numero;
|
||||
}
|
||||
|
||||
public Object getValue( int col )
|
||||
{
|
||||
switch( col )
|
||||
{
|
||||
case 0:
|
||||
return nome;
|
||||
|
||||
case 1:
|
||||
return numero;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Integer getID()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
}
|
||||
@ -1,281 +0,0 @@
|
||||
/*
|
||||
* MedicoEditor.java
|
||||
*
|
||||
* Created on 10 de Abril de 2004, 20:50
|
||||
*/
|
||||
|
||||
package siprp.ficha;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
|
||||
import shst.data.outer.MedicosData;
|
||||
import siprp.FichaDataProvider;
|
||||
import siprp.ui.SIPRPTabbedWindow;
|
||||
|
||||
import com.evolute.entity.ProviderInterface;
|
||||
import com.evolute.utils.Singleton;
|
||||
import com.evolute.utils.tables.BaseTable;
|
||||
import com.evolute.utils.tables.VectorTableModel;
|
||||
import com.evolute.utils.ui.CustomJDialog;
|
||||
import com.evolute.utils.ui.DialogException;
|
||||
import com.evolute.utils.ui.text.CopyPasteHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
public class MedicoEditor extends CustomJDialog
|
||||
implements ActionListener, ListSelectionListener
|
||||
{
|
||||
|
||||
private ProviderInterface JDO;
|
||||
private FichaDataProvider provider;
|
||||
private BaseTable table;
|
||||
private VectorTableModel model;
|
||||
private JButton okButton;
|
||||
private JButton cancelarButton;
|
||||
private JButton novoButton;
|
||||
private JTextField nomeText;
|
||||
private JTextField numeroText;
|
||||
private Integer id;
|
||||
private boolean isNew = false;
|
||||
|
||||
/** Creates a new instance of MedicoEditor */
|
||||
public MedicoEditor( SIPRPTabbedWindow owner )
|
||||
throws Exception
|
||||
{
|
||||
super( owner, true );
|
||||
provider = (FichaDataProvider)FichaDataProvider.getProvider();
|
||||
JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_EVO_DATA_PROVIDER );
|
||||
setupComponents();
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
throws Exception
|
||||
{
|
||||
setSize( 600, 300 );
|
||||
setResizable( false );
|
||||
setTitle( "Criar/Editar M\u00e9dico" );
|
||||
centerSuper();
|
||||
|
||||
model = new VectorTableModel( new String[]{ "Nome", "NC" } );
|
||||
table = new BaseTable( model );
|
||||
table.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
|
||||
JScrollPane scp = new JScrollPane();
|
||||
scp.setMinimumSize( new Dimension( 300, 200 ) );
|
||||
scp.setMaximumSize( new Dimension( 300, 200 ) );
|
||||
scp.setPreferredSize( new Dimension( 300, 200 ) );
|
||||
scp.setSize( new Dimension( 300, 200 ) );
|
||||
scp.setViewportView( table );
|
||||
scp.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
|
||||
scp.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
|
||||
table.fixColumnWidth( 0, 200 );
|
||||
table.setNonResizableNorReordable();
|
||||
table.getSelectionModel().addListSelectionListener( this );
|
||||
Object obj[][] = provider.getAllMedicos();
|
||||
Vector medicos = new Vector();
|
||||
for( int n = 0; n < obj.length; n++ )
|
||||
{
|
||||
medicos.add( new MedicoColumnizedObject( (Integer)obj[n][0],
|
||||
(String)obj[n][1],
|
||||
(String)obj[n][2] ) );
|
||||
}
|
||||
model.setValues( medicos );
|
||||
|
||||
okButton = new JButton( "OK" );
|
||||
cancelarButton = new JButton( "Cancelar" );
|
||||
novoButton = new JButton( "Novo" );
|
||||
okButton.addActionListener( this );
|
||||
cancelarButton.addActionListener( this );
|
||||
novoButton.addActionListener( this );
|
||||
|
||||
nomeText = new JTextField();
|
||||
nomeText.setEnabled( false );
|
||||
numeroText = new JTextField();
|
||||
numeroText.setEnabled( false );
|
||||
|
||||
GridBagLayout gridbag = new GridBagLayout();
|
||||
getContentPane().setLayout( gridbag );
|
||||
GridBagConstraints constraints = new GridBagConstraints();
|
||||
constraints.insets = new Insets( 1, 1, 1, 1 );
|
||||
constraints.fill = GridBagConstraints.BOTH;
|
||||
constraints.weighty = 1;
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
constraints.gridheight = 1;
|
||||
|
||||
JPanel upperPanel = new JPanel();
|
||||
upperPanel.setLayout( new GridLayout( 1, 2 ) );
|
||||
upperPanel.add( scp );
|
||||
JPanel textPanel = new JPanel();
|
||||
upperPanel.add( textPanel );
|
||||
gridbag.setConstraints( upperPanel, constraints );
|
||||
getContentPane().add( upperPanel );
|
||||
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.weighty = 0;
|
||||
constraints.weightx = 0.3;
|
||||
constraints.gridwidth = 1;
|
||||
constraints.gridheight = GridBagConstraints.REMAINDER;;
|
||||
|
||||
gridbag.setConstraints( novoButton, constraints );
|
||||
getContentPane().add( novoButton );
|
||||
|
||||
gridbag.setConstraints( okButton, constraints );
|
||||
getContentPane().add( okButton );
|
||||
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( cancelarButton, constraints );
|
||||
getContentPane().add( cancelarButton );
|
||||
|
||||
gridbag = new GridBagLayout();
|
||||
textPanel.setLayout( gridbag );
|
||||
constraints.weighty = 0;
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
constraints.gridheight = 1;
|
||||
|
||||
JLabel nomeLabel = new JLabel( "Nome" );
|
||||
gridbag.setConstraints( nomeLabel, constraints );
|
||||
textPanel.add( nomeLabel );
|
||||
|
||||
gridbag.setConstraints( nomeText, constraints );
|
||||
textPanel.add( nomeText );
|
||||
|
||||
JLabel numeroLabel = new JLabel( "N\u00famero" );
|
||||
gridbag.setConstraints( numeroLabel, constraints );
|
||||
textPanel.add( numeroLabel );
|
||||
|
||||
gridbag.setConstraints( numeroText, constraints );
|
||||
textPanel.add( numeroText );
|
||||
|
||||
constraints.weighty = 1;
|
||||
constraints.gridheight = GridBagConstraints.REMAINDER;;
|
||||
JPanel pad = new JPanel();
|
||||
gridbag.setConstraints( pad, constraints );
|
||||
textPanel.add( pad );
|
||||
|
||||
new CopyPasteHandler( nomeText );
|
||||
new CopyPasteHandler( numeroText );
|
||||
}
|
||||
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
if( e.getSource().equals( okButton ) )
|
||||
{
|
||||
if( save() )
|
||||
{
|
||||
close();
|
||||
}
|
||||
}
|
||||
else if( e.getSource().equals( cancelarButton ) )
|
||||
{
|
||||
close();
|
||||
}
|
||||
if( e.getSource().equals( novoButton ) )
|
||||
{
|
||||
table.getSelectionModel().removeListSelectionListener( this );
|
||||
nomeText.setText( "" );
|
||||
numeroText.setText( "" );
|
||||
nomeText.setEnabled( true );
|
||||
numeroText.setEnabled( true );
|
||||
id = null;
|
||||
isNew = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void valueChanged(javax.swing.event.ListSelectionEvent listSelectionEvent)
|
||||
{
|
||||
int selected = table.getSelectedRow();
|
||||
if( selected == -1 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
MedicoColumnizedObject row = (MedicoColumnizedObject)model.getRowAt( selected );
|
||||
id = row.getID();
|
||||
String nome = (String) row.getValue( 0 );
|
||||
String numero = (String) row.getValue( 1 );
|
||||
nomeText.setText( nome );
|
||||
numeroText.setText( numero );
|
||||
nomeText.setEnabled( true );
|
||||
numeroText.setEnabled( true );
|
||||
}
|
||||
|
||||
private void close()
|
||||
{
|
||||
setVisible( false );
|
||||
dispose();
|
||||
}
|
||||
|
||||
public boolean getIsNew()
|
||||
{
|
||||
return isNew;
|
||||
}
|
||||
|
||||
public Integer getID()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
private boolean save()
|
||||
{
|
||||
String nome = nomeText.getText().trim();
|
||||
String numero = numeroText.getText().trim();
|
||||
if( nome.length() == 0 )
|
||||
{
|
||||
JOptionPane.showMessageDialog( this, "O Nome n\u00e3o pode ser vazio.", "Erro...",
|
||||
JOptionPane.ERROR_MESSAGE );
|
||||
return false;
|
||||
}
|
||||
try
|
||||
{
|
||||
MedicosData medico;
|
||||
if( id != null )
|
||||
{
|
||||
medico = ( MedicosData ) JDO.load( MedicosData.class, id );
|
||||
// medico = provider.load( provider.MEDICOS, new DBKey( id ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
medico = new MedicosData();
|
||||
// medico = provider.createObject( provider.MEDICOS );
|
||||
}
|
||||
// medico.setProperty( provider.NOME, nome );
|
||||
// medico.setProperty( provider.NUMERO_CEDULA, numero );
|
||||
medico.set( MedicosData.NOME, nome );
|
||||
medico.set( MedicosData.NUMERO_CEDULA, numero );
|
||||
medico.save();
|
||||
if( id == null )
|
||||
{
|
||||
// DBKey key = medico.getPrimaryKeyValue();
|
||||
// DBField fields[] = provider.MEDICOS.getPrimaryKey();
|
||||
// id = new Integer( ((Number)key.getFieldValue( fields[ 0 ] )).intValue() );
|
||||
id = (Integer)medico.get( MedicosData.ID );
|
||||
}
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
// JOptionPane.showMessageDialog( this, "Erro a gravar...", "Erro...",
|
||||
// JOptionPane.ERROR_MESSAGE );
|
||||
DialogException.showExceptionMessage( ex, "Erro a gravar...", false );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -1,103 +0,0 @@
|
||||
/*
|
||||
* ObservacoesPanel.java
|
||||
*
|
||||
* Created on 29 de Marco de 2004, 11:56
|
||||
*/
|
||||
|
||||
package siprp.ficha;
|
||||
|
||||
import java.awt.GridLayout;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import shst.data.outer.TrabalhadoresData;
|
||||
import siprp.FichaDataProvider;
|
||||
|
||||
import com.evolute.entity.ProviderInterface;
|
||||
import com.evolute.utils.Singleton;
|
||||
import com.evolute.utils.dataui.ControllableComponent;
|
||||
import com.evolute.utils.documents.MaximumLengthDocument;
|
||||
import com.evolute.utils.ui.text.CopyPasteHandler;
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class ObservacoesPanel extends JPanel
|
||||
implements ControllableComponent
|
||||
{
|
||||
private ProviderInterface JDO;
|
||||
|
||||
private JTextField observacoesText;
|
||||
|
||||
private FichaDataProvider provider;
|
||||
|
||||
/** Creates a new instance of ObservacoesPanel */
|
||||
public ObservacoesPanel()
|
||||
throws Exception
|
||||
{
|
||||
provider = (FichaDataProvider)FichaDataProvider.getProvider();
|
||||
JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_EVO_DATA_PROVIDER );
|
||||
setupComponents();
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
{
|
||||
setBorder( BorderFactory.createTitledBorder(
|
||||
BorderFactory.createEtchedBorder(),
|
||||
"Observa\u00e7\u00f5es" ) );
|
||||
|
||||
// JScrollPane scp = new JScrollPane();
|
||||
// scp.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
|
||||
// scp.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
|
||||
observacoesText = new JTextField();
|
||||
observacoesText.setDocument( new MaximumLengthDocument( 150 ) );
|
||||
// observacoesText.setLineWrap( true );
|
||||
// observacoesText.setWrapStyleWord( true );
|
||||
// scp.setViewportView( observacoesText );
|
||||
|
||||
setLayout( new GridLayout( 1, 1, 0, 0 ) );
|
||||
add( observacoesText );
|
||||
|
||||
new CopyPasteHandler( observacoesText );
|
||||
}
|
||||
|
||||
public void fill(Object value)
|
||||
{
|
||||
clear();
|
||||
Integer trabalhadorID = (Integer)value;
|
||||
if( trabalhadorID != null )
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
TrabalhadoresData trabalhador = (TrabalhadoresData)JDO.load( TrabalhadoresData.class, trabalhadorID );
|
||||
String observacoes = (String) trabalhador.get( TrabalhadoresData.OBSERVACOES );
|
||||
if( observacoes != null )
|
||||
{
|
||||
observacoesText.setText( observacoes );
|
||||
}
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Object save()
|
||||
{
|
||||
return observacoesText.getText();
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
observacoesText.setText( "" );
|
||||
}
|
||||
|
||||
public void setEnabled( boolean enable )
|
||||
{
|
||||
observacoesText.setEnabled( enable );
|
||||
}
|
||||
}
|
||||
@ -1,57 +0,0 @@
|
||||
package siprp.ficha;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.print.PageFormat;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import com.evolute.utils.print.A4ContinuoPage;
|
||||
import com.evolute.utils.print.AbstractPrintHandler;
|
||||
import com.sun.pdfview.PDFFile;
|
||||
import com.sun.pdfview.PDFPage;
|
||||
import com.sun.pdfview.PDFRenderer;
|
||||
|
||||
public class PDFFilePrinter extends AbstractPrintHandler
|
||||
{
|
||||
protected byte pdf[];
|
||||
protected PDFFile pdffile;
|
||||
|
||||
public PDFFilePrinter(byte pdf[], boolean printDialog )
|
||||
throws Exception
|
||||
{
|
||||
super( new A4ContinuoPage(), printDialog );
|
||||
|
||||
this.pdf = pdf;
|
||||
ByteBuffer buffer = ByteBuffer.allocate( pdf.length );
|
||||
buffer.put( pdf );
|
||||
//
|
||||
|
||||
// File file = new File("/home/fpalma/Desktop/icons_op.pdf");
|
||||
//
|
||||
// // set up the PDF reading
|
||||
// RandomAccessFile raf = new RandomAccessFile(file, "r");
|
||||
// FileChannel channel = raf.getChannel();
|
||||
// ByteBuffer buffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
|
||||
pdffile = new PDFFile(buffer);
|
||||
setNumberOfPages( pdffile.getNumPages() );
|
||||
print();
|
||||
}
|
||||
|
||||
protected void paintGraphics( Graphics g, PageFormat pf, int index )
|
||||
{
|
||||
try
|
||||
{
|
||||
PDFPage page = pdffile.getPage( index );
|
||||
PDFRenderer renderer = new PDFRenderer(page, ( Graphics2D ) g,
|
||||
new Rectangle(0, 0,(int) page.getWidth(), (int) page.getHeight()), null, Color.RED);
|
||||
page.waitForFinish();
|
||||
renderer.run();
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,64 +0,0 @@
|
||||
/*
|
||||
* RecomendacoesPanel.java
|
||||
*
|
||||
* Created on 29 de Marco de 2004, 11:58
|
||||
*/
|
||||
|
||||
package siprp.ficha;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.GridLayout;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
|
||||
import com.evolute.utils.documents.MaximumLengthDocument;
|
||||
import com.evolute.utils.ui.calendar.JCalendarPanel;
|
||||
import com.evolute.utils.ui.text.CopyPasteHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class RecomendacoesPanel extends JPanel
|
||||
{
|
||||
private JTextArea recomendacoesText;
|
||||
private JCalendarPanel proximoExamePanel;
|
||||
/** Creates a new instance of RecomendacoesPanel */
|
||||
public RecomendacoesPanel()
|
||||
{
|
||||
setupComponents();
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
{
|
||||
setBorder( BorderFactory.createTitledBorder(
|
||||
BorderFactory.createEtchedBorder(),
|
||||
"Outras Recomenda\u00e7\u00f5es" ) );
|
||||
|
||||
JScrollPane scp = new JScrollPane();
|
||||
scp.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
|
||||
scp.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
|
||||
recomendacoesText = new JTextArea();
|
||||
recomendacoesText.setLineWrap( true );
|
||||
recomendacoesText.setWrapStyleWord( true );
|
||||
recomendacoesText.setDocument( new MaximumLengthDocument( 150 ) );
|
||||
scp.setViewportView( recomendacoesText );
|
||||
JPanel rightPanel = new JPanel();
|
||||
JLabel proximoExameLabel = new JLabel( "Pr\u00f3ximo Exame" );
|
||||
proximoExamePanel = new JCalendarPanel( null );
|
||||
|
||||
setLayout( new GridLayout( 1, 2, 0, 0 ) );
|
||||
add( scp );
|
||||
add( rightPanel );
|
||||
|
||||
rightPanel.setLayout( new BorderLayout() );
|
||||
rightPanel.add( proximoExameLabel, BorderLayout.WEST );
|
||||
rightPanel.add( proximoExamePanel, BorderLayout.CENTER );
|
||||
|
||||
new CopyPasteHandler( recomendacoesText );
|
||||
}
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
/*
|
||||
* 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 );
|
||||
}
|
||||
@ -1,470 +0,0 @@
|
||||
/*
|
||||
* TrabalhadorPanel.java
|
||||
*
|
||||
* Created on 29 de Marco de 2004, 11:55
|
||||
*/
|
||||
|
||||
package siprp.ficha;
|
||||
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.util.Hashtable;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import shst.data.outer.TrabalhadoresData;
|
||||
import shst.importer.Importer;
|
||||
import siprp.FichaDataProvider;
|
||||
|
||||
import com.evolute.entity.ProviderInterface;
|
||||
import com.evolute.utils.Singleton;
|
||||
import com.evolute.utils.data.IDObject;
|
||||
import com.evolute.utils.data.MappableObject;
|
||||
import com.evolute.utils.dataui.ComponentController;
|
||||
import com.evolute.utils.dataui.ComponentsHashtable;
|
||||
import com.evolute.utils.dataui.ControllableComponent;
|
||||
import com.evolute.utils.date.DateUtils;
|
||||
import com.evolute.utils.ui.DialogException;
|
||||
import com.evolute.utils.ui.calendar.JCalendarPanel;
|
||||
import com.evolute.utils.ui.panel.RadioButtonFixedPanel;
|
||||
import com.evolute.utils.ui.panel.RadioButtonPanel;
|
||||
import com.evolute.utils.ui.text.CopyPasteHandler;
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class TrabalhadorPanel extends JPanel
|
||||
implements ControllableComponent
|
||||
{
|
||||
private ProviderInterface JDO;
|
||||
private JTextField nomeText;
|
||||
private RadioButtonFixedPanel sexoPanel;
|
||||
private JCalendarPanel dataNascimentoPanel;
|
||||
private JTextField nacionalidadeText;
|
||||
private JTextField numeroMecanograficoText;
|
||||
private JCalendarPanel dataAdmissaoPanel;
|
||||
private JTextField categoriaText;
|
||||
private JTextField localText;
|
||||
private JTextField funcaoText;
|
||||
private JCalendarPanel dataAdmissaoFuncaoPanel;
|
||||
|
||||
private ComponentsHashtable components;
|
||||
private FichaDataProvider provider;
|
||||
private TrabalhadoresData trabalhador;
|
||||
|
||||
/** Creates a new instance of TrabalhadorPanel */
|
||||
|
||||
public TrabalhadorPanel()
|
||||
throws Exception
|
||||
{
|
||||
provider = (FichaDataProvider)FichaDataProvider.getProvider();
|
||||
JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_EVO_DATA_PROVIDER );
|
||||
setupComponents();
|
||||
setupComponentsHashtable();
|
||||
}
|
||||
|
||||
|
||||
private void setupComponents()
|
||||
{
|
||||
setBorder( BorderFactory.createTitledBorder(
|
||||
BorderFactory.createEtchedBorder(),
|
||||
"Trabalhador" ) );
|
||||
JLabel nomeLabel = new JLabel( "Nome" );
|
||||
nomeText = new JTextField();
|
||||
JLabel sexoLabel = new JLabel( "Sexo" );
|
||||
sexoPanel =
|
||||
new RadioButtonFixedPanel(
|
||||
new IDObject[]{ new MappableObject( new Integer( 1 ), "M" ),
|
||||
new MappableObject( new Integer( 2 ), "F" ) },
|
||||
1, 2, RadioButtonPanel.ORIENTATION_HORIZONTAL, false );
|
||||
JLabel dataNascimentoLabel = new JLabel( "Data de Nascimento" );
|
||||
dataNascimentoPanel = new JCalendarPanel( null );
|
||||
JLabel nacionalidadeLabel = new JLabel( "Nacionalidade" );
|
||||
nacionalidadeText = new JTextField();
|
||||
JLabel numeroMecanograficoLabel = new JLabel( "N\u00famero Mecanogr\u00e1fico/outro" );
|
||||
numeroMecanograficoText = new JTextField();
|
||||
JLabel dataAdmissaoLabel = new JLabel( "Data de Admiss\u00e3o" );
|
||||
dataAdmissaoPanel = new JCalendarPanel( null );
|
||||
JLabel categoriaLabel = new JLabel( "Categoria Profissional" );
|
||||
categoriaText = new JTextField();
|
||||
JLabel localLabel = new JLabel( "Local de Trabalho" );
|
||||
localText = new JTextField();
|
||||
JLabel funcaoLabel = new JLabel( "Fun\u00e7\u00e3o proposta" );
|
||||
funcaoText = new JTextField();
|
||||
JLabel dataAdmissaoFuncaoLabel = new JLabel( "Data de Admiss\u00e3o na Fun\u00e7\u00e3o" );
|
||||
dataAdmissaoFuncaoPanel = new JCalendarPanel( null );
|
||||
|
||||
GridBagLayout gridbag = new GridBagLayout();
|
||||
setLayout( gridbag );
|
||||
GridBagConstraints constraints = new GridBagConstraints();
|
||||
constraints.insets = new Insets( 0, 1, 0, 1 );
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.weighty = 0;
|
||||
constraints.gridheight = 1;
|
||||
constraints.gridwidth = 1;
|
||||
constraints.weightx = 0;
|
||||
|
||||
gridbag.setConstraints( nomeLabel, constraints );
|
||||
add( nomeLabel );
|
||||
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = 3;
|
||||
gridbag.setConstraints( nomeText, constraints );
|
||||
add( nomeText );
|
||||
|
||||
constraints.gridwidth = 1;
|
||||
constraints.weightx = 0;
|
||||
gridbag.setConstraints( sexoLabel, constraints );
|
||||
add( sexoLabel );
|
||||
|
||||
constraints.weightx = 0;
|
||||
//constraints.gridwidth = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( sexoPanel, constraints );
|
||||
add( sexoPanel );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 2;
|
||||
gridbag.setConstraints( nacionalidadeLabel, constraints );
|
||||
add( nacionalidadeLabel );
|
||||
|
||||
constraints.weightx = 0.5;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( nacionalidadeText, constraints );
|
||||
add( nacionalidadeText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( dataNascimentoLabel, constraints );
|
||||
add( dataNascimentoLabel );
|
||||
|
||||
constraints.weightx = 0.5;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( dataNascimentoPanel, constraints );
|
||||
add( dataNascimentoPanel );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 2;
|
||||
gridbag.setConstraints( numeroMecanograficoLabel, constraints );
|
||||
add( numeroMecanograficoLabel );
|
||||
|
||||
constraints.weightx = 0.5;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( numeroMecanograficoText, constraints );
|
||||
add( numeroMecanograficoText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( dataAdmissaoLabel, constraints );
|
||||
add( dataAdmissaoLabel );
|
||||
|
||||
constraints.weightx = 0.5;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( dataAdmissaoPanel, constraints );
|
||||
add( dataAdmissaoPanel );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 2;
|
||||
gridbag.setConstraints( categoriaLabel, constraints );
|
||||
add( categoriaLabel );
|
||||
|
||||
constraints.weightx = 0.5;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( categoriaText, constraints );
|
||||
add( categoriaText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
gridbag.setConstraints( localLabel, constraints );
|
||||
add( localLabel );
|
||||
|
||||
constraints.weightx = 0.5;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( localText, constraints );
|
||||
add( localText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 2;
|
||||
gridbag.setConstraints( funcaoLabel, constraints );
|
||||
add( funcaoLabel );
|
||||
|
||||
constraints.weightx = 0.5;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( funcaoText, constraints );
|
||||
add( funcaoText );
|
||||
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
gridbag.setConstraints( dataAdmissaoFuncaoLabel, constraints );
|
||||
add( dataAdmissaoFuncaoLabel );
|
||||
|
||||
constraints.weightx = 0.5;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( dataAdmissaoFuncaoPanel, constraints );
|
||||
add( dataAdmissaoFuncaoPanel );
|
||||
|
||||
new CopyPasteHandler( nomeText );
|
||||
new CopyPasteHandler( nacionalidadeText );
|
||||
new CopyPasteHandler( numeroMecanograficoText );
|
||||
new CopyPasteHandler( categoriaText );
|
||||
new CopyPasteHandler( localText );
|
||||
new CopyPasteHandler( funcaoText );
|
||||
}
|
||||
|
||||
private void setupComponentsHashtable()
|
||||
{
|
||||
components = new ComponentsHashtable();
|
||||
components.putComponent( TrabalhadoresData.NOME, nomeText );
|
||||
components.putComponent( TrabalhadoresData.SEXO, new ControllableComponent()
|
||||
{
|
||||
public void fill( Object value )
|
||||
{
|
||||
if( value != null && value.equals( "f" ) )
|
||||
{
|
||||
sexoPanel.fill( new Integer(2) );
|
||||
}
|
||||
else
|
||||
{
|
||||
sexoPanel.fill( new Integer(1) );
|
||||
}
|
||||
}
|
||||
|
||||
public Object save()
|
||||
{
|
||||
Integer id = (Integer)sexoPanel.save();
|
||||
if( id != null && id.intValue() == 1 )
|
||||
{
|
||||
return "m";
|
||||
}
|
||||
return "f";
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
sexoPanel.clear();
|
||||
}
|
||||
|
||||
public void setEnabled( boolean enable )
|
||||
{
|
||||
sexoPanel.setEnabled( enable );
|
||||
}
|
||||
} );
|
||||
components.putComponent( TrabalhadoresData.DATA_NASCIMENTO, dataNascimentoPanel );
|
||||
components.putComponent( TrabalhadoresData.NACIONALIDADE, nacionalidadeText );
|
||||
components.putComponent( TrabalhadoresData.NUMERO_MECANOGRAFICO, numeroMecanograficoText );
|
||||
components.putComponent( TrabalhadoresData.DATA_ADMISSAO, dataAdmissaoPanel );
|
||||
components.putComponent( TrabalhadoresData.CATEGORIA, categoriaText );
|
||||
components.putComponent( TrabalhadoresData.LOCAL_TRABALHO, localText );
|
||||
components.putComponent( TrabalhadoresData.FUNCAO_PROPOSTA, funcaoText );
|
||||
components.putComponent( TrabalhadoresData.DATA_ADMISSAO_FUNCAO, dataAdmissaoFuncaoPanel );
|
||||
components.putDummy( TrabalhadoresData.DATA_DEMISSAO );
|
||||
components.putDummy( TrabalhadoresData.OBSERVACOES );
|
||||
components.putDummy( TrabalhadoresData.OBSERVACOES_GESTAO );
|
||||
components.putDummy( TrabalhadoresData.PERFIL );
|
||||
components.putDummy( TrabalhadoresData.TO_ESTABELECIMENTO_ID );
|
||||
components.putDummy( TrabalhadoresData.NOME_PLAIN );
|
||||
components.putDummy( TrabalhadoresData.BI );
|
||||
|
||||
// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.NOME, nomeText );
|
||||
// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.DATA_NASCIMENTO, dataNascimentoPanel );
|
||||
// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.NACIONALIDADE, nacionalidadeText );
|
||||
// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.NUMERO_MECANOGRAFICO, numeroMecanograficoText );
|
||||
// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.DATA_ADMISSAO, dataAdmissaoPanel );
|
||||
// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.CATEGORIA, categoriaText );
|
||||
// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.LOCAL_TRABALHO, localText );
|
||||
// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.FUNCAO_PROPOSTA, funcaoText );
|
||||
// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.DATA_ADMISSAO_FUNCAO, dataAdmissaoFuncaoPanel );
|
||||
// components.putDummy( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.ESTABELECIMENTO_ID );
|
||||
// components.putDummy( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.OBSERVACOES );
|
||||
// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.SEXO,
|
||||
// new ControllableComponent()
|
||||
// {
|
||||
// public void fill( Object value )
|
||||
// {
|
||||
// if( value != null && value.equals( "f" ) )
|
||||
// {
|
||||
// sexoPanel.fill( new Integer(2) );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// sexoPanel.fill( new Integer(1) );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public Object save()
|
||||
// {
|
||||
// Integer id = (Integer)sexoPanel.save();
|
||||
// if( id != null && id.intValue() == 1 )
|
||||
// {
|
||||
// return "m";
|
||||
// }
|
||||
// return "f";
|
||||
// }
|
||||
//
|
||||
// public void clear()
|
||||
// {
|
||||
// sexoPanel.clear();
|
||||
// }
|
||||
//
|
||||
// public void setEnabled( boolean enable )
|
||||
// {
|
||||
// sexoPanel.setEnabled( enable );
|
||||
// }
|
||||
// } );
|
||||
}
|
||||
|
||||
public void fill(Object value)
|
||||
{
|
||||
clear();
|
||||
trabalhador = null;
|
||||
if( value != null )
|
||||
{
|
||||
Integer trabalhadorID = (Integer)value;
|
||||
if( trabalhadorID != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
trabalhador = ( TrabalhadoresData ) JDO.load( TrabalhadoresData.class, trabalhadorID );
|
||||
// String names[] = trabalhador.getFieldNames();
|
||||
ComponentController.fill( trabalhador.getHashData(), components );
|
||||
// trabalhador = provider.load( FichaDataProvider.TRABALHADORES, new DBKey( trabalhadorID ) );
|
||||
// DBField fields[] = FichaDataProvider.TRABALHADORES.getInsertFields();
|
||||
// String trabalhadorFields[] = new String[ fields.length ];
|
||||
// Hashtable data = new Hashtable();
|
||||
// for( int i = 0; i < trabalhadorFields.length; ++i )
|
||||
// {
|
||||
// trabalhadorFields[ i ] = fields[ i ].FULL_NAME;
|
||||
// Object fieldValue = trabalhador.getProperty( trabalhadorFields[ i ] );
|
||||
// if( fieldValue != null )
|
||||
// {
|
||||
// data.put( trabalhadorFields[ i ], fieldValue );
|
||||
// }
|
||||
// }
|
||||
// ComponentController.fill( trabalhadorFields, data, components );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a carregar os dados do trabalhador", true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Object save()
|
||||
{
|
||||
StringBuffer msg = new StringBuffer();
|
||||
boolean hasMsg = false;
|
||||
try
|
||||
{
|
||||
if( trabalhador == null )
|
||||
{
|
||||
// trabalhador = provider.createObject( FichaDataProvider.TRABALHADORES );
|
||||
trabalhador = new TrabalhadoresData();
|
||||
trabalhador.set( TrabalhadoresData.PERFIL, new Integer( 1 ) );
|
||||
}
|
||||
trabalhador.setHashData( ComponentController.save( components ) );
|
||||
// if( ((String)trabalhador.getProperty( FichaDataProvider.NOME )).trim().length() == 0 )
|
||||
if( ((String)trabalhador.get( TrabalhadoresData.NOME )).trim().length() == 0 )
|
||||
{
|
||||
msg.append( "O trabalhador tem de ter nome\n" );
|
||||
hasMsg = true;
|
||||
}
|
||||
// if( trabalhador.getProperty( FichaDataProvider.SEXO ) == null )
|
||||
if( trabalhador.get( TrabalhadoresData.SEXO ) == null )
|
||||
{
|
||||
msg.append( "O trabalhador tem de ter um sexo definido\n" );
|
||||
hasMsg = true;
|
||||
}
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
if( hasMsg )
|
||||
{
|
||||
throw new ValuesException( msg.toString() );
|
||||
}
|
||||
return trabalhador;
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
String names[] = (String[])components.keySet().toArray( new String[0] );
|
||||
ComponentController.clear( names, components );
|
||||
trabalhador = null;
|
||||
}
|
||||
|
||||
public void setEnabled( boolean enable )
|
||||
{
|
||||
String names[] = (String[])components.keySet().toArray( new String[0] );
|
||||
ComponentController.setEnabled( names, enable, components );
|
||||
}
|
||||
|
||||
public void setData( Hashtable data )
|
||||
{
|
||||
String nome = (String)data.get( Importer.NOME );
|
||||
if( nome != null && nome.trim().length() > 0 )
|
||||
{
|
||||
nomeText.setText( nome );
|
||||
}
|
||||
String sexo = (String)data.get( Importer.SEXO );
|
||||
if( sexo != null && sexo.trim().length() > 0 )
|
||||
{
|
||||
Integer sexoInt;
|
||||
if( sexo.trim().toLowerCase().charAt(0) == 'f' )
|
||||
{
|
||||
sexoInt = new Integer( 2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
sexoInt = new Integer( 1 );
|
||||
}
|
||||
sexoPanel.fill( sexoInt );
|
||||
}
|
||||
String nacionalidade = (String)data.get( Importer.NACIONALIDADE );
|
||||
if( nacionalidade != null && nacionalidade.trim().length() > 0 )
|
||||
{
|
||||
nacionalidadeText.setText( nacionalidade );
|
||||
}
|
||||
String dataNascimento = (String)data.get( Importer.DATA_NASCIMENTO );
|
||||
if( dataNascimento != null )
|
||||
{
|
||||
dataNascimentoPanel.setDate( DateUtils.guessDate( dataNascimento ) );
|
||||
}
|
||||
String numeroMecanografico = (String)data.get( Importer.NUMERO_MECANOGRAFICO );
|
||||
if( numeroMecanografico != null && numeroMecanografico.trim().length() > 0 )
|
||||
{
|
||||
numeroMecanograficoText.setText( numeroMecanografico );
|
||||
}
|
||||
String dataAdmissao = (String)data.get( Importer.DATA_ADMISSAO );
|
||||
if( dataAdmissao != null )
|
||||
{
|
||||
dataAdmissaoPanel.setDate( DateUtils.guessDate( dataAdmissao ) );
|
||||
}
|
||||
String categoria = (String)data.get( Importer.CATEGORIA );
|
||||
if( categoria != null && categoria.trim().length() > 0 )
|
||||
{
|
||||
categoriaText.setText( categoria );
|
||||
}
|
||||
String localTrabalho = (String)data.get( Importer.LOCAL_TRABALHO );
|
||||
if( localTrabalho != null && localTrabalho.trim().length() > 0 )
|
||||
{
|
||||
localText.setText( localTrabalho );
|
||||
}
|
||||
String funcao = (String)data.get( Importer.FUNCAO );
|
||||
if( funcao != null && funcao.trim().length() > 0 )
|
||||
{
|
||||
funcaoText.setText( funcao );
|
||||
}
|
||||
String dataAdmissaoFuncao = (String)data.get( Importer.DATA_ADMISSAO_FUNCAO );
|
||||
if( dataAdmissaoFuncao != null )
|
||||
{
|
||||
dataAdmissaoFuncaoPanel.setDate( DateUtils.guessDate( dataAdmissaoFuncao ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,305 +0,0 @@
|
||||
/*
|
||||
* UpperPanel.java
|
||||
*
|
||||
* Created on 29 de Marco de 2004, 17:44
|
||||
*/
|
||||
|
||||
package siprp.ficha;
|
||||
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.util.Hashtable;
|
||||
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import shst.data.outer.EmpresasData;
|
||||
import shst.data.outer.EstabelecimentosData;
|
||||
import shst.data.outer.MedicosData;
|
||||
import shst.data.outer.TrabalhadoresData;
|
||||
import siprp.FichaDataProvider;
|
||||
import siprp.ui.SIPRPTabbedWindow;
|
||||
|
||||
import com.evolute.entity.ProviderInterface;
|
||||
import com.evolute.utils.Singleton;
|
||||
import com.evolute.utils.data.IDObject;
|
||||
import com.evolute.utils.data.MappableObject;
|
||||
import com.evolute.utils.dataui.ControllableComponent;
|
||||
import com.evolute.utils.ui.DialogException;
|
||||
import com.evolute.utils.ui.text.CopyPasteHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class UpperPanel extends JPanel
|
||||
implements ControllableComponent< Object >, ItemListener
|
||||
{
|
||||
protected ProviderInterface JDO;
|
||||
|
||||
protected SIPRPTabbedWindow owner;
|
||||
private JTextField empresaText;
|
||||
private JTextField nomeText;
|
||||
private JComboBox medicosCombo;
|
||||
private JTextField cpText;
|
||||
|
||||
private FichaDataProvider provider;
|
||||
private Hashtable medicosHash;
|
||||
|
||||
/** Creates a new instance of UpperPanel */
|
||||
public UpperPanel()
|
||||
throws Exception
|
||||
{
|
||||
provider = (FichaDataProvider)FichaDataProvider.getProvider();
|
||||
medicosHash = new Hashtable();
|
||||
JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_EVO_DATA_PROVIDER );
|
||||
setupComponents();
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
throws Exception
|
||||
{
|
||||
JLabel empresaLabel = new JLabel( "Empresa/Entidade" );
|
||||
empresaText = new JTextField();
|
||||
empresaText.setEditable( false );
|
||||
JLabel nomeLabel = new JLabel( "Nome" );
|
||||
nomeText = new JTextField();
|
||||
nomeText.setEditable( false );
|
||||
JLabel medicoLabel = new JLabel( "M\u00e9dico" );
|
||||
medicosCombo = new JComboBox();
|
||||
JLabel cpLabel = new JLabel( "c.p." );
|
||||
cpText = new JTextField();
|
||||
cpText.setEditable( false );
|
||||
fillCombo();
|
||||
GridBagLayout gridbag = new GridBagLayout();
|
||||
setLayout( gridbag );
|
||||
GridBagConstraints constraints = new GridBagConstraints();
|
||||
constraints.insets = new Insets( 0, 1, 0, 1 );
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.gridheight = 1;
|
||||
constraints.weighty = 0;
|
||||
|
||||
constraints.gridwidth = 1;
|
||||
constraints.weightx = 0;
|
||||
gridbag.setConstraints( empresaLabel, constraints );
|
||||
add( empresaLabel );
|
||||
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
constraints.weightx = 1;
|
||||
gridbag.setConstraints( empresaText, constraints );
|
||||
add( empresaText );
|
||||
|
||||
constraints.gridwidth = 1;
|
||||
constraints.weightx = 0;
|
||||
gridbag.setConstraints( nomeLabel, constraints );
|
||||
add( nomeLabel );
|
||||
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
constraints.weightx = 1;
|
||||
gridbag.setConstraints( nomeText, constraints );
|
||||
add( nomeText );
|
||||
|
||||
constraints.gridwidth = 1;
|
||||
constraints.weightx = 0;
|
||||
gridbag.setConstraints( medicoLabel, constraints );
|
||||
add( medicoLabel );
|
||||
|
||||
constraints.gridwidth = 1;
|
||||
constraints.weightx = 0.8;
|
||||
gridbag.setConstraints( medicosCombo, constraints );
|
||||
add( medicosCombo );
|
||||
|
||||
constraints.gridwidth = 1;
|
||||
constraints.weightx = 0;
|
||||
gridbag.setConstraints( cpLabel, constraints );
|
||||
add( cpLabel );
|
||||
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
constraints.weightx = 0.2;
|
||||
gridbag.setConstraints( cpText, constraints );
|
||||
add( cpText );
|
||||
|
||||
new CopyPasteHandler( empresaText );
|
||||
new CopyPasteHandler( nomeText );
|
||||
new CopyPasteHandler( cpText );
|
||||
}
|
||||
|
||||
public void fill(Object value)
|
||||
{
|
||||
Integer values[] = (Integer[])value;
|
||||
Integer empresaID = values[0];
|
||||
Integer estabelecimentoID = values[1];
|
||||
Integer trabalhadorID = values[2];
|
||||
clear();
|
||||
try
|
||||
{
|
||||
TrabalhadoresData trabalhador;
|
||||
EstabelecimentosData estabelecimento;
|
||||
EmpresasData empresa;
|
||||
if( trabalhadorID != null )
|
||||
{
|
||||
trabalhador = ( TrabalhadoresData ) JDO.load( TrabalhadoresData.class, trabalhadorID );
|
||||
String nome = (String) trabalhador.get( TrabalhadoresData.NOME );
|
||||
nomeText.setText( nome );
|
||||
}
|
||||
String nomeEstabelecimento = "";
|
||||
if( estabelecimentoID != null )
|
||||
{
|
||||
estabelecimento = ( EstabelecimentosData ) JDO.load( EstabelecimentosData.class, estabelecimentoID );
|
||||
nomeEstabelecimento = (String) estabelecimento.get( EstabelecimentosData.NOME );
|
||||
try
|
||||
{
|
||||
Integer medicoID = provider.getMedicoForEstabelecimento( estabelecimentoID );
|
||||
if( medicoID != null && medicoID.intValue() > -1 )
|
||||
{
|
||||
for( int n = 0; n < medicosCombo.getItemCount(); n++ )
|
||||
{
|
||||
IDObject medico = ( IDObject ) medicosCombo.getItemAt( n );
|
||||
if( medico.getID().equals( medicoID ) )
|
||||
{
|
||||
medicosCombo.setSelectedIndex( n );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
}
|
||||
}
|
||||
if( empresaID != null )
|
||||
{
|
||||
empresa = ( EmpresasData ) JDO.load( EmpresasData.class, empresaID );
|
||||
String nomeEmpresa = (String) empresa.get( EmpresasData.DESIGNACAO_SOCIAL );
|
||||
empresaText.setText( nomeEmpresa + ( nomeEstabelecimento.length() > 0?" / " + nomeEstabelecimento:"" ) );
|
||||
}
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a carregar os dados do cabe\u00e7alho...", true );
|
||||
}
|
||||
}
|
||||
|
||||
public Object save()
|
||||
{
|
||||
Integer id = ( (IDObject) medicosCombo.getSelectedItem() ).getID();
|
||||
if( id != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
MedicosData medico = ( MedicosData )JDO.load( MedicosData.class, id );
|
||||
return medico;
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ValuesException( "A ficha tem de ter um m\u00e9dico associado" );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void fillCombo()
|
||||
throws Exception
|
||||
{
|
||||
medicosCombo.removeItemListener( this );
|
||||
medicosCombo.removeAllItems();
|
||||
medicosHash.clear();
|
||||
Object medicos[][] = provider.getAllMedicos();
|
||||
for( int n = 0; n < medicos.length; n++ )
|
||||
{
|
||||
Object medico[] = new Object[ 4 ];
|
||||
medico[ 0 ] = new Integer( ( (Number)medicos[n][0] ).intValue() );
|
||||
medico[ 1 ] = medicos[ n ][ 1 ];
|
||||
medico[ 2 ] = medicos[ n ][ 2 ];
|
||||
medico[ 3 ] = new Integer( n );
|
||||
medicosHash.put( medicos[ n ][ 0 ], medico );
|
||||
medicosCombo.addItem( new MappableObject( (Integer) medico[ 0 ], medico[ 1 ] ) );
|
||||
}
|
||||
|
||||
if( medicos.length > 0 )
|
||||
{
|
||||
medicosCombo.setSelectedIndex( 0 );
|
||||
cpText.setText( medicos[ 0 ][ 2 ] != null?(String)medicos[ 0 ][ 2 ]:"" );
|
||||
}
|
||||
else
|
||||
{
|
||||
medicosCombo.addItem( new MappableObject( null, "" ) );
|
||||
medicosCombo.setSelectedIndex( 0 );
|
||||
cpText.setText( "" );
|
||||
}
|
||||
medicosCombo.addItem( new MappableObject( new Integer( -1 ), "Novo/Editar" ) );
|
||||
medicosCombo.addItemListener( this );
|
||||
}
|
||||
|
||||
public void itemStateChanged(java.awt.event.ItemEvent itemEvent)
|
||||
{
|
||||
int index = medicosCombo.getSelectedIndex();
|
||||
if( index == medicosCombo.getItemCount() - 1 )
|
||||
{
|
||||
try
|
||||
{
|
||||
MedicoEditor me = new MedicoEditor( owner );
|
||||
me.setVisible( true );
|
||||
// boolean isNew = me.getIsNew();
|
||||
Integer id = me.getID();
|
||||
if( id == null )
|
||||
{
|
||||
medicosCombo.setSelectedIndex( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
fillCombo();
|
||||
if( id != null )
|
||||
{
|
||||
Object[] medico = (Object[])medicosHash.get( id );
|
||||
medicosCombo.setSelectedIndex( ((Integer)medico[ 3 ] ).intValue() );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
JOptionPane.showMessageDialog( null, "Erro a abrir a janela de edi\u00e7\u00e3o...", "Erro...",
|
||||
JOptionPane.ERROR_MESSAGE );
|
||||
ex.printStackTrace();
|
||||
medicosCombo.setSelectedIndex( 0 );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IDObject selected = (IDObject)medicosCombo.getItemAt( index );
|
||||
Integer id = selected.getID();
|
||||
if( id == null )
|
||||
{
|
||||
cpText.setText( "" );
|
||||
}
|
||||
else
|
||||
{
|
||||
Object[] medico = (Object[])medicosHash.get( id );
|
||||
cpText.setText( medico[ 2 ] != null?(String)medico[ 2 ]:"" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
empresaText.setText( "" );
|
||||
nomeText.setText( "" );
|
||||
medicosCombo.setSelectedIndex( 0 );
|
||||
}
|
||||
|
||||
public void setEnabled( boolean enable )
|
||||
{
|
||||
medicosCombo.setEnabled( enable );
|
||||
}
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* ValuesException.java
|
||||
*
|
||||
* Created on 5 de Abril de 2004, 20:22
|
||||
*/
|
||||
|
||||
package siprp.ficha;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class ValuesException extends RuntimeException
|
||||
{
|
||||
|
||||
/** Creates a new instance of ValuesException */
|
||||
public ValuesException( String msg )
|
||||
{
|
||||
super( msg );
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,88 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<FichaAptidao>
|
||||
<portaria>111-21/12/2001</portaria>
|
||||
<empresa>
|
||||
<designacao-social>
|
||||
Evolute - Consultoria Informatica
|
||||
</designacao-social>
|
||||
</empresa>
|
||||
<estabelecimento>
|
||||
<nome>
|
||||
Sede
|
||||
</nome>
|
||||
<localidade>
|
||||
Lisboa
|
||||
</localidade>
|
||||
<servico-saude>
|
||||
<tipo>
|
||||
<interno>y</interno>
|
||||
<interempresas>n</interempresas>
|
||||
<externo>n</externo>
|
||||
<sns>n</sns>
|
||||
</tipo>
|
||||
<designacao>
|
||||
SIPRP
|
||||
</designacao>
|
||||
</servico-saude>
|
||||
<servico-higiene-seguranca>
|
||||
<tipo>
|
||||
<interno>n</interno>
|
||||
<interempresas>n</interempresas>
|
||||
<externo>n</externo>
|
||||
<outro>y</outro>
|
||||
</tipo>
|
||||
<designacao>
|
||||
SIPRP
|
||||
</designacao>
|
||||
</servico-higiene-seguranca>
|
||||
</estabelecimento>
|
||||
<trabalhador>
|
||||
<nome>Frederico Palma</nome>
|
||||
<sexo>Masculino</sexo>
|
||||
<data-nascimento>30-12-1977</data-nascimento>
|
||||
<nacionalidade>Portuguesa</nacionalidade>
|
||||
<numero-mecanografico>32434234</numero-mecanografico>
|
||||
<data-admissao>01-10-2006</data-admissao>
|
||||
<categoria-profissional>Deus</categoria-profissional>
|
||||
<local-trabalho>Sede</local-trabalho>
|
||||
<funcao-proposta>Senhor do Universo</funcao-proposta>
|
||||
<data-admissao-funcao>01-01-10000AF</data-admissao-funcao>
|
||||
</trabalhador>
|
||||
<observacoes>
|
||||
nada a observar
|
||||
</observacoes>
|
||||
<exame-medico>
|
||||
<data>03-12-2007</data>
|
||||
<tipo>
|
||||
<admissao>y</admissao>
|
||||
<periodico>y</periodico>
|
||||
<ocasional>y</ocasional>
|
||||
<ocasional-doenca>y</ocasional-doenca>
|
||||
<ocasional-acidente>y</ocasional-acidente>
|
||||
<ocasional-pedido-trabalhador>y</ocasional-pedido-trabalhador>
|
||||
<ocasional-pedido-servico>y</ocasional-pedido-servico>
|
||||
<ocasional-mudanca-funcao>y</ocasional-mudanca-funcao>
|
||||
<ocasional-alteracao-condicoes-trabalho>y</ocasional-alteracao-condicoes-trabalho>
|
||||
<ocasional-outro>y</ocasional-outro>
|
||||
<ocasional-outro-descricao>sdlfjk</ocasional-outro-descricao>
|
||||
</tipo>
|
||||
<resultado>
|
||||
<apto>y</apto>
|
||||
<apto-condicionalmente>y</apto-condicionalmente>
|
||||
<inapto-temporariamente>y</inapto-temporariamente>
|
||||
<inapto-definitivamente>y</inapto-definitivamente>
|
||||
<outras-funcoes-1>outra-func-1</outras-funcoes-1>
|
||||
<outras-funcoes-2>outra-func-2</outras-funcoes-2>
|
||||
<outras-funcoes-3>outra-func-3</outras-funcoes-3>
|
||||
<outras-funcoes-4>outra-func-4</outras-funcoes-4>
|
||||
</resultado>
|
||||
</exame-medico>
|
||||
<proximo-exame>10-01-2010</proximo-exame>
|
||||
<outras-recomendacoes>
|
||||
Olho por Olho, Dente por Dente
|
||||
</outras-recomendacoes>
|
||||
<medico>
|
||||
<nome>Joao Antonio Pedro</nome>
|
||||
<cedula>4234234</cedula>
|
||||
</medico>
|
||||
</FichaAptidao>
|
||||
@ -1,6 +0,0 @@
|
||||
C:\Documents and Settings\Frederico\workspace\SIPRP\SIPRPSoft\src\siprp\ficha\ficha_aptidao_teste.xml
|
||||
/home/fpalma/projectos2/SIPRP/SIPRPSoft/src/siprp/ficha/ficha_aptidao_teste.xml
|
||||
|
||||
☐
|
||||
✓
|
||||
|
||||
|
Before Width: | Height: | Size: 763 B |
|
Before Width: | Height: | Size: 763 B |
@ -1,38 +0,0 @@
|
||||
package siprp.initializer;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import com.evolute.application.EvoAbstractAppInitializer;
|
||||
import com.nilo.plaf.nimrod.NimRODLookAndFeel;
|
||||
import com.nilo.plaf.nimrod.NimRODTheme;
|
||||
|
||||
public class SIPRPUIInitializer extends EvoAbstractAppInitializer
|
||||
{
|
||||
|
||||
public SIPRPUIInitializer()
|
||||
{
|
||||
super( "UI", false, false, false );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doInit() throws Exception
|
||||
{
|
||||
NimRODTheme nt = new NimRODTheme();
|
||||
|
||||
nt.setPrimary1( new Color( 150, 180, 200 ) ); // tab header highlight, scroll highlight
|
||||
nt.setPrimary2( new Color( 150, 180, 200 ) ); // button highlight & progress bar & selected tab header background & selected row ...
|
||||
nt.setPrimary3( new Color( 150, 150, 150 ) ); // tree's graph color
|
||||
|
||||
nt.setSecondary1( new Color( 150, 150, 150 ) ); // Button contour
|
||||
nt.setSecondary2( new Color( 200, 210, 220 ) ); // unselected tab header's background & border color (in tables too)
|
||||
nt.setSecondary3( new Color( 235, 235, 235 ) ); // panel's background
|
||||
|
||||
NimRODLookAndFeel NimRODLF = new NimRODLookAndFeel();
|
||||
NimRODLookAndFeel.setCurrentTheme( nt );
|
||||
UIManager.setLookAndFeel( NimRODLF );
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,100 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Document : HolterPanel.xml
|
||||
Created on : 1 de Outubro de 2004, 11:17
|
||||
Author : fpalma
|
||||
Description:
|
||||
Purpose of the document follows.
|
||||
-->
|
||||
|
||||
<!DOCTYPE UICOMPONENT SYSTEM 'http://evolute.dyndns.tv/dtd/uicomponent.dtd' >
|
||||
<UICOMPONENT DATA_CLASS="siprp.data.MarcacaoTrabalhadorData">
|
||||
<INCLUDE LANGUAGE="JAVA" >siprp.data.*</INCLUDE>
|
||||
<PANEL NAME="MarcacaoConsultaPanel" ROW="0" COLUMN="0">
|
||||
<GRID>
|
||||
<ROW TYPE="MIN"/> <!--R0-->
|
||||
<ROW TYPE="MIN"/> <!--R1-->
|
||||
<ROW TYPE="MIN"/> <!--R2-->
|
||||
<ROW TYPE="MAX"/> <!--R3-->
|
||||
|
||||
<COL TYPE="MIN" /> <!--C0-->
|
||||
<COL TYPE="MAX" /> <!--C1-->
|
||||
<COL TYPE="MAX" /> <!--C2-->
|
||||
</GRID>
|
||||
|
||||
<!-- ROW 0 -->
|
||||
<LABEL NAME="dataLabel" ROW="0" COLUMN="0">
|
||||
<CAPTION>
|
||||
Data da consulta
|
||||
</CAPTION>
|
||||
</LABEL>
|
||||
<EDITOR NAME="dataPanel" ROW="0" COLUMN="1" DATA_FIELD="data">
|
||||
<CONTENT TYPE="DATE" />
|
||||
<SIZE>
|
||||
<WIDTH PREFERRED="100" MIN="300" />
|
||||
<HEIGHT PREFERRED="20" MIN="20" />
|
||||
</SIZE>
|
||||
</EDITOR>
|
||||
<BUTTON NAME="emailButton" ROW="0" COLUMN="2">
|
||||
<CAPTION>
|
||||
Enviar Email
|
||||
</CAPTION>
|
||||
<SIZE>
|
||||
<WIDTH PREFERRED="200" MIN="300" />
|
||||
<HEIGHT PREFERRED="20" MIN="20" />
|
||||
</SIZE>
|
||||
</BUTTON>
|
||||
|
||||
<!-- ROW 1 -->
|
||||
<LABEL NAME="dataFichaLabel" ROW="1" COLUMN="0">
|
||||
<CAPTION>
|
||||
Data da Ficha de Aptid\u00e3o
|
||||
</CAPTION>
|
||||
</LABEL>
|
||||
<EDITOR NAME="dataFichaPanel" ROW="1" COLUMN="1" DATA_FIELD="data_relatorio">
|
||||
<CONTENT TYPE="DATE" />
|
||||
<SIZE>
|
||||
<WIDTH PREFERRED="100" MIN="300" />
|
||||
<HEIGHT PREFERRED="20" MIN="20" />
|
||||
</SIZE>
|
||||
</EDITOR>
|
||||
|
||||
<!-- ROW 2 -->
|
||||
<EDITOR NAME="tipoList" ROW="2" COLUMN="0" COLSPAN="2" EDITABLE="FALSE" DATA_FIELD="motivo">
|
||||
<BORDER TYPE="ETCHED">Tipo</BORDER>
|
||||
<CONTENT TYPE="INTEGER" ISLIST="TRUE">
|
||||
<ROWS>4</ROWS>
|
||||
</CONTENT>
|
||||
<LIST_CONTENT HAS_IDS="TRUE" SELECTABLE="TRUE" DISPLAY_COLUMNS="1">
|
||||
<LIST_OPTION OPTION_ID="1" DEFAULT="TRUE">Admiss\u00e3o</LIST_OPTION>
|
||||
<LIST_OPTION OPTION_ID="2">Peri\u00f3dico</LIST_OPTION>
|
||||
<LIST_OPTION OPTION_ID="5">Peri\u00f3dico inicial</LIST_OPTION>
|
||||
<LIST_OPTION OPTION_ID="3">Ocasional</LIST_OPTION>
|
||||
</LIST_CONTENT>
|
||||
</EDITOR>
|
||||
|
||||
<EDITOR NAME="estadoList" ROW="2" COLUMN="2" EDITABLE="FALSE" DATA_FIELD="estado">
|
||||
<BORDER TYPE="ETCHED">Estado</BORDER>
|
||||
<CONTENT TYPE="INTEGER" ISLIST="TRUE">
|
||||
<ROWS>6</ROWS>
|
||||
</CONTENT>
|
||||
<LIST_CONTENT HAS_IDS="TRUE" SELECTABLE="TRUE" DISPLAY_COLUMNS="1">
|
||||
<LIST_OPTION OPTION_ID="0" DEFAULT="TRUE">Por realizar</LIST_OPTION>
|
||||
<LIST_OPTION OPTION_ID="2">Realizada</LIST_OPTION>
|
||||
<LIST_OPTION OPTION_ID="3">Desmarcada pelo trabalhador</LIST_OPTION>
|
||||
<LIST_OPTION OPTION_ID="4">Desmarcada pela SIPRP</LIST_OPTION>
|
||||
<LIST_OPTION OPTION_ID="5">Faltou</LIST_OPTION>
|
||||
</LIST_CONTENT>
|
||||
</EDITOR>
|
||||
|
||||
<!-- ROW 3 -->
|
||||
<EDITOR NAME="observacoesText" ROW="3" COLUMN="0" COLSPAN="3" DATA_FIELD="observacoes">
|
||||
<BORDER TYPE="ETCHED">Observa\u00e7\u00f5es</BORDER>
|
||||
<SCROLL/>
|
||||
<CONTENT TYPE="CHAR" ACCEPTS_NEGATIVE="FALSE">
|
||||
<ROWS>5</ROWS>
|
||||
</CONTENT>
|
||||
</EDITOR>
|
||||
</PANEL>
|
||||
</UICOMPONENT>
|
||||
@ -1,78 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Document : HolterPanel.xml
|
||||
Created on : 1 de Outubro de 2004, 11:17
|
||||
Author : fpalma
|
||||
Description:
|
||||
Purpose of the document follows.
|
||||
-->
|
||||
|
||||
<!DOCTYPE UICOMPONENT SYSTEM 'http://evolute.dyndns.tv/dtd/uicomponent.dtd' >
|
||||
<UICOMPONENT DATA_CLASS="siprp.data.MarcacaoTrabalhadorData">
|
||||
<INCLUDE LANGUAGE="JAVA" >siprp.data.*</INCLUDE>
|
||||
<PANEL NAME="MarcacaoExamePanel" ROW="0" COLUMN="0">
|
||||
<GRID>
|
||||
<ROW TYPE="MIN"/> <!--R0-->
|
||||
<ROW TYPE="MIN"/> <!--R1-->
|
||||
<ROW TYPE="MAX"/> <!--R2-->
|
||||
|
||||
<COL TYPE="MIN" /> <!--C0-->
|
||||
<COL TYPE="MAX" /> <!--C1-->
|
||||
<COL TYPE="MAX" /> <!--C2-->
|
||||
</GRID>
|
||||
|
||||
<!-- ROW 0 -->
|
||||
<LABEL NAME="dataLabel" ROW="0" COLUMN="0">
|
||||
<CAPTION>
|
||||
Data dos Exames
|
||||
</CAPTION>
|
||||
</LABEL>
|
||||
<EDITOR NAME="dataPanel" ROW="0" COLUMN="1" DATA_FIELD="data">
|
||||
<CONTENT TYPE="DATE" />
|
||||
</EDITOR>
|
||||
<BUTTON NAME="emailButton" ROW="0" COLUMN="2">
|
||||
<CAPTION>
|
||||
Enviar Email
|
||||
</CAPTION>
|
||||
<SIZE>
|
||||
<WIDTH PREFERRED="200" MIN="300" />
|
||||
<HEIGHT PREFERRED="20" MIN="20" />
|
||||
</SIZE>
|
||||
</BUTTON>
|
||||
|
||||
<!-- ROW 1 -->
|
||||
<PANEL NAME="detalhesPanel" ROW="1" COLUMN="0" COLSPAN="2">
|
||||
<BORDER TYPE="ETCHED">Detalhes</BORDER>
|
||||
<GRID>
|
||||
<ROW TYPE="MAX"/> <!--R0-->
|
||||
|
||||
<COL TYPE="MAX" /> <!--C0-->
|
||||
</GRID>
|
||||
</PANEL>
|
||||
|
||||
<EDITOR NAME="estadoList" ROW="1" COLUMN="2" EDITABLE="FALSE" DATA_FIELD="estado">
|
||||
<BORDER TYPE="ETCHED">Estado</BORDER>
|
||||
<CONTENT TYPE="INTEGER" ISLIST="TRUE">
|
||||
<ROWS>6</ROWS>
|
||||
</CONTENT>
|
||||
<LIST_CONTENT HAS_IDS="TRUE" SELECTABLE="TRUE" DISPLAY_COLUMNS="1">
|
||||
<LIST_OPTION OPTION_ID="0" DEFAULT="TRUE">Por realizar</LIST_OPTION>
|
||||
<LIST_OPTION OPTION_ID="1">Parcialmente realizados</LIST_OPTION>
|
||||
<LIST_OPTION OPTION_ID="2">Realizados</LIST_OPTION>
|
||||
<LIST_OPTION OPTION_ID="3">Desmarcados pelo trabalhador</LIST_OPTION>
|
||||
<LIST_OPTION OPTION_ID="4">Desmarcados pela SIPRP</LIST_OPTION>
|
||||
<LIST_OPTION OPTION_ID="5">Faltou</LIST_OPTION>
|
||||
</LIST_CONTENT>
|
||||
</EDITOR>
|
||||
|
||||
<!-- ROW 2 -->
|
||||
<EDITOR NAME="observacoesText" ROW="2" COLUMN="0" COLSPAN="3" DATA_FIELD="observacoes">
|
||||
<BORDER TYPE="ETCHED">Observa\u00e7\u00f5es</BORDER>
|
||||
<SCROLL/>
|
||||
<CONTENT TYPE="CHAR" ACCEPTS_NEGATIVE="FALSE">
|
||||
<ROWS>5</ROWS>
|
||||
</CONTENT>
|
||||
</EDITOR>
|
||||
</PANEL>
|
||||
</UICOMPONENT>
|
||||
@ -1,159 +0,0 @@
|
||||
ALTER TABLE empresas ADD a_consultas char(1);
|
||||
ALTER TABLE empresas ADD a_exames char(1);
|
||||
ALTER TABLE empresas ADD b_consultas char(1);
|
||||
ALTER TABLE empresas ADD b_exames char(1);
|
||||
ALTER TABLE empresas ADD data_cancelamento DATE;
|
||||
|
||||
ALTER TABLE marcacoes_trabalhador ADD motivo INT;
|
||||
ALTER TABLE marcacoes_trabalhador ADD estado INT;
|
||||
ALTER TABLE marcacoes_trabalhador ADD observacoes VARCHAR( 2048 );
|
||||
UPDATE marcacoes_trabalhador SET estado = 2 WHERE realizada = 'y';
|
||||
|
||||
|
||||
-- PROTOCOLOS
|
||||
|
||||
CREATE TABLE prt_grupos_protocolo
|
||||
(
|
||||
id int4 NOT NULL,
|
||||
descricao varchar(255) NOT NULL,
|
||||
descricao_plain varchar(255) NOT NULL,
|
||||
CONSTRAINT grupos_protocolo_pkey PRIMARY KEY (id)
|
||||
)
|
||||
WITHOUT OIDS;
|
||||
ALTER TABLE prt_grupos_protocolo OWNER TO postgres;
|
||||
|
||||
|
||||
|
||||
CREATE TABLE prt_tipos_elementos_protocolo
|
||||
(
|
||||
id int4 NOT NULL,
|
||||
descricao_plain varchar(255) NOT NULL,
|
||||
descricao varchar(255) NOT NULL,
|
||||
grupo_protocolo_id int4 NOT NULL,
|
||||
CONSTRAINT prt_tipos_elementos_protocolo_pkey PRIMARY KEY (id),
|
||||
CONSTRAINT prt_tipos_elementos_protocolo_grupo_protocolo_id_fkey FOREIGN KEY (grupo_protocolo_id) REFERENCES prt_grupos_protocolo (id) ON UPDATE RESTRICT ON DELETE RESTRICT
|
||||
)
|
||||
WITHOUT OIDS;
|
||||
ALTER TABLE prt_tipos_elementos_protocolo OWNER TO postgres;
|
||||
|
||||
|
||||
CREATE TABLE prt_elementos_protocolo
|
||||
(
|
||||
id serial NOT NULL,
|
||||
tipo_elemento_protocolo_id int4 NOT NULL,
|
||||
empresa_id int4 NOT NULL,
|
||||
numero_perfil int4 NOT NULL,
|
||||
CONSTRAINT prt_elementos_protocolo_pkey PRIMARY KEY (id),
|
||||
CONSTRAINT prt_elementos_protocolo_empresa_id_fkey FOREIGN KEY (empresa_id) REFERENCES empresas (id) ON UPDATE RESTRICT ON DELETE RESTRICT,
|
||||
CONSTRAINT prt_elementos_protocolo_tipo_elemento_protocolo_id_fkey FOREIGN KEY (tipo_elemento_protocolo_id) REFERENCES prt_tipos_elementos_protocolo (id) ON UPDATE RESTRICT ON DELETE RESTRICT
|
||||
)
|
||||
WITH OIDS;
|
||||
ALTER TABLE prt_elementos_protocolo OWNER TO postgres;
|
||||
|
||||
|
||||
CREATE TABLE marcacoes_grupos_realizados
|
||||
(
|
||||
id serial NOT NULL,
|
||||
marcacao_trabalhador_id int4 NOT NULL,
|
||||
grupo_protocolo_id int4 NOT NULL,
|
||||
CONSTRAINT marcacoes_grupos_realizados_pkey PRIMARY KEY (id),
|
||||
CONSTRAINT marcacoes_grupos_realizados_grupo_protocolo_id_fkey FOREIGN KEY (grupo_protocolo_id) REFERENCES prt_grupos_protocolo (id) ON UPDATE RESTRICT ON DELETE RESTRICT,
|
||||
CONSTRAINT marcacoes_grupos_realizados_marcacao_trabalhador_id_fkey FOREIGN KEY (marcacao_trabalhador_id) REFERENCES marcacoes_trabalhador (id) ON UPDATE RESTRICT ON DELETE RESTRICT
|
||||
)
|
||||
WITH OIDS;
|
||||
ALTER TABLE marcacoes_grupos_realizados OWNER TO postgres;
|
||||
|
||||
INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain )
|
||||
VALUES( 1, 'Sangue', 'sangue' );
|
||||
INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain )
|
||||
VALUES( 2, 'Urina', 'urina' );
|
||||
INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain )
|
||||
VALUES( 3, 'RX T\\u00f3rax', 'rx torax' );
|
||||
INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain )
|
||||
VALUES( 4, 'Audiograma', 'audiograma' );
|
||||
INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain )
|
||||
VALUES( 5, 'Rastreio Visual', 'rastreio visual' );
|
||||
INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain )
|
||||
VALUES( 6, 'ECG', 'ecg' );
|
||||
INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain )
|
||||
VALUES( 7, 'Espirometria', 'espirometria' );
|
||||
INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain )
|
||||
VALUES( 8, 'Exsudado Nasofar\\u00edngeo', 'exsudado nasofaringeo' );
|
||||
INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain )
|
||||
VALUES( 9, 'Exame Bacteriol\\u00f3gico (Fezes)', 'exame bacteriologico (fezes)' );
|
||||
INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain )
|
||||
VALUES( 10, 'Coprocultura', 'coprocultura' );
|
||||
INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain )
|
||||
VALUES( 11, 'Outros ECDs', 'outros ecds' );
|
||||
INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain )
|
||||
VALUES( 12, 'Outras An\\u00e1lises', 'outras analises' );
|
||||
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 1, 'Hemograma', 'hemograma', 1 );
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 2, 'Plaquetas', 'plaquetas', 1 );
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 3, 'VS', 'vs', 1 );
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 4, 'Glicemia', 'glicemia', 1 );
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 5, 'Creatinina', 'creatinina', 1 );
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 6, 'Colesterol Total', 'colesterol total', 1 );
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 7, 'colesterol hdl', 'Colesterol hdl', 1 );
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 8, 'Colesterol LDL', 'colesterol ldl', 1 );
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 9, 'Trigliceridos', 'trigliceridos', 1 );
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 10, 'Transaminases', 'transaminases', 1 );
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 11, 'Gama GT', 'gama gt', 1 );
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 12, 'Ureia', 'ureia', 1 );
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 13, '\\u00c1cido \\u00darico', 'acido urico', 1 );
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 14, 'MBE (Chumbo)', 'mbe (chumbo)', 1 );
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 15, 'MBE (Outros)', 'mbe (outros)', 1 );
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 16, 'Serologias Hepatite', 'serologias hepatite', 1 );
|
||||
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 17, 'Urina II', 'urina ii', 2 );
|
||||
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 18, 'RX T\\u00f3rax', 'rx torax', 3 );
|
||||
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 19, 'Audiometria', 'audiometria', 4 );
|
||||
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 20, 'Rastreio Visual', 'rastreio visual', 5 );
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 21, 'ECG', 'ecg', 6 );
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 22, 'Espirometria', 'espirometria', 7 );
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 23, 'Exsudado Nasofar\\u00edngeo', 'exsudado nasofaringeo', 8 );
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 24, 'Exame Bacteriol\\u00f3gico (Fezes)', 'exame bacteriologico (fezes)', 9 );
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 25, 'Coprocultura', 'coprocultura', 10 );
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 26, 'Outros ECDs', 'outros ecds', 11 );
|
||||
INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id )
|
||||
values( 27, 'Outras An\\u00e1lises', 'outras analises', 12 );
|
||||
|
||||
|
||||
ALTER TABLE prt_grupos_protocolo ADD grupo_real char(1);
|
||||
UPDATE prt_grupos_protocolo SET grupo_real='y' WHERE id <= 4;
|
||||
UPDATE prt_grupos_protocolo SET grupo_real='n' WHERE id > 4;
|
||||
|
||||
ALTER TABLE prt_grupos_protocolo ADD ordem int4;
|
||||
UPDATE prt_grupos_protocolo SET ordem=id;
|
||||
|
||||
ALTER TABLE prt_tipos_elementos_protocolo ADD ordem int4;
|
||||
UPDATE prt_tipos_elementos_protocolo SET ordem=id;
|
||||
@ -1,2 +0,0 @@
|
||||
/home/fpalma/projectos/SIPRP/SIPRPSoft/src/siprp/teste.xml
|
||||
/home/fpalma/projectos2/SIPRP/SIPRPSoft/src/siprp/analise_acidentes_trabalho.xsl
|
||||
@ -1,922 +0,0 @@
|
||||
/*
|
||||
* EstatisticasProvider.java
|
||||
*
|
||||
* Created on 3 de Junho de 2004, 18:23
|
||||
*/
|
||||
|
||||
package siprp.pesquisas;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
|
||||
import shst.data.Marcacao;
|
||||
import shst.data.outer.EmpresasData;
|
||||
import shst.data.outer.MarcacoesTrabalhadorData;
|
||||
import shst.data.outer.TrabalhadoresData;
|
||||
|
||||
import com.evolute.utils.Singleton;
|
||||
import com.evolute.utils.arrays.Virtual2DArray;
|
||||
import com.evolute.utils.data.IDObject;
|
||||
import com.evolute.utils.data.MappableObject;
|
||||
import com.evolute.utils.db.DBManager;
|
||||
import com.evolute.utils.db.Executer;
|
||||
import com.evolute.utils.metadb.MetaProvider;
|
||||
import com.evolute.utils.sql.Expression;
|
||||
import com.evolute.utils.sql.Field;
|
||||
import com.evolute.utils.sql.Select;
|
||||
import com.evolute.utils.sql.Select2;
|
||||
import com.evolute.utils.sql.expression.Par;
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class PesquisasProvider extends MetaProvider
|
||||
{
|
||||
private static final Object LOCK = new Object();
|
||||
private static PesquisasProvider instance = null;
|
||||
private final Executer executer;
|
||||
|
||||
private static final int TIPOS_OCASIONAL[] =
|
||||
new int[]{ 5, //mudanca de posto
|
||||
6, //mudancas das condicoes
|
||||
-1, //apos 30 dias
|
||||
4, //iniciativa do medico
|
||||
3, //pedido do trabalhador
|
||||
2, //acidente de trabalho
|
||||
1, //Doenca subita
|
||||
-1, //Cessacao do contrato
|
||||
10 //Outras razoes
|
||||
};
|
||||
public static final String DESCRICAO_TIPOS_OCASIONAL[] =
|
||||
new String[]{ "MUDAN\u00C7A DE POSTO DE TRABALHO",
|
||||
"ALTERA\u00C7\u00D5ES NO POSTO DE TRABALHO",
|
||||
"REGRESSO AO TRABALHO AP\u00D3S AUS\u00CANCIA SUPERIOR A 30 DIAS",
|
||||
"INICIATIVA DO M\u00C9DICO",
|
||||
"PEDIDO DO TRABALHADOR",
|
||||
"ACIDENTE DE TRABALHO",
|
||||
"DOEN\u00C7A S\u00DABITA",
|
||||
"POR CESSA\u00C7\u00C3O DO CONTRATO DE TRABALHO",
|
||||
"OUTRAS RAZ\u00D5ES" };
|
||||
|
||||
private static final int TIPOS_EXAME[] =
|
||||
new int[]{ 1, //admissao
|
||||
2, //periodico
|
||||
3 //ocasional
|
||||
};
|
||||
private static final int TIPO_OCASIONAL = 3;
|
||||
|
||||
public static final String DESCRICAO_TIPOS_EXAME[] =
|
||||
new String[]{ "TOTAL DE EXAMES DE ADMISS\u00C3O",
|
||||
"TOTAL DE EXAMES PERI\u00D3DICOS",
|
||||
"TOTAL DE EXAMES OCASIONAIS" };
|
||||
|
||||
public static final String PAR_ANO = "PAR_ANO";
|
||||
public static final String PAR_EMPRESA = "PAR_EMPRESA";
|
||||
public static final String PAR_ESTABELECIMENTO = "PAR_ESTABELECIMENTO";
|
||||
public static final String PAR_TIPO_EXAME = "PAR_TIPO_EXAME";
|
||||
public static final String PAR_RESULTADO = "PAR_RESULTADO";
|
||||
public static final String PAR_SEXO = "PAR_SEXO";
|
||||
public static final String PAR_GRUPO_ETARIO = "PAR_GRUPO_ETARIO";
|
||||
|
||||
/** Creates a new instance of EstatisticasProvider */
|
||||
public PesquisasProvider() throws Exception
|
||||
{
|
||||
DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ );
|
||||
executer = dbm.getSharedExecuter( this );
|
||||
}
|
||||
|
||||
public static MetaProvider getProvider()
|
||||
throws Exception
|
||||
{
|
||||
synchronized( LOCK )
|
||||
{
|
||||
if( instance == null )
|
||||
{
|
||||
instance = new PesquisasProvider();
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public IDObject[] getAllEmpresas()
|
||||
throws Exception
|
||||
{
|
||||
Select select = new Select( new String[]{ "empresas" },
|
||||
new String[]{ EmpresasData.ID, EmpresasData.DESIGNACAO_SOCIAL, EmpresasData.DESIGNACAO_SOCIAL_PLAIN },
|
||||
new Field( EmpresasData.INACTIVO ).isDifferent( "y" ),
|
||||
new String[]{ EmpresasData.DESIGNACAO_SOCIAL_PLAIN }, null );
|
||||
// Select select = new Select( "SELECT e.id, e.designacao_social FROM empresas e ORDER BY lower( e.designacao_social );" );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
IDObject empresas[] = new IDObject[ array.columnLength() ];
|
||||
for( int n = 0; n < empresas.length; n++ )
|
||||
{
|
||||
empresas[ n ] = new MappableObject( (Integer)array.get( n, 0 ), array.get( n, 1 ) );
|
||||
}
|
||||
return empresas;
|
||||
}
|
||||
|
||||
public IDObject []getAllEstabelecimentosForEmpresa( Integer empresaID )
|
||||
throws Exception
|
||||
{
|
||||
return ( ( siprp.FichaDataProvider )siprp.FichaDataProvider.getProvider() ).getAllEstabelecimentosForEmpresa( empresaID );
|
||||
}
|
||||
|
||||
public int[] countTrabalhadoresEstabelecimentoDezembro( Integer estabelecimentoID, int ano )
|
||||
throws Exception
|
||||
{
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.set( Calendar.YEAR, ano );
|
||||
cal.set( Calendar.MONTH, 11 );
|
||||
cal.set( Calendar.DAY_OF_MONTH, 30 );
|
||||
Select select =
|
||||
new Select( new String[]{ "trabalhadores" },
|
||||
new String[]{ "COUNT(" + TrabalhadoresData.ID + ")" },
|
||||
new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or(
|
||||
new Field( TrabalhadoresData.DATA_ADMISSAO ).isEqual( null ) ) ).and(
|
||||
new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and(
|
||||
new Field( TrabalhadoresData.SEXO ).isEqual( "m" ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and(
|
||||
new Par( new Field( TrabalhadoresData.DATA_DEMISSAO ).isGreater( cal.getTime() ).or(
|
||||
new Field( TrabalhadoresData.DATA_DEMISSAO ).isEqual( null ) ) ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
int contagem[] = new int[ 2 ];
|
||||
contagem[ 0 ] = ( ( Number ) array.get( 0, 0 ) ).intValue();
|
||||
select =
|
||||
new Select( new String[]{ "trabalhadores" },
|
||||
new String[]{ "COUNT(" + TrabalhadoresData.ID + ")" },
|
||||
new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or(
|
||||
new Field( TrabalhadoresData.DATA_ADMISSAO ).isEqual( null ) ) ).and(
|
||||
new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and(
|
||||
new Field( TrabalhadoresData.SEXO ).isEqual( "f" ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and(
|
||||
new Par( new Field( TrabalhadoresData.DATA_DEMISSAO ).isGreater( cal.getTime() ).or(
|
||||
new Field( TrabalhadoresData.DATA_DEMISSAO ).isEqual( null ) ) ) ) );
|
||||
array = executer.executeQuery( select );
|
||||
contagem[ 1 ] = ( ( Number ) array.get( 0, 0 ) ).intValue();
|
||||
return contagem;
|
||||
}
|
||||
|
||||
public int[][] countTrabalhadoresEstabelecimentoDezembroPorGrupoEtario( Integer estabelecimentoID, int ano )
|
||||
throws Exception
|
||||
{
|
||||
Calendar eoy = Calendar.getInstance();
|
||||
eoy.set( Calendar.YEAR, ano );
|
||||
eoy.set( Calendar.MONTH, 11 );
|
||||
eoy.set( Calendar.DAY_OF_MONTH, 30 );
|
||||
|
||||
Calendar today = Calendar.getInstance();
|
||||
today.set( Calendar.YEAR, ano );
|
||||
today.set( Calendar.MONTH, 11 );
|
||||
today.set( Calendar.DAY_OF_MONTH, 31 );
|
||||
today.set( Calendar.HOUR_OF_DAY, 23 );
|
||||
Calendar age18 = (Calendar) today.clone();
|
||||
age18.add( Calendar.YEAR, -18 );
|
||||
Calendar age50 = (Calendar) today.clone();
|
||||
age50.add( Calendar.YEAR, -50 );
|
||||
//0-18
|
||||
Select select =
|
||||
new Select( new String[]{ "trabalhadores" },
|
||||
new String[]{ "COUNT(" + TrabalhadoresData.ID + ")" },
|
||||
new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or(
|
||||
new Field( TrabalhadoresData.DATA_ADMISSAO ).isEqual( null ) ) ).and(
|
||||
new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and(
|
||||
new Field( TrabalhadoresData.SEXO ).isEqual( "m" ) ).and(
|
||||
new Field( TrabalhadoresData.DATA_NASCIMENTO ).isGreater( age18.getTime() ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and(
|
||||
new Par( new Field( TrabalhadoresData.DATA_DEMISSAO ).isGreater( eoy.getTime() ).or(
|
||||
new Field( TrabalhadoresData.DATA_DEMISSAO ).isEqual( null ) ) ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
int contagem[][] = new int[ 3 ][ 2 ];
|
||||
contagem[ 0 ][ 0 ] = ( ( Number ) array.get( 0, 0 ) ).intValue();
|
||||
select =
|
||||
new Select( new String[]{ "trabalhadores" },
|
||||
new String[]{ "COUNT(" + TrabalhadoresData.ID + ")" },
|
||||
new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or(
|
||||
new Field( TrabalhadoresData.DATA_ADMISSAO ).isEqual( null ) ) ).and(
|
||||
new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and(
|
||||
new Field( TrabalhadoresData.SEXO ).isEqual( "f" ) ).and(
|
||||
new Field( TrabalhadoresData.DATA_NASCIMENTO ).isGreater( age18.getTime() ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and(
|
||||
new Par( new Field( TrabalhadoresData.DATA_DEMISSAO ).isGreater( eoy.getTime() ).or(
|
||||
new Field( TrabalhadoresData.DATA_DEMISSAO ).isEqual( null ) ) ) ) );
|
||||
array = executer.executeQuery( select );
|
||||
contagem[ 0 ][ 1 ] = ( ( Number ) array.get( 0, 0 ) ).intValue();
|
||||
//18-49
|
||||
select =
|
||||
new Select( new String[]{ "trabalhadores" },
|
||||
new String[]{ "COUNT(" + TrabalhadoresData.ID + ")" },
|
||||
new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or(
|
||||
new Field( TrabalhadoresData.DATA_ADMISSAO ).isEqual( null ) ) ).and(
|
||||
new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and(
|
||||
new Field( TrabalhadoresData.SEXO ).isEqual( "m" ) ).and(
|
||||
new Field( TrabalhadoresData.DATA_NASCIMENTO ).isLessOrEqual( age18.getTime() ) ).and(
|
||||
new Field( TrabalhadoresData.DATA_NASCIMENTO ).isGreater( age50.getTime() ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and(
|
||||
new Par( new Field( TrabalhadoresData.DATA_DEMISSAO ).isGreater( eoy.getTime() ).or(
|
||||
new Field( TrabalhadoresData.DATA_DEMISSAO ).isEqual( null ) ) ) ) );
|
||||
array = executer.executeQuery( select );
|
||||
contagem[ 1 ][ 0 ] = ( ( Number ) array.get( 0, 0 ) ).intValue();
|
||||
select =
|
||||
new Select( new String[]{ "trabalhadores" },
|
||||
new String[]{ "COUNT(" + TrabalhadoresData.ID + ")" },
|
||||
new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or(
|
||||
new Field( TrabalhadoresData.DATA_ADMISSAO ).isEqual( null ) ) ).and(
|
||||
new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and(
|
||||
new Field( TrabalhadoresData.SEXO ).isEqual( "f" ) ).and(
|
||||
new Field( TrabalhadoresData.DATA_NASCIMENTO ).isLessOrEqual( age18.getTime() ) ).and(
|
||||
new Field( TrabalhadoresData.DATA_NASCIMENTO ).isGreater( age50.getTime() ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and(
|
||||
new Par( new Field( TrabalhadoresData.DATA_DEMISSAO ).isGreater( eoy.getTime() ).or(
|
||||
new Field( TrabalhadoresData.DATA_DEMISSAO ).isEqual( null ) ) ) ) );
|
||||
array = executer.executeQuery( select );
|
||||
contagem[ 1 ][ 1 ] = ( ( Number ) array.get( 0, 0 ) ).intValue();
|
||||
|
||||
//50-
|
||||
select =
|
||||
new Select( new String[]{ "trabalhadores" },
|
||||
new String[]{ "COUNT(" + TrabalhadoresData.ID + ")" },
|
||||
new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or(
|
||||
new Field( TrabalhadoresData.DATA_ADMISSAO ).isEqual( null ) ) ).and(
|
||||
new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and(
|
||||
new Field( TrabalhadoresData.SEXO ).isEqual( "m" ) ).and(
|
||||
new Field( TrabalhadoresData.DATA_NASCIMENTO ).isLessOrEqual( age50.getTime() ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and(
|
||||
new Par( new Field( TrabalhadoresData.DATA_DEMISSAO ).isGreater( eoy.getTime() ).or(
|
||||
new Field( TrabalhadoresData.DATA_DEMISSAO ).isEqual( null ) ) ) ) );
|
||||
array = executer.executeQuery( select );
|
||||
contagem[ 2 ][ 0 ] = ( ( Number ) array.get( 0, 0 ) ).intValue();
|
||||
select =
|
||||
new Select( new String[]{ "trabalhadores" },
|
||||
new String[]{ "COUNT(" + TrabalhadoresData.ID + ")" },
|
||||
new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or(
|
||||
new Field( TrabalhadoresData.DATA_ADMISSAO ).isEqual( null ) ) ).and(
|
||||
new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and(
|
||||
new Field( TrabalhadoresData.SEXO ).isEqual( "f" ) ).and(
|
||||
new Field( TrabalhadoresData.DATA_NASCIMENTO ).isLessOrEqual( age50.getTime() ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and(
|
||||
new Par( new Field( TrabalhadoresData.DATA_DEMISSAO ).isGreater( eoy.getTime() ).or(
|
||||
new Field( TrabalhadoresData.DATA_DEMISSAO ).isEqual( null ) ) ) ) );
|
||||
array = executer.executeQuery( select );
|
||||
contagem[ 2 ][ 1 ] = ( ( Number ) array.get( 0, 0 ) ).intValue();
|
||||
|
||||
return contagem;
|
||||
}
|
||||
|
||||
public int[][] countExamesEstabelecimentoDezembroPorGrupoEtario( Integer estabelecimentoID, int ano )
|
||||
throws Exception
|
||||
{
|
||||
Calendar today = Calendar.getInstance();
|
||||
today.set( Calendar.YEAR, ano );
|
||||
today.set( Calendar.MONTH, 11 );
|
||||
today.set( Calendar.DAY_OF_MONTH, 31 );
|
||||
today.set( Calendar.HOUR_OF_DAY, 23 );
|
||||
Calendar age18 = (Calendar) today.clone();
|
||||
age18.add( Calendar.YEAR, -18 );
|
||||
Calendar age50 = (Calendar) today.clone();
|
||||
age50.add( Calendar.YEAR, -50 );
|
||||
Calendar dates[] = new Calendar[]{ null, age18, age50, null };
|
||||
String sexos[] = new String[]{ "m", "f" };
|
||||
|
||||
int contagem[][] = new int[ 4 ][ 6 ];
|
||||
for( int t = 0; t < TIPOS_EXAME.length; t++ )
|
||||
{
|
||||
for( int s = 0; s < sexos.length; s++ )
|
||||
{
|
||||
for( int d = 0; d < dates.length - 1; d++ )
|
||||
{
|
||||
Select select =
|
||||
new Select( new String[]{ "exames", "trabalhadores" },
|
||||
new String[]{ "DISTINCT trabalhadores.id, exames.data" },
|
||||
new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ).and(
|
||||
new Field( "exames.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ).and(
|
||||
new Field( TrabalhadoresData.SEXO ).isEqual( sexos[s] ) ).and(
|
||||
new Field( "YEAR( exames.data )" ).isEqual( new Integer( ano ) ) ).and(
|
||||
dates[ d ] == null ? new Field( "exames.id" ).isDifferent( null ) :
|
||||
new Field( TrabalhadoresData.DATA_NASCIMENTO ).isLessOrEqual( dates[ d ].getTime() ) ).and(
|
||||
dates[ d + 1 ] == null ? new Field( "exames.id" ).isDifferent( null ) :
|
||||
new Field( TrabalhadoresData.DATA_NASCIMENTO ).isGreater( dates[ d + 1 ].getTime() ) ).and(
|
||||
new Field( "exames.tipo" ).isEqual( new Integer( TIPOS_EXAME[ t ] ) ) ).and(
|
||||
new Field( "exames.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) );
|
||||
try
|
||||
{
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
contagem[ t ][ s * 3 + d ] = array.columnLength();
|
||||
//System.out.println( select + ": " + contagem[ t ][ s * 3 + d ] );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
contagem[ t ][ s * 3 + d ] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return contagem;
|
||||
}
|
||||
|
||||
public int[][] countExamesOcasionaisEstabelecimentoDezembroPorGrupoEtario( Integer estabelecimentoID, int ano )
|
||||
throws Exception
|
||||
{
|
||||
Calendar today = Calendar.getInstance();
|
||||
today.set( Calendar.YEAR, ano );
|
||||
today.set( Calendar.MONTH, 11 );
|
||||
today.set( Calendar.DAY_OF_MONTH, 31 );
|
||||
today.set( Calendar.HOUR_OF_DAY, 23 );
|
||||
Calendar age18 = (Calendar) today.clone();
|
||||
age18.add( Calendar.YEAR, -18 );
|
||||
Calendar age50 = (Calendar) today.clone();
|
||||
age50.add( Calendar.YEAR, -50 );
|
||||
Calendar dates[] = new Calendar[]{ null, age18, age50, null };
|
||||
String sexos[] = new String[]{ "m", "f" };
|
||||
|
||||
int contagem[][] = new int[ TIPOS_OCASIONAL.length ][ ( dates.length - 1 ) * sexos.length ];
|
||||
for( int t = 0; t < TIPOS_OCASIONAL.length; t++ )
|
||||
{
|
||||
for( int s = 0; s < sexos.length; s++ )
|
||||
{
|
||||
for( int d = 0; d < dates.length - 1; d++ )
|
||||
{
|
||||
if( TIPOS_OCASIONAL[t] == -1 )
|
||||
{
|
||||
contagem[ t ][ s * 3 + d ] = -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
Select select =
|
||||
new Select( new String[]{ "exames", "trabalhadores" },
|
||||
new String[]{ "DISTINCT trabalhadores.id, exames.data" },
|
||||
new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ).and(
|
||||
new Field( "exames.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ).and(
|
||||
new Field( TrabalhadoresData.SEXO ).isEqual( sexos[s] ) ).and(
|
||||
new Field( "YEAR( exames.data )" ).isEqual( new Integer( ano ) ) ).and(
|
||||
dates[ d ] == null ? new Field( "exames.id" ).isDifferent( null ) :
|
||||
new Field( TrabalhadoresData.DATA_NASCIMENTO ).isLessOrEqual( dates[ d ].getTime() ) ).and(
|
||||
dates[ d + 1 ] == null ? new Field( "exames.id" ).isDifferent( null ) :
|
||||
new Field( TrabalhadoresData.DATA_NASCIMENTO ).isGreater( dates[ d + 1 ].getTime() ) ).and(
|
||||
new Field( "exames.tipo" ).isEqual( new Integer( 3 ) ) ).and(
|
||||
new Field( "exames.ocasional" ).isEqual( new Integer( TIPOS_OCASIONAL[ t ] ) ) ).and(
|
||||
new Field( "exames.inactivo" ).isDifferent( "y" ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) );
|
||||
try
|
||||
{
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
contagem[ t ][ s * 3 + d ] = array.columnLength();
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
contagem[ t ][ s * 3 + d ] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return contagem;
|
||||
}
|
||||
|
||||
public double[] countNumeroMedioTrabalhadoresEmpresa( Integer empresaID, int ano )
|
||||
throws Exception
|
||||
{
|
||||
double contagens[] = new double[ 2 ];;
|
||||
Select select;
|
||||
String sexos[] = new String[]{ "m", "f" };
|
||||
|
||||
for( int n = 0; n < sexos.length; n++ )
|
||||
{
|
||||
select =
|
||||
new Select( new String[]{ "estabelecimentos", "trabalhadores" },
|
||||
new String[]{ "COUNT(trabalhadores.id)" },
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ).and(
|
||||
new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isLess( new Integer( ano ) ).or(
|
||||
new Field( TrabalhadoresData.DATA_ADMISSAO ).isEqual( null ) ) ) ).and(
|
||||
new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_DEMISSAO + ")" ).isGreater( new Integer( ano ) ).or(
|
||||
new Field( TrabalhadoresData.DATA_DEMISSAO ).isEqual( null ) ) ) ).and(
|
||||
new Field( "empresa_id" ).isEqual( empresaID ) ).and(
|
||||
new Field( TrabalhadoresData.SEXO ).isEqual( sexos[ n ] ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
contagens[ n ] = ( ( Number ) array.get( 0, 0 ) ).doubleValue();
|
||||
}
|
||||
for( int n = 0; n < sexos.length; n++ )
|
||||
{
|
||||
select =
|
||||
new Select( new String[]{ "estabelecimentos", "trabalhadores" },
|
||||
new String[]{ "SUM( MONTH( data_demissao ) )" },
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ).and(
|
||||
new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isLess( new Integer( ano ) ).or(
|
||||
new Field( TrabalhadoresData.DATA_ADMISSAO ).isEqual( null ) ) ) ).and(
|
||||
new Field( "YEAR(" + TrabalhadoresData.DATA_DEMISSAO + ")" ).isEqual( new Integer( ano ) ) ).and(
|
||||
new Field( "empresa_id" ).isEqual( empresaID ) ).and(
|
||||
new Field( TrabalhadoresData.SEXO ).isEqual( sexos[ n ] ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ) );
|
||||
System.out.println( "SELECT: " + select );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.get( 0, 0 ) != null )
|
||||
{
|
||||
contagens[ n ] += ( ( Number ) array.get( 0, 0 ) ).doubleValue() / 12.0;
|
||||
}
|
||||
}
|
||||
|
||||
for( int n = 0; n < sexos.length; n++ )
|
||||
{
|
||||
select =
|
||||
new Select( new String[]{ "estabelecimentos", "trabalhadores" },
|
||||
new String[]{ "SUM( ( 1 + 12 - MONTH( data_admissao ) ) )" },
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ).and(
|
||||
new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isEqual( new Integer( ano ) ) ).and(
|
||||
new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_DEMISSAO + ")" ).isGreater( new Integer( ano ) ).or(
|
||||
new Field( TrabalhadoresData.DATA_DEMISSAO ).isEqual( null ) ) ) ).and(
|
||||
new Field( "empresa_id" ).isEqual( empresaID ) ).and(
|
||||
new Field( TrabalhadoresData.SEXO ).isEqual( sexos[ n ] ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.get( 0, 0 ) != null )
|
||||
{
|
||||
contagens[ n ] += ( ( Number ) array.get( 0, 0 ) ).doubleValue() / 12.0;
|
||||
}
|
||||
}
|
||||
|
||||
for( int n = 0; n < sexos.length; n++ )
|
||||
{
|
||||
select =
|
||||
new Select( new String[]{ "estabelecimentos", "trabalhadores" },
|
||||
new String[]{ "SUM( ( 1 + MONTH( data_demissao ) - MONTH( data_admissao ) ) )" },
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ).and(
|
||||
new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isEqual( new Integer( ano ) ) ).and(
|
||||
new Field( "YEAR(" + TrabalhadoresData.DATA_DEMISSAO + ")" ).isEqual( new Integer( ano ) ) ).and(
|
||||
new Field( "empresa_id" ).isEqual( empresaID ) ).and(
|
||||
new Field( TrabalhadoresData.SEXO ).isEqual( sexos[ n ] ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
if( array.get( 0, 0 ) != null )
|
||||
{
|
||||
contagens[ n ] += ( ( Number ) array.get( 0, 0 ) ).doubleValue() / 12.0;
|
||||
}
|
||||
}
|
||||
|
||||
return contagens;
|
||||
}
|
||||
|
||||
public double[] countNumeroTotalTrabalhadoresEmpresa( Integer empresaID, int ano )
|
||||
throws Exception
|
||||
{
|
||||
double contagens[] = new double[ 2 ];;
|
||||
Select select;
|
||||
String sexos[] = new String[]{ "m", "f" };
|
||||
|
||||
for( int n = 0; n < sexos.length; n++ )
|
||||
{
|
||||
select =
|
||||
new Select( new String[]{ "estabelecimentos", "trabalhadores" },
|
||||
new String[]{ "COUNT(trabalhadores.id)" },
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ).and(
|
||||
new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or(
|
||||
new Field( TrabalhadoresData.DATA_ADMISSAO ).isEqual( null ) ) ) ).and(
|
||||
new Par( new Field( "YEAR(" + TrabalhadoresData.DATA_DEMISSAO + ")" ).isGreaterOrEqual( new Integer( ano ) ).or(
|
||||
new Field( TrabalhadoresData.DATA_DEMISSAO ).isEqual( null ) ) ) ).and(
|
||||
new Field( "empresa_id" ).isEqual( empresaID ) ).and(
|
||||
new Field( TrabalhadoresData.SEXO ).isEqual( sexos[ n ] ) ).and(
|
||||
new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
contagens[ n ] = ( ( Number ) array.get( 0, 0 ) ).doubleValue();
|
||||
}
|
||||
return contagens;
|
||||
}
|
||||
|
||||
public String []getNomesExames()
|
||||
throws Exception
|
||||
{
|
||||
String nomes[];
|
||||
Select select =
|
||||
new Select( new String[]{ "tipos_exames_comp" },
|
||||
new String[]{ "descricao", "ordem" },
|
||||
null,
|
||||
new String[]{ "ordem" }, null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
nomes = new String[ array.columnLength() ];
|
||||
for( int n = 0; n < array.columnLength(); n++ )
|
||||
{
|
||||
nomes[ n ] = ( String )array.get( n, 0 );
|
||||
}
|
||||
return nomes;
|
||||
}
|
||||
|
||||
public int []countExamesComplementaresEmpresa( Integer empresaID, int ano )
|
||||
throws Exception
|
||||
{
|
||||
// Vector perfis[] = new Vector[ 2 ];
|
||||
// Hashtable contagens[] = new Hashtable[ 2 ];
|
||||
// Select select;
|
||||
// Virtual2DArray array;
|
||||
//
|
||||
// for( int p = 0; p < 2; p++ )
|
||||
// {
|
||||
// Integer pAux = new Integer( p + 1 );
|
||||
// perfis[ p ] = new Vector();
|
||||
// select = new Select( new String[]{"estabelecimentos", "trabalhadores", "marcacoes_trabalhador"},
|
||||
// new String[]{"COUNT(marcacoes_trabalhador.id)", TrabalhadoresData.PERFIL },
|
||||
// new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
// new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
// new Field( "empresa_id" ).isEqual( empresaID ) ).and(
|
||||
// new Field( MarcacoesTrabalhadorData.TIPO ).isEqual( new Integer( MarcacoesTrabalhadorData.TIPO_EXAMES ) ) ).and(
|
||||
// new Field( "YEAR( marcacoes_trabalhador.data ) " ).isEqual( new Integer( ano ) ).and(
|
||||
// new Field( MarcacoesTrabalhadorData.ESTADO ).in( new Integer[]{ new Integer( 1 ), new Integer( 2 ) } ) ) ).and(
|
||||
// new Field( "trabalhadores.perfil" ).isEqual( pAux ) ) );
|
||||
// array = executer.executeQuery( select );
|
||||
//
|
||||
// select =
|
||||
// new Select( new String[]{ "prt_elementos_protocolo", "prt_tipos_elementos_protocolo" },
|
||||
// new String[]{ "DISTINCT prt_tipos_elementos_protocolo.grupo_protocolo_id" },
|
||||
// new Field( "prt_elementos_protocolo.empresa_id" ).isEqual( empresaID ).and(
|
||||
// new Field( "prt_elementos_protocolo.tipo_elemento_protocolo_id" ).isEqual( new Field( "prt_elementos_protocolo.id" ) ) ).and(
|
||||
// new Field( "pr_elementos_protocolo.perfil" ).isEqual( new Integer( p + 1 ) ) ) );
|
||||
// array = executer.executeQuery( select );
|
||||
// for( int ecd = 0; ecd < array.columnLength(); ecd++ )
|
||||
// {
|
||||
// perfis[ p ].add( ( Integer ) array.get( 0, 0 ) );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// return contagens;
|
||||
|
||||
|
||||
int contagens[];
|
||||
Select select;
|
||||
select = new Select( new String[]{"empresas"}, new String[]{ "perfil_1", "perfil_2" },
|
||||
new Field( "id" ).isEqual( empresaID ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
String p1Str = (String)array.get( 0, 0 );
|
||||
String p2Str = (String)array.get( 0, 1 );
|
||||
Number perfil1 = ( p1Str != null && p1Str.length() > 0 )?new Integer( p1Str ):null;
|
||||
Number perfil2 = ( p2Str != null && p2Str.length() > 0 )?new Integer( p2Str ):null;
|
||||
select =
|
||||
new Select( new String[]{ "tipos_exames_comp" },
|
||||
new String[]{ "id", "ordem" },
|
||||
null,
|
||||
new String[]{ "ordem" }, null );
|
||||
array = executer.executeQuery( select );
|
||||
contagens = new int[ array.columnLength() ];
|
||||
Hashtable idExames = new Hashtable();
|
||||
for( int n = 0; n < array.columnLength(); n++ )
|
||||
{
|
||||
idExames.put( ( Number )array.get( n, 0 ), new Integer( n ) );
|
||||
}
|
||||
if( perfil1 == null && perfil2 == null )
|
||||
{
|
||||
return contagens;
|
||||
}
|
||||
else if( perfil1 == null )
|
||||
{
|
||||
perfil1 = perfil2;
|
||||
}
|
||||
else if( perfil2 == null )
|
||||
{
|
||||
perfil2 = perfil1;
|
||||
}
|
||||
select = new Select( new String[]{"estabelecimentos", "trabalhadores", "marcacoes_trabalhador"},
|
||||
new String[]{"COUNT(marcacoes_trabalhador.id)", TrabalhadoresData.PERFIL },
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and(
|
||||
new Field( "empresa_id" ).isEqual( empresaID ) ).and(
|
||||
new Field( MarcacoesTrabalhadorData.TIPO ).isEqual( new Integer( MarcacoesTrabalhadorData.TIPO_EXAMES ) ) ).and(
|
||||
new Field( "YEAR( marcacoes_trabalhador.data ) " ).isEqual( new Integer( ano ) ).and(
|
||||
new Field( Marcacao.REALIZADA ).isEqual( "y" ) ) ),
|
||||
new String[]{ TrabalhadoresData.PERFIL },
|
||||
new String[]{ TrabalhadoresData.PERFIL } );
|
||||
array = executer.executeQuery( select );
|
||||
int numeroExames[] = new int[ 2 ];
|
||||
for( int n = 0; n < array.columnLength(); n++ )
|
||||
{
|
||||
Integer perfil = (Integer)array.get( n, 1 );
|
||||
if( perfil == null || perfil.intValue() == 1 )
|
||||
{
|
||||
numeroExames[0] += ( (Number) array.get( n, 0 ) ).intValue();
|
||||
}
|
||||
else if( perfil.intValue() == 2 )
|
||||
{
|
||||
numeroExames[1] += ( (Number) array.get( n, 0 ) ).intValue();
|
||||
}
|
||||
}
|
||||
|
||||
Hashtable hash = new Hashtable();
|
||||
select = new Select( new String[]{ "exames_perfis" },
|
||||
new String[]{ "tipo", "multiplicador" },
|
||||
new Field( "perfil" ).isEqual( perfil1 ) );
|
||||
array = executer.executeQuery( select );
|
||||
for( int n = 0; n < array.columnLength(); n++ )
|
||||
{
|
||||
Number tipo = (Number) array.get( n, 0 );
|
||||
if( tipo == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Number multiplicador = (Number) array.get( n, 1 );
|
||||
if( multiplicador == null )
|
||||
{
|
||||
multiplicador = new Integer( 1 );
|
||||
}
|
||||
if( idExames.containsKey( tipo ) )
|
||||
{
|
||||
int pos = ((Integer)idExames.get( tipo )).intValue();
|
||||
contagens[ pos ] += numeroExames[0] * multiplicador.intValue();
|
||||
}
|
||||
}
|
||||
select = new Select( new String[]{ "exames_perfis" },
|
||||
new String[]{ "tipo", "multiplicador" },
|
||||
new Field( "perfil" ).isEqual( perfil2 ) );
|
||||
array = executer.executeQuery( select );
|
||||
for( int n = 0; n < array.columnLength(); n++ )
|
||||
{
|
||||
Number tipo = (Number) array.get( n, 0 );
|
||||
if( tipo == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Number multiplicador = (Number) array.get( n, 1 );
|
||||
if( multiplicador == null )
|
||||
{
|
||||
multiplicador = new Integer( 1 );
|
||||
}
|
||||
if( idExames.containsKey( tipo ) )
|
||||
{
|
||||
int pos = ((Integer)idExames.get( tipo )).intValue();
|
||||
contagens[ pos ] += numeroExames[1] * multiplicador.intValue();
|
||||
}
|
||||
}
|
||||
return contagens;
|
||||
}
|
||||
|
||||
public HashMap<String,Integer> countExamesComplementaresEmpresaNovosProtocolos( Integer empresaId, int ano )
|
||||
throws Exception
|
||||
{
|
||||
HashMap<Integer,Vector<String>> perfis = new HashMap<Integer,Vector<String>>();
|
||||
HashMap<String,Integer> contagens = null;
|
||||
|
||||
Select select =
|
||||
new Select2( new String[]{ "prt_elementos_protocolo", "prt_tipos_elementos_protocolo", "prt_grupos_protocolo" },
|
||||
new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER },
|
||||
new Expression[]{
|
||||
new Field( "prt_elementos_protocolo.tipo_elemento_protocolo_id" ).isEqual( new Field( "prt_tipos_elementos_protocolo.id" ) ),
|
||||
new Field( "prt_tipos_elementos_protocolo.grupo_protocolo_id" ).isEqual( new Field( "prt_grupos_protocolo.id" ) ),
|
||||
},
|
||||
new String[]{ "DISTINCT prt_elementos_protocolo.numero_perfil", "prt_grupos_protocolo.descricao" },
|
||||
new Field( "prt_elementos_protocolo.empresa_id" ).isEqual( empresaId ),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
for( int n = 0; n < array.columnLength(); n++ )
|
||||
{
|
||||
Integer perfil = ( Integer ) array.get( n, 0 );
|
||||
String tipo = ( String ) array.get( n, 1 );
|
||||
if( !perfis.containsKey( perfil ) )
|
||||
{
|
||||
perfis.put( perfil, new Vector<String>() );
|
||||
}
|
||||
perfis.get( perfil ).add( tipo );
|
||||
}
|
||||
|
||||
if( perfis.size() > 0 )
|
||||
{
|
||||
contagens = new HashMap<String,Integer>();
|
||||
select = new Select2(
|
||||
new String[]{"trabalhadores", "marcacoes_trabalhador", "empresas"},
|
||||
new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER },
|
||||
new Expression[]{
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ),
|
||||
new Field( "trabalhadores.estabelecimentos_id" ).isEqual( new Field( "estabelecimentos.id" ) ),
|
||||
},
|
||||
new String[]{"COUNT(marcacoes_trabalhador.id)", TrabalhadoresData.PERFIL },
|
||||
new Field( "estabelecimentos.id.empresa_id" ).isEqual( empresaId ).and(
|
||||
new Field( MarcacoesTrabalhadorData.TIPO ).isEqual( new Integer( MarcacoesTrabalhadorData.TIPO_EXAMES ) ) ).and(
|
||||
new Field( "YEAR( marcacoes_trabalhador.data ) " ).isEqual( new Integer( ano ) ).and(
|
||||
new Field( Marcacao.REALIZADA ).isEqual( "y" ) ) ),
|
||||
null,
|
||||
new String[]{ TrabalhadoresData.PERFIL },
|
||||
null,
|
||||
null );
|
||||
array = executer.executeQuery( select );
|
||||
for( int n = 0; n < array.columnLength(); n++ )
|
||||
{
|
||||
Integer perfil = (Integer)array.get( n, 1 );
|
||||
Integer count = ( ( Number ) array.get( n, 0 ) ).intValue();
|
||||
if( perfil == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Vector<String> tipos = perfis.get( perfil );
|
||||
for( String tipo : tipos )
|
||||
{
|
||||
if( !contagens.containsKey( tipo ) )
|
||||
{
|
||||
contagens.put( tipo, count );
|
||||
}
|
||||
else
|
||||
{
|
||||
contagens.put( tipo, contagens.get( tipo ) + count );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return contagens;
|
||||
}
|
||||
|
||||
public int []countExamesComplementaresEstabelecimento( Integer estabelecimentoID, int ano )
|
||||
throws Exception
|
||||
{
|
||||
int contagens[] = null;
|
||||
Select select;
|
||||
select = new Select( new String[]{"estabelecimentos", "empresas"},
|
||||
new String[]{ "empresas.perfil_1", "empresas.perfil_2" },
|
||||
new Field( "estabelecimentos.id" ).isEqual( estabelecimentoID ).and(
|
||||
new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) ) );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
String p1Str = (String)array.get( 0, 0 );
|
||||
String p2Str = (String)array.get( 0, 1 );
|
||||
Number perfil1 = ( p1Str != null && p1Str.length() > 0 )?new Integer( p1Str ):null;
|
||||
Number perfil2 = ( p2Str != null && p2Str.length() > 0 )?new Integer( p2Str ):null;
|
||||
select =
|
||||
new Select( new String[]{ "tipos_exames_comp" },
|
||||
new String[]{ "id", "ordem" },
|
||||
null,
|
||||
new String[]{ "ordem" }, null );
|
||||
array = executer.executeQuery( select );
|
||||
contagens = new int[ array.columnLength() ];
|
||||
Hashtable idExames = new Hashtable();
|
||||
for( int n = 0; n < array.columnLength(); n++ )
|
||||
{
|
||||
idExames.put( ( Number )array.get( n, 0 ), new Integer( n ) );
|
||||
}
|
||||
if( perfil1 == null && perfil2 == null )
|
||||
{
|
||||
return contagens;
|
||||
}
|
||||
else if( perfil1 == null )
|
||||
{
|
||||
perfil1 = perfil2;
|
||||
}
|
||||
else if( perfil2 == null )
|
||||
{
|
||||
perfil2 = perfil1;
|
||||
}
|
||||
select = new Select( new String[]{"trabalhadores", "marcacoes_trabalhador"},
|
||||
new String[]{"COUNT(marcacoes_trabalhador.id)", TrabalhadoresData.PERFIL },
|
||||
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and(
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and(
|
||||
new Field( MarcacoesTrabalhadorData.TIPO ).isEqual( new Integer( MarcacoesTrabalhadorData.TIPO_EXAMES ) ) ).and(
|
||||
new Field( "YEAR( marcacoes_trabalhador.data ) " ).isEqual( new Integer( ano ) ).and(
|
||||
new Field( Marcacao.REALIZADA ).isEqual( "y" ) ) ),
|
||||
new String[]{ TrabalhadoresData.PERFIL },
|
||||
new String[]{ TrabalhadoresData.PERFIL } );
|
||||
array = executer.executeQuery( select );
|
||||
int numeroExames[] = new int[ 2 ];
|
||||
for( int n = 0; n < array.columnLength(); n++ )
|
||||
{
|
||||
Integer perfil = (Integer)array.get( n, 1 );
|
||||
if( perfil == null || perfil.intValue() == 1 )
|
||||
{
|
||||
numeroExames[0] += ( (Number) array.get( n, 0 ) ).intValue();
|
||||
}
|
||||
else if( perfil.intValue() == 2 )
|
||||
{
|
||||
numeroExames[1] += ( (Number) array.get( n, 0 ) ).intValue();
|
||||
}
|
||||
}
|
||||
|
||||
Hashtable hash = new Hashtable();
|
||||
select = new Select( new String[]{ "exames_perfis" },
|
||||
new String[]{ "tipo", "multiplicador" },
|
||||
new Field( "perfil" ).isEqual( perfil1 ) );
|
||||
array = executer.executeQuery( select );
|
||||
for( int n = 0; n < array.columnLength(); n++ )
|
||||
{
|
||||
Number tipo = (Number) array.get( n, 0 );
|
||||
if( tipo == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Number multiplicador = (Number) array.get( n, 1 );
|
||||
if( multiplicador == null )
|
||||
{
|
||||
multiplicador = new Integer( 1 );
|
||||
}
|
||||
if( idExames.containsKey( tipo ) )
|
||||
{
|
||||
int pos = ((Integer)idExames.get( tipo )).intValue();
|
||||
contagens[ pos ] += numeroExames[0] * multiplicador.intValue();
|
||||
}
|
||||
}
|
||||
select = new Select( new String[]{ "exames_perfis" },
|
||||
new String[]{ "tipo", "multiplicador" },
|
||||
new Field( "perfil" ).isEqual( perfil2 ) );
|
||||
array = executer.executeQuery( select );
|
||||
for( int n = 0; n < array.columnLength(); n++ )
|
||||
{
|
||||
Number tipo = (Number) array.get( n, 0 );
|
||||
if( tipo == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Number multiplicador = (Number) array.get( n, 1 );
|
||||
if( multiplicador == null )
|
||||
{
|
||||
multiplicador = new Integer( 1 );
|
||||
}
|
||||
if( idExames.containsKey( tipo ) )
|
||||
{
|
||||
int pos = ((Integer)idExames.get( tipo )).intValue();
|
||||
contagens[ pos ] += numeroExames[1] * multiplicador.intValue();
|
||||
}
|
||||
}
|
||||
return contagens;
|
||||
}
|
||||
|
||||
|
||||
public HashMap<String,Integer> countExamesComplementaresEstabelecimentoNovosProtocolos( Integer estabelecimentoID, int ano )
|
||||
throws Exception
|
||||
{
|
||||
HashMap<Integer,Vector<String>> perfis = new HashMap<Integer,Vector<String>>();
|
||||
HashMap<String,Integer> contagens = null;
|
||||
Select select =
|
||||
new Select2( new String[]{ "estabelecimentos" },
|
||||
new Integer[]{},
|
||||
new Expression[]{},
|
||||
new String[]{ "empresa_id" },
|
||||
new Field( "id" ).isEqual( estabelecimentoID ),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null );
|
||||
Virtual2DArray array = executer.executeQuery( select );
|
||||
Integer empresaId = ( Integer ) array.get( 0, 0 );
|
||||
select =
|
||||
new Select2( new String[]{ "prt_elementos_protocolo", "prt_tipos_elementos_protocolo", "prt_grupos_protocolo" },
|
||||
new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER },
|
||||
new Expression[]{
|
||||
new Field( "prt_elementos_protocolo.tipo_elemento_protocolo_id" ).isEqual( new Field( "prt_tipos_elementos_protocolo.id" ) ),
|
||||
new Field( "prt_tipos_elementos_protocolo.grupo_protocolo_id" ).isEqual( new Field( "prt_grupos_protocolo.id" ) ),
|
||||
},
|
||||
new String[]{ "DISTINCT prt_elementos_protocolo.numero_perfil", "prt_grupos_protocolo.descricao" },
|
||||
new Field( "prt_elementos_protocolo.empresa_id" ).isEqual( empresaId ),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null );
|
||||
array = executer.executeQuery( select );
|
||||
for( int n = 0; n < array.columnLength(); n++ )
|
||||
{
|
||||
Integer perfil = ( Integer ) array.get( n, 0 );
|
||||
String tipo = ( String ) array.get( n, 1 );
|
||||
if( !perfis.containsKey( perfil ) )
|
||||
{
|
||||
perfis.put( perfil, new Vector<String>() );
|
||||
}
|
||||
perfis.get( perfil ).add( tipo );
|
||||
}
|
||||
|
||||
if( perfis.size() > 0 )
|
||||
{
|
||||
contagens = new HashMap<String,Integer>();
|
||||
select = new Select2(
|
||||
new String[]{"trabalhadores", "marcacoes_trabalhador"},
|
||||
new Integer[]{ Select2.JOIN_INNER },
|
||||
new Expression[]{ new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) },
|
||||
new String[]{"COUNT(marcacoes_trabalhador.id)", TrabalhadoresData.PERFIL },
|
||||
new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ).and(
|
||||
new Field( MarcacoesTrabalhadorData.TIPO ).isEqual( new Integer( MarcacoesTrabalhadorData.TIPO_EXAMES ) ) ).and(
|
||||
new Field( "YEAR( marcacoes_trabalhador.data ) " ).isEqual( new Integer( ano ) ).and(
|
||||
new Field( Marcacao.REALIZADA ).isEqual( "y" ) ) ),
|
||||
null,
|
||||
new String[]{ TrabalhadoresData.PERFIL },
|
||||
null,
|
||||
null );
|
||||
array = executer.executeQuery( select );
|
||||
for( int n = 0; n < array.columnLength(); n++ )
|
||||
{
|
||||
Integer perfil = (Integer)array.get( n, 1 );
|
||||
Integer count = ( ( Number ) array.get( n, 0 ) ).intValue();
|
||||
if( perfil == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Vector<String> tipos = perfis.get( perfil );
|
||||
for( String tipo : tipos )
|
||||
{
|
||||
if( !contagens.containsKey( tipo ) )
|
||||
{
|
||||
contagens.put( tipo, count );
|
||||
}
|
||||
else
|
||||
{
|
||||
contagens.put( tipo, contagens.get( tipo ) + count );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return contagens;
|
||||
}
|
||||
}
|
||||
@ -1,626 +0,0 @@
|
||||
/*
|
||||
* PesquisasWindow.java
|
||||
*
|
||||
* Created on 3 de Junho de 2004, 18:13
|
||||
*/
|
||||
|
||||
package siprp.pesquisas;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FileDialog;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
|
||||
import shst.data.outer.ContactosData;
|
||||
import shst.data.outer.EmpresasData;
|
||||
import shst.data.outer.EstabelecimentosData;
|
||||
import siprp.ui.SIPRPFrame;
|
||||
|
||||
import com.evolute.entity.ProviderInterface;
|
||||
import com.evolute.utils.Singleton;
|
||||
import com.evolute.utils.data.IDObject;
|
||||
import com.evolute.utils.data.MappableObject;
|
||||
import com.evolute.utils.documents.YearDocument;
|
||||
import com.evolute.utils.tables.BaseTable;
|
||||
import com.evolute.utils.tables.VectorTableModel;
|
||||
import com.evolute.utils.tracker.TrackableWindow;
|
||||
import com.evolute.utils.ui.DialogException;
|
||||
import com.evolute.utils.ui.text.CopyPasteHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class RelatorioAnualWindow extends SIPRPFrame
|
||||
implements TrackableWindow, ListSelectionListener, ActionListener
|
||||
{
|
||||
private ProviderInterface JDO;
|
||||
private PesquisasProvider provider;
|
||||
|
||||
private JTextField anoText;
|
||||
private BaseTable empresasTable;
|
||||
private VectorTableModel empresasModel;
|
||||
private BaseTable estabelecimentosTable;
|
||||
private VectorTableModel estabelecimentosModel;
|
||||
private JButton pesquisarButton;
|
||||
private JButton exportarButton;
|
||||
private JEditorPane resultadoText;
|
||||
|
||||
// public static void main( String args[] )
|
||||
// throws Exception
|
||||
// {
|
||||
// new PesquisasWindow().show();
|
||||
// }
|
||||
|
||||
/** Creates a new instance of PesquisasWindow */
|
||||
public RelatorioAnualWindow()
|
||||
throws Exception
|
||||
{
|
||||
provider = (PesquisasProvider)PesquisasProvider.getProvider();
|
||||
JDO =( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_EVO_DATA_PROVIDER );
|
||||
setupComponents();
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
{
|
||||
setSize( 1000, 700 );
|
||||
setTitle( "Relat\u00f3rio Anual" );
|
||||
|
||||
JLabel anoLabel = new JLabel( "Ano" );
|
||||
anoText = new JTextField();
|
||||
anoText.setDocument( new YearDocument() );
|
||||
anoText.setPreferredSize( new Dimension( 50, 20 ) );
|
||||
new CopyPasteHandler( anoText );
|
||||
|
||||
empresasModel = new VectorTableModel( new String[]{ "Designa\u00e7\u00e3o Social" } );
|
||||
empresasTable = new BaseTable( empresasModel );
|
||||
empresasTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
|
||||
empresasTable.setNonResizableNorReordable();
|
||||
empresasTable.getSelectionModel().addListSelectionListener( this );
|
||||
JScrollPane empresasScroll = new JScrollPane();
|
||||
empresasScroll.setViewportView( empresasTable );
|
||||
empresasScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
|
||||
empresasScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
|
||||
empresasScroll.getVerticalScrollBar().setBlockIncrement(20);
|
||||
|
||||
estabelecimentosModel = new VectorTableModel( new String[]{ "Nome" } );
|
||||
estabelecimentosTable = new BaseTable( estabelecimentosModel );
|
||||
estabelecimentosTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
|
||||
estabelecimentosTable.setNonResizableNorReordable();
|
||||
estabelecimentosTable.getSelectionModel().addListSelectionListener( this );
|
||||
JScrollPane estabelecimentosScroll = new JScrollPane();
|
||||
estabelecimentosScroll.setViewportView( estabelecimentosTable );
|
||||
estabelecimentosScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
|
||||
estabelecimentosScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
|
||||
|
||||
pesquisarButton = new JButton( "Pesquisar" );
|
||||
pesquisarButton.addActionListener( this );
|
||||
exportarButton = new JButton( "Exportar" );
|
||||
exportarButton.addActionListener( this );
|
||||
|
||||
resultadoText = new JEditorPane( "text/html", "" );
|
||||
resultadoText.setEditable( false );
|
||||
// resultadoText.setLineWrap( true );
|
||||
// resultadoText.setWrapStyleWord( true );
|
||||
new CopyPasteHandler( resultadoText );
|
||||
JScrollPane resultadoScroll = new JScrollPane();
|
||||
resultadoScroll.setViewportView( resultadoText );
|
||||
resultadoScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
|
||||
resultadoScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
|
||||
|
||||
JPanel pad;
|
||||
|
||||
GridBagLayout gridbag = new GridBagLayout();
|
||||
getContentPane().setLayout( gridbag );
|
||||
GridBagConstraints constraints = new GridBagConstraints();
|
||||
constraints.insets = new Insets( 5, 5, 5, 5 );
|
||||
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.weighty = 0;
|
||||
constraints.gridheight = 1;
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
JPanel anoPanel = new JPanel();
|
||||
anoPanel.setLayout( new FlowLayout( FlowLayout.LEFT ) );
|
||||
anoPanel.add( anoLabel );
|
||||
anoPanel.add( anoText );
|
||||
gridbag.setConstraints( anoPanel, constraints );
|
||||
getContentPane().add( anoPanel );
|
||||
|
||||
constraints.fill = GridBagConstraints.BOTH;
|
||||
constraints.weighty = 0.2;
|
||||
constraints.gridheight = 2;
|
||||
constraints.weightx = 0.3;
|
||||
constraints.gridwidth = 3;
|
||||
|
||||
JPanel empresasPanel = new JPanel( new BorderLayout() );
|
||||
JPanel estabelecimentosPanel = new JPanel( new BorderLayout() );
|
||||
empresasPanel.setBorder( BorderFactory.createTitledBorder( "Empresa" ) );
|
||||
estabelecimentosPanel.setBorder( BorderFactory.createTitledBorder( "Estabelecimento" ) );
|
||||
empresasPanel.add( empresasScroll, BorderLayout.CENTER );
|
||||
estabelecimentosPanel.add( estabelecimentosScroll, BorderLayout.CENTER );
|
||||
|
||||
gridbag.setConstraints( empresasPanel, constraints );
|
||||
getContentPane().add( empresasPanel );
|
||||
|
||||
gridbag.setConstraints( estabelecimentosPanel, constraints );
|
||||
getContentPane().add( estabelecimentosPanel );
|
||||
|
||||
constraints.weighty = 0;
|
||||
constraints.gridheight = 1;
|
||||
constraints.weightx = 0.4;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
pad = new JPanel();
|
||||
gridbag.setConstraints( pad, constraints );
|
||||
getContentPane().add( pad );
|
||||
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.weighty = 0;
|
||||
constraints.gridheight = 1;
|
||||
constraints.weightx = 0;
|
||||
constraints.gridwidth = 1;
|
||||
JPanel buttonPanel = new JPanel();
|
||||
buttonPanel.setLayout( new GridLayout( 1, 2 ) );
|
||||
buttonPanel.add( pesquisarButton );
|
||||
buttonPanel.add( exportarButton );
|
||||
gridbag.setConstraints( buttonPanel, constraints );
|
||||
getContentPane().add( buttonPanel );
|
||||
|
||||
constraints.weighty = 0;
|
||||
constraints.gridheight = 1;
|
||||
constraints.weightx = 0.4;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
pad = new JPanel();
|
||||
gridbag.setConstraints( pad, constraints );
|
||||
getContentPane().add( pad );
|
||||
|
||||
constraints.fill = GridBagConstraints.BOTH;
|
||||
constraints.weighty = 0.8;
|
||||
constraints.gridheight = GridBagConstraints.REMAINDER;
|
||||
constraints.weightx = 1;
|
||||
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||
gridbag.setConstraints( resultadoScroll, constraints );
|
||||
getContentPane().add( resultadoScroll );
|
||||
}
|
||||
|
||||
private boolean close()
|
||||
{
|
||||
setVisible( false );
|
||||
dispose();
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean closeIfPossible()
|
||||
{
|
||||
return close();
|
||||
}
|
||||
|
||||
public void open()
|
||||
{
|
||||
empresasTable.clearSelection();
|
||||
try
|
||||
{
|
||||
IDObject empresas[] = provider.getAllEmpresas();
|
||||
empresasModel.setValues( new Vector( Arrays.asList( empresas ) ) );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a carregar dados", true );
|
||||
}
|
||||
setVisible( true );
|
||||
}
|
||||
|
||||
public void refresh()
|
||||
{
|
||||
}
|
||||
|
||||
public void valueChanged( ListSelectionEvent e )
|
||||
{
|
||||
Object source = e.getSource();
|
||||
if( source.equals( empresasTable.getSelectionModel() ) )
|
||||
{
|
||||
estabelecimentosTable.clearSelection();
|
||||
int selected = empresasTable.getSelectedRow();
|
||||
if( selected == -1 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
IDObject empresa = (IDObject) empresasModel.getRowAt( selected );
|
||||
estabelecimentosModel.clearAll();
|
||||
IDObject estabelecimentos[];
|
||||
try
|
||||
{
|
||||
estabelecimentos = provider.getAllEstabelecimentosForEmpresa( empresa.getID() );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a carregar os estabelecimentos", true );
|
||||
return;
|
||||
}
|
||||
Vector v = new Vector( Arrays.asList( estabelecimentos ) );
|
||||
v.add( new MappableObject( new Integer( -1 ), "TODOS" ) );
|
||||
estabelecimentosModel.setValues( v );
|
||||
}
|
||||
/* else if( source.equals( estabelecimentosTable.getSelectionModel() ) )
|
||||
{
|
||||
}*/
|
||||
}
|
||||
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
Object source = e.getSource();
|
||||
if( source.equals( pesquisarButton ) )
|
||||
{
|
||||
int sEmpresa = empresasTable.getSelectedRow();
|
||||
int sEstabelecimento = estabelecimentosTable.getSelectedRow();
|
||||
String anoStr = anoText.getText();
|
||||
int ano = ( anoStr.length() != 0 )? Integer.parseInt( anoStr ): -1;
|
||||
if( sEmpresa == -1 || ano == -1 )
|
||||
{
|
||||
JOptionPane.showMessageDialog( this, "Tem de escolher ano e empresa", "Erro...",
|
||||
JOptionPane.ERROR_MESSAGE );
|
||||
return;
|
||||
}
|
||||
StringBuffer buff = new StringBuffer();
|
||||
buff.append( "ANO: " );
|
||||
buff.append( "<B>" + ano + "</B><BR>" );
|
||||
buff.append( "<BR><I>EMPRESA</I><BR>" );
|
||||
try
|
||||
{
|
||||
Integer idEmpresa = ( (IDObject)empresasModel.getRowAt( sEmpresa ) ).getID();
|
||||
EmpresasData empresa = (EmpresasData)JDO.load( EmpresasData.class, idEmpresa );
|
||||
buff.append( " DESIGNA\u00C7\u00C3O SOCIAL: " );
|
||||
String designacao = (String)empresa.get( EmpresasData.DESIGNACAO_SOCIAL );
|
||||
buff.append( "<B>" + ( designacao == null ? "" : designacao.trim() ) + "</B><BR>" );
|
||||
buff.append( " MORADA: " );
|
||||
String morada = (String)empresa.get( EmpresasData.MORADA );
|
||||
buff.append( "<B>" + ( morada == null ? "" : morada.trim() ) + "</B><BR>" );
|
||||
buff.append( " LOCALIDADE: " );
|
||||
String localidade = ( String ) empresa.get( EmpresasData.LOCALIDADE );
|
||||
buff.append( "<B>" + ( localidade == null ? "" : localidade.trim() ) + "</B><BR>" );
|
||||
buff.append( " C\u00D3DIGO POSTAL: " );
|
||||
String codigoPostal = ( String ) empresa.get( EmpresasData.CODIGO_POSTAL );
|
||||
buff.append( "<B>" + ( codigoPostal == null ? "" : codigoPostal.trim() ) + "</B><BR>" );
|
||||
// ContactosData contacto = (ContactosData)empresa.get( EmpresasData.CONTACTO_2 );
|
||||
ContactosData contacto = empresa.toContacto_2();
|
||||
if( contacto == null )
|
||||
{
|
||||
buff.append( " TELEFONE: <BR>" );
|
||||
buff.append( " FAX: <BR>" );
|
||||
}
|
||||
else
|
||||
{
|
||||
buff.append( " TELEFONE: " );
|
||||
String telefone = ( String ) contacto.get( ContactosData.TELEFONE );
|
||||
buff.append( "<B>" + ( telefone == null ? "" : telefone.trim() ) + "</B><BR>" );
|
||||
buff.append( " FAX: " );
|
||||
String fax = ( String ) contacto.get( ContactosData.TELEFONE );
|
||||
buff.append( "<B>" + ( fax == null ? "" : fax.trim() ) + "</B><BR>" );
|
||||
}
|
||||
buff.append( " DISTRITO: " );
|
||||
String distrito = ( String ) empresa.get( EmpresasData.DISTRITO );
|
||||
buff.append( "<B>" + ( distrito == null ? "" : distrito ) + "</B><BR>" );
|
||||
buff.append( " CONCELHO: " );
|
||||
String concelho = ( String ) empresa.get( EmpresasData.CONCELHO );
|
||||
buff.append( "<B>" + ( concelho == null ? "" : concelho ) + "</B><BR>" );
|
||||
buff.append( " N\u00DAMERO PESSOA COLECTIVA: " );
|
||||
String contribuinte = ( String ) empresa.get( EmpresasData.CONTRIBUINTE );
|
||||
buff.append( "<B>" + ( contribuinte == null ? "" : contribuinte ) + "</B><BR>" );
|
||||
buff.append( " N\u00DAMERO SEGURAN\u00C7A SOCIAL: " );
|
||||
String segSocial = ( String ) empresa.get( EmpresasData.SEGURANCA_SOCIAL );
|
||||
buff.append( "<B>" + ( segSocial == null ? "" : segSocial ) + "</B><BR>" );
|
||||
buff.append( " CAE: " );
|
||||
String CAE = ( String ) empresa.get( EmpresasData.CAE );
|
||||
buff.append( "<B>" + ( CAE == null ? "" : CAE ) + "</B><BR>" );
|
||||
buff.append( "<BR> N\u00DAMERO M\u00C9DIO DE TRABALHADORES DURANTE O ANO" );
|
||||
double contagemMedia[] = provider.countNumeroMedioTrabalhadoresEmpresa( idEmpresa, ano );
|
||||
buff.append( "<TABLE BORDER=\"0\">" );
|
||||
buff.append( "<TR>" );
|
||||
buff.append( "<TD> </TD><TD> </TD><TD> </TD><TD>TOTAL</TD><TD> </TD><TD>HOMENS</TD><TD> </TD><TD>MULHERES</TD>" );
|
||||
buff.append( "</TR><TR>" );
|
||||
buff.append( "<TD> </TD><TD>TOTAL</TD><TD> </TD><TD ALIGN=\"CENTER\"><B>" + (int)( Math.round( contagemMedia[0] ) + Math.round( contagemMedia[1] ) ) + "</B></TD>");
|
||||
buff.append( "<TD> </TD><TD ALIGN=\"CENTER\"><B>" + ( (int)Math.round( contagemMedia[0] ) ) + "</B></TD>" );
|
||||
buff.append( "<TD> </TD><TD ALIGN=\"CENTER\"><B>" + ( (int)Math.round( contagemMedia[1] ) ) + "</B></TD>" );
|
||||
buff.append( "</TR>" );
|
||||
buff.append( "</TABLE>" );
|
||||
buff.append( "<BR> N\u00DAMERO TOTAL DE TRABALHADORES DURANTE O ANO" );
|
||||
double contagemTotal[] = provider.countNumeroTotalTrabalhadoresEmpresa( idEmpresa, ano );
|
||||
buff.append( "<TABLE BORDER=\"0\">" );
|
||||
buff.append( "<TR>" );
|
||||
buff.append( "<TD> </TD><TD> </TD><TD> </TD><TD>TOTAL</TD><TD> </TD><TD>HOMENS</TD><TD> </TD><TD>MULHERES</TD>" );
|
||||
buff.append( "</TR><TR>" );
|
||||
buff.append( "<TD> </TD><TD>TOTAL</TD><TD> </TD><TD ALIGN=\"CENTER\"><B>" + (int)( Math.round( contagemTotal[0] ) + Math.round( contagemTotal[1] ) ) + "</B></TD>");
|
||||
buff.append( "<TD> </TD><TD ALIGN=\"CENTER\"><B>" + ( (int)Math.round( contagemTotal[0] ) ) + "</B></TD>" );
|
||||
buff.append( "<TD> </TD><TD ALIGN=\"CENTER\"><B>" + ( (int)Math.round( contagemTotal[1] ) ) + "</B></TD>" );
|
||||
buff.append( "</TR>" );
|
||||
buff.append( "</TABLE>" );
|
||||
|
||||
IDObject estabelecimentos[];
|
||||
if( sEstabelecimento == -1 || ( ( IDObject )estabelecimentosModel.getRowAt( sEstabelecimento ) ).getID().equals( new Integer( -1 ) ) )
|
||||
{
|
||||
estabelecimentos = provider.getAllEstabelecimentosForEmpresa( idEmpresa );
|
||||
}
|
||||
else
|
||||
{
|
||||
estabelecimentos = new IDObject[ 1 ];
|
||||
estabelecimentos[ 0 ] = ( IDObject )estabelecimentosModel.getRowAt( sEstabelecimento );
|
||||
}
|
||||
buff.append( "<BR>" );
|
||||
buff.append( "<BR><I> ESTABELECIMENTOS</I><BR>" );
|
||||
buff.append( "<BR>" );
|
||||
for( int n = 0; n < estabelecimentos.length; n++ )
|
||||
{
|
||||
EstabelecimentosData estabelecimento = (EstabelecimentosData)JDO.load( EstabelecimentosData.class, estabelecimentos[ n ].getID() );
|
||||
buff.append( " NOME: " );
|
||||
String nome = (String)estabelecimento.get( EstabelecimentosData.NOME );
|
||||
buff.append( "<B>" + ( nome == null ? "" : nome.trim() ) + "</B><BR>" );
|
||||
buff.append( " MORADA: " );
|
||||
morada = (String)estabelecimento.get( EstabelecimentosData.MORADA );
|
||||
buff.append( "<B>" + ( morada == null ? "" : morada.trim() ) + "</B><BR>" );
|
||||
buff.append( " LOCALIDADE: " );
|
||||
localidade = (String)estabelecimento.get( EstabelecimentosData.LOCALIDADE );
|
||||
buff.append( "<B>" + ( localidade == null ? "" : localidade.trim() ) + "</B><BR>" );
|
||||
buff.append( " C\u00D3DIGO POSTAL: " );
|
||||
codigoPostal = (String)estabelecimento.get( EstabelecimentosData.CODIGO_POSTAL );
|
||||
buff.append( "<B>" + ( codigoPostal == null ? "" : codigoPostal.trim() ) + "</B><BR>" );
|
||||
contacto = estabelecimento.toContacto_id();
|
||||
if( contacto == null )
|
||||
{
|
||||
buff.append( " TELEFONE: <BR>" );
|
||||
buff.append( " FAX: <BR>" );
|
||||
}
|
||||
else
|
||||
{
|
||||
buff.append( " TELEFONE: " );
|
||||
String telefone = ( String ) contacto.get( ContactosData.TELEFONE );
|
||||
buff.append( "<B>" + ( telefone == null ? "" : telefone.trim() ) + "</B><BR>" );
|
||||
buff.append( " FAX: " );
|
||||
String fax = ( String ) contacto.get( ContactosData.TELEFONE );
|
||||
buff.append( "<B>" + ( fax == null ? "" : fax.trim() ) + "</B><BR>" );
|
||||
}
|
||||
int countTrabalhadores[] = provider.countTrabalhadoresEstabelecimentoDezembro( estabelecimentos[ n ].getID(), ano );
|
||||
buff.append( "<BR>" );
|
||||
buff.append( " <I>TRABALHADORES A 31 DE DEZEMBRO DE " + ano + ":</I> " );
|
||||
buff.append( "<BR>" );
|
||||
buff.append( "<TABLE BORDER=\"0\">" );
|
||||
buff.append( "<TR>" );
|
||||
buff.append( "<TD> </TD><TD> </TD><TD>TOTAL</TD><TD>HOMENS</TD><TD>MULHERES</TD>" );
|
||||
buff.append( "</TR>" );
|
||||
buff.append( "<TR>" );
|
||||
buff.append( "<TD> </TD><TD>TOTAL</TD>"
|
||||
+ "<TD ALIGN=\"CENTER\"><B> " + ( countTrabalhadores[0] + countTrabalhadores[1] ) + "</B></Td>"
|
||||
+ "<TD ALIGN=\"CENTER\"><B> " + ( countTrabalhadores[0] ) + "</B></TD>"
|
||||
+ "<TD ALIGN=\"CENTER\"><B> " + ( countTrabalhadores[1] ) + "</B></TD>" );
|
||||
buff.append( "</TR>" );
|
||||
int countTrabalhadoresEtario[][] = provider.countTrabalhadoresEstabelecimentoDezembroPorGrupoEtario( estabelecimentos[ n ].getID(), ano );
|
||||
buff.append( "<TR>" );
|
||||
buff.append( "<TD> </TD><TD>MENOS DE 18 ANOS</TD>"
|
||||
+ "<TD ALIGN=\"CENTER\"><B> " + ( countTrabalhadoresEtario[0][0] + countTrabalhadoresEtario[0][1] ) + "</B></Td>"
|
||||
+ "<TD ALIGN=\"CENTER\"><B> " + ( countTrabalhadoresEtario[0][0] ) + "</B></TD>"
|
||||
+ "<TD ALIGN=\"CENTER\"><B> " + ( countTrabalhadoresEtario[0][1] ) + "</B></TD>" );
|
||||
buff.append( "</TR>" );
|
||||
buff.append( "<TR>" );
|
||||
buff.append( "<TD> </TD><TD>18 A 49 ANOS</TD>"
|
||||
+ "<TD ALIGN=\"CENTER\"><B> " + ( countTrabalhadoresEtario[1][0] + countTrabalhadoresEtario[1][1] ) + "</B></Td>"
|
||||
+ "<TD ALIGN=\"CENTER\"><B> " + ( countTrabalhadoresEtario[1][0] ) + "</B></TD>"
|
||||
+ "<TD ALIGN=\"CENTER\"><B> " + ( countTrabalhadoresEtario[1][1] ) + "</B></TD>" );
|
||||
buff.append( "</TR>" );
|
||||
buff.append( "<TR>" );
|
||||
buff.append( "<TD> </TD><TD>MAIS DE 50 ANOS</TD>"
|
||||
+ "<TD ALIGN=\"CENTER\"><B> " + ( countTrabalhadoresEtario[2][0] + countTrabalhadoresEtario[2][1] ) + "</B></Td>"
|
||||
+ "<TD ALIGN=\"CENTER\"><B> " + ( countTrabalhadoresEtario[2][0] ) + "</B></TD>"
|
||||
+ "<TD ALIGN=\"CENTER\"><B> " + ( countTrabalhadoresEtario[2][1] ) + "</B></TD>" );
|
||||
buff.append( "</TR>" );
|
||||
buff.append( "</TABLE>" );
|
||||
buff.append( "<BR>" );
|
||||
int countExames[][] = provider.countExamesEstabelecimentoDezembroPorGrupoEtario( estabelecimentos[ n ].getID(), ano );
|
||||
for( int cE = 0; cE < countExames[ countExames.length - 2 ].length; cE++ )
|
||||
{
|
||||
countExames[ countExames.length - 2 ][ cE ] += countExames[ countExames.length - 1 ][ cE ];
|
||||
}
|
||||
int totais[] = new int[ 6 ];
|
||||
for( int cE1 = 0; cE1 < totais.length; cE1++ )
|
||||
{
|
||||
for( int cE2 = 0; cE2 < countExames.length; cE2++ )
|
||||
{
|
||||
totais[ cE1 ] += countExames[ cE2 ][ cE1 ];
|
||||
}
|
||||
}
|
||||
buff.append( "<BR>" );
|
||||
buff.append( " <I>N\u00DAMERO DE EXAMES DE ADMISS\u00C3O, PERI\u00D3DICOS E OCASIONAIS EFECTUADOS</I>" );
|
||||
buff.append( "<BR>" );
|
||||
buff.append( "<TABLE BORDER=\"0\">" );
|
||||
buff.append( "<TR><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD>TOTAL</TD><TD> </TD><TD>INFERIOR A 18 ANOS</TD>"
|
||||
+ "<TD> </TD><TD>18 A 49 ANOS</TD><TD> </TD><TD>50 E MAIS ANOS</TD><TD> </TD></TR>" );
|
||||
buff.append( "<TR><TD> </TD><TD>TOTAL DE EXAMES</TD><TD> </TD><TD>H</TD>" );
|
||||
buff.append( "<TD ALIGN=\"CENTER\"><B>" + ( totais[0] + totais[1] + totais[2] ) + "</B></TD><TD> </TD>" );
|
||||
for( int t = 0; t < 3; t++ )
|
||||
{
|
||||
buff.append( "<TD ALIGN=\"CENTER\"><B>" + totais[t] + "</B></TD><TD> </TD>" );
|
||||
}
|
||||
buff.append( "</TR>" );
|
||||
buff.append( "<TR><TD> </TD><TD> </TD><TD> </TD><TD>M</TD>" );
|
||||
buff.append( "<TD ALIGN=\"CENTER\"><B>" + ( totais[3] + totais[4] + totais[5] ) + "</B></TD><TD> </TD>" );
|
||||
for( int t = 3; t < 6; t++ )
|
||||
{
|
||||
buff.append( "<TD ALIGN=\"CENTER\"><B>" + totais[t] + "</B></TD><TD> </TD>" );
|
||||
}
|
||||
buff.append( "</TR>" );
|
||||
String sexos[] = new String[]{ "H", "M" };
|
||||
for( int t = 0; t < provider.DESCRICAO_TIPOS_EXAME.length; t++ )
|
||||
{
|
||||
buff.append( "<TR><TD> </TD><TD> "+provider.DESCRICAO_TIPOS_EXAME[t]+"</TD>" );
|
||||
|
||||
for( int s = 0; s < 2; s++ )
|
||||
{
|
||||
buff.append( "<TD> </TD><TD>" + sexos[ s ] + "</TD>" );
|
||||
buff.append( "<TD ALIGN=\"CENTER\"><B>" + (countExames[t][s*3]+countExames[t][s*3+1]+countExames[t][s*3+2]) + "</B></TD><TD> </TD>" );
|
||||
for( int d = 0; d < 3; d++ )
|
||||
{
|
||||
buff.append( "<TD ALIGN=\"CENTER\"><B>" + countExames[t][s*3+d] + "</B></TD><TD> </TD>" );
|
||||
}
|
||||
if( s == 0 )
|
||||
{
|
||||
buff.append( "</TR><TR><TD> </TD><TD> </TD>" );
|
||||
}
|
||||
else
|
||||
{
|
||||
buff.append( "</TR>" );
|
||||
}
|
||||
}
|
||||
}
|
||||
int countExamesOcasionais[][] = provider.countExamesOcasionaisEstabelecimentoDezembroPorGrupoEtario( estabelecimentos[ n ].getID(), ano );
|
||||
for( int t = 0; t < provider.DESCRICAO_TIPOS_OCASIONAL.length; t++ )
|
||||
{
|
||||
buff.append( "<TR><TD> </TD><TD> "+provider.DESCRICAO_TIPOS_OCASIONAL[t]+"</TD>" );
|
||||
|
||||
for( int s = 0; s < 2; s++ )
|
||||
{
|
||||
buff.append( "<TD> </TD><TD>" + sexos[ s ] + "</TD>" );
|
||||
int sum = countExamesOcasionais[t][s*3]+countExamesOcasionais[t][s*3+1]+countExamesOcasionais[t][s*3+2];
|
||||
buff.append( "<TD ALIGN=\"CENTER\"><B>" + ( sum < 0 ? "-" : "" + sum ) + "</B></TD><TD> </TD>" );
|
||||
for( int d = 0; d < 3; d++ )
|
||||
{
|
||||
int val = countExamesOcasionais[t][s*3+d];
|
||||
if( val < 0 )
|
||||
{
|
||||
countExamesOcasionais[t][s*3+d] = 0;
|
||||
}
|
||||
buff.append( "<TD ALIGN=\"CENTER\"><B>" + ( val < 0 ? "-" : "" + val ) + "</B></TD><TD> </TD>" );
|
||||
}
|
||||
if( s == 0 )
|
||||
{
|
||||
buff.append( "</TR><TR><TD> </TD><TD> </TD>" );
|
||||
}
|
||||
else
|
||||
{
|
||||
buff.append( "</TR>" );
|
||||
}
|
||||
}
|
||||
}
|
||||
buff.append( "</TABLE>" );
|
||||
buff.append( "<BR>" );
|
||||
buff.append( " <I>EXAMES COMPLEMENTARES REALIZADOS</I>" );
|
||||
buff.append( "<BR>" );
|
||||
buff.append( "<TABLE BORDER=\"0\">" );
|
||||
buff.append( "<TR><TD> </TD><TD>TIPO DE EXAME</TD><TD> </TD>" );
|
||||
buff.append( "<TD>N\u00BA TOTAL DE EXAMES</TD></TR>" );
|
||||
String nomesExamesComp[] = provider.getNomesExames();
|
||||
// int countExamesComp[] = provider.countExamesComplementaresEmpresa( idEmpresa, ano );
|
||||
HashMap<String,Integer> countExamesCompNovo = provider.countExamesComplementaresEstabelecimentoNovosProtocolos( estabelecimentos[ n ].getID(), ano );
|
||||
if( countExamesCompNovo != null )
|
||||
{
|
||||
String nomesExames[] = countExamesCompNovo.keySet().toArray( new String[ countExamesCompNovo.size() ] );
|
||||
Arrays.sort( nomesExames );
|
||||
for( String nomeExame : nomesExames )
|
||||
{
|
||||
buff.append( "<TR>" );
|
||||
buff.append( "<TD> </TD><TD>" + nomeExame + "</TD>" );
|
||||
buff.append( "<TD> </TD><TD ALIGN=\"CENTER\"><B>" + countExamesCompNovo.get( nomeExame ) + "</B></TD>" );
|
||||
buff.append( "</TR>" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int countExamesComp[] = provider.countExamesComplementaresEstabelecimento( estabelecimentos[ n ].getID(), ano );
|
||||
for( int nec = 0; nec < nomesExamesComp.length; nec++ )
|
||||
{
|
||||
buff.append( "<TR>" );
|
||||
buff.append( "<TD> </TD><TD>" + nomesExamesComp[nec] + "</TD>" );
|
||||
buff.append( "<TD> </TD><TD ALIGN=\"CENTER\"><B>" + countExamesComp[nec] + "</B></TD>" );
|
||||
buff.append( "</TR>" );
|
||||
}
|
||||
}
|
||||
buff.append( "</TABLE>" );
|
||||
buff.append("<BR><HR><BR>");
|
||||
}
|
||||
|
||||
resultadoText.setText( buff.toString() );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a carregar dados", false );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if( source.equals( exportarButton ) )
|
||||
{
|
||||
exportar();
|
||||
}
|
||||
}
|
||||
|
||||
public void exportar()
|
||||
{
|
||||
FileDialog dialog = new FileDialog( this, "Ficheiro de destino", FileDialog.SAVE );
|
||||
dialog.setDirectory( System.getProperty( "user.home" ) );
|
||||
dialog.setVisible( true );
|
||||
String fileName;
|
||||
String dirName;
|
||||
fileName = dialog.getFile();
|
||||
dirName = dialog.getDirectory();
|
||||
if( fileName != null )
|
||||
{
|
||||
int index = fileName.indexOf( '.' );
|
||||
if( index == -1 )
|
||||
{
|
||||
fileName += ".html";
|
||||
}
|
||||
if( index == fileName.length() - 1 )
|
||||
{
|
||||
fileName += "html";
|
||||
}
|
||||
String fullName = dirName + fileName;
|
||||
String text = resultadoText.getText();
|
||||
String title = "S.I.P.R.P. - Sociedade Ibérica de Prevenção de Riscos Profissionais";
|
||||
String style = "<style type=\"text/css\">\n"
|
||||
+ " body,td{font-family: arial;"
|
||||
+ " font-size: 8pt; }\n"
|
||||
+ " p{font-family: arial;"
|
||||
+ " font-size: 1pt; }\n"
|
||||
+ "</style>";
|
||||
text = text.replace( "<head>", "<head>\n\t\t<title>" + title + "</title>\n" + style );
|
||||
text = text.replace( "<font size=\"+2\">", "<div style=\"font-family : arial; font-size : 12pt;\">" );
|
||||
text = text.replace( "</font>", "</div>" );
|
||||
text = text.replace( "<body>", "<body>\n<div style=\"font-family : arial; font-size : 12pt;\" align=\"center\"><b>Relatório Anual</b></div>" );
|
||||
// String title = "S.I.P.R.P. - Sociedade Ibérica de Prevenção de Riscos Profissionais";
|
||||
// text = text.replace( "<head>", "<head>\n\t\t<title>" + title + "</title>" );
|
||||
// System.out.println( text );
|
||||
try
|
||||
{
|
||||
FileWriter writer = new FileWriter( new File( fullName ) );
|
||||
writer.write( text );
|
||||
writer.close();
|
||||
}
|
||||
catch( IOException ex )
|
||||
{
|
||||
DialogException.showException( ex );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,384 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<AnaliseAcidente>
|
||||
<Numero>
|
||||
1
|
||||
</Numero>
|
||||
<Data>
|
||||
<Ano>
|
||||
2008
|
||||
</Ano>
|
||||
<Mes>
|
||||
01
|
||||
</Mes>
|
||||
<Dia>
|
||||
01
|
||||
</Dia>
|
||||
</Data>
|
||||
<EntidadeEmpregadora>
|
||||
<IdentificacaoCompleta>
|
||||
Companhia Portuguesa de Hipermercados, S.A., com sede na Travessa Teixeira
|
||||
Júnior, 1 - 1300-553 Lisboa
|
||||
</IdentificacaoCompleta>
|
||||
<Actividade>
|
||||
Comércio a Retalho em Supermercados e Hipermercados
|
||||
</Actividade>
|
||||
<Loja>
|
||||
Jumbo Alfragide
|
||||
</Loja>
|
||||
</EntidadeEmpregadora>
|
||||
<Seguro>
|
||||
<Empresa>
|
||||
Mapfre Seguros Gerais, S.A.
|
||||
</Empresa>
|
||||
<Apolice>
|
||||
1500591100500
|
||||
</Apolice>
|
||||
</Seguro>
|
||||
<EmpresaSHST>
|
||||
<IdentificacaoCompleta>
|
||||
SIPRP - Sociedade Ibérica de Prevenção de Riscos Profissionais Lda.,
|
||||
com sede no Edifício Atrium Saldanha, Praça Duque de Saldanha, 1 - 9º G
|
||||
- 1050-094 Lisboa
|
||||
</IdentificacaoCompleta>
|
||||
<TecnicoSuperiorHST>
|
||||
<Nome>
|
||||
Tecnico HST teste
|
||||
</Nome>
|
||||
<CAP>
|
||||
C1A2P3
|
||||
</CAP>
|
||||
</TecnicoSuperiorHST>
|
||||
<MedicoTrabalho>
|
||||
<Nome>
|
||||
Medico Trabalho teste
|
||||
</Nome>
|
||||
<Cedula>
|
||||
C123
|
||||
</Cedula>
|
||||
</MedicoTrabalho>
|
||||
</EmpresaSHST>
|
||||
<Acidentado>
|
||||
<Nome>
|
||||
Trablhador acidentado
|
||||
</Nome>
|
||||
<EstabelecimentoOrigem>
|
||||
<Nome>
|
||||
Jumbo de Alfragide
|
||||
</Nome>
|
||||
</EstabelecimentoOrigem>
|
||||
<DataNascimento>
|
||||
<Ano>
|
||||
1980
|
||||
</Ano>
|
||||
<Mes>
|
||||
11
|
||||
</Mes>
|
||||
<Dia>
|
||||
08
|
||||
</Dia>
|
||||
</DataNascimento>
|
||||
<BilheteIdentidade>
|
||||
<Numero>
|
||||
1112225585
|
||||
</Numero>
|
||||
</BilheteIdentidade>
|
||||
<Morada>
|
||||
Rua de Cima, 3º dto
|
||||
</Morada>
|
||||
<Telefone>
|
||||
215465981
|
||||
</Telefone>
|
||||
<DataAdmissao>
|
||||
<Ano>
|
||||
2004
|
||||
</Ano>
|
||||
<Mes>
|
||||
10
|
||||
</Mes>
|
||||
<Dia>
|
||||
01
|
||||
</Dia>
|
||||
</DataAdmissao>
|
||||
<Funcao>
|
||||
Varredor
|
||||
</Funcao>
|
||||
<Turno>
|
||||
Tarde
|
||||
</Turno>
|
||||
<Superior>
|
||||
<Nome>
|
||||
António Pedro
|
||||
</Nome>
|
||||
<Email>
|
||||
apedro@hotmail.com
|
||||
</Email>
|
||||
</Superior>
|
||||
</Acidentado>
|
||||
<Acidente>
|
||||
<Averiguador>
|
||||
<Nome>
|
||||
João António
|
||||
</Nome>
|
||||
</Averiguador>
|
||||
<DataOcorrencia>
|
||||
<Ano>
|
||||
2007
|
||||
</Ano>
|
||||
<Mes>
|
||||
12
|
||||
</Mes>
|
||||
<Dia>
|
||||
23
|
||||
</Dia>
|
||||
</DataOcorrencia>
|
||||
<HoraOcorrencia>
|
||||
<Horas>
|
||||
12
|
||||
</Horas>
|
||||
<Minutos>
|
||||
35
|
||||
</Minutos>
|
||||
</HoraOcorrencia>
|
||||
<HorasTrabalhadas>
|
||||
4
|
||||
</HorasTrabalhadas>
|
||||
<Local>
|
||||
<Seccao>
|
||||
Congelados
|
||||
</Seccao>
|
||||
<LocalEspecifico>
|
||||
Corredor Esquerdo
|
||||
</LocalEspecifico>
|
||||
</Local>
|
||||
<Actividade>
|
||||
<Descricao>
|
||||
A varrer
|
||||
</Descricao>
|
||||
<Objectos>
|
||||
Vassoura
|
||||
</Objectos>
|
||||
<Condicoes>
|
||||
Chão molhado
|
||||
</Condicoes>
|
||||
</Actividade>
|
||||
<Testemunhas>
|
||||
Pedro Silva, Marco Pedro
|
||||
</Testemunhas>
|
||||
<Causas>
|
||||
Sono
|
||||
</Causas>
|
||||
<Descricao>
|
||||
Escorregou e caiu
|
||||
</Descricao>
|
||||
<Imagens>
|
||||
<Imagem>
|
||||
</Imagem>
|
||||
<Imagem>
|
||||
</Imagem>
|
||||
</Imagens>
|
||||
<Conclusoes>
|
||||
Conclusao sem indicios nenhuns q a suportem
|
||||
</Conclusoes>
|
||||
<AccoesTomadas>
|
||||
gritar. correr as voltas em panico
|
||||
</AccoesTomadas>
|
||||
<FormacaoSHST>
|
||||
<TeveFormacao>
|
||||
y
|
||||
</TeveFormacao>
|
||||
<Motivo>
|
||||
</Motivo>
|
||||
</FormacaoSHST>
|
||||
<OutrasOcorrenciasMesmoPosto>
|
||||
<Quantidade>
|
||||
3
|
||||
</Quantidade>
|
||||
<Relatorios>
|
||||
<Relatorio>
|
||||
3487
|
||||
</Relatorio>
|
||||
<Relatorio>
|
||||
23424
|
||||
</Relatorio>
|
||||
</Relatorios>
|
||||
</OutrasOcorrenciasMesmoPosto>
|
||||
<OutrasOcorrenciasOutrosTrabalhadores>
|
||||
<Quantidade>
|
||||
0
|
||||
</Quantidade>
|
||||
<Relatorios>
|
||||
<Relatorio>
|
||||
</Relatorio>
|
||||
<Relatorio>
|
||||
</Relatorio>
|
||||
</Relatorios>
|
||||
</OutrasOcorrenciasOutrosTrabalhadores>
|
||||
<Lesao>
|
||||
<Areas>
|
||||
<Area>
|
||||
<Nome>
|
||||
Cabeça
|
||||
</Nome>
|
||||
</Area>
|
||||
<Area>
|
||||
<Nome>
|
||||
Tronco
|
||||
</Nome>
|
||||
</Area>
|
||||
<Area>
|
||||
<Nome>
|
||||
Membro Superior Direito
|
||||
</Nome>
|
||||
<Detalhe>
|
||||
Mão
|
||||
</Detalhe>
|
||||
</Area>
|
||||
</Areas>
|
||||
<Tipo>
|
||||
Grave
|
||||
</Tipo>
|
||||
</Lesao>
|
||||
<Incapacidade>
|
||||
<Tipo>
|
||||
Permanente
|
||||
</Tipo>
|
||||
<Coeficiente>
|
||||
10
|
||||
</Coeficiente>
|
||||
<DataAvaliacao>
|
||||
<Ano>
|
||||
2005
|
||||
</Ano>
|
||||
<Mes>
|
||||
01
|
||||
</Mes>
|
||||
<Dia>
|
||||
01
|
||||
</Dia>
|
||||
</DataAvaliacao>
|
||||
<DataRevisao>
|
||||
<Ano>
|
||||
2007
|
||||
</Ano>
|
||||
<Mes>
|
||||
01
|
||||
</Mes>
|
||||
<Dia>
|
||||
01
|
||||
</Dia>
|
||||
</DataRevisao>
|
||||
<PeriodoIncapacidade>
|
||||
<Inicio>
|
||||
<Ano>
|
||||
</Ano>
|
||||
<Mes>
|
||||
</Mes>
|
||||
<Dia>
|
||||
</Dia>
|
||||
</Inicio>
|
||||
<Fim>
|
||||
<Ano>
|
||||
</Ano>
|
||||
<Mes>
|
||||
</Mes>
|
||||
<Dia>
|
||||
</Dia>
|
||||
</Fim>
|
||||
</PeriodoIncapacidade>
|
||||
</Incapacidade>
|
||||
</Acidente>
|
||||
<RecomendacoesSIPRP>
|
||||
<Recomendacao>
|
||||
beber mta agua
|
||||
</Recomendacao>
|
||||
<Recomendacao>
|
||||
fazer aerobica
|
||||
</Recomendacao>
|
||||
</RecomendacoesSIPRP>
|
||||
<MedidasAdoptar>
|
||||
<Medida>
|
||||
despedir o trabalhador
|
||||
</Medida>
|
||||
<Medida>
|
||||
lamber sabao
|
||||
</Medida>
|
||||
</MedidasAdoptar>
|
||||
<TomadaConhecimento>
|
||||
<DepartamentoSeguranca>
|
||||
<Nome>
|
||||
Joao
|
||||
</Nome>
|
||||
<Data>
|
||||
<Ano>
|
||||
2007
|
||||
</Ano>
|
||||
<Mes>
|
||||
01
|
||||
</Mes>
|
||||
<Dia>
|
||||
01
|
||||
</Dia>
|
||||
</Data>
|
||||
</DepartamentoSeguranca>
|
||||
<TecnicoHST>
|
||||
<Nome>
|
||||
Pedro
|
||||
</Nome>
|
||||
<Data>
|
||||
<Ano>
|
||||
2007
|
||||
</Ano>
|
||||
<Mes>
|
||||
01
|
||||
</Mes>
|
||||
<Dia>
|
||||
02
|
||||
</Dia>
|
||||
</Data>
|
||||
</TecnicoHST>
|
||||
<ResponsavelSeguranca>
|
||||
<Nome>
|
||||
Simao
|
||||
</Nome>
|
||||
<Data>
|
||||
<Ano>
|
||||
2007
|
||||
</Ano>
|
||||
<Mes>
|
||||
01
|
||||
</Mes>
|
||||
<Dia>
|
||||
03
|
||||
</Dia>
|
||||
</Data>
|
||||
</ResponsavelSeguranca>
|
||||
<ResponsavelRH>
|
||||
<Nome>
|
||||
Rafael
|
||||
</Nome>
|
||||
<Data>
|
||||
<Ano>
|
||||
2007
|
||||
</Ano>
|
||||
<Mes>
|
||||
01
|
||||
</Mes>
|
||||
<Dia>
|
||||
04
|
||||
</Dia>
|
||||
</Data>
|
||||
</ResponsavelRH>
|
||||
<SuperiorHierarquico>
|
||||
<Nome>
|
||||
</Nome>
|
||||
<Data>
|
||||
<Ano>
|
||||
</Ano>
|
||||
<Mes>
|
||||
</Mes>
|
||||
<Dia>
|
||||
</Dia>
|
||||
</Data>
|
||||
</SuperiorHierarquico>
|
||||
</TomadaConhecimento>
|
||||
</AnaliseAcidente>
|
||||
@ -1,20 +0,0 @@
|
||||
package siprp.ui;
|
||||
|
||||
import com.evolute.swing.frame.EvoFrame;
|
||||
|
||||
public class SIPRPFrame extends EvoFrame
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public SIPRPFrame()
|
||||
{
|
||||
this( "" );
|
||||
}
|
||||
|
||||
public SIPRPFrame( String title )
|
||||
{
|
||||
super( title );
|
||||
centerLater();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,32 +0,0 @@
|
||||
package siprp.ui;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import com.evolute.utils.ui.window.TabbedWindow;
|
||||
|
||||
public class SIPRPTabbedWindow extends TabbedWindow
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public SIPRPTabbedWindow( JPanel upperPanel, String[] tabNames, boolean[][] activeActions )
|
||||
throws Exception
|
||||
{
|
||||
super( upperPanel, tabNames, activeActions );
|
||||
centerLater();
|
||||
}
|
||||
|
||||
public SIPRPTabbedWindow( boolean upperPanel, String[] tabNames, double weight, boolean[][] activeActions )
|
||||
throws Exception
|
||||
{
|
||||
super( upperPanel, tabNames, weight, activeActions );
|
||||
centerLater();
|
||||
}
|
||||
|
||||
public SIPRPTabbedWindow( JPanel upperPanel, String[] tabNames, double weight, boolean[][] activeActions )
|
||||
throws Exception
|
||||
{
|
||||
super( upperPanel, tabNames, weight, activeActions );
|
||||
centerLater();
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,7 +0,0 @@
|
||||
interno=localhost:5432
|
||||
iuser=postgres
|
||||
ipasswd=Typein
|
||||
externo=www.evolute.pt:5436
|
||||
euser=siprp
|
||||
epasswd=rg2h-opksiprp
|
||||
intervalo=10
|
||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue