<?php
date_default_timezone_set('Asia/Kolkata'); 
$phone = $_GET['cid'];
$servername = "localhost";
$username = "avitac_user26";
$password = "h5*4ge2HToIK";
$dbname = "avitac_cms";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}
//create html of the data
ob_start();
?>
<style>
table {
border-collapse: collapse;
width: 100%;
}
th {
text-align: center;
padding: 3px;
font-size:14px;
font-weight:bold;
}
	
td {
padding: 3px;
font-size:14px;
}
	h1, h2, h3, h4, h5, h6, td, th, table, p, ul, li, label 
{
	font-family: Consolas, "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", Monaco, "Courier New", "monospace";
}
</style>
<div style="margin: 15px; padding:5px; margin-top: 15px;">
<p align="center"><img src="../users/avit_logo.jpg"></p>
<hr style="padding: 0 !important; margin: 0 !important; border: 1px solid black;" />
	<p align="center" style="font-size: 14px; margin-bottom: 2px !important; margin-top: 4px !important;"><strong>DEPARTMENT OF ICT- WIFI REGISTRATIONS (AV CAMPUS)</strong></p>
<div class="clear" style="clear: both;"></div>
	<table cellpadding="0" cellspacing="0" border="0" class="datatable-1 table table-bordered table-striped	 display" width="100%">
									
									<tbody>

<?php $st='closed';
$query=mysqli_query($conn,"select tblcomplaints.*,users.fullName as name,category.categoryName as catname from tblcomplaints join users on users.id=tblcomplaints.userId join category on category.id=tblcomplaints.category where tblcomplaints.complaintNumber='".$_GET['cid']."'");
while($row=mysqli_fetch_array($query))
{

?>									
										<tr>
											<td><b>Complaint Number</b></td>
											<td><?php echo htmlentities($row['complaintNumber']);?></td>
											<td><b>Complainant Name</b></td>
											<td> <?php echo htmlentities($row['name']);?></td>
											<td><b>Reg Date</b></td>
											<td><?php echo htmlentities($row['regDate']);?>
											</td>
										</tr>

<tr>
											<td><b>Category </b></td>
											<td><?php echo htmlentities($row['catname']);?></td>
											<td><b>SubCategory</b></td>
											<td> <?php echo htmlentities($row['subcategory']);?></td>
											<td><b>Location</b></td>
											<td><?php echo htmlentities($row['Location']);?>
											</td>
										</tr>
<tr>
										
											<td ><b>Nature of Complaint</b></td>
											<td colspan="5"> <?php echo htmlentities($row['noc']);?></td>
											
										</tr>
<tr>
											<td><b>Complaint Details </b></td>
											
											<td colspan="5"> <?php echo htmlentities($row['complaintDetails']);?></td>
											
										</tr>
										</tbody>
										</table>
</div>

<?php
}
?>
	
<?php 
        $body = ob_get_clean();

        $body = iconv("UTF-8","UTF-8//IGNORE",$body);

        include("../mpdf/mpdf.php");
        $mpdf=new \mPDF('c','A4','','' , 0, 0, 0, 0, 0, 0); 

        //write html to PDF
        $mpdf->WriteHTML($body);
 
        //output pdf
        $mpdf->Output($_GET['cid'].'.pdf','D');
?>