<?php 	function CategoryUsers_Show($pcode, $PcateID, $dashVal)
	{
	    global $db;
		$dashVal = $dashVal . "-";
		$s=new db_query();

	     $sqlCate = "select * from www_users  where  parentid = '".$PcateID."' and  companyid='".$_SESSION['ACGCompanyId']."'";
	 
 		$rsCate  = DB_query($sqlCate,$db);	
		 
 		if(DB_num_rows($rsCate)>0)
		{
			while($rowCate = DB_fetch_array($rsCate))
			{
			 	 
				$px='';
				 if($rowCate['id']==$pcode)
				 $px="selected";
 		?>
 				<option value="<?php echo $rowCate['id'];?>" <?php echo $px ?>><?php echo $dashVal;?>
				 <?php echo  $rowCate['realname'] . " " ;
			     //echo $s->GetFieldValue('deptmaster_hierarchy'," id='".$rowCate['department'] ."' and CompanyId='".$rowCate['companyid']."'" ,'deptname')." )";?> </option>
	   <?php			
				   CategoryUsers_Show($pcode,$rowCate['id'], $dashVal);
			}
		}
	}   ?>
	
	
	
	
<?php 	function CategoryUsers_Permission($pcode, $PcateID, $dashVal,$d,$desig)
	{
	    global $db;
		$dashVal = $dashVal . "-";
		$s=new db_query();

	       $sqlCate = "select * from www_users  where  parentid = '".$PcateID."' and  companyid='".$_SESSION['ACGCompanyId']."' and  department ='".$d."' and designation='".$desig."'";
	 
 		$rsCate  = DB_query($sqlCate,$db);	
		 
 		if(DB_num_rows($rsCate)>0)
		{
			while($rowCate = DB_fetch_array($rsCate))
			{
 				$px='';
				 if($rowCate['id']==$pcode)
				 $px="selected";
 		?>
 				<option value="<?php echo $rowCate['id'];?>" <?php echo $px ?>><?php echo $dashVal;?>
				 <?php echo  $rowCate['realname'] . " " ;	 ?> </option>
	   <?php			
				   CategoryUsers_Permission($pcode,$rowCate['id'], $dashVal,$d,$desig);
			}
		}
	}   ?>	