<SCRIPT language="javascript">
function getXMLHTTP()
	 { //fuction to return the xml http object
	var xmlhttp=false;	
		try
		{
		xmlhttp=new XMLHttpRequest();
		}
		catch(e)	
		{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
				}
			catch(e)
			{
				try
				{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1)
				{
				xmlhttp=false;
				}
			}
		}
	return xmlhttp;
	}   
	
$(function(){
 
    // add multiple select / deselect functionality
    $("#selectall").click(function () {
          $('.case').attr('checked', this.checked);
    });
 
    // if all checkbox are selected, check the selectall checkbox
    // and viceversa
    $(".case").click(function(){
 
        if($(".case").length == $(".case:checked").length) {
            $("#selectall").attr("checked", "checked");
        } else {
            $("#selectall").removeAttr("checked");
        }
 
    });
});
</SCRIPT>
<?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 Invoice No</td>
  	<td>Date</td>
    <td>Amount</td>
    <td>Status</td>
    <td>Bill</td>
  </tr>
  
  <?php

$routeid ='';
$tripdate ='';
$fromdate='';
$todate='';

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

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

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

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

$i=1;
$sq_arr="select * from cf_receipt where client_type = 'invoice' ";
/*if($routeid!=''){
$sq_arr.=" and trip_route_id = '".$routeid."' ";
}

if($tripdate!=''){
$sq_arr.=" and 	trip_date = '".$tripdate."' ";
}

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

/*if($sdate_12!=''){
$sq_arr.=" and date='".$sdate."' ";
}*/
$sq_arr.=" order by rec_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=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['receipt_id'];?></td>
    <td><?php echo $res['acc_date'];?></td>
  	<td><?php echo $res['acc_amt'];?></td>
    <td>
	<?php 
		if($res['bill_status'] == 1)
		{
			echo "Finished";
		}
		else
		{
			echo "Pending";
		}
	?>
    </td>
    <td><a href="client_invoice_voucher.php?trip_id=<?php echo $res['trip_id']; ?>" style="color:#009999" >bill</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>