<?php $table='securityroles';
		$pcode= $rolepid;
		function CategoryShow($companyid, $PcateID, $dashVal)
		{
			global $db;
			$dashVal = $dashVal."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
			  
			$sqlCate = "select * from securityroles  where  rolepid  = '".$PcateID."' and companyid='".$companyid."'";
			$rsCate  = DB_query($sqlCate,$db);	
 			if(DB_num_rows($rsCate)>0)
			{
				while($rowCate = DB_fetch_array($rsCate))
				{
  					 echo '<tr bgcolor="#FFFFFF"><td style="font-family:Verdana, Arial, Helvetica, sans-serif">'.$dashVal .'<img src="images/rollicon.jpeg" height="20px" width="20px">'.$rowCate['role_name'].'</td></tr>'; 
					   CategoryShow( $companyid,$rowCate['secroleid'], $dashVal);
				}
			}
		} 
		
		$dashVal = "&nbsp;&nbsp;&nbsp;";
		?>
 

<link rel="stylesheet" href="css/new_mxerp.css">

<link href="css/pagnation.css" rel="stylesheet" type="text/css">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>

<table width="70%" border="0" cellspacing="0" cellpadding="0" align="left">
   <tr>
    <td colspan="2"><h2>Role   <strong>Hierarchy&nbsp;</strong> </h2></td>
	<td>
	<div align="right"><a href="index.php?route=DealerDistrbutions/Setup/RoleMaster&modid=<?php echo $_REQUEST['modid']?>&frmid=<?php echo $_REQUEST['frmid']?>"><input type="button" name="Add" value="Add/Edit Role" class="search" /> </a></div>
	</td>
   </tr>
   
 
<tr><td colspan="3" >
<form action="" method="post" >
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
 		<tr>
		<td colspan="2"> 
		<table width="100%" border="0" cellspacing="3" cellpadding="3" style="border:#999999 solid 2px;">
 		<?php 
		  $query=DB_query("select * from companies  where CompanyId='".$_SESSION['ACGCompanyId']."' ",$db);
		  while($row=DB_fetch_array($query))
		  {
 		    echo "<tr bgcolor='#999999'><td><strong><font size='3px'>".$row['CompanyName'].'</font></strong></td></tr>' ;
			$dashVal = "&nbsp;&nbsp;&nbsp;";
			?>
			
 			<?php 
			 $query_comprole=DB_query("select * from securityroles where rolepid=0 and   companyid  ='".$row['CompanyId']."'",$db);
 			  while($row_comprole=DB_fetch_array($query_comprole))
			  {
			  	 echo '<tr bgcolor="#FFFFFF"><td style="font-family:Verdana, Arial, Helvetica, sans-serif"><img src="images/rollicon.jpeg" height="20px" width="20px">'.$row_comprole['role_name'].'</td></tr>' ;;
  			  	  CategoryShow($row['CompanyId'], $row_comprole['secroleid'], $dashVal);
				  
 			  }	
			    
 		 ?>
		  
		

		 
		 
		<?php } ?>
		
		 </table>
		 	 </td>
		</tr>
		 
		</table>
</form>


</td>
</tr>
 

</table>
 </td>
   </tr>
  
</table>
