/home/mip/mip/public/img/credit/datatables/edit_source_survey.php.tar
home/mip/public_html_/old-website/employer/edit_source_survey.php000064400000020141151520763120021427 0ustar00<?
session_start();
require_once("func_all.php");
do_html_header("Sourcing Survey");

if($submit=="Reserve"){
	require_once("sqlupdate.php");
}

$status_id="On Pool";
$principal = getdata_one("*","principals","principal_id",$myprincipalid);  
$category = getdata("select * from job_category where 1 and category_id in (".substr($principal["category_ids"],0,-2).") order by name");
$position = getdata("select * from positions where 1 and category_id in (select category_id from job_category where 1 and category_id in (".substr($principal["category_ids"],0,-2).")) order by name");
$status = getdata("select * from applicant_status order by status");

if($gender) $sql_gender = "AND p.sex='$gender'"; // gender
	  
if($job_desc) {
	$sql_jobdesc = "AND employment.job_desc like '%$job_desc%'"; 
	$inner_emp = "Inner Join employment ON employment.applicant_id = p.applicant_id";
}	

if($min_age){
	$min_date = get_date($sqltoday,-$min_age);
	$sql_min_age = "and p.birthdate > 0 and p.birthdate <= '$min_date'";
}
	
if($max_age){
	$max_date = get_date($sqltoday,-($max_age+1));
	$sql_max_age = "and p.birthdate >= '$max_date'";
}

$sql_age = "$sql_max_age $sql_min_age"; // age
	
if($category_id) {	
	if($sort_by){
		$old_sort_order = $sort_order;
		$sort_order = ($old_sort_order=="asc")? "desc" : "asc";
		$sql_sort_by = "p.$sort_by";
		if($sort_by == 'position1_yrsofexp')  $add_sort = ",position1_mosofexp $sort_order";  			 
	} else {
		$sql_sort_by = "p.lname";
		$sort_order = "asc";
	}	
	
if($status_id) {
	$sql_status="AND p.status = '$status_id' ";
}	

if($position_id) {
	$sqlposition = "AND p.position_id1 = '$position_id'";
} else {
	$sqlposition = "AND p.position_id1 in (select position_id from positions where 1 and category_id = '".$category_id."')";
}

$sql = "SELECT DISTINCT(p.applicant_id), p.birthdate, p.sex, p.cellphone, p.video, p.position1_yrsofexp, p.position1_mosofexp, concat(p.lname,', ',p.fname,' ',left(p.mname,1),'.') as name FROM personal AS p $inner_emp WHERE 1 $sqlposition AND p.blacklisted <> '1' $sql_status $sql_gender $sql_age $sql_jobdesc ORDER BY $sql_sort_by $sort_order $add_sort";
$result = getdata($sql);
$found = count($result);
echo mysql_error();

}
?> 
<tr><td valign="top"><br>
	<table align=center width=98%>
	<tr><td align=center style="padding-bottom:0px;">
	<form method=post action="<?=$PHP_SELF?>" name="form_source_survey">
		<table border=0 cellpadding='0' cellspacing='0'>
		<tr><td>
			<div style="padding-bottom:15px;">
			<b>Category :</b>
			<select name="category_id" id="category_id" onChange="load_category_source();">
			<option value="0">--Select Category</option>
			<?selectcode($category,$category_id,"category_id","name")?>
			</select>
			</div>
			<div style="padding-bottom:15px;">
			<b>Position :</b>
			<select name="position_id">
			<option value="0">All</option>
			<?selectcode($position,"$position_id","position_id","name")?>
			</option>
			</select>
			</div>
			<div style="padding-bottom:15px;">
			<b>Gender:</b><input class="radio2" type=radio name=gender value="" <?=(!$gender)? "checked" : ""?>>any 
						  <input class="radio2" type=radio name=gender value="M" <?=($gender=='M')? "checked" : ""?>>Male 
						  <input class="radio2" type=radio name=gender value="F" <?=($gender=='F')? "checked" : ""?>>Female&nbsp;&nbsp;&nbsp;			  
			<b>Age:</b> Min <input type=text name="min_age" size=4 maxlength=2 value="<?=$min_age?>" onfocus="select()" onkeypress="return isNumberKey(event);">&nbsp;&nbsp;
						Max <input type=text name="max_age" size=4 maxlength=2 value="<?=$max_age?>" onfocus="select()" onkeypress="return isNumberKey(event);">
