<link rel="stylesheet" href="css5/jquery.treeview.css" />
<link rel="stylesheet" href="css5/screen.css" />
<script src="js5/jquery.js" type="text/javascript"></script>
	<script src="js5/jquery.cookie.js" type="text/javascript"></script>
	<script src="js5/jquery.treeview.js" type="text/javascript"></script>
	
	<script type="text/javascript" src="js5/demo.js"></script>
<?php $table='securityroles';
		$pcode= $rolepid;
		function CategoryShow($companyid, $PcateID, $dashVal)
		{
			global $db;
			$dashVal = $dashVal . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
			    $s=new db_query();
   		 

		  	$sqlCate = "select * from deptmaster_hierarchy  where  parentid  = '".$PcateID."' and companyid='".$companyid."'";
		 
			$rsCate  = DB_query($sqlCate,$db);	
 			if(DB_num_rows($rsCate)>0)
			{
				while($rowCate = DB_fetch_array($rsCate))
				{
  					 echo '<tr><td><b>'.$dashVal.'<img src="css/professional/images/user.png" border="0" align="absmiddle" style="cursor:pointer;">&nbsp;'.$rowCate['deptname'];
					  
					 echo  '</b>'.$dashVal.'
				 
 				 
					 
					 
					 </td></tr>'; 
					  CategoryShow($companyid,$rowCate['id'], $dashVal);
				}
			}
		} 
		
	 
		
		$dashVal = "&nbsp;&nbsp;&nbsp;";		
		?>
 


<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=Setup/NDepartmentHierarchy&Application=<?php echo $_REQUEST['Application']?>&modid=<?php echo $_REQUEST['modid']?>">Add/Edit   </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"> 
		
 		<?php 
		 "select * from companies where CompanyId='".$_SESSION['ACGCompanyId']."'";
		  $query=DB_query("select * from companies where CompanyId='".$_SESSION['ACGCompanyId']."'",$db);
		  while($row=DB_fetch_array($query))
		  {
 		    echo "<font face='Arial, Helvetica, sans-serif' size='+1'>".$row['CompanyName'].'</font><br>' ;
			$dashVal = "&nbsp;&nbsp;&nbsp;";
			?>
			<table width="100%" border="0" cellspacing="3" cellpadding="3">
 			<?php 
			
			 
			
			// echo "select * from deptmaster_hierarchy where parentid=0 and companyid='".$row['CompanyId']."'";
			 $query_comprole=DB_query("select * from deptmaster_hierarchy where parentid=0 and companyid='".$row['CompanyId']."'",$db);
 			  while($row_comprole=DB_fetch_array($query_comprole))
			  {
			  	 echo '<tr><td><img src="css/professional/images/menu_root.gif" border="0" align="absmiddle" style="cursor:pointer;"><b><font face="Arial, Helvetica, sans-serif">'.$row_comprole['deptname'].'</font> &nbsp;&nbsp;';
				// echo $s->GetFieldValue('www_users',"rolepid='".$row_comprole['secroleid']."'",'realname');
				 echo '  </b></td></tr>';
  			  	  CategoryShow($row['CompanyId'], $row_comprole['id'], $dashVal);
				  
 			  }	
 		 ?>
		 </table>
		<?php echo "<br>";} ?>
		 	 </td>
		</tr>
		</table>
</form>
</td>
</tr>
</table>
 </td>
</table>
