|
|
|
|
@ -15,8 +15,10 @@ import java.util.*;
|
|
|
|
|
import javax.swing.*;
|
|
|
|
|
import java.text.*;
|
|
|
|
|
|
|
|
|
|
import com.evolute.utils.data.*;
|
|
|
|
|
import com.evolute.utils.metadb.*;
|
|
|
|
|
import com.evolute.utils.ui.*;
|
|
|
|
|
import com.evolute.utils.ui.panel.*;
|
|
|
|
|
import com.evolute.utils.ui.search.*;
|
|
|
|
|
import com.evolute.utils.ui.window.*;
|
|
|
|
|
|
|
|
|
|
@ -25,6 +27,7 @@ import com.evolute.utils.ui.window.*;
|
|
|
|
|
* @author fpalma
|
|
|
|
|
*/
|
|
|
|
|
public class FichaWindow extends TabbedWindow
|
|
|
|
|
implements ListAction
|
|
|
|
|
{
|
|
|
|
|
private UpperPanel upperPanel;
|
|
|
|
|
private EmpresaPanel empresaPanel;
|
|
|
|
|
@ -119,6 +122,22 @@ public class FichaWindow extends TabbedWindow
|
|
|
|
|
}, "Imprimir",
|
|
|
|
|
"Imprimir Ficha", "print",
|
|
|
|
|
0, true );
|
|
|
|
|
|
|
|
|
|
registerAction( new ActionHandler(){
|
|
|
|
|
public void execute()
|
|
|
|
|
{
|
|
|
|
|
printOld();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean activate( boolean newAction, boolean editAction,
|
|
|
|
|
boolean cancelAction, boolean saveAction,
|
|
|
|
|
boolean deleteAction, boolean selectAction )
|
|
|
|
|
{
|
|
|
|
|
return saveAction || editAction;
|
|
|
|
|
}
|
|
|
|
|
}, "Imprimir Fichas Anteriores",
|
|
|
|
|
"Imprimir Fichas Anteriores", null,
|
|
|
|
|
0, false );
|
|
|
|
|
|
|
|
|
|
registerAction( new ActionHandler(){
|
|
|
|
|
public void execute()
|
|
|
|
|
@ -363,14 +382,7 @@ public class FichaWindow extends TabbedWindow
|
|
|
|
|
System.out.println( "no id" );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
MetaObject exame = fdpProvider.load( fdpProvider.EXAMES, new DBKey( id ) );
|
|
|
|
|
byte pdf[] = (byte []) exame.getProperty( fdpProvider.PDF );
|
|
|
|
|
if( exame == null )
|
|
|
|
|
{
|
|
|
|
|
throw new Exception( "N\u00e3o existe exame" );
|
|
|
|
|
}
|
|
|
|
|
ExamePDF ePDF = new ExamePDF();
|
|
|
|
|
ePDF.print( pdf );
|
|
|
|
|
print( id );
|
|
|
|
|
}
|
|
|
|
|
catch( Exception ex )
|
|
|
|
|
{
|
|
|
|
|
@ -378,6 +390,19 @@ public class FichaWindow extends TabbedWindow
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void print( Integer exameID )
|
|
|
|
|
throws Exception
|
|
|
|
|
{
|
|
|
|
|
MetaObject exame = fdpProvider.load( fdpProvider.EXAMES, new DBKey( exameID ) );
|
|
|
|
|
byte pdf[] = (byte []) exame.getProperty( fdpProvider.PDF );
|
|
|
|
|
if( exame == null )
|
|
|
|
|
{
|
|
|
|
|
throw new Exception( "N\u00e3o existe exame" );
|
|
|
|
|
}
|
|
|
|
|
ExamePDF ePDF = new ExamePDF();
|
|
|
|
|
ePDF.print( pdf );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public byte[] createPDF( MetaObject exame )
|
|
|
|
|
throws Exception
|
|
|
|
|
{
|
|
|
|
|
@ -565,4 +590,51 @@ public class FichaWindow extends TabbedWindow
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void printOld()
|
|
|
|
|
{
|
|
|
|
|
if( trabalhadorID == null )
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
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 );
|
|
|
|
|
dialog.show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean executeListAction( int line, Object value )
|
|
|
|
|
{
|
|
|
|
|
if( value == null )
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
print( ( ( IDObject )value ).getID() );
|
|
|
|
|
}
|
|
|
|
|
catch( Exception ex )
|
|
|
|
|
{
|
|
|
|
|
DialogException.showExceptionMessage( ex, "Erro a imprimir Ficha", true );
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getListActionName()
|
|
|
|
|
{
|
|
|
|
|
return "Imprimir";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|