<?php
session_start();
$yr=$_SESSION['yea'];
$pid=$_SESSION['cid'];
$tr=$_SESSION['tam'];
include('../include/config.php');

$tou=$_GET['tr'];
$cla=$_GET['Grade'];

    $date = new DateTime("now", new DateTimeZone('Africa/Nairobi') );
    $timenow=$date->format('Y-m-d H:i:s');
    $timenow2=$date->format('Y-m-d');
    $month=$date->format('M');
    
 

    
    
    $result = mysqli_query($con,"SELECT * from Tours where id='$tou'");
    while($row = $result->fetch_assoc()) 
    {
    $nam=$row["Title"];
    //$admno=$row["AdmNo"];
    //$claz=$row["Claz"];
    }
   require_once 'dompdf/vendor/autoload.php';
 use Dompdf\Dompdf;
$html='
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0" name="viewport">
  <title>Tour Report</title>
  <meta content="" name="description">
  <meta content="" name="keywords">
  
  <link href="https://fonts.gstatic.com" rel="preconnect">
  <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Nunito:300,300i,400,400i,600,600i,700,700i|Poppins:300,300i,400,400i,500,500i,600,600i,700,700i" rel="stylesheet">
  <link href="assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  <!-- Vendor CSS Files -->
 
   <link rel="stylesheet" href="data/css/bootstrap.min.css">
  <link href="assets/vendor/bootstrap-icons/bootstrap-icons.css" rel="stylesheet">
  <link href="assets/vendor/boxicons/css/boxicons.min.css" rel="stylesheet">
  <link href="assets/vendor/quill/quill.snow.css" rel="stylesheet">
  <link rel="shortcut icon" href="../images/logo.ico">
</head>
<body style="border:1px solid #004d1a;border-radius:5px;padding:5px;border-style: double;outline-offset: -5px;">
    <div>
   <center> <h6 style="margin-top:5px;color:#0099cc" class="text-red" >CATHOLIC DIOCESE OF MURANGA </h6> </center>
   <center> <h3 style="margin-top:-20px" class="text-red" >BISHOP KAIRO EDUCATION CENTRE </h3> </center>
   <center> <h4 style="margin-top:-20px" class="text-red" >EXCELLENCE IS IN GODLINESS </h4> </center>
  
<img style="position:absolute;margin-top:-80px;margin-bottom:10px;max-height:90px" src="https://bishopkairoeducationcentre.sc.ke/QB-Beta/data/logo.png" alt="" class="" />
<br />
   <label style="margin-top:-20px" class="text-red" ><strong>Telephone:</strong> 0728 966 221, 0714 647 708 </label>
   <br />
  <label style="margin-top:-20px" class="text-red" ><strong>Email:</strong> cdmbishopkairo@gmail.com </label>
  <hr />

<div style="">
 <center>Tour Name: <strong> <u>'.$nam.' </u></strong> Report for:   <strong><u>'.$cla.'</u></center>
   
    <table>
      <thead>
         <tr>
            <th>Amount Paid</th>
       
         </tr>
      </thead>
        <tbody>
        <tr>
        '.
         
    $resultt = mysqli_query($con,"SELECT * FROM TourPayment");
    while($row = $resultt->fetch_assoc()) 
    {'
    <td>'.$row["Amount"].'</td>
    
     ';
        
    }' 
         
        </tr> 
         
       </tbody>
     </table>
</div>

 <br />
     </div>

  <script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
  <script src="assets/vendor/quill/quill.min.js"></script>
  <script src="assets/vendor/simple-datatables/simple-datatables.js"></script>
  <script src="assets/vendor/tinymce/tinymce.min.js"></script>
  <script src="assets/vendor/php-email-form/validate.js"></script>
  <!-- Template Main JS File -->
  <script src="assets/js/main.js"></script>
  <script src="assets/js/jQuery-2.1.4.min.js"></script>
</body>
</html>'; 
$name=$nam.'.php';
$dompdf = new Dompdf();
$dompdf->loadHtml($html);
$options = $dompdf->getOptions(); 
$options->set(array('isRemoteEnabled' => true));
$dompdf->setOptions($options);
$dompdf->setPaper('A4', 'portrait');
$dompdf->render();
$dompdf->stream($name,['Attachment' => 0]);