<?php
//die("invalid token");
$errmsg='';
$sucmsg='';

include('database.php');

//GET DETAILS FROM DB
	if(isset($_GET["i"])){$applicant_idpci=$_GET["i"]; }
	$q = "Select * from pci_application where id=$applicant_idpci limit 1";
    $qry=mysqli_query($con, $q);
    $row=mysqli_fetch_assoc($qry);
    extract($row);
	//print_r($row);
	$myAppID = $id;
	$applicant_idpci = $id;
	$applicant_no = $memberNo;
    

	switch($memberGrade)
	{
		case 1: $memberGrade="Fellow";
		break;
		
		case 2: $memberGrade="Member";
		break;
		
		case 3: $memberGrade="Probationer";
		break;
		
		case 4: $memberGrade="Technician";
		break;
		
		case 5: $memberGrade="Student";
		break;
		
		case 6: $memberGrade="Practicing Firm";
		break;
		
		case 7: $memberGrade="Graduate";
		break;
		
		case 8: $memberGrade="State Chapter";
		break;
		
		case 9: $memberGrade="Past President";
		break;
		
	}
	
?>

<html>
<head>
<title><?php echo $applicant_no; ?> NIQS PCI Application Form</title>
</head> 
<body>

<div class="graph-visual tables-main" name='myarea' id='myarea'>
<?php
//header

echo "<table width='90%' cellspacing='0' align='center'>";
/*
echo "<tr><td><img src='images/logo.png'></td><th><h3><center>THE NIGERIAN INSTITUTE OF QUANTITY SURVEYORS <br>
 APPLICATION FOR TEST OF PROFESSIONAL COMPETENCE INTERVIEW <br>
(PCI-CANDIDATE)</center></h3></th></tr>";

echo "<tr><td colspan='3'><h4> PLEASE READ THE INSTRUCTIONS BELOW BEFORE COMPLETING THE FORM </h4></td></tr>";
echo "<tr><td colspan='3'> 
<ol>
<li> The Institute will neither entertain further correspondence in connection with the examination results released nor state reasons for any decision made with reference
to the examination.</li>

<li>Only financial members of the Institute will be allowed to sit or sponsor candidates for the examination.</li>
<li>Payment of the non-refundable examination fee must be made in full online before you can proceed with the application.</li>
<li>Print the duly completed application form after submission online and return to the Institute in an envelope addressed to the Secretary General, NIQS No 84, 4th
Avenue (Sa’adu Zungur Avenue) Gwarinpa, Abuja. This shall include photocopies of the following:</li>
  <ul>
	<li><font color='red'>Two 2 Recent Passport Sized Photographs</font></li>
	<li><font color='red'>O'Level Certificate (Not Statement of Result)</font></li>
	<li><font color='red'>Copy of Graduate Level Certificates (compulsory)/Postgraduate Certificates (where applicable) </font></li>
	<li><font color='red'>Membership Certificate of other professional bodies</font></li>
	<li><font color='red'>Evidences of Logbooks/Diaries Assessments stages 1,2,3, Passed</font></li>
	<li><font color='red'>GDE & TPC Examinations Results (passed)</font></li>
	<li><font color='red'>Copy of Logbook/Diary Stage 3 Report</font></li>
	<li><font color='red'>Evidence of confirmed online payment of the examination fee. (N20,000.00)</font></li>
   </ul>
<li><b>EXAMINATION COMMUNICATION OFFENCE:</b></li>
	<ol>
	  <li>Except in the case of examination fraud that is supported by documentary evidence, the Institute will not entertain any communication with examination candidates in respect of the outcome of examination results. Any such communication will attract suspension from future examinations.</li>
	  <li>At any point in time that any false information is detected in any documentation, it will lead to the cancellation of examination application, result and ultimately withdrawal of certificate.</li>
	</ol>
</ol>
 </td></tr>";
*/


echo "<tr><td><img src='images/logo.png' width='' height=''></td><th><h3><center> <font color='#106DB3'>THE NIGERIAN INSTITUTE OF QUANTITY SURVEYORS </h3><h3>
 APPLICATION FOR TEST OF PROFESSIONAL COMPETENCE INTERVIEW <br>
(PCI CANDIDATE - $regSet) </font></center></h3>   </th> <td>"; 
		 $mypassport = "passport/".$applicant_no."_".$applicant_idpci.".jpg";
		 $filemtime = filemtime($mypassport);
				
		 if(file_exists($mypassport))
		 {
			 echo "<img src='".$mypassport."?".$filemtime."' width='120px' height='150px'><font color='black'>PC".$uniqueId."</font><br><br>";
		 }

