<?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");
			
	
	   
	
	$listQuery =  "SELECT * FROM nam_rad_representatives  ORDER BY last_name ";
	$listResult = mySQL_query($listQuery) or die ("Error in query:   $listQuery . * ". mySQL_error());
	$n = 0;
	$listNum = mysql_num_rows($listResult);
	
	 
?>
<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">Representatives list </div>
<br />
<p class="main">Representatives as per : <b><?php echo date("d-m-Y");?></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        Number in list:<b><b><?php echo $listNum;?></b></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  <input name="button3" type="button" class="linkbutton" id="button3" onclick="MM_goToURL('parent','repWiz0.php');return document.MM_returnValue" value="New Rep" />
</p>

	

<table id="tableList" class="sortable-onload-1 rowstyle-alt no-arrow "  >
<thead>
		<tr>
		    <th width="142" class="sortable-text">Name</th>
			<th width="148" class="sortable-text">Designation </th>
			<th width="117" class="sortable-text">Cell</th>
			<th width="173" class="sortable-text">Company</th>
		</tr>
	</thead>
	<tbody>
	<?php 
	while ($n < $listNum) {
	    $b0 = mysql_result($listResult, $n, "last_name");
		$b1 = mysql_result($listResult, $n, "first_name");
	    $b2 = mysql_result($listResult, $n, "designation");
		$b3 = mysql_result($listResult, $n, "cell");
		$b4 = mysql_result($listResult, $n, "account");
		$b5 = mysql_result($listResult, $n, "repId");
	?>
	
		<tr onmouseover="this.style.cursor='pointer'" onclick="MM_goToURL('parent','displayRep.php?repId=<?php echo $b5 ?>');return document.MM_returnValue" >
		  <td><?php echo $b0.", ".$b1?></td>
		  <td> <?php echo $b2?>
		  </a></td>
		  <td><?php echo $b3?></td>
		  <td><?php echo $b4 ?></td>
	    </tr>
		
	<?php 
	$n++;
	}
	?>
	</tbody>
</table>

  
	  
	    End of list.<?php
	}
	include("../footer.php");

?>
      
