<?php 
include "config.php";
include "financial_year_calculation.php";
include "current_date_time.php";
error_reporting(0);
?>
<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 

   $customer = $_GET['customer'];
$cus=mysqli_query($connect,"select * from customerdetails where status !='deleted' and code = '$customer'");
while($cusshow = mysqli_fetch_array($cus))
{
    $product = $_GET['product'];
$pro=mysqli_query($connect,"select *,CURTIME() as time from productdetail where status !='deleted' and productcode = '$product'");
while($proshow = mysqli_fetch_array($pro))
{
    // $date = $singleshow['editdate'];
  $datefr = date_create($date);
  $datefrom = date_format($datefr,"d-m-Y");

?>
  <tr>
    <th colspan=4>SHRI PANDIAN BLUE METAL</th>
  </tr>
  <tr>
    <td colspan="2"><b>To:<?php echo $cusshow['name'] ?></b></td>
    <!-- <td colspan="2">(Tripno :<?php echo $_GET['trip'] ?>)</td> -->
  </tr>
  <tr>
    <td colspan=4><b>Ticket No:</b>
    
<?php 
$accountyear    = $financialYearStart."-".$financialYearEnd;
//echo $accountyear;
     $code = mysqli_query($connect,"select count(id) as count from ticket where status !='deleted'&& financialyear ='$accountyear'");
      while($row=mysqli_fetch_array($code))
     {
       $codsin = mysqli_query($connect,"select count(id) as count from single_transaction where status !='deleted'&& financialyear ='$accountyear' ");
     while($roww=mysqli_fetch_array($codsin))
     {
       $code = $row['count'];
       $codsin = $roww['count'];
         $codee = $code + $codsin;
         $year_code=substr($financialYearEnd,2);
         $codeco = $year_code."-". ($codee+1);
     }}
    ?>
    <span><b><?php echo "T".$codeco ?></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>Material:</b>
    <span><b><?php echo $proshow['productname'] ?></b></span></td><td colspan=2><span><b>Unit:<?php echo $_GET['quantity'] ?></b></span></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 $_GET['emptyweight'] ?></b></span></td>
  </tr>
  <tr>
    <td colspan=2><b>Load-weight</b>
    </td><td colspan=2><span><b><?php echo $_GET['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 $_GET['netweight'] ?></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>