echo "</td></tr>";

echo "</table>";
echo "<table width='90%' cellspacing='0' align='center'>";

//1.0
echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='3'>  <b>1.0 PERSONAL DETAILS</b> </font></td></tr>";
echo "<tr><td colspan='3'><br>";

	echo "<table width='100%' border='1' cellspacing='0'>";
	echo "<tr><td width='40%' height='30px'> &nbsp; <b> NIQS MEMBERSHIP NUMBER: </b></td> 	<td colspan='2'> &nbsp;  ".strtoupper($memberNo)." </td></tr>";
	echo "<tr><td> &nbsp; <b> SURNAME: </b></td> 					<td colspan='2'> &nbsp;  ".strtoupper($memberSurname)." </td></tr>";
	echo "<tr><td> &nbsp; <b> OTHER NAMES: </b></td> 				<td colspan='2'> &nbsp;  ".strtoupper($memberOthernames)." </td></tr>";
	echo "<tr><td> &nbsp; <b> TITLE/GENDER: </b></td> 				<td colspan='2'> &nbsp;  ".strtoupper($memberTitle)."/".strtoupper($memberGender)." </td></tr>";
	echo "<tr><td> &nbsp; <b> DATE OF BIRTH: </b></td> 				<td colspan='2'> &nbsp;  ".strtoupper($memberDOB)." </td></tr>";
	echo "<tr><td> &nbsp; <b> CHAPTER: </b></td> 					<td colspan='2'> &nbsp;  ".strtoupper($memberChapter)." </td></tr>";
	echo "<tr><td> &nbsp; <b> PHONE NUMBER:  </b></td> 				<td colspan='2'> &nbsp;  $memberPhone1, $memberPhone2 </td></tr>";
	echo "<tr><td> &nbsp; <b> EMAIL ADDRESS: </b></td> 				<td colspan='2'> &nbsp;  ".$memberEmail." </td></tr>";
	echo "<tr><td> &nbsp; <b> POSTAL ADDRESS: </b></td> 			<td colspan='2'> &nbsp;  ".strtoupper($memberAddress)." </td></tr>";
	echo "<tr><td> &nbsp; <b> CURRENT MEMBERSHIP GRADE: </b></td> 	<td colspan='2'> &nbsp;  ".strtoupper($memberGrade)." </td></tr>";
	echo "<tr><td> &nbsp; <b> DATE OF REGISTRATION: </b></td> 		<td colspan='2'> &nbsp;  ".strtoupper($memberRegDate)." </td></tr>";
	echo "<tr><td> &nbsp; <b> DIET:  </b></td> 						<td colspan='2'> &nbsp;  ".strtoupper($regSet)." </td></tr>";
	echo "<tr><td> &nbsp; <b> DISABILITY:  </b></td> 					<td colspan='2'> &nbsp;  ".strtoupper($disability); if($disability=='YES'){ echo " - ".$disability_type; } echo "   </td></tr>";
	echo "</table>";
	
echo "</td></tr>";
echo "<tr><td><b> <br><br> </b></td> 						<td colspan='2'> </td></tr>";
	
//2.0 centre
echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='3'> <b>2.0 PREFERRED INTERVIEW CENTRE:</b> </font></td></tr>";
echo "<tr><td colspan='3'> ".strtoupper($examCentre)." </td></tr>";
echo "<tr><td><b> <br><br> </b></td> 						<td colspan='2'> </td></tr>";

//3.0 olevel
$q = "Select * from pci_olevel where applicant_id='$applicant_idpci'";
$qry2=mysqli_query($con, $q);

echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='4'> <b>3.0 O' LEVEL SUBJECTS RESULT (5 CREDITS FROM WAEC/NECO/NABTEB):</b> </font></td></tr>";
echo "<tr><td colspan='3'> <br>";
	echo "<table width='50%' border='1' cellspacing='0'>";
	echo "<tr bgcolor='skyblue'><td> &nbsp; <b> SUBJECTS </b></td> 	<td align='center'><b> GRADE </b></td></tr>";

	while($row2=mysqli_fetch_array($qry2)){
		extract($row2);
		echo "<tr><td><b> &nbsp; ".$subject."</b></td> 	<td align='center'> ".strtoupper($grade)." </td></tr>";
	}
	echo "</table>";
	
