<?php

$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>Client Name</td>    
    <td>Code No</td>
    <td>Address</td>
    <td>Phone No</td>
    <td>Contact Person</td> 
    <td>Tin No</td> 
    <td>Edit</td>
    <td>Delete</td>
  </tr>
  
<?php

$client_name ='';
$con_person ='';
$client_code='';
$fromdate='';
$todate='';

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

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

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

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

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

$i=1;
$sq_arr="select * from cf_client where client_type = 1 ";
if($client_name!=''){
$sq_arr.=" and client_name like '%".$client_name."%' ";
}

if($client_code!=''){
$sq_arr.=" and client_newcode like '%".$client_code."%' ";
}

if($con_person!=''){
$sq_arr.=" and 	client_conper like '%".$con_person."%' ";
}

if($fromdate!="" && $todate!=""){
$sq_arr.=" and client_date between '$fromdate' and '$todate'";
}

/*if($sdate_12!=''){
$sq_arr.=" and date='".$sdate."' ";
}*/
$sq_arr.=" order by client_name asc ";
$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['client_name'];?></td>
    <td><?php echo $res['client_code'];?></td>
    <td><?php if($res['client_address']!='')echo $res['client_address'];else echo '--'; ?></td>
    <td><?php if($res['client_phno']!='')echo $res['client_phno'];else echo '--'; ?></td>
    <td><?php if($res['client_conper']!='')echo $res['client_conper'];else echo '--'; ?></td>
    <td><?php if($res['client_csttinno']!='')echo $res['client_csttinno'];else echo '--'; ?></td>
   
   <td class="tr_td_b"><a href="add-client.php?clientid=<?php echo $res['client_id'] ?>"><img src="images/edit.png" title="edit"></a></td>
   
   <td class="tr_td_r" ><a href="client-list.php?del=delete&id=<?php echo $res['client_id']; ?>" 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>