<?php
include("../include/session.php");
if( !$session->isAdmin() && !$session->isRadstoneReceptionUser() && !$session->isRadstoneStoreUser() ){
	//header("Location: ../Store/storeMenu.php");?>
<script language="javascript" type="text/javascript">
        <!--
		  window.location="denied.php";
        -->
       </script>
<?php 
}else{
	include("../storeHeader.php");
	    
	
	$query =  "SELECT * FROM customer WHERE active=1 ORDER BY CompanyName";
	$result = mySQL_query($query) or die ("Error in query:   $Query . * ". mySQL_error());
	$i = 0;
	$num = mysql_num_rows($result);
	
?>
<script type="text/javascript" src="../css/tablesort.js"></script>
<link href="../css/main.css" rel="stylesheet" type="text/css" />


<script type="text/javascript">
<!--
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
<div class="headerbox2">Customer list</div>
<p class="main">Active customer as per : <b><?php echo date("d-m-Y");?></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        Number in list: <b><?php echo $num;?></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  <input name="button3" type="button" class="linkbutton" id="button3" onclick="MM_goToURL('parent','customerWiz0.php');return document.MM_returnValue"  value="New Account" />
</p>
<table id="tableList" class="sortable-onload-1 rowstyle-alt no-arrow "  >
  <thead>
    <tr>
      <th width="49" class="sortable-text">Acc No</th>
      <th width="162" class="sortable-text">(Company) Name </th>
      <th width="140" class="sortable-text">Contact</th>
      <th width="139" class="sortable-text">Phone - Cell</th>
      <th width="33" >Active</th>
    </tr>
  </thead>
  <tbody>
    <?php 
	while ($i < $num) {
	    $b0 = mysql_result($result, $i, "CustNo");
		$b1 = mysql_result($result, $i, "CompanyName");
	    $b2 = mysql_result($result, $i, "ContactName");
	    $b3 = mysql_result($result, $i, "Phone");
		$b4 = mysql_result($result, $i, "Cell");
		$b5 = mysql_result($result, $i, "AccNo");
		$b6 = mysql_result($result, $i, "PostalPlace");
		$b7 = mysql_result($result, $i, "active");
		
		
		
		
		
	?>
    <tr onclick="MM_goToURL('parent','displayCustomer.php?CustNo=<?php echo $b0 ?>');return document.MM_returnValue"   onmouseover="this.style.cursor='pointer'"  >
      <td><?php  echo $b5 ?></td>
      <td><?php echo $b1?></td>
      <td><?php echo $b2?></td>
      <td><?php echo $b3 . "<br>" . $b4 ?></td>
      <td><?php if($b7==1) { echo "yes"; } else { echo "no"; } ?></td>
    </tr>
    <?php 
	$i++;
	}
	?>
  </tbody>
</table>
<?php
	}
	include("../footer.php");

?>