echo "</td></tr>";
echo "<tr><td><b> <br><br> </b></td> 						<td colspan='2'> </td></tr>";


//4.0 education
$q = "Select * from pci_education where applicant_id='$applicant_idpci'";
$qry2=mysqli_query($con, $q);
echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='3'>  <b>4.0 EDUCATION:</b> </font></td></tr>";
echo "<tr><td colspan='3'> <br>";
	echo "<table width='100%' border='1' cellspacing='0'>";
	echo "<tr><td align='center'><b> SN </td> <td align='center'><b> UNIVERSITY/INSTITUTION </b></td> 	<td align='center'><b> COUNTRY </b></td>   <td align='center'><b> DEGREE/DIPLOMA NAME <br> (eg. B.Tech Quantity Surveying) </b></td>   <td><b><center> DATE COMPLETED </center></b></td> </tr>";
	
	$edd=1;
	while($row2=mysqli_fetch_array($qry2)){
		extract($row2);
		echo "<tr><td align='center'>$edd</td> <td align='center'> ".strtoupper($institution)."</td> <td align='center'> ".strtoupper($country)." </td>   <td align='center'> ".strtoupper($degree)." IN ".strtoupper($course)." </td>   <td align='center'> ".strtoupper($dateCompleted)." </td>  </tr>";
		$edd++;
	}
	echo "</table>";
	
echo "</td></tr>";
echo "<tr><td><b> <br><br> </b></td> 						<td colspan='2'> </td></tr>";

//5.0 professional bodies
$q = "Select * from pci_body where applicant_id='$applicant_idpci'";
$qry2=mysqli_query($con, $q);
echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='3'>  <b>5.0 MEMBERSHIP OF ANY OTHER PROFESSIONAL INSTITUTION(S): (IF ANY)</b> </font></td></tr>";
echo "<tr><td colspan='3'> <br>";
	echo "<table width='100%' border='1' cellspacing='0'>";
	echo "<tr><td align='center'><b> SN </td> <td align='center'><b> NAME OF INSTITUTION  </b></td> 	<td align='center'><b> CURRENT GRADE  </b></td>   <td align='center'><b> HOW MEMBERSHIP WAS ACHIEVED <br>(E.G. EXAMINATION) </b></td>   <td><b><center> YEAR REGISTERED/<br>OBTAINED/ELECTED </center></b></td> </tr>";

	$ed=1;
	while($row2=mysqli_fetch_array($qry2)){
		extract($row2);
		echo "<tr><td align='center'>$ed</td> <td align='center'> ".strtoupper($institution)."</td> <td align='center'> ".strtoupper($currentGrade)." </td>   <td align='center'> ".strtoupper($regRoute)." </td>   <td align='center'> ".strtoupper($regYear)." </td>  </tr>";
		$ed++;
	}
	echo "</table>";
	
echo "</td></tr>";
echo "<tr><td><b> <br><br> </b></td> 						<td colspan='2'> </td></tr>";

//6.0 TPC and Logbook
$q = "Select * from pci_tpc a, pci_logbook as b where a.applicant_id=b.applicant_id AND a.applicant_id='$applicant_idpci'";
$qry2=mysqli_query($con, $q);
echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='4'>  <b>6.0 PATICULARS OF TPC EXAMINATION AND LOGBOOK/DIARY STAGE 3 PASSED (OR RICS MEMBERSHIP)</b> </font></td></tr>";
echo "<tr><td colspan='3'> <br>";
	echo "<table width='100%' border='1' cellspacing='0'>";
	
	while($row2=mysqli_fetch_array($qry2)){
	extract($row2);
		
	if($tpcNo!="NA")
	{
		echo "<tr><td align='left'> &nbsp; <b> DETAILS  </b></td> <td align='center'><b> YEAR/MONTH </b></td>   <td align='center'><b> EXAM. NO.<br>(WHERE APPLICABLE) </b></td>  <td><b><center> CENTER<br>(WHERE APPLICABLE) </center></b></td> </tr>";

		echo "<tr><td align='left'> &nbsp; TPC EXAMINATION </td> <td align='center'> ".strtoupper($tpcMonth)." ".strtoupper($tpcYear)." </td>   <td align='center'> ".strtoupper($tpcNo)." </td>   <td align='center'> ".strtoupper($tpcCentre)." </td>  </tr>";
		echo "<tr><td align='left'> &nbsp; LOGBOOK/DIARY STAGE 3 </td> <td align='center'> ".strtoupper($logbookMonth)." ".strtoupper($logbookYear)." </td>   <td align='center'>  </td>   <td align='center'>  </td>  </tr>";
	}else{ echo "<tr><td> RICS Member </td></tr>";  }
	
	} //end of while 
	echo "</table>";
	
