<?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 escapekeypressed()
{
	//alert(event.keyCode);
	if(event.keyCode=='13'){ window.print(); }
}
</script>
<body onkeydown="escapekeypressed()" >

<table>
<?php 
$code = $_GET['print'];
$table = $_GET['table'];
//echo $code;
//echo "select * from $table where status !='deleted' and salescode ='$code'";
$single=mysqli_query($connect,"select * from $table where status !='deleted' and salescode ='$code'");
while($singleshow = mysqli_fetch_array($single))
{
    $tkt = $singleshow['ticket'];
    $fst=mysqli_query($connect,"select * from ticket where status !='deleted' and ticket = '$tkt'");
    while($fstshow = mysqli_fetch_array($fst))
    {
   $customer = $singleshow['customer'];
  // echo"select * from customerdetails  where  code = '$customer' && status!='deleted'";
$cus=mysqli_query($connect,"select * from customerdetails  where  code = '$customer' && status!='deleted'");
while($cusshow = mysqli_fetch_array($cus))
{
    $product = $singleshow['product'];
$pro=mysqli_query($connect,"select * from productdetail where productcode = '$product'");
while($proshow = mysqli_fetch_array($pro))
{
    $date = $singleshow['editdate'];
  $datefr = date_create($date);
  $datefrom = date_format($datefr,"d-m-Y");

?><?php 
$proedit=mysqli_query($connect,"select * from partydetail order by id desc");
while($proshowedi = mysqli_fetch_array($proedit))
{
  $party=  $proshowedi['party'];
}

?>
<tr align="center"><th colspan="4"><?php echo $party ?></th></tr>
  <tr>
    <td colspan="4"><b>To:<?php echo $cusshow['name'] ?></b></td>
  </tr>
  <!-- <tr>
    <td colspan=4><b>Trip No:</b>
    <span><b><?php echo $fstshow['tripno'] ?></b></span></td>
  </tr> -->
  <tr>
    <td colspan=4><b>Vehicle No:</b>
    <span><b><?php echo $singleshow['vehicleno'] ?></b></span></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>Invoice No:</b>
    <span><b><?php echo $singleshow['salescode'] ?></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=4><b>Material:</b>
    <span><b><?php echo $proshow['productname'] ?></b></span></td>
  </tr>
  <tr>
    <td colspan=4><span><b>Unit:<?php echo $singleshow['netqty'] ?></b></span></b>
    </td>  </tr>
  <tr>
    <td colspan=4>--------------------------------------------------</td>
  </tr>
  <tr>
    <td colspan=2><b>Details</b>
    </td><td colspan=2><span><b>Weight</b></span></td>
  </tr>
  <tr>
    <td colspan=4>--------------------------------------------------</td>
  </tr>
  <tr>
    <td colspan=2><b>Empty-weight</b>
    </td><td colspan=2><span><b><?php echo $singleshow['emptyweight'] ?></b></span></td>
  </tr>
  <tr>
    <td colspan=2><b>Load-weight</b>
    </td><td colspan=2><span><b><?php echo $singleshow['loadweight'] ?></b></span></td>
  </tr>
    <tr>
    <td colspan=4>--------------------------------------------------</td>
  </tr>
  <tr>
    <td colspan=2><b>Nett-weight</b>
    </td><td colspan=2><span><b><?php echo $singleshow['netweight'] ?></b></span></td>
  </tr>
  <tr>
    <td colspan=4>--------------------------------------------------</td>
  </tr>
  <tr>
  
    <td colspan=2 style="text-align:center;float:left;margin-top:50px;font-weight:normal;">Customer Signature<td>
	<td colspan=2 style="text-align:center;float:right;font-weight:normal;">Authorized Signature<td>
  </tr>
  <tr>
    <td colspan=4>--------------------------------------------------</td>
  </tr>
  <tr>
    <td colspan=4 style="text-align:center">Thank You<td>
  </tr>
  <?php 
}}}}
  ?>
</table>

</body>
</html>