|  |  | @ -19,6 +19,7 @@ import java.beans.PropertyChangeEvent; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.beans.PropertyChangeListener; |  |  |  | import java.beans.PropertyChangeListener; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.io.File; |  |  |  | import java.io.File; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.io.FileOutputStream; |  |  |  | import java.io.FileOutputStream; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import java.io.IOException; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.text.SimpleDateFormat; |  |  |  | import java.text.SimpleDateFormat; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.Date; |  |  |  | import java.util.Date; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.EventObject; |  |  |  | import java.util.EventObject; | 
			
		
	
	
		
		
			
				
					|  |  | @ -49,6 +50,7 @@ import siprp.database.cayenne.objects.HsRelatorio; | 
			
		
	
		
		
			
				
					
					|  |  |  | import siprp.database.cayenne.objects.MarcacoesEstabelecimento; |  |  |  | import siprp.database.cayenne.objects.MarcacoesEstabelecimento; | 
			
		
	
		
		
			
				
					
					|  |  |  | import siprp.database.cayenne.objects.MarcacoesTecnicosHst; |  |  |  | import siprp.database.cayenne.objects.MarcacoesTecnicosHst; | 
			
		
	
		
		
			
				
					
					|  |  |  | import siprp.higiene.gestao.equipamentos.AdicionarEquipamentosPanel; |  |  |  | import siprp.higiene.gestao.equipamentos.AdicionarEquipamentosPanel; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import siprp.higiene.relatorio.print.RelatorioPDFCreator; | 
			
		
	
		
		
			
				
					
					|  |  |  | import siprp.logic.HigieneSegurancaLogic; |  |  |  | import siprp.logic.HigieneSegurancaLogic; | 
			
		
	
		
		
			
				
					
					|  |  |  | import siprp.medicina.processo.mail.MailDialog; |  |  |  | import siprp.medicina.processo.mail.MailDialog; | 
			
		
	
		
		
			
				
					
					|  |  |  | import siprp.planoactuacao.print.PlanoActuacaoPDFCreator; |  |  |  | import siprp.planoactuacao.print.PlanoActuacaoPDFCreator; | 
			
		
	
	
		
		
			
				
					|  |  | @ -125,7 +127,6 @@ public class PanelRelatorio extends JPanel implements CaretListener, ChangeListe | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	private void startupComponents() |  |  |  | 	private void startupComponents() | 
			
		
	
		
		
			
				
					
					|  |  |  | 	{ |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		buttonPdfRelatorio.setEnabled( false ); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 		dataRelatorio.setPreferredSize( new Dimension( 150, 0 ) ); |  |  |  | 		dataRelatorio.setPreferredSize( new Dimension( 150, 0 ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		panelEquipamentos.setPreferredSize( new Dimension( 400, 0 ) ); |  |  |  | 		panelEquipamentos.setPreferredSize( new Dimension( 400, 0 ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		bg.add( radioInicial ); |  |  |  | 		bg.add( radioInicial ); | 
			
		
	
	
		
		
			
				
					|  |  | @ -249,7 +250,15 @@ public class PanelRelatorio extends JPanel implements CaretListener, ChangeListe | 
			
		
	
		
		
			
				
					
					|  |  |  | 			@Override |  |  |  | 			@Override | 
			
		
	
		
		
			
				
					
					|  |  |  | 			public void actionPerformed( ActionEvent e ) |  |  |  | 			public void actionPerformed( ActionEvent e ) | 
			
		
	
		
		
			
				
					
					|  |  |  | 			{ |  |  |  | 			{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 				pdf(); |  |  |  | 				pdf(true); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		} ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		buttonPdfRelatorio.addActionListener( new ActionListener() | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			@Override | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			public void actionPerformed( ActionEvent e ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				pdf(false); | 
			
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} ); |  |  |  | 		} ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		buttonRevertPlano.addActionListener( new ActionListener() |  |  |  | 		buttonRevertPlano.addActionListener( new ActionListener() | 
			
		
	
	
		
		
			
				
					|  |  | @ -361,13 +370,37 @@ public class PanelRelatorio extends JPanel implements CaretListener, ChangeListe | 
			
		
	
		
		
			
				
					
					|  |  |  | 		return result; |  |  |  | 		return result; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	private void pdf() |  |  |  | 	private void pdf(boolean plano) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 	{ |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		try |  |  |  | 		try | 
			
		
	
		
		
			
				
					
					|  |  |  | 		{ |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 			setCursor( new Cursor(Cursor.WAIT_CURSOR) ); |  |  |  | 			setCursor( new Cursor(Cursor.WAIT_CURSOR) ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			byte [] pdf = null; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			if( plano ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 				PlanoActuacaoPDFCreator creator = new PlanoActuacaoPDFCreator(); |  |  |  | 				PlanoActuacaoPDFCreator creator = new PlanoActuacaoPDFCreator(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 			byte [] pdf = creator.createPDF( relatorio.getId(), false ); |  |  |  | 				pdf = creator.createPDF( relatorio.getId(), false ); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			else | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				RelatorioPDFCreator creator = new RelatorioPDFCreator(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				pdf = creator.createPDF( relatorio.getId() ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			printToFile( pdf ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		catch( Exception e ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			LeafDialog.error( e ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		finally | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			setCursor( new Cursor(Cursor.DEFAULT_CURSOR) ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	private void printToFile( byte [] pdf ) throws IOException | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		 | 
			
		
	
		
		
			
				
					
					|  |  |  | 		if( pdf != null ) |  |  |  | 		if( pdf != null ) | 
			
		
	
		
		
			
				
					
					|  |  |  | 		{ |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 			JFileChooser fileChooser = new JFileChooser(  ); |  |  |  | 			JFileChooser fileChooser = new JFileChooser(  ); | 
			
		
	
	
		
		
			
				
					|  |  | @ -393,15 +426,6 @@ public class PanelRelatorio extends JPanel implements CaretListener, ChangeListe | 
			
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		catch( Exception e ) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 		{ |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 			LeafDialog.error( e ); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 		finally |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 		{ |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 			setCursor( new Cursor(Cursor.DEFAULT_CURSOR) ); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	private JFrame getFrame( ) |  |  |  | 	private JFrame getFrame( ) | 
			
		
	
		
		
			
				
					
					|  |  |  | 	{ |  |  |  | 	{ | 
			
		
	
	
		
		
			
				
					|  |  | 
 |