<?php
session_start();
$i=1;
include("../include/config.php");
require_once "../include/Database_functions.php";
?>

  <table  border="0" cellspacing="0" cellpadding="0" class="tableList">
  <tr class="heading">
    <td>No</td>    
    <td>Vehicle/Other</td>
    <td>Vehicle No</td>
    <td>Description</td>
    <td>Image</td>
    <td>Edit</td>
    <td>Delete</td>
  </tr>
  
<?php
$veh_no ='';
$con_person ='';
$client_code='';
$fromdate='';
$todate='';

if(isset($_REQUEST['veh_no'])){
$veh_no=$_REQUEST['veh_no'];
}



$i=1;
if(($_SESSION['typename'] == 'SuperAdmin')) {
	$sq_arr="select *,A.id as Aid from  tbl_upload_file A join cf_vehicle B on B.id = A.vehicle_id ";	
}

/*if(($_SESSION['typename'] == 'SubAdmin')) {	
	$userids = $_SESSION['admin_id'];
	
	$sq_user1 = mysql_query("select cf_client.client_sub_id from cf_user_clientid join cf_client on cf_user_clientid.client_code = cf_client.client_newcode where cf_user_clientid.user_id = '$userids' ");
	$rw1=mysql_fetch_array($sq_user1);
	$clientsubid = $rw1['client_sub_id'];
	$sq_arr="select * from cf_reseller where client_subid = $clientsubid "; 	
}*/

if($veh_no!=''){
$sq_arr.=" and A.vehicle_id = '".$veh_no."' ";
}


$sq_arr.=" order by Aid 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=10;
}

$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>
	<td><?php echo ($res['vehicle_others']=="0")?"Vehicle":"Others";?></td>
    <td><?php if($res['vehiclenum'])echo $res['vehiclenum'];else echo '--'; ?></td>
    <td><?php if($res['description']!='')echo $res['description'];else echo '--'; ?></td>
    <td><?php if($res['image']!='')echo "<img width='30' height='30' src='up/".$res['image']."'>";else echo '--'; ?></td>

	
   <td align="center" class="tr_td_b"><a href="edit_upload_file.php?edit_id=<?php echo $res['Aid']; ?>&ab=<?php echo $i;?>"><img src="images/edit.png" title="edit"></a></td>
   <td align="center" class="tr_td_r" ><a href="add_upload_file.php?delete_id=<?php echo $res['Aid']; ?>" onClick="return confirm('Do you really want to delete this field?');"><img src="images/delete.png" title="delete"></a></td>
    
   
  </tr>
  <?php 
    }}
  ?>
 
  <!--<tr>
    <td><input type="checkbox">2</td>
    <td>2323d</td>
    <td>jinesh</td>
    <td>jose</td>
    <td>9443274636</td>
    <td>email@gmail.com</td>
    <td>design</td>
    <td>designer</td>
    <td>23/4/11</td>
    <td><div class="deletedStat"></div></td>
    <td><a href="#">
      <div class="actEdit"></div><div class="actDelete"></div>
    </a></td>
  </tr>-->

   
</table>
  
   <div align="right" style="padding-top:10px;"><?=$pagination?></div>