<?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))
			{
			 	//$sqlCateSel = "select * from www_users where id  ='".$rowCate['id']."' and  companyid='".$_SESSION['ACGCompanyId']."' ";
				//$rsCateSel	= DB_query($sqlCateSel,$db);
				$px1='';
				$empid= $s->GetFieldValue('empmaster'," mst_www_userid='". $rowCate['id']."' " ,'id')  ;
				 if($empid==$pcode)
				 $px1="selected";
				 	
 		?>
 				<option value="<?php echo $empid;?>" <?php echo $px1 ?>><?php echo $dashVal;?>
				 <?php echo strtoupper( $rowCate['realname'] ) ;
			     ?> </option>
	   <?php			
				   CategoryUsers_Show($pcode,$rowCate['id'], $dashVal);
			}
		}
	}    
	
	
	  $pcode=$_REQUEST['employee_code'];
	
	?>
	
	
	<select name="employee_code" id="employee_code" style="width:107px;">	  
  
  <?php 
	$dashVal = "---";
	$sqlCate = "select * from  www_users  where department='".$_SESSION['ACGCompany_UserDept']."' and id='".$_SESSION['UserID']."' ";
	$rsCate  = DB_query($sqlCate,$db);
	if(DB_num_rows($rsCate)>0)
	{
		while($rowCate =DB_fetch_array($rsCate))
		{
 				//$sqlCateSel = "select * from www_users where id   =".$rowCate['parentid']." ";
			//	$rsCateSel	= DB_query($sqlCateSel,$db);
				$px='';
				$empid= $s->GetFieldValue('empmaster'," mst_www_userid='". $rowCate['id']."' " ,'id')  ;
				 if($empid== $_REQUEST['employee_code']  )
				 $px="selected";
			echo $dashVal;	
			
		  ?>
		<option value="<?php echo $empid;?>"<?php echo $px ?>> 
		<?php echo  strtoupper($rowCate['realname'])   ;
		 ?></option>
	  <?php	
	  
   		 	if($_REQUEST['type']!='mysal'){	
			 CategoryUsers_Show($pcode, $rowCate['id'], $dashVal);
			 }
		}
	}
?></select>