echo "</td></tr>";
echo "<tr><td><b> <br><br> </b></td> 						<td colspan='2'> </td></tr>";


//7.0 professional experience
$q = "Select * from pci_experience where applicant_id='$applicant_idpci'";
$qry2=mysqli_query($con, $q);
echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='3'>  <b>7.0 PROFESSIONAL EXPERIENCE:</b> </font></td></tr>";
echo "<tr><td colspan='3'> <br>";
	echo "<table width='100%' border='1' cellspacing='0'>";
	echo "<tr><td align='center'><b> SN </td> <td align='left'><b> EMPLOYER'S NAME AND ADDRESS  </b></td> <td align='center'><b> POSITION HELD & DATES  </b> <td align='left'> &nbsp; <b> DUTIES </b></td> </tr>";
	
	$xp=1;
	while($row2=mysqli_fetch_array($qry2)){
		extract($row2);
		echo "<tr><td align='center'> $xp </td> <td align='left'> ".strtoupper($employer)."</td> <td align='center'> ".strtoupper($position)." ($startDate - $endDate) </td>   <td> <font size='2'>".strtoupper($duties)."</font> </td> </tr>";
		$xp++;
	}
	echo "</table>";
	
echo "</td></tr>";
echo "<tr><td><b> <br><br> </b></td> 						<td colspan='2'> </td></tr>";


//8.0 Employer 
$q = "Select * from pci_employer where applicant_id='$applicant_idpci'";
$qry2=mysqli_query($con, $q);
$row2=mysqli_fetch_array($qry2);
extract($row2);
echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='3'>  <b>8.0 EMPLOYER DETAILS</b> </font></td></tr>";
	
echo "<tr><td colspan='3'><br>";

	echo "<table width='100%' border='1' cellspacing='0'>";

	echo "<tr><td width='40%'><b> &nbsp;  a)   NAME OF EMPLOYER: </b></td> 	<td colspan='2'> &nbsp;  ".strtoupper($employer)." </td></tr>";
	echo "<tr><td><b> &nbsp;  b) EMPLOYER'S BUSINESS ADDRESS: </b></td> 			<td colspan='2'> &nbsp;  ".strtoupper($address)." </td></tr>";
	echo "<tr><td><b> &nbsp;  c)  NATURE OF EMPLOYER'S BUSINESS: </b></td> 			<td colspan='2'> &nbsp;  ".strtoupper($nature)." </td></tr>";
	echo "<tr><td><b> &nbsp;  d)  POSITION OF APPLICANT: </b></td> 				<td colspan='2'> &nbsp;  ".strtoupper($position)." </td></tr>";
	echo "<tr><td><b> &nbsp;  e)  DATE OF EMPLOYMENT: </b></td> 				<td colspan='2'> &nbsp;  ".strtoupper($employmentDate)." </td></tr>";
	
	echo "</table>";

echo "</td></td>";
echo "<tr><td><b> <br> </b></td> 					<td colspan='2'>  </td></tr>";
	echo "<tr><td colspan='2'><b> f)  I hereby attest that to the best of my knowledge, the particulars given by me and the applicant here are true and correct.   </b></td> 	</tr>";
	echo "<tr><td><b>  </b></td> 				<td colspan='2' align='center'> <br><br><br><img src='images/line.jpg' width='70%'><br><b> EMPLOYER'S SIGNATURE & DATE </b>	 </td></tr>";
echo "<tr><td><b> <br><br> </b></td> 						<td colspan='2'> </td></tr>";




//9.0 sponsor
$q = "Select * from pci_sponsor where applicant_id='$applicant_idpci'";
$qry2=mysqli_query($con, $q);
$row2=mysqli_fetch_array($qry2);
extract($row2);

echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='3'> <b>9.0 SPONSOR DETAILS</b> </font></td></tr>";
echo "<tr><td colspan='3'><br>";

	echo "<table width='100%' border='1' cellspacing='0'>";
	echo "<tr><td width='40%'><b> &nbsp;  a) SPONSOR'S NIQS MEMBERSHIP NUMBER: </b></td> 	<td colspan='2'> &nbsp;  ".strtoupper($memberNo)." </td></tr>";
	echo "<tr><td><b> &nbsp;  b)  SPONSOR'S FULL NAME: </b></td> 				<td colspan='2'> &nbsp;  ".strtoupper($memberSurname)." ".strtoupper($memberOthernames)." </td></tr>";
	echo "<tr><td><b> &nbsp;  c)  SPONSOR'S EMAIL ADDRESS: </b></td> 			<td colspan='2'> &nbsp;  ".strtoupper($memberEmail)." </td></tr>";
	echo "<tr><td><b> &nbsp;  d)  SPONSOR'S CONTACT ADDRESS: </b></td> 			<td colspan='2'> &nbsp;  ".strtoupper($memberAddress)." </td></tr>";
	echo "<tr><td><b> &nbsp;  e)  SPONSOR'S MEMBERSHIP GRADE: </b></td> 			<td colspan='2'> &nbsp;  ".strtoupper($memberGrade)." </td></tr>";
	echo "<tr><td><b> &nbsp;  f)  SPONSOR'S RESGISTRATION DATE:: </b></td> 			<td colspan='2'> &nbsp;  ".strtoupper($memberRegDate)." </td></tr>";
	
	echo "</table>";

echo "</td></td>";
echo "<tr><td><b> <br> </b></td> 					<td colspan='2'>  </td></tr>";
	echo "<tr><td colspan='2'><b> g) I hereby declare that to the best of my knowledge, the particulars given by me and the applicant here are true and correct.   </b></td> 	</tr>";	
echo "<tr><td><b>  </b></td> 				<td colspan='2' align='center' width='50%'> <br><br><br><img src='images/line.jpg' width='70%'><br><b> SPONSOR'S SIGNATURE & DATE </b>	 </td></tr>";
echo "<tr><td><b> <br><br> </b></td> 						<td colspan='2'> </td></tr>";

//


echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='3'> &nbsp; <b>10.0 APPLICANT'S DECLARATION</b> </font></td></tr>";
echo "<tr><td colspan='2' align='justify'><br>I declare that the particulars given on this form are true and correct and that I will abide by the Rules and Regulations governing the Institute’s Examinations.   <br>";
echo "<p align='justify'>By completing and submitting this application form, you agree to be bound by all existing NIQS Examination Policies, Rules and Guidelines and the rules guiding the ".$regSet." professional examination in particular.</p><br><br></td> 	</tr>";
echo "<tr><td colspan='2'><b>Applicant's Signature.......................................................................... Date..............................................    </b></td> 	</tr>";
echo "<tr><td><b> <br><br> </b></td> 						<td colspan='2'> </td></tr>";
//

echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='3'> &nbsp; <b>11.0 STATE CHAPTER CHAIRMAN/SECRETARY (COMPULSORY) TO BE COMPLETED MANUALLY</b> </font></td></tr>";
echo "<tr><td colspan='3'><br>";

	echo "<table width='100%' border='1' cellspacing='0'>";
	echo "<tr><td height='40px' width='30%'> &nbsp; <b> CHAPTER: </b></td> 	<td colspan='2' > &nbsp; &nbsp;  ".strtoupper($memberChapter)." <br> </td></tr>";
	echo "<tr><td> &nbsp;<b> NAME: </b></td> 	<td colspan='2'> <br><br> </td></tr>";
	echo "<tr><td> &nbsp;<b> NIQS MEMBERSHIP NUMBER: </b></td> 	<td colspan='2'> <br><br> </td></tr>";
	echo "<tr><td> &nbsp;<b> DESIGNATION: </b></td> 	<td colspan='2'> <br><br> </td></tr>";
	echo "<tr><td> &nbsp;<b> PHONE NUMBER: </b></td> 	<td colspan='2'> <br><br> </td></tr>";
	echo "<tr><td> &nbsp;<b> DATE: </b></td> 	<td colspan='2'> <br><br> </td></tr>";
	echo "<tr><td> &nbsp;<b> EMAIL: </b></td> 	<td colspan='2'> <br><br> </td></tr>";
	echo "<tr><td> &nbsp;<b> SIGNATURE: </b></td> 	<td colspan='2'> <br><br> </td></tr>";
	echo "</table>";

echo "</td><tr>";


echo "</table>";
?>
</div>
</body>
</html>

<script>
window.print();
//history.back();
</script>