public void cetakLaporan(String pembeli, String telepon){
       boolean adaKesalahan = false;	
        Connection cn = null; 
        
       try{ 
	  Class.forName(Koneksi.driver); 
	} catch (Exception ex){ 
	  adaKesalahan = true; 
	  JOptionPane.showMessageDialog(null,"JDBC Driver tidak ditemukan atau rusak\n"+ex,"Kesalahan",JOptionPane.ERROR_MESSAGE);  
	} 
	
	if (!adaKesalahan){ 
	  try { 
	    cn = DriverManager.getConnection(Koneksi.database+"?user="+Koneksi.user+"&password="+Koneksi.password+""); 
	  } catch (Exception ex) { 
	    adaKesalahan = true;  
		JOptionPane.showMessageDialog(null,"Koneksi ke "+Koneksi.database+" gagal\n"+ex,"Kesalahan",JOptionPane.ERROR_MESSAGE); 
	  } 
	  
	  if (!adaKesalahan){ 
              String SQLStatement="";
              try {
                  Statement statement = cn.createStatement();
                  
                  SQLStatement = "SELECT buku.`kode_buku` AS buku_kode_buku, "
                          +"buku.`judul_buku` AS buku_judul_buku, "
                          +"buku.`penerbit` AS buku_penerbit, "
                          +"kwitansi.`no_beli` AS kwitansi_no_beli, "
                          +"kwitansi.`kode_buku` AS kwitansi_kode_buku, "
                          +"kwitansi.`Jumlah` AS kwitansi_Jumlah,"
                          + "kwitansi.`harga` AS kwitansi_harga, "
                          +"(kwitansi.`harga`*kwitansi.`jumlah`) AS kwitansi_totalharga, "
                          +"pembeli.`no_beli` AS pembeli_no_beli, "
                          +"pembeli.`nama` AS pembeli_nama, "
                          +"pembeli.`alamat` AS pembeli_alamat, "
                          +"pembeli.`tlp` AS pembeli_tlp "
                          +"FROM "
                          +"`buku` buku INNER JOIN `kwitansi` kwitansi ON buku.`kode_buku` = kwitansi.`kode_buku` "
                          +"INNER JOIN `pembeli` pembeli ON kwitansi.`no_beli` = pembeli.`no_beli` ";                          
                  
                  if (!pembeli.equals(" ")){
                      SQLStatement = SQLStatement + "where pembeli.`nama` like '%"+pembeli+"%'";
                      
                      if (!telepon.equals("")){
                          SQLStatement = SQLStatement + " and pembeli.`tlp` like '%"+telepon+"%'";
                      }
                  } else {
                      if (!telepon.equals("")){
                          SQLStatement = SQLStatement + " where pembeli.`tlp`='"+telepon+"'";
                      }
                  }                  
                  
                  SQLStatement = SQLStatement +" ORDER BY "
                          +"pembeli.`alamat` ASC, "
                          +"pembeli.`tlp` ASC, "
                          +"pembeli.`nama` ASC";
                  
                  JasperDesign disain = JRXmlLoader.load(new File("").getAbsolutePath()+"/src/reports/KwitansiReport.jrxml");
		  JasperReport nilaiLaporan = JasperCompileManager.compileReport(disain);
                  
                  ResultSet resultSet = statement.executeQuery(SQLStatement);
                  JRResultSetDataSource resultSetDataSource = new JRResultSetDataSource(resultSet);
                  
                  JasperPrint cetak = JasperFillManager.fillReport(nilaiLaporan,new HashMap(),resultSetDataSource);
		  
		  JasperViewer.viewReport(cetak,false);
	    } catch (Exception ex) {  
                JOptionPane.showMessageDialog(null,"Gagal mencetak\n"+ex,"Kesalahan",JOptionPane.ERROR_MESSAGE);
            }
          }
        }
    }