<?php 
include "config.php";
?>
<html>
<head>
  <title>Feenix</title>
  <style>
    th
    {
      font-size:24px;
    }
    td
    {
      font-size:20px;
      font-weight:bold;
    }
  </style>
</head>
<script>
  function enterkeypressed()
{
	//alert(event.keyCode);
	if(event.keyCode=='13'){ window.print(); }
}
</script>
<body onkeydown="enterkeypressed()" ><table>
<?php 
$print = $_GET['print'];
$single=mysqli_query($connect,"select * from first_transaction where status !='deleted' and ticket = '$print'");
while($singleshow = mysqli_fetch_array($single))
{
   $customer = $singleshow['customer'];
$cus=mysqli_query($connect,"select * from customerdetails where status !='deleted' and code = '$customer'");
while($cusshow = mysqli_fetch_array($cus))
{
    $product = $singleshow['product'];
$pro=mysqli_query($connect,"select * from productdetail where status !='deleted' and productcode = '$product'");
while($proshow = mysqli_fetch_array($pro))
{
    $date = $singleshow['date'];
  $datefr = date_create($date);
  $datefrom = date_format($datefr,"d-m-Y");

?>
  <tr>
    <th colspan=4>SMT CRUSHER</th>
  </tr>
  <tr>
    <td colspan="2"><b>To:<?php echo $cusshow['name'] ?></b></td><td colspan="2">(Tripno :<?php echo $singleshow['tripsheet'] ?>)</td>
  </tr>
  <tr>
    <td colspan=4><b>Ticket No:</b>
    <span><b><?php echo $singleshow['ticket'] ?></b></span></td>
  </tr>
  <tr>
    <td colspan=4><b><span><?php echo $datefrom?></span>,</b>
    <span><b><?php echo $singleshow['edittime'] ?></b></span></td>
  </tr>
  <tr>
    <td colspan=4>--------------------------------------------------</td>
  </tr>
  <tr>
    <td colspan=2><b>Material:</b>
    <span><b><?php echo $proshow['productname'] ?></b></span></td><td colspan=2><span></td>
  </tr>
  <tr>
    <td colspan=4>--------------------------------------------------</td>
  </tr>
  <tr>
    <td colspan=2><b>Vehicle NO</b>
    </td><td colspan=2><span><b>Empty-weight</b></span></td>
  </tr>
  <tr>
    <td colspan=4>--------------------------------------------------</td>
  </tr>
 
  <tr>
    <td colspan=2><b><?php echo $singleshow['vehicleno'] ?></b>
    </td><td colspan=2><span><b><?php echo $singleshow['weight'] ?></b></span></td>
  </tr>
    
    <tr>
    <td colspan=4>--------------------------------------------------</td>
  </tr>
  <tr>
    <td colspan=4 style="text-align:center">Thank You<td>
  </tr>
  <?php 
}}}
  ?>
</table>

</body>
</html>