<?php
include '../fungsi.php';
?>
<!DOCTYPE html>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>Cetak Data Prospek Yang Hadir Di Event </title>
</head>
<body>
	<style type="text/css">
	body{
		font-family: sans-serif;
	}
	table{
		margin: 20px auto;
		border-collapse: collapse;
	}
	table th,
	table td{
		border: 1px solid #3c3c3c;
		padding: 3px 8px;

	}
	a{
		background: blue;
		color: #fff;
		padding: 8px 10px;
		text-decoration: none;
		border-radius: 2px;
	}
	</style>

	<?php
	IF(empty($_GET['qr'])){
	    echo "<script>alert('Akses Not Valid');window.location='../'</script>";
	}
	$namafile = 'File Export QRCode id ' . $_GET['qr'];
	$idqr = $_GET['qr'];
	//header("Content-type: application/vnd-ms-excel");
    //header("Content-Disposition: attachment; filename=$namafile.xls");
    
    $tampil=mysqli_fetch_row(mysqli_query($con,"select * from qrcode where id='".$_GET['qr']."'"));	
    
	?>

	<center>
		<h2>Data QRoce Event <br><?php echo $tampil[2]; ?> </h2>
	</center>

	<table border="1">
		<tr>
			<th>No</th>
			<th>Nama Prospek</th>
            <th>Email</th>
            <th>Handphone/WA</th>
            <th>Tgl.Validasi</th>
		</tr>
		<?php 
		
		$data = mysqli_query($con,"select qrcode_detail.id as id,prospek.nama as nama,prospek.email as email,prospek.hp as hp,qrcode_detail.tglv as tglv from qrcode_detail, prospek where qrcode_detail.email=prospek.email and qrcode_detail.idqr ='$idqr' order by qrcode_detail.tglv desc");
		$no = 1;
		while($d = mysqli_fetch_array($data)){
		?>
		<tr>
			<td><?php echo $no++; ?></td>
			<td><?php echo $d[1]; ?></td>
			<td><?php echo $d[2]; ?></td>
			<td><?php echo $d[3]; ?></td>
			<td><?php echo $d[4]; ?></td>
		</tr>
		<?php 
		}
		?>
	</table>
	<script>
		window.print();
	</script>
</body>
</html>