/home/mip/public_html_/old-website/employerxxx/report_applicant2.php
<?
session_start();
require_once("func_all.php");

if($doc==1) header('Content-Type: application/msword');

	do_resume_header($applicant_id,"Information Report (Agency Version)");
	
	$applicant = getdata_one("*","personal","applicant_id","$applicant_id"); 
  		
	$sex = $applicant[sex];
	if($sex=="F") $sex="Female"; else $sex="Male"; 
	
  $bene = getdata_one("*","beneficiary","applicant_id","$applicant_id");	
  
	$education = getdata("select * from education where applicant_id='$applicant_id' order by to_date desc");
	$num_educ = count($education);
	
	$employment = getdata("select *,DATE_FORMAT(from_date,'%b %Y') AS frm_date, IF(to_date,DATE_FORMAT(to_date,'%b %Y'),'PRESENT') as t_date from employment where applicant_id='$applicant_id' order by from_date desc");
	$num_emp = count($employment);
	
	$training = getdata("select * from training where applicant_id='$applicant_id' order by date desc");
	$num_train = count($training);
	
	$prequalify = getdata_one("*,DATE_FORMAT(date,'%b %d, %Y') AS date","prequalify","applicant_id","$applicant_id");

	$complaint = getdata("select *,DATE_FORMAT(complaint_date,'%b %d, %Y') AS complaint_date,DATE_FORMAT(resolved_date,'%b %d, %Y') AS resolved_date from complaints where applicant_id='$applicant_id' order by complaint_date desc");
  $num_comp = count($complaint);
	
	$medical = getdata("select m.medical_id,m.applicant_id,m.status,m.description,c.name as clinic_name,DATE_FORMAT(m.date,'%b %d, %Y') AS date from medical as m,clinics as c where m.clinic_id=c.clinic_id and applicant_id='$applicant_id' order by date desc");
  $num_med = count($medical);
	
	$process = getdata_one("*","process","applicant_id","$applicant_id");	
	
