<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
		  
		  $customer=$_POST['customer'];
		  $product=$_POST['product'];
		  $fromdate=$_POST['fromdate'];
		  $todate=$_POST['todate'];
		  
		  $sql_query="select sh.salescode,sh.ticket,sh.chakka,sh.vehicleno,sh.customer,sh.delivery,sh.productname,sh.price,sh.priceori,sh.date,sh.time,sh.emptyweight,sh.loadweight,sh.netweight,sh.netqty,sh.netqtyori,sh.cft,sh.totalamount from second_transaction as sh where sh.status=''";
		  
		  if($customer !=''  && $fromdate !='' && $todate !=''  && $product ==''  ) {
	 	$sql_query.=" and customer='".$customer."' and date BETWEEN '".$tripfromDate."' AND '".$triptoDate."' ORDER BY sh.date ASC ";

	 }
	 else if ($customer !=''  && $fromdate !='' && $todate !=''  && $product !=''  ) {
	 	$sql_query.=" and customer='".$customer."' and  product='".$product."' and date BETWEEN '".$tripfromDate."' AND '".$triptoDate."' ORDER BY sh.date ASC ";

	 }
	 
	 else if ($customer !=''  && $fromdate =='' && $todate ==''  && $product !=''  ) {
	 	$sql_query.=" and customer='".$customer."' and  product='".$product."'  ORDER BY sh.date ASC ";

	 }
	 
		  
		  ?>
          <div class="container col-sm-12">
          <table  class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%">
              <thead>
                 <th>Sno</th>
                 <th>Ticket</th>
                 <th>TripNo</th>
                 <th>Customer</th>
                 <th>Product</th>
                 <th>VehicleNo</th>
                 <th>Chakka</th>
                 <th>Delivery</th>
                 
                 
                 <th>Date</th>
                 <th>Time</th>
                 <th>EmptyWeight</th>
                 <th>LoadWeight</th>
                 <th>NetWeight</th>
                 <th>Capacity</th>
                 <th>NetQty</th>
                 <th>QtyAdjed</th>
                 <th>Price</th>
                 <th>Priceori</th>
                 <th>Totalamount</th>
                 <th>Mode</th>
                 <th>Adj</th>
                 <th>AdjKg</th>
                 <th>Mode</th>
                 <th>Remarks</th>
              
             </thead>
             <?php
			 			$query=mysqli_query($connect, $sql_query) or die("brandgriddata.php: get brand Data step 1".$sql_query);
			$sno=0;
			while($row_query=mysqli_fetch_array($query))
{
			 ?>
             <tbody >
<tr>
<td><?php echo ++$sno;?></td>
<td><?php echo $row_query['ticket'];?></td>
<td><?php echo $row_query['ticket'];?></td>
<td><?php echo $row_query['customer'];?></td>
<td><?php echo $row_query['productname'];?></td>
<td><?php echo $row_query['vehicleno'];?></td>
<td><?php echo $row_query['chakka'];?></td>
<td><?php echo $row_query['delivery'];?></td>
<td><?php echo $row_query['date'];?></td>
<td><?php echo $row_query['time'];?></td>
<td><?php echo $row_query['emptyweight'];?></td>
<td><?php echo $row_query['loadweight'];?></td>
<td><?php echo $row_query['netweight'];?></td>
<td><?php echo $row_query['cft'];?></td>
<td><?php echo $row_query['netqty'];?></td>
<td><?php echo $row_query['netqtyori'];?></td>
<td><?php echo $row_query['price'];?></td>
<td><?php echo $row_query['priceori'];?></td>
<td><?php echo $row_query['totalamount'];?></td>
<td><?php echo $row_query['modeof'];?></td>
<td><?php echo $row_query['remark'];?></td>
</tr>
             </tbody>
             <?php
			 }
			 ?>
           </table>
         
   
   
</div>
</body>
</html>
