<?
ob_start();
session_start();
if(isset($_SESSION['ses_name']))
{
$user=$_SESSION['ses_name'];
}else{
header("location:index.php");
}


$veh_num='';
$sdate_12 ='';
$page='1';
include("include/config.php");
require_once "include/Database_functions.php";
$sqlObj=new sqlclass();
$msg = '';

if(isset($_REQUEST['del']) && $_REQUEST['del']=='delete')
{
	$id = $_REQUEST['id'];
	$sql=mysql_query("delete from cf_bank where bank_id='$id'");
	header("location:bank-list.php?msg=You Have Successfully Deleted");
}

?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>OIL FILL</title>
<link href="css/styles.css" rel="stylesheet"  />
<link href="css/menu.css" rel="stylesheet" type="text/css" />
<link type="text/css" href="css_date/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
<script type='text/javascript' src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="js/trippopup.js" type="text/javascript"></script>


<script type='text/javascript' src="js/jquery.autocomplete.js"></script>
<link rel="stylesheet" type="text/css" href="js/jquery.autocomplete.css" />

<script type="text/javascript" src="scripts_date/jquery-calendar-1.7.2.js"></script>
<script language="javascript">

$(document).ready(function(){
$('#fromdate').datepicker({
showOn: 'both',
buttonImage: 'icons_date/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: 'yy-mm-dd'
});
});

$(document).ready(function(){
$('#todate').datepicker({
showOn: 'both',
buttonImage: 'icons_date/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: 'yy-mm-dd'
});
});
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 Searchdate(val)
{ 
 	
	 var page=val;	
	 var client_name='';
	 var con_person='';
	 var client_code='';
	 var fromdate='';
	 var todate='';
	 	
	 if(document.client_frm.client_name){
	 client_name= document.client_frm.client_name.value;
	 }
	 
	 if(document.client_frm.client_code){
	 client_code= document.client_frm.client_code.value;
	 }
	 
	 if(document.client_frm.con_person){
	 con_person= document.client_frm.con_person.value;
	 }
	 
	 if(document.client_frm.fromdate){
	 fromdate= document.client_frm.fromdate.value;
	 }
	 
	 if(document.client_frm.todate){
	 todate= document.client_frm.todate.value;
	 }
	
	var strURL="ajax/client_data.php?&page="+page;
	if(client_name!=''){
	strURL+="&client_name="+client_name;
	}
	
	if(client_code!=''){
	strURL+="&client_code="+client_code;
	}
	
	if(con_person!=''){
	strURL+="&con_person="+con_person;
	}	
	
	if(fromdate!=''){
	strURL+="&fromdate="+fromdate;
	}	
	
	if(todate!=''){
	strURL+="&todate="+todate;
	}	
	
	//alert(strURL);
	var req = getXMLHTTP();
   if (req)
   {
     req.onreadystatechange = function()
     {
		 
			if ((req.readyState == 0)||(req.readyState == 1)||(req.readyState == 2)||(req.readyState == 3))
      		{
			//document.getElementById('order').innerHTML='<div align="center"><img src="'+path+'images/ajax_loader.gif"/></div>';
			//document.getElementById('Cakeorder').innerHTML='<div align="center"><img src="'+path+'images/ajax_loader.gif"/></div>';
			}
		 
		 
      if (req.readyState == 4)
      {
	 // only if "OK"
	 	if (req.status == 200)
	 	{ 
	   document.getElementById('list').innerHTML=req.responseText;
	//	document.getElementById('Cakeorder').innerHTML=req.responseText;
	 	}
	  else 
	 	{
   	   alert("There was a problem while using XMLHTTP:\n" + req.statusText);

	 }
     }
     }
   req.open("GET", strURL, true);
   req.send(null);
   }
 
   
}
</script>
</head>

<body>
<!------------------popup area (view, edit)--------------->



<!---------------popup area ends------------------>
<div class="wrapper">
  <div>
<?php 
	include("header.php");
?>
 
</div>
 
 <div class="tabbedArea">
   
  <div class="tabBody">
   <h1>Bank List</h1>
   <form name="client_frm" id="client_frm" method="post"  >
   <div class="searchBox" style="width:93%; margin-right:0px;  padding:0px; ">
   <div style="padding:20px;">
    <div class="searchField">
     <p class="input1">Client Name</p>
     <input type="text" name="client_name" id="client_name" class="input1" />
    </div>
    
    <?php 
    if(($_SESSION['typename'] == 'SuperAdmin')) {
	?>
    <div class="searchField">
     <p class="input1">Code No</p>
     <input type="text" name="client_code" id="client_code" class="input1" />
    </div>
    <?php } ?>
    
    <!--<div class="searchField">
     <p class="input1">Concerned Person</p>
     <input type="text" name="con_person" id="con_person" class="input1" />
    </div>
    
    <div class="searchField" style="padding-left:20px;">
     <p class="input1">From Date</p>
     <input type="text" name="fromdate" id="fromdate" class="input1" />
    </div>
    
    <div class="searchField" style="padding-left:20px;">
     <p class="input1">To Date</p>
     <input type="text" name="todate" id="todate" class="input1" />
    </div>-->
       
    <div class="searchField">
     <input name="button" type="button" class="input1" onClick="Searchdate(1);" value="search" />
    </div>
  
   </div>
   </div>
   </form>
   <div id="list">
   <table  border="0" cellspacing="0" cellpadding="0" class="tableList">
  <tr class="heading">
    <td>No</td>    
    <td>Bank Name</td> 
	<td>Open Balance</td>   
    <td>Branch</td>	
	<td>Acc No</td>
    <td>Address</td>
	<td>Phone No</td>
    <td>IFSC</td>
    <td>Edit</td>
    <td>Delete</td>
  </tr>
  
  <?php



$i=1;

$sq_arr="select * from cf_bank where 1 ";

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

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


$sq_arr.=" order by bank_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['bankname'];?></td>
	<td><?php echo $res['bank_open'];?></td>
    <td><?php echo $res['bank_branch'];?></td>
    <td><?php if($res['bank_acno']!='')echo $res['bank_acno'];else echo '--'; ?></td>
    <td><?php if($res['bank_address']!='')echo $res['bank_address'];else echo '--'; ?></td>
    <td><?php if($res['bank_phoneno']!='')echo $res['bank_phoneno'];else echo '--'; ?></td>
    <td><?php if($res['bank_ifsc']!='')echo $res['bank_ifsc'];else echo '--'; ?></td>
   
   <td class="tr_td_b"><a href="add-bank.php?bankid=<?php echo $res['bank_id'] ?>"><img src="images/edit.png" title="edit"></a></td>
   
   <td class="tr_td_r" ><a href="bank-list.php?del=delete&id=<?php echo $res['bank_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> 
  </div>
  </div>
 </div>
 <div class="footer"><p>Powered by <a href="http://www.aadhocc.co.uk/" target="_blank">Aadhocc</a></p></div>
 
</div>
<div class="quicLInksCover">
 <?php 
	include("leftlink.php");
?>

</div>
</body>
</html>