&nbsp;&nbsp;</div>
			<div style="padding-bottom:0px;">
			<b>Job Description:</b> <input type="text" name="job_desc" size="35" value=<?=$job_desc?>><input type=submit value="Get Applicants">
			</div>
		</td></tr>
		</table>
	</form>
	</td></tr>	
	<? 
	if($category_id) {	
	if($found){ ?> 
	<tr><td bgcolor="#d4d0c8" height="25">
		<table border=0><tr><td><font color=red>Note:</font></td><td>Click the Applicant Name, Age, Yrs. of Experience to sort the applicants.</td></tr>
		<tr><td></td><td>To view the resume of an applicant, click on the Applicant No.</td></tr>
		</table>
	</td></tr>			 	
	<tr><td>
		<table border="0" cellpadding="0" cellspacing="0" width=100%>
		<tr><td><img src="img/topleft-login.gif" border="0"></td>
		<td background="img/toptile-login.gif"><img src="img/toptile-login.gif" border="0"></td>
		<td><img src="img/topright-login.gif" border="0"></td></tr>
		<tr><td background="img/midleft-login.gif"><img src="img/midleft-login.gif" border="0"></td>
		<td width="100%" align="center" bgcolor="#dbdee3">
			<form method=post action="sqlupdate.php?what=reserve_applicants" name="form_source_survey">
			<table width="100%" cellpadding='3' cellspacing='3'>
   			<tr>
				<td width=1%>&nbsp;</td>
			    <td width=2%>&nbsp;</td>
				<td width=9%><b>Applicant No.</b></td>
				<td width=29%><a href="<?=$PHP_SELF?>?position_id=<?=$position_id?>&gender=<?=$gender?>&min_age=<?=$min_age?>&max_age=<?=$max_age?>&sort_by=lname&sort_order=<?=$sort_order?>&category_id=<?=$category_id?>"><b>Applicant Name</b></a></td>
				<td width=7% align=center><b>Sex</b></td>
				<td width=8% align=center><a href="<?=$PHP_SELF?>?position_id=<?=$position_id?>&gender=<?=$gender?>&min_age=<?=$min_age?>&max_age=<?=$max_age?>&sort_by=birthdate&sort_order=<?=$sort_order?>&category_id=<?=$category_id?>"><b>Age</b></a></td>				
				<td width=17%><b>Education</b></td>
				<td width=10% align=center><a href="<?=$PHP_SELF?>?position_id=<?=$position_id?>&gender=<?=$gender?>&min_age=<?=$min_age?>&max_age=<?=$max_age?>&sort_by=position1_yrsofexp&sort_order=<?=$sort_order?>&category_id=<?=$category_id?>"><b>Yrs. of Experience</b></a></td>								
			</tr>
			<? 
			for($i=1;$i<=$found;$i++){ 
			$applicant_id = $result[$i]["applicant_id"];
			$educ = getdata("SELECT education FROM education WHERE applicant_id = '$applicant_id' ORDER BY to_date DESC");
			print "<tr>";
				print "<td class=box align=right valign=top><input type='checkbox' class='radio' name='arr_applicants[]' value='$applicant_id'></td>";
				print "<td class=box align=right valign=top>$i.&nbsp;</td>";
				print "<td class=box valign=top><a href=\"report_resume.php?employer=1&applicant_id=".$applicant_id."\" target=\"page$applicant_id\">".$applicant_id."</a></td>";
				print "<td class=box valign=top>".$result[$i]["name"]."</td>";    				
    			print "<td class=box align=center valign=top>".$result[$i]["sex"]."</td>";
				print "<td class=box align=center valign=top>".get_age($result[$i]["birthdate"])."</td>";
				print "<td  class=box valign=top>".$educ[1]["education"]."</td>";						
				print "<td class=box align=left valign=top>";
				print ($result[$i]["position1_yrsofexp"])? ($result[$i]["position1_yrsofexp"])."yrs" : "";
				print ($result[$i]["position1_yrsofexp"] && $result[$i]["position1_mosofexp"])? " & " : "";
				print ($result[$i]["position1_mosofexp"])? ($result[$i]["position1_mosofexp"])."mos" : "";
				print "</td>";						
			print "</tr>";
	      	}
			?>
	  		<tr><td colspan=9>
				<input type="submit" name="submit" value="Reserve Applicants">
				<input type="hidden" name="position_id" value="<?=$position_id?>">
				<input type="hidden" name="category_id" value="<?=$category_id?>">
				<input type="hidden" name="status_id" value="<?=$status_id?>">
				<input type="hidden" name="gender" value="<?=$gender?>">
				<input type="hidden" name="min_age" value="<?=$min_age?>">
				<input type="hidden" name="max_age" value="<?=$max_age?>">
				<input type="hidden" name="job_desc" value="<?=$job_desc?>">
			</td></tr>
			</table>
			</form>
		</td>
		<td background="img/midright-login.gif"><img src="img/midright-login.gif" border="0"></td></tr>
		<tr><td><img src="img/botleft-login.gif" border="0"></td>
		<td background="img/bottile-login.gif"><img src="img/bottile-login.gif" border="0"></td>
		<td><img src="img/botright-login.gif" border="0"></td></tr>
		</table>			
	</td></tr>
	<? } else { ?>	
	<tr><td height="25" align="center"><font color=red>There are no on pool applicants under the above criteria(s).</font></td></tr>
	<?	
	} 
	}
	?>
	</table>
</td></tr>
<?
do_html_footer();
if($msg) echo "<script>alert('$msg')</script>";
?>