<?php session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />


<link href="admin_min.css" rel="stylesheet" type="text/css" media="screen" />



<title>Search Customer</title>
<link rel="stylesheet" href="css/table_min.css" type="text/css"/>	
<script language="JavaScript" src="js/search_cheq.js"></script>
<style type="text/css">

	/* START CSS NEEDED ONLY IN DEMO */
	html{
		height:100%;
	}
	
	
	#mainContainer{
		width:700px;
		margin:0 auto;
		text-align:left;
		height:100%;
		background-color:#FFF;
		border-left:3px double #000;
		border-right:3px double #000;
	}
	#formContent{
		padding:5px;
	}
	/* END CSS ONLY NEEDED IN DEMO */
	
	
	/* Big box with list of options */
	#ajax_listOfOptions{
		position:absolute;	/* Never change this one */
		width:175px;	/* Width of box */
		height:250px;	/* Height of box */
		overflow:auto;	/* Scrolling features */
		border:1px solid #317082;	/* Dark green border */
		background-color:#FFF;	/* White background color */
		text-align:left;
		font-size:0.9em;
		z-index:100;
	}
	#ajax_listOfOptions div{	/* General rule for both .optionDiv and .optionDivSelected */
		margin:1px;		
		padding:1px;
		cursor:pointer;
		font-size:0.9em;
	}
	#ajax_listOfOptions .optionDiv{	/* Div for each item in list */
		
	}
	#ajax_listOfOptions .optionDivSelected{ /* Selected item in the list */
		background-color:#317082;
		color:#FFF;
	}
	#ajax_listOfOptions_iframe{
		background-color:#F00;
		position:absolute;
		z-index:5;
	}
	
	form{
		display:inline;
	}

	#article {font: 12pt Verdana, geneva, arial, sans-serif;  background: white; color: black; padding: 10pt 15pt 0 5pt}
    </style>
	

</head>

<body>

 <table width="1444" border="0">
 
<tr>
  <td  background="images/headingbg.gif" ><input type="radio" name="radio" id="Option1" value="Option1" checked="checked" onclick="select_list('all');" />Save</td>
  <td  background="images/headingbg.gif" ><input type="radio" name="radio" id="Option2" value="Option2"  onclick="select_list('all');" />Not Approved</td>
  <td  background="images/headingbg.gif" ><input type="radio" name="radio" id="Option3" value="Option3" onclick="select_list('all');" />Not Posted</td>
  <td  background="images/headingbg.gif" ><input type="radio" name="radio" id="Option4" value="Option4"  onclick="select_list('all');" />Complete</td>
</tr>
<tr>					
						<?php 
	  				$stname = $_GET["stname"];
					?>
                             <td width="283"  background="images/headingbg.gif" ><input type="text" size="20" name="invno" id="invno" value="" class="txtbox"  onkeyup="<?php echo "update_list('$stname')"; ?>"/></td>
                             <td width="170"  background="images/headingbg.gif" >&nbsp;</td>
    <td width="264"  background="images/headingbg.gif" ><input type="hidden" size="10" name="customername" id="customername" value="" class="txtbox" onkeyup="<?php echo "update_list('$stname')"; ?>"/></td>
    <td width="709"  background="images/headingbg.gif" ><input type="hidden" size="29" name="invdate" id="invdate" value="" class="txtbox" onkeyup="<?php echo "update_list('$stname')"; ?>"/></td>
   </tr>  </table>    