?> 	
<tr><td height="100%" align=center valign="top">
<table align=center cellpadding='2' cellspacing='2' width=100%>
<tr><td bgcolor="#d6d3ce">
    
    <table width=100%>     
			 <tr height=30>		
				   <td class="box1"><b>Personal Information</b></td>				   
			 </tr>
		</table>				
	 	<table width=100%>
   		  <tr>
				<td>
				<table cellspacing=5>
				<tr>
						<td><b>Application No.</b></td>
						<td><b>:</b> <?=$applicant[applicant_id]?></td>
				</tr>
				<tr>
						<td><b>Application Date</b></td>
						<td><b>:</b> <?=dateformat($applicant[apply_date])?></td>
				</tr>
				<tr>
						<td colspan=2><b>Position Applied</b></td>
						<td><b>Yrs. Exp.</b></td>
				</tr>		
				<tr>
						<td align='right'><b>1st Choice</b></td>
						<td><b>:</b> <?=getname($applicant[position_id1],"positions","position_id")?></td>
						<td><b></b> <?=($applicant[position1_yrsofexp])? $applicant[position1_yrsofexp]." yrs" : ""?><?=($applicant[position1_yrsofexp] && $applicant[position1_mosofexp])? " & " : ""?><?=($applicant[position1_mosofexp])? $applicant[position1_mosofexp]." mos" : ""?></td>						
				</tr>
				<tr>
						<td align='right'><b>2nd Choice</b></td>
						<td><b>:</b> <?=getname($applicant[position_id2],"positions","position_id")?></td>
						<td><b></b> <?=($applicant[position2_yrsofexp])? $applicant[position2_yrsofexp]." yrs" : ""?><?=($applicant[position2_yrsofexp] && $applicant[position2_mosofexp])? " & " : ""?><?=($applicant[position2_mosofexp])? $applicant[position2_mosofexp]." mos" : ""?></td>						
				</tr>						
				<tr>
						<td colspan=2><b>Country Applied</b></td>
						<td><b>Status</b></td>
						<td><!--<b>Applicant No.</b>--></td>
				</tr>		
				<tr>
						<td align='right'><b>1st Choice</b></td>
						<td><b>:</b> <?=getname($applicant[country_id],"country","country_id")?></td>
						<td><?=$applicant['status']?></td>
						<td><!--<?=$applicant['applicant_id1']?>--></td>
				</tr>
				<tr>
						<td align='right'><b>2nd Choice</b></td>
						<td><b>:</b> <?=getname($applicant[country_id2],"country","country_id")?></td>
						<td><?=$applicant['status2']?></td>
						<td><!--<?=$applicant['applicant_id2']?>--></td>
				</tr>
				
				
				</table>
				</td>
				<td align=right><?if ($applicant[picture]){print resize_pic1(175,175,$pic_dir1.$applicant[picture],"","","",1);}?>
				</td>
				</tr>		
		</table>					  
		<table bgcolor="#cccccc"  width=100% border="0" cellspacing="2" cellpadding="2">
				<tr>
						<td class="box11" width=20%><b>Last Name</b></td>
						<td class="box11" width=30%><?=$applicant[lname]?></td>
						<td class="box11" width=15%><b>First Name</b></td>
						<td class="box11" width=15%><?=$applicant[fname]?></td>
						<td class="box11" width=10%><b>Middle</b></td>
						<td class="box11" width=10%><?=$applicant[mname]?></td>
				</tr>
				<tr>
						<td class="box11"><b>Age</b></td>
						<td class="box11" colspan=5><?=get_age($applicant[birthdate])?></td>
				</tr>
				<tr>
						<td class="box11"><b>Date of Birth</b></td>
						<td class="box11"><?=dateformat($applicant[birthdate])?></td>
						<td class="box11" colspan="1"><b>Place of Birth</b></td>
						<td class="box11" colspan="3"><?=($applicant[birthplace])?$applicant[birthplace] : "N/A"?></td>
				</tr>
				<tr>
						<td class="box11"><b>Sex</b></td>
						<td class="box11"><?=$sex?></td>
						<td class="box11" colspan="1"><b>Civil Status</b></td>
						<td class="box11" colspan="3"><?=$applicant[civil_status]?></td>
				</tr>
				<tr>
						<td class="box11"><b>Height</b></td>
						<td class="box11"><?=$applicant[height1]." ".$applicant[height2]?></td>
						<td class="box11" colspan="1"><b>Weight</b></td>
						<td class="box11" colspan="3"><?=$applicant[weight1]." ".$applicant[weight2]?></td>
				</tr>
				<tr>
						<td class="box11"><b>Religion</b></td>
						<td class="box11" colspan="5"><?=($applicant[religion])?$applicant[religion] : "N/A"?></td>						
				</tr>													
				<!--<tr>
						<td class="box11"><b>Present Address</b></td>
						<td class="box11" colspan=5><?=$applicant[address1]?></td>						
				</tr>																										
				<tr>
						<td class="box11"><b>Tel [Office]</b></td>
						<td class="box11" colspan="5"><?=$applicant[office_phone]?></td>						
				</tr>											
				<tr>
						<td class="box11"><b>Tel [Home]</b></td>
						<td class="box11" colspan="5"><?=$applicant[home_phone]?></td>						
				</tr>											
				<tr>
						<td class="box11"><b>Cellphone</b></td>
						<td class="box11" colspan="5"><?=$applicant[cellphone]?></td>						
				</tr>											
				<tr>
						<td class="box11"><b>Permanent Address</b></td>						
						<td class="box11" colspan=5><?=$applicant[perm_no]." ".$applicant[perm_st]?><?=($applicant[perm_city])? ", ".$applicant[perm_city] : ""?><?=($applicant[perm_prov])? ", ".$applicant[perm_prov] : ""?> <?=$applicant[perm_zip]?></td>
				</tr>-->
																		
		</table>
		<? if($bene) { ?>
		<!-- Beneficiary Information-->
	  <table border=0 width="100%">
					<tr height=25><td class=box1><b>Beneficiary Data</b></td></tr>
		</table>
		<table width=100% border=0>
				<tr>
						<td class="box11" width=20%><b>Beneficiary Name:</b></td>
						<td class="box11"><?=$bene[ben_fname]. " ".$bene[ben_mname]." ".$bene[ben_lname]?></td>
						<td class="box11" width=22%><b>Relationship to Worker:</b></td>
						<td class="box11"><?=$bene[ben_relationship]?></td>
				</tr>
				<tr>
						<td class="box11"><b>Allotee Name:</b></td>
						<td class="box11"><?=$bene[allo_fname]. " ".$bene[allo_mname]." ".$bene[allo_lname]?></td>
						<td class="box11"><b>Relationship to Allotee:</b></td>
						<td class="box11"><?=$bene[allo_relationship]?></td>
				</tr>
				<tr>
						<td class="box11"><b>Permanent Address:</b></td>
						<td class="box11" colspan=3><?=$bene[add_no]. " ".$bene[add_st]?><?=($bene[add_city])? ", ".$bene[add_city] : ""?><?=($bene[add_prov])? ", ".$bene[add_prov] : ""?></td>						
				</tr>
    </TABLE>	
		<? } ?>
		<?if($num_educ){?>
		<!-- Educational Background-->	  		
		<table  border=0 width=100% align=center>
         <tr height=25><td class="box1"><b>Educational Background</b></td>		 				
         </tr>
		</table>		
    <table width=100%>				
				
				<tr>
						<td class="box11" width=20%><b>Education</b></td>
						<td class="box11" width=10%><b>From</b></td>
						<td class="box11" width=10%><b>To</b></td>
						<td class="box11" width=35%><b>School</b></td>
						<td class="box11" width=25%><b>Course</b></td>
				</tr>
				<?for ($i=1; $i<=$num_educ; $i++){?>
				<tr>
						<td class="box11" valign=top><?=$education[$i][education]?></td>
						<td class="box11" valign=top><?=$education[$i][from_date]?></td>
						<td class="box11" valign=top><?=$education[$i][to_date]?></td>
						<td class="box11" valign=top><?=$education[$i][school]?></td>
						<td class="box11" valign=top><?=($education[$i][course])? $education[$i][course] : "N/A"?></td>
				</tr>
				<?}?>						
		</table>
		<?}?>
		
		<?if($num_train){?>
		<!-- Training -->
		<table  border=0 width=100% align=center>
         <tr height=25 class=trtitle1><td class="box1"><b>Trainings</b></td>		 				
         </tr>
		</table>	  		
		<table width="100%">				
				<tr>
						<td class="box11" align=center width=13%><b>Date</b></td>
     				<td class="box11" align=center width=28%><b>Training Center</b></td>
						<td class="box11" align=center width=23%><b>Position</b></td>
     				<td class="box11" align=center width=35%><b>Remarks</b></td>						
			 </tr>
			<?for ($i=1; $i<=$num_train; $i++){?>
			 <tr>
						<td class="box11"><?=dateformat($training[$i][date])?></td>
     				<td class="box11"><?=$training[$i][center]?></td>
						<td class="box11"><?=$training[$i][title]?></td>
     				<td class="box11"><?=$training[$i][remarks]?></td>
			 </tr>
			 <?}?>
    </TABLE>	
		<?}?>
		
		<?if($num_emp){?>
 		<!-- Employment Information -->		
		<table  border=0 width=100% align=center>
         <tr height=25 class=trtitle1><td class="box1"><b>Employment Information</b></td>		 				
         </tr>
		</table>
		<table bordercolor=green  width=100%>	  			
		<?for ($i=1; $i<=$num_emp; $i++){?>
					<tr class=none1 align=left>
						<td class="box11" width=20%><b>Company/Employer</b></td>
     				<td class="box11" width=30%><?=($employment[$i][company])?$employment[$i][company] : "N/A"?></td>
     				<td class="box11" colspan="2"><i>(<?=($employment[$i]['overseas'])? "Overseas" : "Local"?>)</td>						
					</tr>
					<tr class=none1 align=left>
						<td class="box11"><b>Address</b></td>
     				<td class="box11"><?=($employment[$i][address])?$employment[$i][address] : "N/A"?></td>
						<td class="box11" width=15%><b>Contact No.</b></td>
     				<td class="box11" width=35%><?=($employment[$i]['contact_no'])?$employment[$i]['contact_no'] : "N/A"?></td>
					</tr>
					<tr class=none1 align=left>
						<td class="box11"><b>Position</b></td>
     				<td class="box11"><?=($employment[$i][position])?$employment[$i][position] : "N/A"?> </td>
						<td class="box11"><b>Salary</b></td>
     				<td class="box11" colspan="1"><?=$employment[$i][salary]?></td>				
					</tr>
					<tr class=none1 align=left>
						<td class="box11"><b>From</b></td>
     				<td class="box11"><?=$employment[$i][frm_date]?>	</td>
						<td class="box11"><b>To</b></td>
     				<td class="box11" colspan=1><?=$employment[$i][t_date]?> </td>
					</tr>
      		<tr class=none1 align=left>
						<td class="box11" valign=top><b>Job Description</b></td>
     				<td class="box11" colspan=3><?=($employment[$i][job_desc])? addbreaks($employment[$i][job_desc]) : "N/A"?></td>						
					</tr> 
					<tr class=none1 align=left>	
						<td class="box11" valign=top><b>Reason for Leaving</b></td>
     				<td class="box11" colspan=3><?=($employment[$i][reason_for_leaving])? addbreaks($employment[$i][reason_for_leaving]) : "N/A"?></td>						
					</tr> 
					<tr><td colspan=4><hr width=100%></td></tr>
			<?  }// end of for loop 
			?>			  
		</table>		
		<?}?>
		
 		<!-- Interview -->		
		<table  border=0 width=100% align=center>
         <tr height=25 class=trtitle1><td class="box1"><b>Interview</b></td>		 				
    		 </tr>
		</table>
		<table bordercolor=green  width=100%>	  			
					 <tr>
					 		 <td class="box11" width=21%><b>Interviewer</b></td>
							 <td class="box11" width=29%><?=$prequalify[RO]?></td>
					 		 <td class="box11" width=21%><b>Date</b></td>
							 <td class="box11" width=29%><?=$prequalify[date]?></td>
					 </tr>
					 <tr>
					 		 <td class="box11"><b>Language Ability</b></td>
							 <td class="box11">Spoken English - <?=$prequalify['spoken_english']?></td>
							 <td class="box11">Written English - <?=$prequalify['written_english']?></td>
							 <td class="box11">Others - <?=$prequalify['others']?></td>
					 </tr>
					 <tr>
					 		 <td class="box11" valign=top><b>Skin Color</b></td>
							 <td class="box11"><?=$prequalify['skin_color']?></td>
					 		 <td class="box11" valign=top><b>Response</b></td>
							 <td class="box11"><?=$prequalify['response']?></td>
					 </tr>
					 <tr>
					 		 <td class="box11"><b>Preferences</b></td>
							 <td class="box11">1st Preference - <?=$prequalify['pref1']?></td>
							 <td class="box11">2nd Preference - <?=$prequalify['pref2']?></td>
							 <td class="box11">3rd Preference - <?=$prequalify['pref3']?></td>
					 </tr>
					 <tr>
					 		 <td class="box11" valign=top><b>Remarks</b></td>
							 <td class="box11" colspan=3><?=nl2br($prequalify[remarks])?></td>
					 </tr>
		</table>
		
		<?if($num_med){?>
		<!-- Medical Information-->
	  <table  border=0 width=100% align=center>
         <tr height=25 class=trtitle1><td class="box1"><b>Medical Information</b></td>		 				
    		 </tr>
		</table>
		<table bordercolor=green  width=100%>		
    		<tr>
						<td class="box11" width=17%><b>Date</b></td>
						<td class="box11" width=30%><b>Clinic</b></td>
						<td class="box11" width=13%><b>Condition</b></td>
						<td class="box11" width=40%><b>Description</b></td>
				</tr>
		<?for ($i=1; $i<=$num_med; $i++){?>
			<tr class=none1 align=left>
						<td class="box11" valign=top><?=$i.".    ".$medical[$i][date]?></td>
     				<td class="box11" valign=top><?=$medical[$i][clinic_name]?></td>
						<td class="box11" valign=top><?=$medical[$i][status]?></td>
     				<td class="box11" valign=top><?=($medical[$i][description])?$medical[$i][description] : "N/A"?></td>
			</tr>			
			<?}?>
		</table>
		<?}?>
		
		<!-- Process -->	  
		<table border=0 width=100% align=center>
         <tr height=25 class=trtitle1><td class=box1><b>Process</b></td>		 				
     	 </tr>
		</table>
		<table bordercolor=green  width=100%>
    			 <tr>
					  	 <td class="box11" width=20%><b>Principal</b></td>
							 <td class="box11"><?=($process[principal_id])? getname($process[principal_id],"principals","principal_id") : "N/A"?></td>
 					 		 <td class="box11" width=20%><b>Position</b></td>
					 		 <td class="box11"><?=($process[position])?$process[position] : "N/A"?></td>
					 </tr>
					 <tr>
					     <td class="box11"><b>Contract Duration</b></td>
					 		 <td class="box11" colspan=3><?=($process[contract_duration])?$process[contract_duration] : "N/A"?></td>
					 </tr>		
					 <tr>
 					 		 <td class="box11"><b>Basic Salary</b></td>
					 		 <td class="box11"><?=($process[basic_salary])? $process[basic_salary] : "N/A"?></td>
					 		 <td class="box11"><b>Food Allowance</b></td>
					 		 <td class="box11"><?=($process[food_allowance])? $process[food_allowance] : "N/A"?></td>
					 </tr>		
					 <tr>
 					 		 <td class="box11"><b>Passport No.</b></td>
					 		 <td class="box11"><?=($process[passport])?$process[passport] : "N/A"?></td>
					 		 <td class="box11"><b>Place Issued</b></td>
					 		 <td class="box11"><?=($process[pp_place_issued])?$process[pp_place_issued] : "N/A"?></td>
					 </tr>
					 <tr>
 					 		 <td class="box11"><b>Date Issued</b></td>
					 		 <td class="box11"><?=($process[pp_date_issued])? dateformat($process[pp_date_issued]) : "N/A"?></td>
					 		 <td class="box11"><b>Date Expires</b></td>
					 		 <td class="box11"><?=($process[pp_date_expires])? dateformat($process[pp_date_expires]) : "N/A"?></td>
					 </tr>
					 <tr>
							 <td class="box11"><b>TIN No.</b></td>
					 		 <td class="box11"><?=$process[tin]?></td>							 
					     <td class="box11"><b>NBI</b></td>
					 		 <td class="box11"><?=$process[nbi]?></td>
					 </tr>		
					 <tr>
 					 		 <td class="box11"><b>CLA No.</b></td>
					 		 <td class="box11" width=30%><?=($process[cla])?$process[cla] : "N/A"?></td>
							 <td class="box11"><b>CLA Date</b></td>
					 		 <td class="box11" width=20%><?=($process[cla_date])? dateformat($process[cla_date]) : "N/A"?></td>
					 		 
					 </tr>
					 <tr>
 					 		 <td class="box11" width=20%><b>OEC No.</b></td>
					 		 <td class="box11"><?=($process[OEC])?$process[OEC] : "N/A"?></td>
							 <td class="box11"><b>MOFA/Category</b></td>
					 		 <td class="box11"><?=($process[mofa])?$process[mofa] : "N/A"?></td>
					 </tr>
					 <tr>
 					 		 <td class="box11"><b>Job Accepted</b></td>
					 		 <td class="box11"><?=($process[job_acceptance])? dateformat($process[job_acceptance]) : "N/A"?></td>
					 		 <td class="box11"><b>Drug Test</b></td>
					 		 <td class="box11"><?=($process[drug_test])? dateformat($process[drug_test]) : "N/A"?></td>
					 </tr>		
					 <tr>
 					 		 <td class="box11"><b>PDOS</b></td>
					 		 <td class="box11"><?=($process[pdos])? dateformat($process[pdos]) : "N/A"?></td>
					 		 <td class="box11"><b>Attest</b></td>
					 		 <td class="box11"><?=($process[attest])? dateformat($process[attest]) : "N/A"?></td>
					 </tr>		
					 <tr>
 					 		 <td class="box11"><b>Visa Filed</b></td>
					 		 <td class="box11"><?=($process[visa_filed])? dateformat($process[visa_filed]) : "N/A"?></td>
					 		 <td class="box11"><b>Visa Released</b></td>
					 		 <td class="box11"><?=($process[visa_released])? dateformat($process[visa_released]) : "N/A"?></td>
					 </tr>		
					 <tr>
 					 		 <td class="box11"><b>POEA Filed</b></td>
					 		 <td class="box11"><?=($process[poea_filed])? dateformat($process[poea_filed]) : "N/A"?></td>
					 		 <td class="box11"><b>POEA Released</b></td>
					 		 <td class="box11"><?=($process[poea_released])? dateformat($process[poea_released]) : "N/A"?></td>
					 </tr>		
					 <tr>
 					 		 <td class="box11"><b>Ticket</b></td>
					 		 <td class="box11"><?=($process[ticket])? dateformat($process[ticket]) : "N/A"?></td>
 					 		 <td class="box11"><b>Deployed</b></td>
					 		 <td class="box11"><?=($process[deployment])? dateformat($process[deployment]) : "N/A"?></td>
					 </tr>		
					 <tr>
 					 		 <td class="box11" valign=top><b>Remarks</b></td>
					 		 <td class="box11" colspan="4"><?=($process[remarks])? addbreaks($process[remarks]) : "N/A"?></td>
					 </tr>
  	</table>
				    
		<?if($num_comp){?>				
		<!-- Complaints -->	  
		<table  border=0 width=100% align=center>
         <tr height=25 class=trtitle1><td class="box1"><b>Complaint/s</b></td>		 				
    		 </tr>
		</table>
    <table bordercolor=green  width=100%>	  			
      <?for ($i=1; $i<=$num_comp; $i++){?>
					<tr>
							<td class="box11" width=20%><b>Complaint Date</b></td>
     					<td class="box11" width=30%><?=$complaint[$i][complaint_date]?></td>
							<td class="box11" width=15%><b>Complaint</b></td>
     					<td class="box11" width=35%><?=($complaint[$i][complaint])?$complaint[$i][complaint] : "N/A"?></td>
					</tr>
					<tr>
							<td class="box11" valign=top><b>Remark</b></td>
     					<td class="box11" colspan=3><?=($complaint[$i][remarks])? addbreaks($complaint[$i][remarks]) : "N/A"?></td>
					</tr>
					<tr>
							<td class="box11" valign=top><b>Broker's Comment</b></td>
     					<td class="box11" colspan=3><?=($complaint[$i][comment])? addbreaks($complaint[$i][comment]) : "N/A"?></td>				
					</tr>
					<tr>
							<td class="box11"><b>Date Resolved</b></td>
     					<td class="box11"><?=$complaint[$i][resolved_date]?> </td>
							<td class="box11"><b>Resolved by</b></td>
     					<td class="box11"><?=($complaint[$i][resolvedby])? $complaint[$i][resolvedby] : "N/A"?> </td>
					</tr>
					<tr><td colspan=5><hr width=100%></td></tr>			
			<?  }// end of for loop
	    ?>									
			</table>		
			<?}?>
			
 </td></tr>
 </table>		
 </td></tr>
<?
 do_report_footer();
 if($doc!=1) echo "<script>alert('To open this page in a Word document, pls. click on the logo/header.')</script>";
?>