private void BtImprimirHistoricoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtImprimirHistoricoActionPerformed
        if(TbHistorico.getRowCount() > 0){
            HashMap par = new HashMap();
            String relatorio, desc = "";
            
            if(CbPeriodo.isSelected()){
                relatorio = "relatorios\\relatoriohistoricomvtocaixacomdata.jasper";
                SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
                try {
                    par.put("DT_INICIAL", format.parse(TfDtInicial.getText()));
                    par.put("DT_FINAL", format.parse(TfDtFinal.getText()));
                } catch (ParseException ex) {
                
                }
                if(TfDtInicial.getText().equals(TfDtFinal.getText())){
                    par.put("DS_RELATORIO", "Movimentações ocorridas no dia "+TfDtInicial.getText());
                }else{
                    par.put("DS_RELATORIO", "Movimentaçções ocorridas entre os dias "+TfDtInicial.getText() +" e "+TfDtFinal.getText());
                }
            }else{
                relatorio = "relatorios\\relatoriohistoricomvtocaixasemdata.jasper";
            }
            
            if(CbEntradas.isSelected()) par.put("TP1", "E");
            else par.put("TP1", "");
            
            if(CbSaidas.isSelected()) par.put("TP2", "S");
            else par.put("TP2", "");
            
            if(CbAjustes.isSelected()) par.put("TP3", "A");
            else par.put("TP3", "");
            par.put("CD_PRODUTO", Integer.parseInt(TbProdutosHist.getValueAt(TbProdutosHist.getSelectedRow(), 0).toString()));
            ConexaoPostgre conexao = new ConexaoPostgre();
            JDialog dialog = new JDialog(new javax.swing.JFrame(), "Visualização - Software Loja da Fátima", true);
                        dialog.setSize(1000, 700);
            dialog.setLocationRelativeTo(null);
            try {
                JasperPrint print = JasperFillManager.fillReport(relatorio, par, conexao.conecta());
                            
                JasperViewer viewer = new JasperViewer(print, true);
                dialog.getContentPane().add(viewer.getContentPane());
                dialog.setVisible(true);
            } catch (Exception ex) {
                System.out.println(ex);
            }
        }
    }//GEN-LAST:event_BtImprimirHistoricoActionPerformed