<div class="CSSTableGenerator" id="filt_table">  <table width="735" border="0" class=\"form-matrix-table\">
                          <?php
						  	if ($_GET["stname"]=="extend"){
                            	echo "<tr>
                              <td width=\"121\"  background=\"images/headingbg.gif\" ><font color=\"#FFFFFF\">Cheque No</font></td>
                              <td width=\"176\"  background=\"images/headingbg.gif\"><font color=\"#FFFFFF\">Cheque Date</font></td>
                              <td width=\"176\"  background=\"images/headingbg.gif\"><font color=\"#FFFFFF\">Cheque Amount</font></td>
                              <td width=\"176\"  background=\"images/headingbg.gif\"><font color=\"#FFFFFF\">Bank</font></td>
							  <td width=\"176\"  background=\"images/headingbg.gif\"><font color=\"#FFFFFF\">Customer</font></td>
</tr>";
							} else {
									echo "<tr>
                              <td width=\"121\"  background=\"images/headingbg.gif\" ><font color=\"#FFFFFF\">Cheque No</font></td>
                              <td width=\"176\"  background=\"images/headingbg.gif\"><font color=\"#FFFFFF\">Cheque Date</font></td>
                              <td width=\"176\"  background=\"images/headingbg.gif\"><font color=\"#FFFFFF\">Cheque Amount</font></td>
                              <td width=\"176\"  background=\"images/headingbg.gif\"><font color=\"#FFFFFF\">Bank</font></td>
							  <td width=\"176\"  background=\"images/headingbg.gif\"><font color=\"#FFFFFF\">Customer</font></td>
							  
</tr>";
							}
                            
							
							require_once("config.inc.php");
							require_once("DBConnector.php");
							$db = new DBConnector();
							
							if ($_SESSION["txt_cuscode"]!=""){
								$sql="select * from s_invcheq where cus_code='".$_SESSION["txt_cuscode"]."'  ORDER BY che_date desc limit 50";
							} else {
								$sql="select * from s_invcheq  ORDER BY che_date desc limit 50";
							}	
							//echo $sql;
							$result =$db->RunQuery($sql);
							while($row = mysql_fetch_array($result)){
								
								if ($_GET["stname"]=="extend"){
							echo "<tr>               
                              <td onclick=\"chq_extn('".$row['cheque_no']."', '".$row['che_date']."', '".$row['che_amount']."', '".$_GET['stname']."', '".$row['cus_code']."');\">".$row['cheque_no']."</a></td>
                              <td onclick=\"chq_extn('".$row['cheque_no']."', '".$row['che_date']."', '".$row['che_amount']."', '".$_GET['stname']."', '".$row['cus_code']."');\">".$row['che_date']."</a></td>
                              <td onclick=\"chq_extn('".$row['cheque_no']."', '".$row['che_date']."', '".$row['che_amount']."', '".$_GET['stname']."', '".$row['cus_code']."');\">".$row['che_amount']."</a></td>
							  <td onclick=\"chq_extn('".$row['cheque_no']."', '".$row['che_date']."', '".$row['che_amount']."', '".$_GET['stname']."', '".$row['cus_code']."');\">".$row['bank']."</a></td>
							   <td onclick=\"chq_extn('".$row['cheque_no']."', '".$row['che_date']."', '".$row['che_amount']."', '".$_GET['stname']."', '".$row['cus_code']."');\">".$row['CUS_NAME']."</a></td>
                            </tr>";
								} if ($_GET["stname"]=="modify"){
											echo "<tr>               
                              <td onclick=\"chq_mod('".$row['cheque_no']."', '".$row['che_date']."', '".$row['che_amount']."', '".$_GET['stname']."', '".$row['cus_code']."');\">".$row['cheque_no']."</a></td>
                              <td onclick=\"chq_mod('".$row['cheque_no']."', '".$row['che_date']."', '".$row['che_amount']."', '".$_GET['stname']."', '".$row['cus_code']."');\">".$row['che_date']."</a></td>
                              <td onclick=\"chq_mod('".$row['cheque_no']."', '".$row['che_date']."', '".$row['che_amount']."', '".$_GET['stname']."', '".$row['cus_code']."');\">".$row['che_amount']."</a></td>
							  <td onclick=\"chq_mod('".$row['cheque_no']."', '".$row['che_date']."', '".$row['che_amount']."', '".$_GET['stname']."', '".$row['cus_code']."');\">".$row['bank']."</a></td>
							  <td onclick=\"chq_mod('".$row['cheque_no']."', '".$row['che_date']."', '".$row['che_amount']."', '".$_GET['stname']."', '".$row['cus_code']."');\">".$row['CUS_NAME']."</a></td>
                            </tr>";	
								} else {
									echo "<tr>               
                              <td onclick=\"ret_chq('".$row['cheque_no']."', '".$row['che_date']."', '".$row['che_amount']."', '".$_GET['stname']."');\">".$row['cheque_no']."</a></td>
                              <td onclick=\"ret_chq('".$row['cheque_no']."', '".$row['che_date']."', '".$row['che_amount']."', '".$_GET['stname']."');\">".$row['che_date']."</a></td>
                              <td onclick=\"ret_chq('".$row['cheque_no']."', '".$row['che_date']."', '".$row['che_amount']."', '".$_GET['stname']."');\">".$row['che_amount']."</a></td>
							  <td onclick=\"ret_chq('".$row['cheque_no']."', '".$row['che_date']."', '".$row['che_amount']."', '".$_GET['stname']."');\">".$row['bank']."</a></td>
                            </tr>";
								}
							}
							  ?>
                    </table>
                </div>

</body>
</html>
