<?php 
include "config.php";
include "financial_year_calculation.php";
include "current_date_time.php";
error_reporting(0);
?>
<?php 
$accountyear    = $financialYearStart."-".$financialYearEnd;
$tktcode = 0;
$singleCount = 0;

$ticketResult = mysqli_query($connect, "select count(id) as count from ticket where status !='deleted' && financialyear ='$accountyear'");
if ($ticketResult) {
  $ticketRow = mysqli_fetch_assoc($ticketResult);
  $tktcode = $ticketRow['count'];
}

$singleResult = mysqli_query($connect, "select count(id) as single_count from single_transaction where status !='deleted' && financialyear ='$accountyear'");
if ($singleResult) {
  $singleRow = mysqli_fetch_assoc($singleResult);
  $singleCount = $singleRow['single_count'];
}

$codee = $tktcode + $singleCount;
$year_code = substr($financialYearEnd, 2);
$codeco = $year_code . "-" . ($codee + 1);
    ?>
<html>
<head>
  <title>Feenix</title>
  <style>
    th
    {
      font-size:24px;
    }
    span
    {
      font-size:20px;
    }
  </style>
</head>
<script>
  function enterkeypressed()
{
	//alert(event.keyCode);
	if(event.keyCode=='13'){ window.print(); }
}
</script>
<body onkeydown="enterkeypressed()" ><table>
<?php 
//error_reporting(0);
$print = $_GET['tkt'];
$vehicle = $_GET['vehicle'];
//echo $vehicle;
//echo $print;
   $customer = $_GET['customer'];
   //echo $customer;
$cus=mysqli_query($connect,"select * from customerdetails where status !='deleted' and code = '$customer'");
while($cusshow = mysqli_fetch_array($cus))
{
    $product = $_GET['product'];
    //echo $product;
$pro=mysqli_query($connect,"select *,CURTIME()as time,CURDATE()as date from productdetail where status !='deleted' and productcode = '$product'");
while($proshow = mysqli_fetch_array($pro))
{

  $datefr = date_create();
  $datefrom = date_format($datefr,"d-m-Y");
  //echo $datefrom;
?>
  <?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'] ?></td>
  </tr>
  <!-- <tr>
    <td colspan=4><b>Trip No:</b>
    <span><b><?php echo $_GET['trip'] ?></b></span></td>
  </tr> -->
  <tr>
    <td colspan=4><b>Ticket No:</b>
    
    <span><b><?php echo "T".$codeco ?></b></span></td>
  </tr>
  <tr>
    <td colspan=4><b>Vehicle No:</b>
    <span><b><?php echo $_GET['vehicle'] ?></b></span></td>
  </tr>
  <tr>
    <td colspan=4><b><span><?php echo $datefrom ?></span>,</b>
    <span><b><?php echo $proshow['time']; ?></b></span></td>
  </tr>
  <tr>
    <td colspan=4>--------------------------------------------------</td>
  </tr>
  <tr>
    <td colspan=2><b>Chakka:</b>
    <span><b><?php echo $singleshow['chakka'] ?></b></span></td><td colspan=2></td>
  </tr>
  <tr>
    <td colspan=2><b>Material:</b>
    <span><b><?php echo $proshow['productname'] ?></b></span></td>
  </tr>
  <tr>
    <td colspan=2><b> Vehicle Capacity:</b>
    <span><?php echo $_GET['quantity'] ?></span></td>
  </tr>
  <tr>
    <td colspan=4>--------------------------------------------------</td>
  </tr>
  <tr>
    <td colspan=4><b>Load Operator Sign</b>
   
  </tr>
  <tr>
    <td colspan=4>--------------------------------------------------</td>
  </tr>
  <tr>
    <td colspan=4 style="text-align:center">Thank You<td>
  </tr>
  <?php 
}}
  ?>
</table>

</body>
</html>
