|
|
|
|
@ -197,21 +197,21 @@ public class FichaWindow extends TabbedWindow
|
|
|
|
|
"Imprimir Fichas Anteriores", null,
|
|
|
|
|
0, false );
|
|
|
|
|
|
|
|
|
|
registerAction( new ActionHandler(){
|
|
|
|
|
public void execute()
|
|
|
|
|
{
|
|
|
|
|
printOldFO();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean activate( boolean newAction, boolean editAction,
|
|
|
|
|
boolean cancelAction, boolean saveAction,
|
|
|
|
|
boolean deleteAction, boolean selectAction )
|
|
|
|
|
{
|
|
|
|
|
return saveAction || editAction;
|
|
|
|
|
}
|
|
|
|
|
}, "Imprimir Fichas Anteriores (novo)",
|
|
|
|
|
"Imprimir Fichas Anteriores (novo)", null,
|
|
|
|
|
0, false );
|
|
|
|
|
// registerAction( new ActionHandler(){
|
|
|
|
|
// public void execute()
|
|
|
|
|
// {
|
|
|
|
|
// printOldFO();
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// public boolean activate( boolean newAction, boolean editAction,
|
|
|
|
|
// boolean cancelAction, boolean saveAction,
|
|
|
|
|
// boolean deleteAction, boolean selectAction )
|
|
|
|
|
// {
|
|
|
|
|
// return saveAction || editAction;
|
|
|
|
|
// }
|
|
|
|
|
// }, "Imprimir Fichas Anteriores (novo)",
|
|
|
|
|
// "Imprimir Fichas Anteriores (novo)", null,
|
|
|
|
|
// 0, false );
|
|
|
|
|
|
|
|
|
|
registerAction( new ActionHandler(){
|
|
|
|
|
public void execute()
|
|
|
|
|
@ -644,31 +644,31 @@ public class FichaWindow extends TabbedWindow
|
|
|
|
|
fileName = absolutePath + fileName + ".pdf";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( fo != null )
|
|
|
|
|
{
|
|
|
|
|
Printer.printFoToFile( fo, fileName, true );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// if( fo != null )
|
|
|
|
|
// {
|
|
|
|
|
// Printer.printFoToFile( fo, fileName, true );
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
Printer.printPDFToFile( pdf, fileName, true );
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
JOptionPane.showMessageDialog( this, "Ficha exportada para: " + fileName );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if( fo != null )
|
|
|
|
|
{
|
|
|
|
|
FichaAptidaoCreator.getCreator().print( fo );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// if( fo != null )
|
|
|
|
|
// {
|
|
|
|
|
// FichaAptidaoCreator.getCreator().print( fo );
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
TrabalhadorData trabalhadorExame = ( TrabalhadorData ) exame.get( ExameData.TRABALHADOR );
|
|
|
|
|
String nomeFicheiro = StringPlainer.convertString( ( String ) trabalhadorExame.get( TrabalhadorData.NOME ) );
|
|
|
|
|
nomeFicheiro = nomeFicheiro.replaceAll( " ", "_" );
|
|
|
|
|
ePDF.print( pdf, nomeFicheiro );
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1182,28 +1182,28 @@ public class FichaWindow extends TabbedWindow
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void printOldFO()
|
|
|
|
|
{
|
|
|
|
|
if( trabalhadorID != null )
|
|
|
|
|
{
|
|
|
|
|
Vector linhas;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
IDObject fichas[] = fdpProvider.getAllFichasForTrabalhador( trabalhadorID );
|
|
|
|
|
linhas = new Vector( Arrays.asList( fichas ) );
|
|
|
|
|
}
|
|
|
|
|
catch( Exception ex )
|
|
|
|
|
{
|
|
|
|
|
DialogException.showExceptionMessage( ex, "Erro a criar lista de Fichas anteriores", true );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
ListActionDialog dialog = new ListActionDialog( this, "Imprimir Fichas Anteriores", new String[]{ "Data" },
|
|
|
|
|
linhas, this );
|
|
|
|
|
dialog.setSize( 250, 200 );
|
|
|
|
|
useFO = true;
|
|
|
|
|
dialog.setVisible( true );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// private void printOldFO()
|
|
|
|
|
// {
|
|
|
|
|
// if( trabalhadorID != null )
|
|
|
|
|
// {
|
|
|
|
|
// Vector linhas;
|
|
|
|
|
// try
|
|
|
|
|
// {
|
|
|
|
|
// IDObject fichas[] = fdpProvider.getAllFichasForTrabalhador( trabalhadorID );
|
|
|
|
|
// linhas = new Vector( Arrays.asList( fichas ) );
|
|
|
|
|
// }
|
|
|
|
|
// catch( Exception ex )
|
|
|
|
|
// {
|
|
|
|
|
// DialogException.showExceptionMessage( ex, "Erro a criar lista de Fichas anteriores", true );
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// ListActionDialog dialog = new ListActionDialog( this, "Imprimir Fichas Anteriores", new String[]{ "Data" },
|
|
|
|
|
// linhas, this );
|
|
|
|
|
// dialog.setSize( 250, 200 );
|
|
|
|
|
// useFO = true;
|
|
|
|
|
// dialog.setVisible( true );
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
public boolean executeListAction( int line, Object value )
|
|
|
|
|
{
|
|
|
|
|
@ -1211,20 +1211,20 @@ public class FichaWindow extends TabbedWindow
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if( useFO )
|
|
|
|
|
{
|
|
|
|
|
ExameData exame = (ExameData) JDO.load( ExameData.class, ( ( IDObject )value ).getID() );
|
|
|
|
|
if( exame == null )
|
|
|
|
|
{
|
|
|
|
|
throw new Exception( "N\u00e3o existe exame" );
|
|
|
|
|
}
|
|
|
|
|
byte fo[] = (byte[]) exame.get( ExameData.FO );
|
|
|
|
|
Printer.printFO( fo );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// if( useFO )
|
|
|
|
|
// {
|
|
|
|
|
// ExameData exame = (ExameData) JDO.load( ExameData.class, ( ( IDObject )value ).getID() );
|
|
|
|
|
// if( exame == null )
|
|
|
|
|
// {
|
|
|
|
|
// throw new Exception( "N\u00e3o existe exame" );
|
|
|
|
|
// }
|
|
|
|
|
// byte fo[] = (byte[]) exame.get( ExameData.FO );
|
|
|
|
|
// Printer.printFO( fo );
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
print( ( ( IDObject )value ).getID(), false );
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
catch( Exception ex )
|
|
|
|
|
{
|
|
|
|
|
|