no message

git-svn-id: https://svn.coded.pt/svn/SIPRP@35 bb69d46d-e84e-40c8-a05a-06db0d633741
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
P Santos 22 years ago
parent 6169e7e1fd
commit bff4694f4e

@ -0,0 +1,203 @@
package siprp.ficha;
import java.awt.Color;
import java.io.*;
import java.util.*;
import com.lowagie.text.*;
import com.lowagie.text.pdf.PdfWriter;
import dori.jasper.engine.*;
public class ExamePDF {
private static final Font FONT_BOLD = new Font( Font.TIMES_ROMAN, 9, Font.BOLD, new Color( 0, 0, 0 ) );
private static final Font FONT_NORMAL = new Font( Font.TIMES_ROMAN, 9, Font.NORMAL, new Color( 0, 0, 0 ) );
public ExamePDF()
{
}
public static void main( String[] args ) {
try
{
new FileOutputStream( "C:\\Chap0804.pdf" ).write( new ExamePDF().createPDF( new Hashtable() ) );
JasperManager.printPage( new ByteArrayInputStream( new ExamePDF().createPDF( new Hashtable() ) ), 1, true );
}
catch( Exception e )
{
e.printStackTrace();
}
}
public byte[] createPDF( Hashtable values )
{
Document document = new Document();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
document.setPageSize( PageSize.A4 );
try {
PdfWriter.getInstance( document, bos );
document.addTitle( "Ficha de Aptid\u00e3o" );
document.addAuthor( "SIPRP" );
document.addCreator( "Evolute" );
document.open();
Paragraph conteudo = new Paragraph();
conteudo.add( new Chunk( "FICHA DE APTID\u00c3O\n",
new Font( Font.TIMES_ROMAN, 10, Font.BOLD, new Color( 0, 0, 0 ) ) ) );
conteudo.add( new Chunk( "(Portaria n\u00ba1031/2002, de 10 de Agosto)",
new Font( Font.TIMES_ROMAN, 7, Font.NORMAL, new Color( 0, 0, 0 ) ) ) );
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 ) );
StringBuffer texto = new StringBuffer();
texto.append( "Designa\u00e7\u00e3o social " + values.get( "designacao_social" ) + "\n" );
texto.append( "Estabelecimento " + values.get( "estabelecimentos.nome" ) + " Localidade " + values.get( "estabelecimentos.localidade" ) + "\n" );
texto.append( "Servi\u00e7o de sa\u00fade: Tipo Interno " + ( ( values.get( "servico_saude_tipo_interno" ) == null ) ? "" : "X" ) + " Interempresas " + ( ( values.get( "servico_saude_tipo_interempresas" ) == null ) ? "" : "X" ) + " Externo " + ( ( values.get( "servico_saude_tipo_exerno" ) == null ) ? "" : "X" ) + " Servi\u00e7o Nacional de Sa\u00fade " + ( ( values.get( "servico_saude_tipo_sns" ) == null ) ? "" : "X" ) + "\n" );
texto.append( "Designa\u00e7\u00e3o " + values.get( "servico_saude_designacao" ) + "\n" );
texto.append( "Servi\u00e7o de Higiene e Seguran\u00e7a: Tipo Interno " + ( ( values.get( "servico_higiene_tipo_interno" ) == null ) ? "" : "X" ) + " Interempresas " + ( ( values.get( "servico_higiene_tipo_interempresas" ) == null ) ? "" : "X" ) + " Externo " + ( ( values.get( "servico_higiene_tipo_externo" ) == null ) ? "" : "X" ) + " Outro " + ( ( values.get( "servico_higiene_outro" ) == null ) ? "" : "X" ) + "\n" );
texto.append( "Designa\u00e7\u00e3o " + values.get( "servico_higiene_designacao" ) + "" );
table.addCell( new Phrase( 12f, texto.toString(), FONT_NORMAL ) );
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 StringBuffer();
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\u00famero mecanogr\u00e1fico/outro " + values.get( "numero_mecanografico" ) + " Data de admiss\u00e3o " + values.get( "data_admissao" ) + "\n" );
texto.append( "Categoria Profissional " + values.get( "categoria" ) + " Local de Trabalho " + values.get( "local_trabalho" ) + "\n" );
texto.append( "Fun\u00e7\u00e3o Proposta " + values.get( "funcao_proposta" ) + " Data de admiss\u00e3o na fun\u00e7\u00e3o " + 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 StringBuffer();
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 cell = new Cell( new Phrase( "Exame M\u00e9dico",
FONT_BOLD ) );
cell.setColspan( 2 );
table.addCell( cell );
texto = new StringBuffer();
texto.append( "Data do exame " + values.get( "exames.data" ) + "\n" );
texto.append( "Tipo\n" );
texto.append( "Admiss\u00e3o ............................................................................................ " + ( ( values.get( "tipo" ) == null ) ? "" : "X" ) + "\n" );
texto.append( "Peri\u00f3dico ............................................................................................. " + ( ( values.get( "tipo" ) == null ) ? "" : "X" ) + "\n" );
texto.append( "Ocasional\n" );
texto.append( " Ap\u00f3s doen\u00e7a .............................................................................. " + ( ( values.get( "tipo" ) == null ) ? "" : "X" ) + "\n" );
texto.append( " Ap\u00f3s acidente ............................................................................ " + ( ( values.get( "tipo" ) == null ) ? "" : "X" ) + "\n" );
texto.append( " A pedido do trabalhador ............................................................ " + ( ( values.get( "tipo" ) == null ) ? "" : "X" ) + "\n" );
texto.append( " A pedido do servi\u00e7o ................................................................... " + ( ( values.get( "tipo" ) == null ) ? "" : "X" ) + "\n" );
texto.append( " Por mudan\u00e7a de fun\u00e7\u00e3o ............................................................. " + ( ( values.get( "tipo" ) == null ) ? "" : "X" ) + "\n" );
texto.append( " Por altera\u00e7\u00e3o das condi\u00e7\u00f5es de trabalho .................................... " + ( ( values.get( "tipo" ) == null ) ? "" : "X" ) + "\n" );
texto.append( "Outro\n" );
texto.append( "Especifique " + ( ( values.get( "tipo" ) == null ) ? "" : values.get( "tipo" ) ) + "" );
table.addCell( new Phrase( texto.toString(), FONT_NORMAL ) );
texto = new StringBuffer();
texto.append( "Resultado\n" );
texto.append( "Apto .................................................................................................... " + ( ( values.get( "resultado" ) == null ) ? "" : "X" ) + "\n" );
texto.append( "Apto condicionalmente ....................................................................... " + ( ( values.get( "resultado" ) == null ) ? "" : "X" ) + "\n\n" );
texto.append( "Inapto temporariamente ...................................................................... " + ( ( values.get( "resultado" ) == null ) ? "" : "X" ) + "\n" );
texto.append( "Inapto definitivamente ........................................................................ " + ( ( values.get( "resultado" ) == null ) ? "" : "X" ) + "\n" );
texto.append( "Outras fun\u00e7\u00f5es que pode desempenhar\n" );
texto.append( " 1 " + ( ( values.get( "outra_funcao_1" ) == null ) ? "" : values.get( "outra_funcao_1" ) ) + "\n" );
texto.append( " 2 " + ( ( values.get( "outra_funcao_2" ) == null ) ? "" : values.get( "outra_funcao_2" ) ) + "\n" );
texto.append( " 3 " + ( ( values.get( "outra_funcao_3" ) == null ) ? "" : values.get( "outra_funcao_3" ) ) + "\n" );
texto.append( " 4 " + ( ( values.get( "outra_funcao_4" ) == null ) ? "" : values.get( "outra_funcao_4" ) ) + "" );
table.addCell( new Phrase( 14f, 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( "Outras Recomenda\u00e7\u00f5es",
FONT_BOLD ) );
texto = new StringBuffer();
texto.append( "Pr\u00f3ximo 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 StringBuffer();
texto.append( "M\u00e9dico do Trabalho " + values.get( "medicos.nome" ) + " C.P. " + values.get( "numero_cedula" ) + "\n" );
texto.append( "Assinatura _____________________________________________________________________________________\n" );
texto.append( "Tomei conhecimento ___________________________________________________________ Data\n" );
texto.append( " O Respons\u00e1vel dos Recursos Humanos" );
table.addCell( new Phrase( 18f, texto.toString(), FONT_NORMAL ) );
document.add( table );
}
catch( Exception e ) {
e.printStackTrace();
return null;
}
document.close();
return bos.toByteArray();
}
}

@ -9,6 +9,7 @@ package siprp.ficha;
import siprp.*;
import java.awt.*;
import java.util.*;
import javax.swing.*;
import com.evolute.utils.metadb.*;
@ -165,7 +166,7 @@ public class FichaWindow extends TabbedWindow
{
exame.save();
ExamePDF ePDF = new ExamePDF();
exame.setProperty( fdpProvider.PDF, ePDF.createPDF() );
exame.setProperty( fdpProvider.PDF, ePDF.createPDF( new Hashtable() ) );
fdpProvider.savePDF( exame );
}
catch( Exception ex )

Loading…
Cancel
Save