
<?php
	ob_start();




$veh_num='';
$sdate_12 ='';
$page='1';
include("include/config.php");
require_once "include/Database_functions.php";
$sqlObj=new sqlclass();
	$ids = $_REQUEST['val'];
	$_REQUEST['chk'];
	/*$ids =  $_REQUEST['val'];
 	$sq_arr=mysql_query("select * from cf_vehicle where id = '".$ids."' ");
	$row = mysql_fetch_array($sq_arr);
	*/
	
 ?>
<div class="viewEmployeeWrap" >
    <div class="viewEmployee">
  
    <h6 class="h6">Tripsheet Details <?=$_REQUEST['chk']?></h6>
     
      <table  border="0" cellspacing="0" cellpadding="0" class="tableList"  style="margin-left:20px;width:500px; ">
  <tr class="heading">
    <td>No</td>    
    <?php 
    if($_REQUEST['chk'] == 'box')
	{?>
    <td>Brand</td>
    <td>Liter</td>  
    <td>Kg (Liter)</td>    
    <td>Box Quantity</td> 
    <?php } ?>
    
    <?php 
    if($_REQUEST['chk'] == 'tin')
	{?>
    <td>No of Tins</td>
    <?php } ?>
    
    <?php 
    if($_REQUEST['chk'] == 'kg')
	{?>
    <td>Quantity</td>
    <?php } ?>
    <td>Rate</td>
    <?php 
    if($_REQUEST['chk'] != 'kg')
	{?>
    <td>Damage Return</td>
    <td>Total</td>
    <?php } ?>
     <?php 
    if($_REQUEST['chk'] == 'box')
	{?>
	
    
    <?php } ?>
    <td>Date</td>
  </tr>
  
<?php
$master = '';
$notification = '';
$trip = '';
$accounting = '';
$accpay = '';
$report = '';

$i=1;
if($_REQUEST['chk'] == 'box')
{
	$sq_arr="select *,(select kgqty from cf_liter_qty where cf_liter_qty.literids = `cf_sales_sub`.`liter_id` and cf_liter_qty.brandid =  `cf_sales_sub`.`branch_id`) as kgqty ,(select liter_qty from cf_liter where cf_liter.liter_id = `cf_sales_sub`.`liter_id`) as litreqty from 	cf_sales_sub join cf_brand on cf_sales_sub.branch_id = cf_brand.brand_id  where cf_sales_sub.sale_id = '$ids' ";
}
if($_REQUEST['chk'] == 'tin' || $_REQUEST['chk'] == 'kg')
{
	$sq_arr="select * from 	cf_sales_sub  where cf_sales_sub.sale_id = '$ids' ";
}

$sq_arr.=" order by cf_sales_sub.sale_sub_id desc ";
$query=$sq_arr;
//echo $query;
$function="Searchdate";
include("pagingserch.php");
$sq_arr.=" LIMIT $start, $limit";

if(isset($_REQUEST['page'])){
$page=$_REQUEST['page'];
}else{
$page=1;
}

$array=mysql_query($sq_arr);
if($array && mysql_num_rows($array)>0){
$pagecnt=$start;
while($res=mysql_fetch_array($array))
{
$pagecnt++;
  ?> 
  <tr>
    <td><?php echo $pagecnt;?></td>
    <?php 
    if($_REQUEST['chk'] == 'box')
	{
	?>
    <td><?php echo $res['brand_name'];?></td>
    <td><?php echo $res['litreqty'];?></td> 
    <td><?php echo $res['kgqty'];?></td> 
    <td><?php echo $res['sale_box'];?></td>
    <td><?php echo $res['sale_rate'];?></td>
    
    <?php } ?>
    
    <?php 
    if($_REQUEST['chk'] == 'tin' || $_REQUEST['chk'] == 'kg')
	{
	?>
    <td><?php echo $res['sale_no_tin_kg'];?></td> 
    <td><?php echo $res['sale_rate'];?></td> 
     
    
    <?php } ?>
    
    <?php 
    if($_REQUEST['chk'] != 'kg')
	{?>
    	<td><?php echo $res['sale_damage_qty'];?></td>
    <?php } ?>
    
    <?php 
    if($_REQUEST['chk'] == 'box' || $_REQUEST['chk'] == 'tin')
	{
	?>
    <td><?php echo $res['sale_line_tot'];?></td>
    <?php } ?>
    <td><?php echo date(('d-m-Y'),strtotime($res['sale_date']));?></td>     
        
    
  </tr>
  <?php 
    }}else{?>
	 <tr>
    <td class="errorMessage"  style="border-right:0px;border-bottom:0px; "><font color="#FF0000">No Records Found</font></td></tr>
	<? }
  ?>
</table>
     
    
    
    
    <?php /*?> <div><p style="float:right;"><a href="vechicle-details-entry.php?id=<?php echo $row['id']; ?>" style="background-color:#0099FF; text-align:center; padding:3px 10px; color:#FFFFFF; border-radius:3px;">Edit</a></p></div><?php */?>
    
     
    </div>
     
     </div>