require_once('mailfunction.php');
require_once('conn.php');
session_start();
function UniversityList ($oldvalue,$conn)
{
$selUniversity = "select GR_UNIVERSITY_NAME , GR_UNIVERSITY_ID from GR_BOARD_UNIVERSITY ORDER BY GR_UB_TYPE DESC, GR_UNIVERSITY_NAME";
$rsUniversity = OCIParse($conn,$selUniversity);
OCIExecute($rsUniversity);
$Select_University = "";
$rowcount = 0;
while(OCIFetchInto($rsUniversity,$mod_row, OCI_ASSOC)) {
if ($rowcount == 0 )
$Select_University = $Select_University . "";
$rowcount++;
$tableValue = $mod_row["GR_UNIVERSITY_ID"];
$tableShow = $mod_row["GR_UNIVERSITY_NAME"];
if ($tableValue == $oldvalue)
$Select_University = $Select_University . "";
else
$Select_University = $Select_University . "";
} // end for
return $Select_University;
} // end function
function DegreeList ($oldvalue,$conn)
{
$selDegree = "select EIS_DEGREE_ID , EIS_NAME from EIS_DEGREE WHERE GBCE_LIST=1 ORDER BY DEGREE_LEVEL, EIS_NAME";
$rsDegree = OCIParse($conn,$selDegree);
OCIExecute($rsDegree);
$Select_Degree = "";
$rowcount = 0;
while(OCIFetchInto($rsDegree,$mod_row, OCI_ASSOC)) {
if ($rowcount == 0 )
$Select_Degree = $Select_Degree . "";
$rowcount++;
$tableValue = $mod_row["EIS_DEGREE_ID"];
$tableShow = $mod_row["EIS_NAME"];
if ($tableValue == $oldvalue)
$Select_Degree = $Select_Degree . "";
else
$Select_Degree = $Select_Degree . "";
} // end for
return $Select_Degree;
} // end function
function GradeList ($oldvalue)
{
$arrGrade[] = "A";
$arrGrade[] = "B";
$arrGrade[] = "C";
$arrGrade[] = "D";
$arrGrade[] = "E";
$arrGrade[] = "F";
$Select_Grade = "";
//$rowcount = 0;
foreach ($arrGrade as $key => $value) {
//if ($rowcount == 0)
// $Select_Grade = $Select_Grade . "";
//$rowcount++;
$tableValue = $value;
$tableShow = $value;
if ($tableValue == $oldvalue)
$Select_Grade = $Select_Grade . "";
else
$Select_Grade = $Select_Grade . "";
} // end for
return $Select_Grade;
} // end function
function DivisionList ($oldvalue)
{
echo $oldvalue;
$arrDivision[] = "First";
$arrDivision[] = "Second";
$arrDivision[] = "Third";
//$arrDivision[] = "Fourth";
$Select_Division = "";
$rowcount = 0;
foreach ($arrDivision as $key => $value) {
if ($rowcount == 0 )
$Select_Division = $Select_Division . "";
$rowcount++;
$tableValue = $value;
$tableShow = $value;
if ($tableValue == $oldvalue)
$Select_Division = $Select_Division . "";
else
$Select_Division = $Select_Division . "";
} // end for
return $Select_Division;
} // end function
function WeekList ($oldvalue)
{
for ($i=1;$i<=60;$i++){
$arrWeek[] = $i;
}
$Select_Week = "";
foreach ($arrWeek as $key => $value) {
$tableValue = $value;
$tableShow = $value;
if ($tableValue == $oldvalue)
$Select_Week = $Select_Week . "";
else
$Select_Week = $Select_Week . "";
} // end for
return $Select_Week;
} // end function
function NatureList ($oldvalue)
{
$arrNature[]="Internee";
$arrNature[]="On Job";
//print_r($arrYears);
$Select_Years = "";
$rowcount = 0;
foreach ($arrNature as $key => $value) {
if ($rowcount == 0)
$Select_Years = $Select_Years . "";
$rowcount++;
$tableValue = $value;
$tableShow = $value;
if ($tableValue == $oldvalue)
$Select_Years = $Select_Years . "";
else
$Select_Years = $Select_Years . "";
} // end for
return $Select_Years;
} // end function
function JobStatus ($oldvalue)
{
$arrJobStatus[] = "Federal Government";
$arrJobStatus[] = "Provincial Government";
$arrJobStatus[] = "Armed Forces";
$arrJobStatus[] = "Semi Government";
$arrJobStatus[] = "Private";
$Select_JobStatus = "";
foreach($arrJobStatus as $key => $value) {
$tableValue = $value;
$tableShow = $value;
if ($tableValue == $oldvalue)
$Select_JobStatus = $Select_JobStatus . "";
else
$Select_JobStatus = $Select_JobStatus . "";
} // end for
return $Select_JobStatus;
} // end function
function JobNature ($oldvalue)
{
$arrJobNature[] = "Permanent";
$arrJobNature[] = "Temporary";
$arrJobNature[] = "Officiating";
$arrJobNature[] = "Contract";
$arrJobNature[] = "Adhoc";
$arrJobNature[] = "Daily Wages";
$arrJobNature[] = "Honorary";
$arrJobNature[] = "Part Time";
$arrJobNature[] = "Apprentice";
$Select_JobNature = "";
foreach ($arrJobNature as $key => $value) {
$tableValue = $value;
$tableShow = $value;
if ($tableValue == $oldvalue)
$Select_JobNature = $Select_JobNature . "";
else
$Select_JobNature = $Select_JobNature . "";
} // end for
return $Select_JobNature;
} // end function
function AgeRelaxArmed($oldvalue)
{
$arrYears[]="Less than 1 year";
$arrYears[]="1 year";
$arrYears[]="2 years";
$arrYears[]="3 years";
$arrYears[]="4 years";
$arrYears[]="5 years";
$arrYears[]="6 years";
$arrYears[]="7 years";
$arrYears[]="8 years";
$arrYears[]="9 years";
$arrYears[]="10 years";
$arrYears[]="11 years";
$arrYears[]="12 years";
$arrYears[]="13 years";
$arrYears[]="14 years";
$arrYears[]="15 years or above";
//print_r($arrYears);
$Select_Years = "";
// $rowcount = 0;
foreach ($arrYears as $key => $value) {
// if ($rowcount == 0)
// $Select_Years = $Select_Years . "\n";
// $rowcount++;
$tableValue = $key;
$tableShow = $value;
if ($tableValue == $oldvalue)
$Select_Years = $Select_Years . "\n";
else
$Select_Years = $Select_Years . "\n";
} // end for
return $Select_Years;
} // end function
function validjobs_ac ($conn)
{
$query = "select distinct t.gr_job_id, t.post_name, t.case_no, t.subject
from gr_phaseiv_2013_ac t
order by t.gr_job_id";
$rjobs = OCIParse($conn,$query);
OCIExecute($rjobs);
$Select_jobs = "";
$Select_jobs = "";
while(OCIFetchInto($rjobs,$mod_row, OCI_ASSOC)) {
$tableValue = $mod_row["GR_JOB_ID"];
$tableShow = $mod_row["CASE_NO"]." [ ".$mod_row["POST_NAME"]." ".$mod_row["SUBJECT"]." ]";
$Select_jobs = $Select_jobs . "";
} // end while
return $Select_jobs;
} // end function
function AgeRelaxGovt($oldvalue)
{
$arrYears[0]="Less than 2 year";
$arrYears[10]="2 years or above";
//print_r($arrYears);
$Select_Years = "";
// $rowcount = 0;
foreach ($arrYears as $key => $value) {
// if ($rowcount == 0)
// $Select_Years = $Select_Years . "\n";
// $rowcount++;
$tableValue = $key;
$tableShow = $value;
if ($tableValue == $oldvalue)
$Select_Years = $Select_Years . "\n";
else
$Select_Years = $Select_Years . "\n";
} // end for
return $Select_Years;
} // end function
function deposit_amount ($amountvalue,$conn)
{
$deposit = "select GR_AMOUNT_ID, GR_AMOUNT from AMOUNT where FLAG=1 ORDER BY GR_AMOUNT";
$depositnew = OCIParse($conn,$deposit);
OCIExecute($depositnew);
$Select_amountnew = "";
$Select_amountnew = "";
while(OCIFetchInto($depositnew,$mod_row, OCI_ASSOC)) {
$tableValue = $mod_row["GR_AMOUNT_ID"];
$tableShow = $mod_row["GR_AMOUNT"];
if ($tableValue == $amountvalue)
$Select_amountnew = $Select_amountnew . "";
else
$Select_amountnew = $Select_amountnew . "";
} // end for
return $Select_amountnew;
} // end function
function districtList_New ($oldvalue,$conn)
{
$seldistrictnew = "select GR_DISTRICT_ID, GR_DISTRICT from DISTRICT where FLAG=1 ORDER BY GR_DISTRICT";
$rsdistrictnew = OCIParse($conn,$seldistrictnew);
OCIExecute($rsdistrictnew);
$Select_districtnew = "";
$Select_districtnew = "";
while(OCIFetchInto($rsdistrictnew,$mod_row, OCI_ASSOC)) {
$tableValue = $mod_row["GR_DISTRICT_ID"];
$tableShow = $mod_row["GR_DISTRICT"];
if ($tableValue == $oldvalue)
$Select_districtnew = $Select_districtnew . "";
else
$Select_districtnew = $Select_districtnew . "";
} // end for
return $Select_districtnew;
} // end function
function districtList ($oldvalue,$conn)
{
$seldistrict = "select GR_DOMICILE_ID,GR_DISTRICT_ID, GR_DISTRICT from DISTRICT ORDER BY GR_DISTRICT";
$rsdistrict = OCIParse($conn,$seldistrict);
OCIExecute($rsdistrict);
$Select_district = "";
while(OCIFetchInto($rsdistrict,$mod_row, OCI_ASSOC)) {
$tableValue = $mod_row["GR_DISTRICT_ID"];
$tableShow = $mod_row["GR_DISTRICT"];
$tableClass = $mod_row["GR_DOMICILE_ID"];
if ($tableValue == $oldvalue)
$Select_district = $Select_district . "";
else
$Select_district = $Select_district . "";
} // end for
return $Select_district;
} // end function
function DomicileList ($oldvalue,$conn)
{
$selDomicile = "select DOMICILE_NAME, DOMICILE_CODE from DOMICILE WHERE FLAG=1 ORDER BY DOMICILE_NAME";
$rsDomicile = OCIParse($conn,$selDomicile);
OCIExecute($rsDomicile);
$Select_Domicile = "";
while(OCIFetchInto($rsDomicile,$mod_row, OCI_ASSOC)) {
$tableValue = $mod_row["DOMICILE_CODE"];
$tableShow = $mod_row["DOMICILE_NAME"];
if ($tableValue == $oldvalue)
$Select_Domicile = $Select_Domicile . "";
else
$Select_Domicile = $Select_Domicile . "";
} // end for
return $Select_Domicile;
} // end function
function GB_DomicileList ($oldvalue,$conn)
{
$selDomicile = "select DOMICILE_NAME, DOMICILE_CODE from DOMICILE WHERE DOMICILE_CODE = 61";
$rsDomicile = OCIParse($conn,$selDomicile);
OCIExecute($rsDomicile);
$Select_Domicile = "";
while(OCIFetchInto($rsDomicile,$mod_row, OCI_ASSOC)) {
$tableValue = $mod_row["DOMICILE_CODE"];
$tableShow = $mod_row["DOMICILE_NAME"];
if ($tableValue == $oldvalue)
$Select_Domicile = $Select_Domicile . "";
else
$Select_Domicile = $Select_Domicile . "";
} // end for
//echo $Select_Domicile; exit;
return $Select_Domicile;
} // end function
function AgeRelaxListnew ($oldvalue,$conn)
{
$selCenter = "select GR_AGE_RELAX_DESC, GR_AGE_RELAX_ID from GR_AGE_RELAX ORDER BY GR_AGE_RELAX_ID";
$rsCenter = OCIParse($conn,$selCenter);
OCIExecute($rsCenter);
$Select_Center = "";
while(OCIFetchInto($rsCenter,$mod_row, OCI_ASSOC)) {
$tableValue = $mod_row["GR_AGE_RELAX_ID"];
$tableShow = $mod_row["GR_AGE_RELAX_DESC"];
if ($tableValue == $oldvalue)
$Select_Center = $Select_Center . "\n";
else
$Select_Center = $Select_Center . "\n";
} // end for
return $Select_Center;
} // end function
function ReligionList ($job_id,$domicile_code,$conn)
{
//Start: To Get Province ID by Domicile Code
$q="select p.gr_province_id from gr_province p, domicile d
where p.gr_province_id=d.prov_id
and d.domicile_code=" . $domicile_code;
$q_parse=OCIParse($conn,$q);
OCIExecute($q_parse);
OCIFetchInto($q_parse,$q_row, OCI_ASSOC);
$province_id= $q_row["GR_PROVINCE_ID"];
//End: To Get Province ID by Domicile Code
//Start: To Get Parent Id for Sub Cases by SE
$query1="select parent_id from gr_job_post where gr_job_id=".$job_id;
$rgender= OCIParse($conn,$query1);
OCIExecute($rgender);
OCIFetchInto($rgender,$mod_row1, OCI_ASSOC);
if($mod_row1['PARENT_ID'])
$job_id = $mod_row1['PARENT_ID'];
else
$job_id = $job_id;
// End: To Get Parent Id for Sub Cases by SE
$selReligion = "select t.gr_eligible_religion from gr_post_calculation t where t.gr_post_id=" . $job_id . " and t.gr_province_id=" . $province_id;
$rsReligion = OCIParse($conn,$selReligion);
OCIExecute($rsReligion);
$Select_Religion = "";
$Select_Religion = "";
OCIFetchInto($rsReligion,$mod_row, OCI_ASSOC);
$tableValue = $mod_row["GR_ELIGIBLE_RELIGION"];
if ($tableValue == "0"){
$Select_Religion = $Select_Religion . "";
}
if ($tableValue == "1"){
$Select_Religion = $Select_Religion . "";
}
return $Select_Religion;
}
function CenterListnew ($oldvalue,$conn)
{
$selCenter = "select CENTER_NAME, CENTER_CODE,CENTER_ID from CENTER where GR_CENTER = 1 ORDER BY Center_NAME";
$rsCenter = OCIParse($conn,$selCenter);
OCIExecute($rsCenter);
$Select_Center = "";
$Select_Center = "";
while(OCIFetchInto($rsCenter,$mod_row, OCI_ASSOC)) {
$tableValue = $mod_row["CENTER_ID"];
$tableShow = $mod_row["CENTER_NAME"];
if ($tableValue == $oldvalue)
$Select_Center = $Select_Center . "\n";
else
$Select_Center = $Select_Center . "\n";
} // end for
return $Select_Center;
}
function InterviewListnew ($oldvalue,$conn)
{
$selCenter = "select CENTER_NAME, CENTER_CODE,CENTER_ID from CENTER where INTERVIEW_CENTER = 1 ORDER BY Center_NAME";
$rsCenter = OCIParse($conn,$selCenter);
OCIExecute($rsCenter);
$Select_Center = "";
$Select_Center = "";
while(OCIFetchInto($rsCenter,$mod_row, OCI_ASSOC)) {
$tableValue = $mod_row["CENTER_ID"];
$tableShow = $mod_row["CENTER_NAME"];
if ($tableValue == $oldvalue)
$Select_Center = $Select_Center . "\n";
else
$Select_Center = $Select_Center . "\n";
} // end for
return $Select_Center;
}
function validjobs ($conn)
{
$query = "select jp.GR_JOB_ID,
'F.4-'||jp.gr_case_no||'/'||trim(to_char(jp.GR_JOB_POST_DATE,'YYYY'))||'-R ['||jp.gr_job_title||']'||js.gr_sub_name as GR_JOB_TITLE
from GR_JOB_POST jp, gr_job_subs js, gr_job_sub_depend jsd
where jp.gr_job_id = jsd.gr_dep_job_id(+)
and jsd.gr_sub_id = js.gr_sub_id(+)
and jp.gr_job_online = 1
and jp.gr_job_id not in (6888,6959)
and GR_ADVERT_ID in(
select GR_ADVERTISEMENT_ID from GR_POST_ADVERTISEMENT where (trunc(SYSDATE) - trunc(CLOSE_DATE)) <= 0)
order by to_number(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(jp.gr_case_no,'A',''),'B',''),'C',''),'D',''),'E',''),'F',''),'G',''),'H',''),'I',''),'J',''),'K',''),'L',''),'M',''),'N',''),'O',''),'P',''),'Q',''),'R',''),'S',''),'T',''),'U',''),'V',''),'W',''),'X',''),'Y',''),'Z',''))
";
/* $query = "select jp.GR_JOB_ID,
'F.4-'||jp.gr_case_no||'/'||trim(to_char(jp.GR_JOB_POST_DATE,'YYYY'))||'-R ['||jp.gr_job_title||']'||js.gr_sub_name as GR_JOB_TITLE
from GR_JOB_POST jp, gr_job_subs js, gr_job_sub_depend jsd
where jp.gr_job_id = jsd.gr_dep_job_id(+)
and jsd.gr_sub_id = js.gr_sub_id(+)
and jp.gr_job_online = 1
and jp.gr_job_id not in (6657,6658,6659,6660,6661,6662,6663)
and GR_ADVERT_ID =2117";
*/
$rjobs = OCIParse($conn,$query);
OCIExecute($rjobs);
$Select_jobs = "";
while(OCIFetchInto($rjobs,$mod_row, OCI_ASSOC)) {
$tableValue = $mod_row["GR_JOB_ID"];
$tableShow = $mod_row["GR_JOB_TITLE"];
$Select_jobs = $Select_jobs . "";
} // end while
return $Select_jobs;
} // end function
function validgender ($job_id,$domicile_code,$conn)
{
//Start: To Get Province ID by Domicile Code
$q_province="select p.gr_province_id from gr_province p, domicile d where p.gr_province_id=d.prov_id and d.domicile_code=" . $domicile_code;
$province_parse=OCIParse($conn,$q_province);
OCIExecute($province_parse);
OCIFetchInto($province_parse,$province_row, OCI_ASSOC);
$province_id= $province_row["GR_PROVINCE_ID"];
//End: To Get Province ID by Domicile Code
//Start: To Get Parent Id for Sub Cases by SE
$query1="select parent_id from gr_job_post where gr_job_id=".$job_id;
$rgender= OCIParse($conn,$query1);
OCIExecute($rgender);
OCIFetchInto($rgender,$mod_row1, OCI_ASSOC);
if($mod_row1['PARENT_ID'])
$job_id = $mod_row1['PARENT_ID'];
else
$job_id = $job_id;
// End: To Get Parent Id for Sub Cases by SE
// job_id & province_id query
$query="select GR_ELIGIBLE_GENDER from gr_post_calculation c where c.gr_post_id=".$job_id . " and c.gr_province_id=".$province_id;
$rgender = OCIParse($conn,$query);
OCIExecute($rgender);
$select_genders = "";
OCIFetchInto($rgender,$mod_row, OCI_ASSOC);
$tableValue = $mod_row["GR_ELIGIBLE_GENDER"];
//print_r($mod_row);
if($tableValue=="0"){
$select_genders.= "";
}
if($tableValue=="1"){
$select_genders.= "";
}
if($tableValue=="2"){
$select_genders.= "";
}
//$select_genders = '";
return $select_genders;
} // end function
/* Old Backup - 25-09-2017
function validgender ($job_id,$conn)
{
$query = "select t.gr_eligible_gender from gr_job_post t where gr_job_id=" . $job_id;
$rgender = OCIParse($conn,$query);
OCIExecute($rgender);
$select_genders="";
OCIFetchInto($rgender,$mod_row, OCI_ASSOC);
$tableValue = $mod_row["GR_ELIGIBLE_GENDER"];
//print_r($mod_row);
if($tableValue=="BOTH"){
$select_genders = "";
}
if($tableValue=="MALE"){
$select_genders = "";
}
if($tableValue=="FEMALE"){
$select_genders = "";
}
$select_genders = '";
return $select_genders;
} // end function
*/
function validdomicile ($job_id,$conn)
{
$query = "select distinct d.domicile_code, d.domicile_name, pr.gr_province_name, t.gr_province_id, jp.northarea from domicile d, gr_post_calculation t, gr_province pr, gr_job_post jp where d.prov_id(+)=pr.gr_province_id and pr.gr_province_id!=3 and pr.gr_province_id=t.gr_province_id and nvl(jp.parent_id,jp.gr_job_id) = t.gr_post_id and t.gr_post_id in(select nvl(parent_id,gr_job_id) from gr_job_post p where gr_post_allocation>0 and p.gr_job_id=" . $job_id . ") order by t.gr_province_id";
$rprovinces = OCIParse($conn,$query);
OCIExecute($rprovinces);
$Select_provinces = "";
while(OCIFetchInto($rprovinces,$mod_row, OCI_ASSOC)) {
if($mod_row["GR_PROVINCE_ID"]==1){
return DomicileList('',$conn);
}
if($mod_row["GR_PROVINCE_ID"]==8 && $mod_row["NORTHAREA"]==1){
return GB_DomicileList('',$conn);
}
$tableValue = $mod_row["DOMICILE_CODE"];
$tableShow = $mod_row["DOMICILE_NAME"];
$Select_provinces = $Select_provinces . "";
} // end for
return $Select_provinces;
} // end function
function new_application($data,$conn){
/*
$sql= "INSERT INTO NEW_GR_APP_PER_EDU (
GR_APPLICANT_ID,
GR_APPLICANT_NAME,
GR_JOB_ID,
GR_DOB,
GR_NEW_NIC,
GR_APPLICANT_EMAIL,
GR_APP_MOBILE
)
VALUES(
SQ_GR_LOGIN_INFORMATION.NEXTVAL,
'$data->gr_applicant_name',
'$data->gr_job_id',
to_date('$data->gr_dob','dd-mm-yyyy'),
'$data->gr_cnic',
'$data->gr_email',
'923335556444')";
//return $sql;
$sql_ins_stmt = OCIParse($conn, $sql);
if (OCIExecute($sql_ins_stmt)) {
return "1";
}else{
return OCIError();
}
*/
$sql= "INSERT INTO NEW_GR_APP (
GR_APPLICANT_ID,
GR_APPLICANT_NAME,
GR_FATHER_NAME,
GR_DOB,
GR_NEW_NIC,
GR_GENDER,
GR_RELIGION,
GR_POSTAL_ADD,
GR_APPLICANT_EMAIL,
GR_APPLICANT_PHONE_OFF,
GR_APP_MOBILE,
GR_AGEREX1,
GR_RELAX_YEARS,
GR_DOMICILE,
GR_DISTRICT_DOMICILE,
GR_DISABILITY,
GR_HELPER,
GR_JOB_ID,
TR_DATE,
GR_AMOUNT,
GR_BANK_BRANCH_NAME,
GR_BANK_CODE,
GR_BANK_DISTRICT,
DATE_APPLIED,
GR_CENTER_ID,
GR_CENTER_NAME,
GR_INTERVIEW_ID,
GR_INTERVIEW_NAME,
GR_REQUIRED_QUALEXP,
GR_RDD,
GR_EXAMINATION_ID1,
GR_EXAMINATION_NAME1,
GR_RESULT_DATE1,
GR_UNIVERSITY_ID1,
GR_UNIVERSITY_NAME1,
GR_BOARD_OTHER1,
GR_GRADE1,
GR_DIVISION1,
GR_CGP1,
GR_MAJOR_COURSE_WORKS1,
GR_EXAMINATION_ID2,
GR_EXAMINATION_NAME2,
GR_RESULT_DATE2,
GR_UNIVERSITY_ID2,
GR_UNIVERSITY_NAME2,
GR_BOARD_OTHER2,
GR_GRADE2,
GR_DIVISION2,
GR_CGP2,
GR_MAJOR_COURSE_WORKS2,
GR_EXAMINATION_ID3,
GR_EXAMINATION_NAME3,
GR_RESULT_DATE3,
GR_UNIVERSITY_ID3,
GR_UNIVERSITY_NAME3,
GR_BOARD_OTHER3,
GR_GRADE3,
GR_DIVISION3,
GR_CGP3,
GR_MAJOR_COURSE_WORKS3,
GR_EXAMINATION_ID4,
GR_EXAMINATION_NAME4,
GR_RESULT_DATE4,
GR_UNIVERSITY_ID4,
GR_UNIVERSITY_NAME4,
GR_BOARD_OTHER4,
GR_GRADE4,
GR_DIVISION4,
GR_CGP4,
GR_MAJOR_COURSE_WORKS4,
GR_EXAMINATION_ID5,
GR_EXAMINATION_NAME5,
GR_RESULT_DATE5,
GR_UNIVERSITY_ID5,
GR_UNIVERSITY_NAME5,
GR_BOARD_OTHER5,
GR_GRADE5,
GR_DIVISION5,
GR_CGP5,
GR_MAJOR_COURSE_WORKS5,
GR_POST_NAME1,
GR_BPS1,
GR_ORGANIZATION_NAME1,
GR_EXP_FROM_DATE1,
GR_EXP_TO_DATE1,
GR_JOB_STATUS1,
GR_JOB_NATURE1,
GR_MAIN_DUTIES1,
GR_POST_NAME2,
GR_BPS2,
GR_ORGANIZATION_NAME2,
GR_EXP_FROM_DATE2,
GR_EXP_TO_DATE2,
GR_JOB_STATUS2,
GR_JOB_NATURE2,
GR_MAIN_DUTIES2,
GR_POST_NAME3,
GR_BPS3,
GR_ORGANIZATION_NAME3,
GR_EXP_FROM_DATE3,
GR_EXP_TO_DATE3,
GR_JOB_STATUS3,
GR_JOB_NATURE3,
GR_MAIN_DUTIES3,
GR_POST_NAME4,
GR_BPS4,
GR_ORGANIZATION_NAME4,
GR_EXP_FROM_DATE4,
GR_EXP_TO_DATE4,
GR_JOB_STATUS4,
GR_JOB_NATURE4,
GR_MAIN_DUTIES4,
GR_POST_NAME5,
GR_BPS5,
GR_ORGANIZATION_NAME5,
GR_EXP_FROM_DATE5,
GR_EXP_TO_DATE5,
GR_JOB_STATUS5,
GR_JOB_NATURE5,
GR_MAIN_DUTIES5,
GR_PHOTO
)
VALUES(
SQ_NEW_GR_APP.NEXTVAL,
trim(upper(:GR_APPLICANT_NAME)),
trim(upper(:GR_FATHER_NAME)),
to_date(:GR_DOB,'dd-mm-yyyy'),
:GR_NEW_NIC,
:GR_GENDER,
:GR_RELIGION,
upper(:GR_POSTAL_ADD1)||', '||upper(:GR_POSTAL_ADD2),
lower(:GR_APPLICANT_EMAIL),
:GR_APPLICANT_PHONE_OFF,
:GR_APP_MOBILE,
upper(:GR_AGEREX1),
:GR_RELAX_YEARS,
upper(:GR_DOMICILE),
upper(:GR_DISTRICT_DOMICILE),
upper(:GR_DISABILITY),
upper(:GR_HELPER),
:GR_JOB_ID,
to_date(:TR_DATE,'dd-mm-yyyy'),
:GR_AMOUNT,
:GR_BANK_BRANCH_NAME,
:GR_BANK_CODE,
:GR_BANK_DISTRICT,
to_date(:DATE_APPLIED,'dd-mm-yyyy hh:mi:ss AM'),
:GR_CENTER_ID,
upper(:GR_CENTER_NAME),
:GR_INTERVIEW_ID,
upper(:GR_INTERVIEW_NAME),
:GR_REQUIRED_QUALEXP,
to_date(:GR_RDD,'dd-mm-yyyy'),
:GR_EXAMINATION_ID1,
:GR_EXAMINATION_NAME1,
to_date(:GR_RESULT_DATE1,'dd-mm-yyyy'),
:GR_UNIVERSITY_ID1,
:GR_UNIVERSITY_NAME1,
:GR_BOARD_OTHER1,
:GR_GRADE1,
:GR_DIVISION1,
:GR_CGP1,
:GR_MAJOR_COURSE_WORKS1,
:GR_EXAMINATION_ID2,
:GR_EXAMINATION_NAME2,
to_date(:GR_RESULT_DATE2,'dd-mm-yyyy'),
:GR_UNIVERSITY_ID2,
:GR_UNIVERSITY_NAME2,
:GR_BOARD_OTHER2,
:GR_GRADE2,
:GR_DIVISION2,
:GR_CGP2,
:GR_MAJOR_COURSE_WORKS2,
:GR_EXAMINATION_ID3,
:GR_EXAMINATION_NAME3,
to_date(:GR_RESULT_DATE3,'dd-mm-yyyy'),
:GR_UNIVERSITY_ID3,
:GR_UNIVERSITY_NAME3,
:GR_BOARD_OTHER3,
:GR_GRADE3,
:GR_DIVISION3,
:GR_CGP3,
:GR_MAJOR_COURSE_WORKS3,
:GR_EXAMINATION_ID4,
:GR_EXAMINATION_NAME4,
to_date(:GR_RESULT_DATE4,'dd-mm-yyyy'),
:GR_UNIVERSITY_ID4,
:GR_UNIVERSITY_NAME4,
:GR_BOARD_OTHER4,
:GR_GRADE4,
:GR_DIVISION4,
:GR_CGP4,
:GR_MAJOR_COURSE_WORKS4,
:GR_EXAMINATION_ID5,
:GR_EXAMINATION_NAME5,
to_date(:GR_RESULT_DATE5,'dd-mm-yyyy'),
:GR_UNIVERSITY_ID5,
:GR_UNIVERSITY_NAME5,
:GR_BOARD_OTHER5,
:GR_GRADE5,
:GR_DIVISION5,
:GR_CGP5,
:GR_MAJOR_COURSE_WORKS5,
:GR_POST_NAME1,
:GR_BPS1,
:GR_ORGANIZATION_NAME1,
to_date(:GR_EXP_FROM_DATE1,'dd-mm-yyyy'),
to_date(:GR_EXP_TO_DATE1,'dd-mm-yyyy'),
:GR_JOB_STATUS1,
:GR_JOB_NATURE1,
:GR_MAIN_DUTIES1,
:GR_POST_NAME2,
:GR_BPS2,
:GR_ORGANIZATION_NAME2,
to_date(:GR_EXP_FROM_DATE2,'dd-mm-yyyy'),
to_date(:GR_EXP_TO_DATE2,'dd-mm-yyyy'),
:GR_JOB_STATUS2,
:GR_JOB_NATURE2,
:GR_MAIN_DUTIES2,
:GR_POST_NAME3,
:GR_BPS3,
:GR_ORGANIZATION_NAME3,
to_date(:GR_EXP_FROM_DATE3,'dd-mm-yyyy'),
to_date(:GR_EXP_TO_DATE3,'dd-mm-yyyy'),
:GR_JOB_STATUS3,
:GR_JOB_NATURE3,
:GR_MAIN_DUTIES3,
:GR_POST_NAME4,
:GR_BPS4,
:GR_ORGANIZATION_NAME4,
to_date(:GR_EXP_FROM_DATE4,'dd-mm-yyyy'),
to_date(:GR_EXP_TO_DATE4,'dd-mm-yyyy'),
:GR_JOB_STATUS4,
:GR_JOB_NATURE4,
:GR_MAIN_DUTIES4,
:GR_POST_NAME5,
:GR_BPS5,
:GR_ORGANIZATION_NAME5,
to_date(:GR_EXP_FROM_DATE5,'dd-mm-yyyy'),
to_date(:GR_EXP_TO_DATE5,'dd-mm-yyyy'),
:GR_JOB_STATUS5,
:GR_JOB_NATURE5,
:GR_MAIN_DUTIES5,
EMPTY_BLOB()
) returning GR_PHOTO ,GR_APPLICANT_ID INTO :GR_PHOTO, :GR_APPLICANT_ID";
$lob = OCINewDescriptor($conn, OCI_D_LOB);
$stid = ociparse($conn, $sql);
//$mobile_num=03+str_replace(substr($data->gr_mobile,strpos($data->gr_mobile,'3')),'-','');
//echo $data->gr_helper."----".$data->gr_disability;
$mobile_num='92'.str_replace('-','',substr($data->gr_mobile,strpos($data->gr_mobile,'3')));
$current_date=date('d-m-Y h:i:s A');
//var_dump($data);exit;
//print_r($data);exit;
$GR_APPLICANT_ID="-1";
OCIBindByName($stid, ':GR_PHOTO', $lob, -1, OCI_B_BLOB);
OCIBindByName($stid, ':GR_APPLICANT_ID', $GR_APPLICANT_ID, 32);
//echo "---".$data->gr_education[0]->degree_text; exit;
ocibindbyname($stid, ':GR_APPLICANT_NAME', $data->gr_applicant_name);
ocibindbyname($stid, ':GR_FATHER_NAME', $data->gr_father_name);
ocibindbyname($stid, ':GR_DOB', $data->gr_dob);
ocibindbyname($stid, ':GR_NEW_NIC', $data->gr_cnic);
ocibindbyname($stid, ':GR_GENDER', $data->gr_gender);
ocibindbyname($stid, ':GR_RELIGION', $data->gr_religion);
ocibindbyname($stid, ':GR_POSTAL_ADD1', $data->gr_postal_adress1);
ocibindbyname($stid, ':GR_POSTAL_ADD2', $data->gr_postal_adress2);
ocibindbyname($stid, ':GR_APPLICANT_EMAIL', $data->gr_email);
ocibindbyname($stid, ':GR_APPLICANT_PHONE_OFF', $data->gr_phone_off);
ocibindbyname($stid, ':GR_APP_MOBILE', $mobile_num);
ocibindbyname($stid, ':GR_AGEREX1', $data->gr_age_relaxation);
ocibindbyname($stid, ':GR_RELAX_YEARS', $data->gr_relaxation_years);
ocibindbyname($stid, ':GR_DOMICILE', $data->gr_domicile);
ocibindbyname($stid, ':GR_DISTRICT_DOMICILE', $data->gr_district);
ocibindbyname($stid, ':GR_DISABILITY', $data->gr_disability);
ocibindbyname($stid, ':GR_HELPER', $data->gr_helper);
ocibindbyname($stid, ':GR_JOB_ID', $data->gr_job_id);
ocibindbyname($stid, ':TR_DATE', $data->gr_TR_Date);
ocibindbyname($stid, ':GR_AMOUNT', $data->gr_TR_Amount);
ocibindbyname($stid, ':GR_BANK_BRANCH_NAME', $data->gr_TR_Bank_Branch_Name);
ocibindbyname($stid, ':GR_BANK_CODE', $data->gr_TR_Bank_Code);
ocibindbyname($stid, ':GR_BANK_DISTRICT', $data->gr_TR_Bank_District);
ocibindbyname($stid, ':DATE_APPLIED', $current_date);
ocibindbyname($stid, ':GR_CENTER_ID', $data->gr_test_centre);
ocibindbyname($stid, ':GR_CENTER_NAME', $data->gr_test_centre_name);
ocibindbyname($stid, ':GR_INTERVIEW_ID', $data->gr_interview_centre);
ocibindbyname($stid, ':GR_INTERVIEW_NAME', $data->gr_interview_centre_name);
ocibindbyname($stid, ':GR_RDD', $data->gr_RDD);
ocibindbyname($stid, ':GR_REQUIRED_QUALEXP', $data->gr_REQUIRED_QUALEXP);
ocibindbyname($stid, ':GR_EXAMINATION_ID1', $data->gr_education[0]->degree);
ocibindbyname($stid, ':GR_EXAMINATION_NAME1', $data->gr_education[0]->degree_name);
ocibindbyname($stid, ':GR_RESULT_DATE1', $data->gr_education[0]->result_date);
ocibindbyname($stid, ':GR_UNIVERSITY_ID1', $data->gr_education[0]->institute);
ocibindbyname($stid, ':GR_UNIVERSITY_NAME1', $data->gr_education[0]->institute_name);
ocibindbyname($stid, ':GR_BOARD_OTHER1', $data->gr_education[0]->other_institute);
ocibindbyname($stid, ':GR_GRADE1', $data->gr_education[0]->grade);
ocibindbyname($stid, ':GR_DIVISION1', $data->gr_education[0]->division);
ocibindbyname($stid, ':GR_CGP1', $data->gr_education[0]->cgpa);
ocibindbyname($stid, ':GR_MAJOR_COURSE_WORKS1', $data->gr_education[0]->major_subjects);
ocibindbyname($stid, ':GR_EXAMINATION_ID2', $data->gr_education[1]->degree);
ocibindbyname($stid, ':GR_EXAMINATION_NAME2', $data->gr_education[1]->degree_name);
ocibindbyname($stid, ':GR_RESULT_DATE2', $data->gr_education[1]->result_date);
ocibindbyname($stid, ':GR_UNIVERSITY_ID2', $data->gr_education[1]->institute);
ocibindbyname($stid, ':GR_UNIVERSITY_NAME2', $data->gr_education[1]->institute_name);
ocibindbyname($stid, ':GR_BOARD_OTHER2', $data->gr_education[1]->other_institute);
ocibindbyname($stid, ':GR_GRADE2', $data->gr_education[1]->grade);
ocibindbyname($stid, ':GR_DIVISION2', $data->gr_education[1]->division);
ocibindbyname($stid, ':GR_CGP2', $data->gr_education[1]->cgpa);
ocibindbyname($stid, ':GR_MAJOR_COURSE_WORKS2', $data->gr_education[1]->major_subjects);
ocibindbyname($stid, ':GR_EXAMINATION_ID3', $data->gr_education[2]->degree);
ocibindbyname($stid, ':GR_EXAMINATION_NAME3', $data->gr_education[2]->degree_name);
ocibindbyname($stid, ':GR_RESULT_DATE3', $data->gr_education[2]->result_date);
ocibindbyname($stid, ':GR_UNIVERSITY_ID3', $data->gr_education[2]->institute);
ocibindbyname($stid, ':GR_UNIVERSITY_NAME3', $data->gr_education[2]->institute_name);
ocibindbyname($stid, ':GR_BOARD_OTHER3', $data->gr_education[2]->other_institute);
ocibindbyname($stid, ':GR_GRADE3', $data->gr_education[2]->grade);
ocibindbyname($stid, ':GR_DIVISION3', $data->gr_education[2]->division);
ocibindbyname($stid, ':GR_CGP3', $data->gr_education[2]->cgpa);
ocibindbyname($stid, ':GR_MAJOR_COURSE_WORKS3', $data->gr_education[2]->major_subjects);
ocibindbyname($stid, ':GR_EXAMINATION_ID4', $data->gr_education[3]->degree);
ocibindbyname($stid, ':GR_EXAMINATION_NAME4', $data->gr_education[3]->degree_name);
ocibindbyname($stid, ':GR_RESULT_DATE4', $data->gr_education[3]->result_date);
ocibindbyname($stid, ':GR_UNIVERSITY_ID4', $data->gr_education[3]->institute);
ocibindbyname($stid, ':GR_UNIVERSITY_NAME4', $data->gr_education[3]->institute_name);
ocibindbyname($stid, ':GR_BOARD_OTHER4', $data->gr_education[3]->other_institute);
ocibindbyname($stid, ':GR_GRADE4', $data->gr_education[3]->grade);
ocibindbyname($stid, ':GR_DIVISION4', $data->gr_education[3]->division);
ocibindbyname($stid, ':GR_CGP4', $data->gr_education[3]->cgpa);
ocibindbyname($stid, ':GR_MAJOR_COURSE_WORKS4', $data->gr_education[3]->major_subjects);
ocibindbyname($stid, ':GR_EXAMINATION_ID5', $data->gr_education[4]->degree);
ocibindbyname($stid, ':GR_EXAMINATION_NAME5', $data->gr_education[4]->degree_name);
ocibindbyname($stid, ':GR_RESULT_DATE5', $data->gr_education[4]->result_date);
ocibindbyname($stid, ':GR_UNIVERSITY_ID5', $data->gr_education[4]->institute);
ocibindbyname($stid, ':GR_UNIVERSITY_NAME5', $data->gr_education[4]->institute_name);
ocibindbyname($stid, ':GR_BOARD_OTHER5', $data->gr_education[4]->other_institute);
ocibindbyname($stid, ':GR_GRADE5', $data->gr_education[4]->grade);
ocibindbyname($stid, ':GR_DIVISION5', $data->gr_education[4]->division);
ocibindbyname($stid, ':GR_CGP5', $data->gr_education[4]->cgpa);
ocibindbyname($stid, ':GR_MAJOR_COURSE_WORKS5', $data->gr_education[4]->major_subjects);
ocibindbyname($stid, ':GR_POST_NAME1', $data->gr_experience[0]->experience_post);
ocibindbyname($stid, ':GR_BPS1', $data->gr_experience[0]->experience_BS);
ocibindbyname($stid, ':GR_ORGANIZATION_NAME1', $data->gr_experience[0]->experience_OMDD);
ocibindbyname($stid, ':GR_EXP_FROM_DATE1', $data->gr_experience[0]->experience_fdate);
ocibindbyname($stid, ':GR_EXP_TO_DATE1', $data->gr_experience[0]->experience_tdate);
ocibindbyname($stid, ':GR_JOB_STATUS1', $data->gr_experience[0]->experience_status);
ocibindbyname($stid, ':GR_JOB_NATURE1', $data->gr_experience[0]->experience_nature);
ocibindbyname($stid, ':GR_MAIN_DUTIES1', $data->gr_experience[0]->experience_duties);
ocibindbyname($stid, ':GR_POST_NAME2', $data->gr_experience[1]->experience_post);
ocibindbyname($stid, ':GR_BPS2', $data->gr_experience[1]->experience_BS);
ocibindbyname($stid, ':GR_ORGANIZATION_NAME2', $data->gr_experience[1]->experience_OMDD);
ocibindbyname($stid, ':GR_EXP_FROM_DATE2', $data->gr_experience[1]->experience_fdate);
ocibindbyname($stid, ':GR_EXP_TO_DATE2', $data->gr_experience[1]->experience_tdate);
ocibindbyname($stid, ':GR_JOB_STATUS2', $data->gr_experience[1]->experience_status);
ocibindbyname($stid, ':GR_JOB_NATURE2', $data->gr_experience[1]->experience_nature);
ocibindbyname($stid, ':GR_MAIN_DUTIES2', $data->gr_experience[1]->experience_duties);
ocibindbyname($stid, ':GR_POST_NAME3', $data->gr_experience[2]->experience_post);
ocibindbyname($stid, ':GR_BPS3', $data->gr_experience[2]->experience_BS);
ocibindbyname($stid, ':GR_ORGANIZATION_NAME3', $data->gr_experience[2]->experience_OMDD);
ocibindbyname($stid, ':GR_EXP_FROM_DATE3', $data->gr_experience[2]->experience_fdate);
ocibindbyname($stid, ':GR_EXP_TO_DATE3', $data->gr_experience[2]->experience_tdate);
ocibindbyname($stid, ':GR_JOB_STATUS3', $data->gr_experience[2]->experience_status);
ocibindbyname($stid, ':GR_JOB_NATURE3', $data->gr_experience[2]->experience_nature);
ocibindbyname($stid, ':GR_MAIN_DUTIES3', $data->gr_experience[2]->experience_duties);
ocibindbyname($stid, ':GR_POST_NAME4', $data->gr_experience[3]->experience_post);
ocibindbyname($stid, ':GR_BPS4', $data->gr_experience[3]->experience_BS);
ocibindbyname($stid, ':GR_ORGANIZATION_NAME4', $data->gr_experience[3]->experience_OMDD);
ocibindbyname($stid, ':GR_EXP_FROM_DATE4', $data->gr_experience[3]->experience_fdate);
ocibindbyname($stid, ':GR_EXP_TO_DATE4', $data->gr_experience[3]->experience_tdate);
ocibindbyname($stid, ':GR_JOB_STATUS4', $data->gr_experience[3]->experience_status);
ocibindbyname($stid, ':GR_JOB_NATURE4', $data->gr_experience[3]->experience_nature);
ocibindbyname($stid, ':GR_MAIN_DUTIES4', $data->gr_experience[3]->experience_duties);
ocibindbyname($stid, ':GR_POST_NAME5', $data->gr_experience[4]->experience_post);
ocibindbyname($stid, ':GR_BPS5', $data->gr_experience[4]->experience_BS);
ocibindbyname($stid, ':GR_ORGANIZATION_NAME5', $data->gr_experience[4]->experience_OMDD);
ocibindbyname($stid, ':GR_EXP_FROM_DATE5', $data->gr_experience[4]->experience_fdate);
ocibindbyname($stid, ':GR_EXP_TO_DATE5', $data->gr_experience[4]->experience_tdate);
ocibindbyname($stid, ':GR_JOB_STATUS5', $data->gr_experience[4]->experience_status);
ocibindbyname($stid, ':GR_JOB_NATURE5', $data->gr_experience[4]->experience_nature);
ocibindbyname($stid, ':GR_MAIN_DUTIES5', $data->gr_experience[4]->experience_duties);
$_SESSION['cnic']=$data->gr_cnic;
$_SESSION['job']=$data->gr_job_id;
session_write_close();
$r = OCIExecute($stid, OCI_DEFAULT);
if($data->gr_picture_path!=""){
if ($lob->savefile($data->gr_picture_path)){
OCICommit($conn);
}
}else{OCICommit($conn);}
if ($r) {
// sms code
$sql_sms_app="select t.gr_applicant_id, t.gr_app_mobile, s.case_no, s.job_title, t.gr_center_name
from new_gr_app t, gr_job_cache s
where t.gr_job_id=s.gr_job_id
and t.gr_applicant_id = $GR_APPLICANT_ID";
//echo $sql_sms;
$rs_sms_app=OCIParse($conn,$sql_sms_app);
OCIExecute($rs_sms_app);
OCIFetchInto($rs_sms_app,$rs_sms_data_app,OCI_ASSOC);
$sms_track_id_app=$rs_sms_data_app["GR_APPLICANT_ID"];
$sms_mobile_app=$rs_sms_data_app["GR_APP_MOBILE"];
$sms_case_no_app=$rs_sms_data_app["CASE_NO"];
$sms_job_title_app=$rs_sms_data_app["JOB_TITLE"];
$sms_gr_center_app=$rs_sms_data_app["GR_CENTER_NAME"];
//SendJobSMS(); // Should be commented as following code is directly embedded
$response = file_get_contents('http://bsms.ufone.com/bsms_app5/sendapi.jsp?id=03343912571&message=Your%20Application%20for%20'.urlencode($sms_case_no_app).'%20'.urlencode($sms_job_title_app).'%20received.%20Application%20Tracking%20ID='.urlencode($sms_track_id_app).'%20You%20opted%20test%20center%20at%20'.urlencode($sms_gr_center_app).'&shortcode=FPSC&lang=English&mobilenum='.urlencode($sms_mobile_app).'&password=745896');
smtpmailer($data->gr_email, 'noreply@fpsc.gov.pk', 'webmanagerfpsc@fpsc.gov.pk', 'FPSC', 'FPSC ONLINE RECRUITMENT SYSTEM', "Your Application has been received in $data->gr_job_name , Your tracking id is $GR_APPLICANT_ID
Important Notice: No hard copy of your application, documents or Bank Challan/Treasury Receipt is required to be sent to FPSC at this stage. The Bank Challan/Treasury Receipt should be preserved and presented at time of test/examination.
Note: This is system generated e-mail. Please do not reply.
Important Notice: No hard copy of your application, documents or Bank Challan/Treasury Receipt is required to be sent to FPSC at this stage. The Bank Challan/Treasury Receipt should be preserved and presented at time of test/examination.
Note: This is system generated e-mail. Please do not reply.
Federal Public Service Commission, Islamabad");
OCIFreeStatement($stid);
return $GR_APPLICANT_ID;
}else{
return OCIError();
}
$lob->free();
OCIFreeStatement($stid);
}
/* Debarred candidate check Implemented from Advertisement No. 01/2015
*/
function check_debarred_application($cnic, $job_id, $conn){
$check_deb_status="select count(*) as CNT
from debarred_candidates
where cnic ='$cnic'";
$check_deb_rs = OCIParse($conn, $check_deb_status);
OCIExecute($check_deb_rs);
OCIFetchInto($check_deb_rs,$cnt_deb_row, OCI_ASSOC);
if ($cnt_deb_row["CNT"] > 0) //If any debarred candidate found then return "2" as debarred candidate status
{
return "2";
}else{
$dup=check_duplicate_application($cnic, $job_id,$conn); // Check for existing application with the same CNIC
return $dup;
}
OCIFreeStatement($check_deb_rs);
}
function check_duplicate_application($cnic, $job_id,$conn){
$check_job_status="select count(gr_applicant_id) as CNT
from new_gr_app
where gr_new_nic ='$cnic'
and gr_job_id =$job_id";
//echo $check_job_status; exit;
$check_job_rs = OCIParse($conn, $check_job_status);
OCIExecute($check_job_rs);
OCIFetchInto($check_job_rs,$cnt_row, OCI_ASSOC);
if ($cnt_row["CNT"] > 0)
{
return "1";
}else{
return "0";
}
OCIFreeStatement($check_job_rs);
}
function check_withindate_application($job_id,$conn){
$check_job_status="select count(*) as CNTAPP
from GR_JOB_POST jp
where jp.gr_job_id = $job_id
and GR_ADVERT_ID in(
select GR_ADVERTISEMENT_ID from GR_POST_ADVERTISEMENT where (trunc(SYSDATE) - trunc(CLOSE_DATE)) <= 0)";
//echo $check_job_status; exit;
$check_job_rs = OCIParse($conn, $check_job_status);
OCIExecute($check_job_rs);
OCIFetchInto($check_job_rs,$cnt_row, OCI_ASSOC);
if ($cnt_row["CNTAPP"] > 0)
{
return "1";
}else{
return "0";
}
OCIFreeStatement($check_job_rs);
}
//:: Method For Edit GR Application ::
function valid_domicile($job_id,$domicelcode,$conn)
{
$query = "select distinct d.domicile_code, d.domicile_name, pr.gr_province_name, t.gr_province_id, jp.northarea from domicile d, gr_post_calculation t, gr_province pr, gr_job_post jp where d.prov_id(+)=pr.gr_province_id and pr.gr_province_id!=3 and pr.gr_province_id=t.gr_province_id and nvl(jp.parent_id,jp.gr_job_id) = t.gr_post_id and t.gr_post_id in(select nvl(parent_id,gr_job_id) from gr_job_post p where gr_post_allocation>0 and p.gr_job_id=" . $job_id . ") order by t.gr_province_id";
$rprovinces = OCIParse($conn,$query);
OCIExecute($rprovinces);
$Select_provinces = "";
while(OCIFetchInto($rprovinces,$mod_row, OCI_ASSOC)) {
if($mod_row["GR_PROVINCE_ID"]==1){
return DomicileList('',$conn);
}
if($mod_row["GR_PROVINCE_ID"]==8 && $mod_row["NORTHAREA"]==1){
return GB_DomicileList('',$conn);
}
$tableValue = $mod_row["DOMICILE_CODE"];
$tableShow = $mod_row["DOMICILE_NAME"];
if($tableValue == $domicelcode)
$Select_provinces = $Select_provinces . "";
else
$Select_provinces = $Select_provinces . "";
} // end for
return $Select_provinces;
} // end function
/*
function update_edits($query,$conn)
{
$parse = OCIParse($conn,$query);
OCIExecute($parse);
}*/
function check_no_of_edits($data,$conn){
//Check number of edits after and before the closing of advertisement
$query ="select to_date(to_char(pa.close_date,'dd-mm-yyyy'),'DD-MM-YYYY')+1 - to_date(to_char(sysdate,'dd-mm-yyyy'),'dd-mm-yyyy') as DATE_DIFF,
ap.edits_before_closing,ap.edits_after_closing
from gr_post_advertisement pa , gr_job_post jp,new_gr_app ap
where pa.gr_advertisement_id=jp.gr_advert_id
and ap.gr_job_id=jp.gr_job_id and jp.gr_job_id=".$data->gr_job_id."
and ap.gr_applicant_id=".$data->gr_applicant_id ;
$parse = OCIParse($conn,$query);
OCIExecute($parse);
$date_diff = -1;
$edits_before_closing=-1;
$edits_after_closing=-1;
while(OCIFetchInto($parse,$mod_row, OCI_ASSOC)) {
$date_diff=$mod_row["DATE_DIFF"];
$edits_before_closing=$mod_row["EDITS_BEFORE_CLOSING"];
$edits_after_closing=$mod_row["EDITS_AFTER_CLOSING"];
}
$rslts=array('date_diff'=>$date_diff,'edits_before_closing'=>$edits_before_closing,'edits_after_closing'=>$edits_after_closing);
return $rslts;
}
function check_no_of_edits_by_nic($cnic,$tracking_id,$conn){
//Check number of edits after and before the closing of advertisement
$query ="select to_date(to_char(pa.close_date,'dd-mm-yyyy'),'DD-MM-YYYY')+1 - to_date(to_char(sysdate,'dd-mm-yyyy'),'dd-mm-yyyy') as DATE_DIFF,
ap.edits_before_closing,ap.edits_after_closing
from gr_post_advertisement pa , gr_job_post jp,new_gr_app ap
where pa.gr_advertisement_id=jp.gr_advert_id
and ap.gr_job_id=jp.gr_job_id and ap.gr_new_nic='".$cnic."'
and ap.gr_applicant_id=".$tracking_id ;
$parse = OCIParse($conn,$query);
OCIExecute($parse);
$date_diff = -1;
$edits_before_closing=-1;
$edits_after_closing=-1;
while(OCIFetchInto($parse,$mod_row, OCI_ASSOC)) {
$date_diff=$mod_row["DATE_DIFF"];
$edits_before_closing=$mod_row["EDITS_BEFORE_CLOSING"];
$edits_after_closing=$mod_row["EDITS_AFTER_CLOSING"];
}
$rslts=array('date_diff'=>$date_diff,'edits_before_closing'=>$edits_before_closing,'edits_after_closing'=>$edits_after_closing);
return $rslts;
}
function update_application($data,$conn){
$edits_array =check_no_of_edits($data,$conn);
$date_diff=$edits_array['date_diff'];
$edits_before_closing=$edits_array['edits_before_closing'];
$edits_after_closing=$edits_array['edits_after_closing'];
$returnVal="";
/* || ($date_diff<0 && $edits_after_closing==0) this will allow edit after closing date
if(($date_diff>=0 && $edits_before_closing==0) || ($date_diff<0 && $edits_after_closing==0))
*/
if($date_diff>=0 && $edits_before_closing==0)
{
if($data->gr_picture_path!=""){
$returnVal=update_app_with_pic($data,$conn,$date_diff,$edits_before_closing,$edits_after_closing);
}
else
{
$returnVal= update_app_pic_from_db($data,$conn,$date_diff,$edits_before_closing,$edits_after_closing);
}
}
else
{
$returnVal= "You have updated application maximum number of allowed times";
}
/*
//Update Edits
$query="";
if(($date_diff>=0 && $edits_before_closing==0))
$query ="update new_gr_app a set a.edits_before_closing=a.edits_before_closing+1 where a.gr_applicant_id=".$data->gr_applicant_id ;
if(($date_diff<0 && $edits_after_closing==0))
$query ="update new_gr_app a set a.edits_after_closing=a.edits_after_closing+1 where a.gr_applicant_id=".$data->gr_applicant_id ;
if($query!="")
update_edits($query,$conn);
*/
return $returnVal;
}
function update_app_with_pic($data,$conn,$date_diff,$edits_before_closing,$edits_after_closing){
$sql= "INSERT INTO NEW_GR_APP_UPDATE (
GR_APPLICANT_ID,
GR_APPLICANT_NAME,
GR_FATHER_NAME,
GR_DOB,
GR_NEW_NIC,
GR_GENDER,
GR_RELIGION,
GR_POSTAL_ADD,
GR_APPLICANT_EMAIL,
GR_APPLICANT_PHONE_OFF,
GR_APP_MOBILE,
GR_AGEREX1,
GR_RELAX_YEARS,
GR_DOMICILE,
GR_DISTRICT_DOMICILE,
GR_DISABILITY,
GR_HELPER,
GR_JOB_ID,
TR_DATE,
GR_AMOUNT,
GR_BANK_BRANCH_NAME,
GR_BANK_CODE,
GR_BANK_DISTRICT,
DATE_APPLIED,
GR_CENTER_ID,
GR_CENTER_NAME,
GR_INTERVIEW_ID,
GR_INTERVIEW_NAME,
GR_REQUIRED_QUALEXP,
GR_RDD,
GR_EXAMINATION_ID1,
GR_EXAMINATION_NAME1,
GR_RESULT_DATE1,
GR_UNIVERSITY_ID1,
GR_UNIVERSITY_NAME1,
GR_BOARD_OTHER1,
GR_GRADE1,
GR_DIVISION1,
GR_CGP1,
GR_MAJOR_COURSE_WORKS1,
GR_EXAMINATION_ID2,
GR_EXAMINATION_NAME2,
GR_RESULT_DATE2,
GR_UNIVERSITY_ID2,
GR_UNIVERSITY_NAME2,
GR_BOARD_OTHER2,
GR_GRADE2,
GR_DIVISION2,
GR_CGP2,
GR_MAJOR_COURSE_WORKS2,
GR_EXAMINATION_ID3,
GR_EXAMINATION_NAME3,
GR_RESULT_DATE3,
GR_UNIVERSITY_ID3,
GR_UNIVERSITY_NAME3,
GR_BOARD_OTHER3,
GR_GRADE3,
GR_DIVISION3,
GR_CGP3,
GR_MAJOR_COURSE_WORKS3,
GR_EXAMINATION_ID4,
GR_EXAMINATION_NAME4,
GR_RESULT_DATE4,
GR_UNIVERSITY_ID4,
GR_UNIVERSITY_NAME4,
GR_BOARD_OTHER4,
GR_GRADE4,
GR_DIVISION4,
GR_CGP4,
GR_MAJOR_COURSE_WORKS4,
GR_EXAMINATION_ID5,
GR_EXAMINATION_NAME5,
GR_RESULT_DATE5,
GR_UNIVERSITY_ID5,
GR_UNIVERSITY_NAME5,
GR_BOARD_OTHER5,
GR_GRADE5,
GR_DIVISION5,
GR_CGP5,
GR_MAJOR_COURSE_WORKS5,
GR_POST_NAME1,
GR_BPS1,
GR_ORGANIZATION_NAME1,
GR_EXP_FROM_DATE1,
GR_EXP_TO_DATE1,
GR_JOB_STATUS1,
GR_JOB_NATURE1,
GR_MAIN_DUTIES1,
GR_POST_NAME2,
GR_BPS2,
GR_ORGANIZATION_NAME2,
GR_EXP_FROM_DATE2,
GR_EXP_TO_DATE2,
GR_JOB_STATUS2,
GR_JOB_NATURE2,
GR_MAIN_DUTIES2,
GR_POST_NAME3,
GR_BPS3,
GR_ORGANIZATION_NAME3,
GR_EXP_FROM_DATE3,
GR_EXP_TO_DATE3,
GR_JOB_STATUS3,
GR_JOB_NATURE3,
GR_MAIN_DUTIES3,
GR_POST_NAME4,
GR_BPS4,
GR_ORGANIZATION_NAME4,
GR_EXP_FROM_DATE4,
GR_EXP_TO_DATE4,
GR_JOB_STATUS4,
GR_JOB_NATURE4,
GR_MAIN_DUTIES4,
GR_POST_NAME5,
GR_BPS5,
GR_ORGANIZATION_NAME5,
GR_EXP_FROM_DATE5,
GR_EXP_TO_DATE5,
GR_JOB_STATUS5,
GR_JOB_NATURE5,
GR_MAIN_DUTIES5,
GR_PHOTO
)
VALUES(
:GR_APPLICANT_ID,
trim(upper(:GR_APPLICANT_NAME)),
trim(upper(:GR_FATHER_NAME)),
to_date(:GR_DOB,'dd-mm-yyyy'),
:GR_NEW_NIC,
:GR_GENDER,
:GR_RELIGION,
upper(:GR_POSTAL_ADD1)||', '||upper(:GR_POSTAL_ADD2),
lower(:GR_APPLICANT_EMAIL),
:GR_APPLICANT_PHONE_OFF,
:GR_APP_MOBILE,
upper(:GR_AGEREX1),
:GR_RELAX_YEARS,
upper(:GR_DOMICILE),
upper(:GR_DISTRICT_DOMICILE),
upper(:GR_DISABILITY),
upper(:GR_HELPER),
:GR_JOB_ID,
to_date(:TR_DATE,'dd-mm-yyyy'),
:GR_AMOUNT,
:GR_BANK_BRANCH_NAME,
:GR_BANK_CODE,
:GR_BANK_DISTRICT,
to_date(:DATE_APPLIED,'dd-mm-yyyy hh:mi:ss AM'),
:GR_CENTER_ID,
upper(:GR_CENTER_NAME),
:GR_INTERVIEW_ID,
upper(:GR_INTERVIEW_NAME),
:GR_REQUIRED_QUALEXP,
to_date(:GR_RDD,'dd-mm-yyyy'),
:GR_EXAMINATION_ID1,
:GR_EXAMINATION_NAME1,
to_date(:GR_RESULT_DATE1,'dd-mm-yyyy'),
:GR_UNIVERSITY_ID1,
:GR_UNIVERSITY_NAME1,
:GR_BOARD_OTHER1,
:GR_GRADE1,
:GR_DIVISION1,
:GR_CGP1,
:GR_MAJOR_COURSE_WORKS1,
:GR_EXAMINATION_ID2,
:GR_EXAMINATION_NAME2,
to_date(:GR_RESULT_DATE2,'dd-mm-yyyy'),
:GR_UNIVERSITY_ID2,
:GR_UNIVERSITY_NAME2,
:GR_BOARD_OTHER2,
:GR_GRADE2,
:GR_DIVISION2,
:GR_CGP2,
:GR_MAJOR_COURSE_WORKS2,
:GR_EXAMINATION_ID3,
:GR_EXAMINATION_NAME3,
to_date(:GR_RESULT_DATE3,'dd-mm-yyyy'),
:GR_UNIVERSITY_ID3,
:GR_UNIVERSITY_NAME3,
:GR_BOARD_OTHER3,
:GR_GRADE3,
:GR_DIVISION3,
:GR_CGP3,
:GR_MAJOR_COURSE_WORKS3,
:GR_EXAMINATION_ID4,
:GR_EXAMINATION_NAME4,
to_date(:GR_RESULT_DATE4,'dd-mm-yyyy'),
:GR_UNIVERSITY_ID4,
:GR_UNIVERSITY_NAME4,
:GR_BOARD_OTHER4,
:GR_GRADE4,
:GR_DIVISION4,
:GR_CGP4,
:GR_MAJOR_COURSE_WORKS4,
:GR_EXAMINATION_ID5,
:GR_EXAMINATION_NAME5,
to_date(:GR_RESULT_DATE5,'dd-mm-yyyy'),
:GR_UNIVERSITY_ID5,
:GR_UNIVERSITY_NAME5,
:GR_BOARD_OTHER5,
:GR_GRADE5,
:GR_DIVISION5,
:GR_CGP5,
:GR_MAJOR_COURSE_WORKS5,
:GR_POST_NAME1,
:GR_BPS1,
:GR_ORGANIZATION_NAME1,
to_date(:GR_EXP_FROM_DATE1,'dd-mm-yyyy'),
to_date(:GR_EXP_TO_DATE1,'dd-mm-yyyy'),
:GR_JOB_STATUS1,
:GR_JOB_NATURE1,
:GR_MAIN_DUTIES1,
:GR_POST_NAME2,
:GR_BPS2,
:GR_ORGANIZATION_NAME2,
to_date(:GR_EXP_FROM_DATE2,'dd-mm-yyyy'),
to_date(:GR_EXP_TO_DATE2,'dd-mm-yyyy'),
:GR_JOB_STATUS2,
:GR_JOB_NATURE2,
:GR_MAIN_DUTIES2,
:GR_POST_NAME3,
:GR_BPS3,
:GR_ORGANIZATION_NAME3,
to_date(:GR_EXP_FROM_DATE3,'dd-mm-yyyy'),
to_date(:GR_EXP_TO_DATE3,'dd-mm-yyyy'),
:GR_JOB_STATUS3,
:GR_JOB_NATURE3,
:GR_MAIN_DUTIES3,
:GR_POST_NAME4,
:GR_BPS4,
:GR_ORGANIZATION_NAME4,
to_date(:GR_EXP_FROM_DATE4,'dd-mm-yyyy'),
to_date(:GR_EXP_TO_DATE4,'dd-mm-yyyy'),
:GR_JOB_STATUS4,
:GR_JOB_NATURE4,
:GR_MAIN_DUTIES4,
:GR_POST_NAME5,
:GR_BPS5,
:GR_ORGANIZATION_NAME5,
to_date(:GR_EXP_FROM_DATE5,'dd-mm-yyyy'),
to_date(:GR_EXP_TO_DATE5,'dd-mm-yyyy'),
:GR_JOB_STATUS5,
:GR_JOB_NATURE5,
:GR_MAIN_DUTIES5,
EMPTY_BLOB()
) returning GR_PHOTO ,GR_APPLICANT_ID INTO :GR_PHOTO, :GR_APPLICANT_ID";
$lob = OCINewDescriptor($conn, OCI_D_LOB);
$stid = ociparse($conn, $sql);
//$mobile_num=03+str_replace(substr($data->gr_mobile,strpos($data->gr_mobile,'3')),'-','');
//echo $data->gr_helper."----".$data->gr_disability;
$mobile_num='92'.str_replace('-','',substr($data->gr_mobile,strpos($data->gr_mobile,'3')));
$current_date=date('d-m-Y h:i:s A');
//var_dump($data);exit;
//print_r($data);exit;
$GR_APPLICANT_ID=$data->gr_applicant_id;
OCIBindByName($stid, ':GR_PHOTO', $lob, -1, OCI_B_BLOB);
OCIBindByName($stid, ':GR_APPLICANT_ID', $data->gr_applicant_id, 32);
//echo "---".$data->gr_education[0]->degree_text; exit;
ocibindbyname($stid, ':GR_APPLICANT_NAME', $data->gr_applicant_name);
ocibindbyname($stid, ':GR_FATHER_NAME', $data->gr_father_name);
ocibindbyname($stid, ':GR_DOB', $data->gr_dob);
ocibindbyname($stid, ':GR_NEW_NIC', $data->gr_cnic);
ocibindbyname($stid, ':GR_GENDER', $data->gr_gender);
ocibindbyname($stid, ':GR_RELIGION', $data->gr_religion);
ocibindbyname($stid, ':GR_POSTAL_ADD1', $data->gr_postal_adress1);
ocibindbyname($stid, ':GR_POSTAL_ADD2', $data->gr_postal_adress2);
ocibindbyname($stid, ':GR_APPLICANT_EMAIL', $data->gr_email);
ocibindbyname($stid, ':GR_APPLICANT_PHONE_OFF', $data->gr_phone_off);
ocibindbyname($stid, ':GR_APP_MOBILE', $mobile_num);
ocibindbyname($stid, ':GR_AGEREX1', $data->gr_age_relaxation);
ocibindbyname($stid, ':GR_RELAX_YEARS', $data->gr_relaxation_years);
ocibindbyname($stid, ':GR_DOMICILE', $data->gr_domicile);
ocibindbyname($stid, ':GR_DISTRICT_DOMICILE', $data->gr_district);
ocibindbyname($stid, ':GR_DISABILITY', $data->gr_disability);
ocibindbyname($stid, ':GR_HELPER', $data->gr_helper);
ocibindbyname($stid, ':GR_JOB_ID', $data->gr_job_id);
ocibindbyname($stid, ':TR_DATE', $data->gr_TR_Date);
ocibindbyname($stid, ':GR_AMOUNT', $data->gr_TR_Amount);
ocibindbyname($stid, ':GR_BANK_BRANCH_NAME', $data->gr_TR_Bank_Branch_Name);
ocibindbyname($stid, ':GR_BANK_CODE', $data->gr_TR_Bank_Code);
ocibindbyname($stid, ':GR_BANK_DISTRICT', $data->gr_TR_Bank_District);
ocibindbyname($stid, ':DATE_APPLIED', $current_date);
ocibindbyname($stid, ':GR_CENTER_ID', $data->gr_test_centre);
ocibindbyname($stid, ':GR_CENTER_NAME', $data->gr_test_centre_name);
ocibindbyname($stid, ':GR_INTERVIEW_ID', $data->gr_interview_centre);
ocibindbyname($stid, ':GR_INTERVIEW_NAME', $data->gr_interview_centre_name);
ocibindbyname($stid, ':GR_RDD', $data->gr_RDD);
ocibindbyname($stid, ':GR_REQUIRED_QUALEXP', $data->gr_REQUIRED_QUALEXP);
ocibindbyname($stid, ':GR_EXAMINATION_ID1', $data->gr_education[0]->degree);
ocibindbyname($stid, ':GR_EXAMINATION_NAME1', $data->gr_education[0]->degree_name);
ocibindbyname($stid, ':GR_RESULT_DATE1', $data->gr_education[0]->result_date);
ocibindbyname($stid, ':GR_UNIVERSITY_ID1', $data->gr_education[0]->institute);
ocibindbyname($stid, ':GR_UNIVERSITY_NAME1', $data->gr_education[0]->institute_name);
ocibindbyname($stid, ':GR_BOARD_OTHER1', $data->gr_education[0]->other_institute);
ocibindbyname($stid, ':GR_GRADE1', $data->gr_education[0]->grade);
ocibindbyname($stid, ':GR_DIVISION1', $data->gr_education[0]->division);
ocibindbyname($stid, ':GR_CGP1', $data->gr_education[0]->cgpa);
ocibindbyname($stid, ':GR_MAJOR_COURSE_WORKS1', $data->gr_education[0]->major_subjects);
ocibindbyname($stid, ':GR_EXAMINATION_ID2', $data->gr_education[1]->degree);
ocibindbyname($stid, ':GR_EXAMINATION_NAME2', $data->gr_education[1]->degree_name);
ocibindbyname($stid, ':GR_RESULT_DATE2', $data->gr_education[1]->result_date);
ocibindbyname($stid, ':GR_UNIVERSITY_ID2', $data->gr_education[1]->institute);
ocibindbyname($stid, ':GR_UNIVERSITY_NAME2', $data->gr_education[1]->institute_name);
ocibindbyname($stid, ':GR_BOARD_OTHER2', $data->gr_education[1]->other_institute);
ocibindbyname($stid, ':GR_GRADE2', $data->gr_education[1]->grade);
ocibindbyname($stid, ':GR_DIVISION2', $data->gr_education[1]->division);
ocibindbyname($stid, ':GR_CGP2', $data->gr_education[1]->cgpa);
ocibindbyname($stid, ':GR_MAJOR_COURSE_WORKS2', $data->gr_education[1]->major_subjects);
ocibindbyname($stid, ':GR_EXAMINATION_ID3', $data->gr_education[2]->degree);
ocibindbyname($stid, ':GR_EXAMINATION_NAME3', $data->gr_education[2]->degree_name);
ocibindbyname($stid, ':GR_RESULT_DATE3', $data->gr_education[2]->result_date);
ocibindbyname($stid, ':GR_UNIVERSITY_ID3', $data->gr_education[2]->institute);
ocibindbyname($stid, ':GR_UNIVERSITY_NAME3', $data->gr_education[2]->institute_name);
ocibindbyname($stid, ':GR_BOARD_OTHER3', $data->gr_education[2]->other_institute);
ocibindbyname($stid, ':GR_GRADE3', $data->gr_education[2]->grade);
ocibindbyname($stid, ':GR_DIVISION3', $data->gr_education[2]->division);
ocibindbyname($stid, ':GR_CGP3', $data->gr_education[2]->cgpa);
ocibindbyname($stid, ':GR_MAJOR_COURSE_WORKS3', $data->gr_education[2]->major_subjects);
ocibindbyname($stid, ':GR_EXAMINATION_ID4', $data->gr_education[3]->degree);
ocibindbyname($stid, ':GR_EXAMINATION_NAME4', $data->gr_education[3]->degree_name);
ocibindbyname($stid, ':GR_RESULT_DATE4', $data->gr_education[3]->result_date);
ocibindbyname($stid, ':GR_UNIVERSITY_ID4', $data->gr_education[3]->institute);
ocibindbyname($stid, ':GR_UNIVERSITY_NAME4', $data->gr_education[3]->institute_name);
ocibindbyname($stid, ':GR_BOARD_OTHER4', $data->gr_education[3]->other_institute);
ocibindbyname($stid, ':GR_GRADE4', $data->gr_education[3]->grade);
ocibindbyname($stid, ':GR_DIVISION4', $data->gr_education[3]->division);
ocibindbyname($stid, ':GR_CGP4', $data->gr_education[3]->cgpa);
ocibindbyname($stid, ':GR_MAJOR_COURSE_WORKS4', $data->gr_education[3]->major_subjects);
ocibindbyname($stid, ':GR_EXAMINATION_ID5', $data->gr_education[4]->degree);
ocibindbyname($stid, ':GR_EXAMINATION_NAME5', $data->gr_education[4]->degree_name);
ocibindbyname($stid, ':GR_RESULT_DATE5', $data->gr_education[4]->result_date);
ocibindbyname($stid, ':GR_UNIVERSITY_ID5', $data->gr_education[4]->institute);
ocibindbyname($stid, ':GR_UNIVERSITY_NAME5', $data->gr_education[4]->institute_name);
ocibindbyname($stid, ':GR_BOARD_OTHER5', $data->gr_education[4]->other_institute);
ocibindbyname($stid, ':GR_GRADE5', $data->gr_education[4]->grade);
ocibindbyname($stid, ':GR_DIVISION5', $data->gr_education[4]->division);
ocibindbyname($stid, ':GR_CGP5', $data->gr_education[4]->cgpa);
ocibindbyname($stid, ':GR_MAJOR_COURSE_WORKS5', $data->gr_education[4]->major_subjects);
ocibindbyname($stid, ':GR_POST_NAME1', $data->gr_experience[0]->experience_post);
ocibindbyname($stid, ':GR_BPS1', $data->gr_experience[0]->experience_BS);
ocibindbyname($stid, ':GR_ORGANIZATION_NAME1', $data->gr_experience[0]->experience_OMDD);
ocibindbyname($stid, ':GR_EXP_FROM_DATE1', $data->gr_experience[0]->experience_fdate);
ocibindbyname($stid, ':GR_EXP_TO_DATE1', $data->gr_experience[0]->experience_tdate);
ocibindbyname($stid, ':GR_JOB_STATUS1', $data->gr_experience[0]->experience_status);
ocibindbyname($stid, ':GR_JOB_NATURE1', $data->gr_experience[0]->experience_nature);
ocibindbyname($stid, ':GR_MAIN_DUTIES1', $data->gr_experience[0]->experience_duties);
ocibindbyname($stid, ':GR_POST_NAME2', $data->gr_experience[1]->experience_post);
ocibindbyname($stid, ':GR_BPS2', $data->gr_experience[1]->experience_BS);
ocibindbyname($stid, ':GR_ORGANIZATION_NAME2', $data->gr_experience[1]->experience_OMDD);
ocibindbyname($stid, ':GR_EXP_FROM_DATE2', $data->gr_experience[1]->experience_fdate);
ocibindbyname($stid, ':GR_EXP_TO_DATE2', $data->gr_experience[1]->experience_tdate);
ocibindbyname($stid, ':GR_JOB_STATUS2', $data->gr_experience[1]->experience_status);
ocibindbyname($stid, ':GR_JOB_NATURE2', $data->gr_experience[1]->experience_nature);
ocibindbyname($stid, ':GR_MAIN_DUTIES2', $data->gr_experience[1]->experience_duties);
ocibindbyname($stid, ':GR_POST_NAME3', $data->gr_experience[2]->experience_post);
ocibindbyname($stid, ':GR_BPS3', $data->gr_experience[2]->experience_BS);
ocibindbyname($stid, ':GR_ORGANIZATION_NAME3', $data->gr_experience[2]->experience_OMDD);
ocibindbyname($stid, ':GR_EXP_FROM_DATE3', $data->gr_experience[2]->experience_fdate);
ocibindbyname($stid, ':GR_EXP_TO_DATE3', $data->gr_experience[2]->experience_tdate);
ocibindbyname($stid, ':GR_JOB_STATUS3', $data->gr_experience[2]->experience_status);
ocibindbyname($stid, ':GR_JOB_NATURE3', $data->gr_experience[2]->experience_nature);
ocibindbyname($stid, ':GR_MAIN_DUTIES3', $data->gr_experience[2]->experience_duties);
ocibindbyname($stid, ':GR_POST_NAME4', $data->gr_experience[3]->experience_post);
ocibindbyname($stid, ':GR_BPS4', $data->gr_experience[3]->experience_BS);
ocibindbyname($stid, ':GR_ORGANIZATION_NAME4', $data->gr_experience[3]->experience_OMDD);
ocibindbyname($stid, ':GR_EXP_FROM_DATE4', $data->gr_experience[3]->experience_fdate);
ocibindbyname($stid, ':GR_EXP_TO_DATE4', $data->gr_experience[3]->experience_tdate);
ocibindbyname($stid, ':GR_JOB_STATUS4', $data->gr_experience[3]->experience_status);
ocibindbyname($stid, ':GR_JOB_NATURE4', $data->gr_experience[3]->experience_nature);
ocibindbyname($stid, ':GR_MAIN_DUTIES4', $data->gr_experience[3]->experience_duties);
ocibindbyname($stid, ':GR_POST_NAME5', $data->gr_experience[4]->experience_post);
ocibindbyname($stid, ':GR_BPS5', $data->gr_experience[4]->experience_BS);
ocibindbyname($stid, ':GR_ORGANIZATION_NAME5', $data->gr_experience[4]->experience_OMDD);
ocibindbyname($stid, ':GR_EXP_FROM_DATE5', $data->gr_experience[4]->experience_fdate);
ocibindbyname($stid, ':GR_EXP_TO_DATE5', $data->gr_experience[4]->experience_tdate);
ocibindbyname($stid, ':GR_JOB_STATUS5', $data->gr_experience[4]->experience_status);
ocibindbyname($stid, ':GR_JOB_NATURE5', $data->gr_experience[4]->experience_nature);
ocibindbyname($stid, ':GR_MAIN_DUTIES5', $data->gr_experience[4]->experience_duties);
$_SESSION['cnic']=$data->gr_cnic;
$_SESSION['job']=$data->gr_job_id;
session_write_close();
$r = OCIExecute($stid, OCI_NO_AUTO_COMMIT);
if($data->gr_picture_path!=""){
$lob->savefile($data->gr_picture_path);
}
/* Start : For updating no of edits*/
$query="";
if(($date_diff>=0 && $edits_before_closing==0))
$query ="update new_gr_app a set a.edits_before_closing=a.edits_before_closing+1 where a.gr_applicant_id=".$data->gr_applicant_id ;
if(($date_diff<0 && $edits_after_closing==0))
$query ="update new_gr_app a set a.edits_after_closing=a.edits_after_closing+1 where a.gr_applicant_id=".$data->gr_applicant_id ;
if($query!=""){
$stid = oci_parse($conn, $query);
$r = OCIExecute($stid, OCI_NO_AUTO_COMMIT);
}
/* End : For updating no of edits*/
if($r)
{
OCICommit($conn);
$lob->free();
OCIFreeStatement($stid);
// sms code
$sql_sms="select t.gr_applicant_id, t.gr_app_mobile, s.case_no, s.job_title, t.gr_center_name
from new_gr_app_update t, gr_job_cache s
where t.gr_job_id=s.gr_job_id
and t.gr_applicant_id = $GR_APPLICANT_ID";
//echo $sql_sms;
$rs_sms=OCIParse($conn,$sql_sms);
OCIExecute($rs_sms);
OCIFetchInto($rs_sms,$rs_sms_data,OCI_ASSOC);
$sms_track_id=$rs_sms_data["GR_APPLICANT_ID"];
$sms_mobile=$rs_sms_data["GR_APP_MOBILE"];
$sms_case_no=$rs_sms_data["CASE_NO"];
$sms_job_title=$rs_sms_data["JOB_TITLE"];
$sms_job_center=$rs_sms_data["GR_CENTER_NAME"];
//SendJobSMS(); // Should be commented as following code is directly embedded
$response = file_get_contents('http://bsms.ufone.com/bsms_app5/sendapi.jsp?id=03343912571&message=Your%20Application%20for%20'.urlencode($sms_case_no).'%20'.urlencode($sms_job_title).'%20updated%20successfully%20against%20tracking%20ID%20'.urlencode($sms_track_id).'%20Your%20opted%20test%20center%20is%20'.urlencode($sms_job_center).'&shortcode=FPSC&lang=English&mobilenum='.urlencode($sms_mobile).'&password=745896');
return $GR_APPLICANT_ID;
}
else
{
oci_rollback($conn);
$lob->free();
OCIFreeStatement($stid);
return oci_error($stid);
}
}
function update_app_pic_from_db($data,$conn,$date_diff,$edits_before_closing,$edits_after_closing){
$sql_update= "INSERT INTO NEW_GR_APP_UPDATE (
GR_APPLICANT_ID,
GR_APPLICANT_NAME,
GR_FATHER_NAME,
GR_DOB,
GR_NEW_NIC,
GR_GENDER,
GR_RELIGION,
GR_POSTAL_ADD,
GR_APPLICANT_EMAIL,
GR_APPLICANT_PHONE_OFF,
GR_APP_MOBILE,
GR_AGEREX1,
GR_RELAX_YEARS,
GR_DOMICILE,
GR_DISTRICT_DOMICILE,
GR_DISABILITY,
GR_HELPER,
GR_JOB_ID,
TR_DATE,
GR_AMOUNT,
GR_BANK_BRANCH_NAME,
GR_BANK_CODE,
GR_BANK_DISTRICT,
DATE_APPLIED,
GR_CENTER_ID,
GR_CENTER_NAME,
GR_INTERVIEW_ID,
GR_INTERVIEW_NAME,
GR_REQUIRED_QUALEXP,
GR_RDD,
GR_EXAMINATION_ID1,
GR_EXAMINATION_NAME1,
GR_RESULT_DATE1,
GR_UNIVERSITY_ID1,
GR_UNIVERSITY_NAME1,
GR_BOARD_OTHER1,
GR_GRADE1,
GR_DIVISION1,
GR_CGP1,
GR_MAJOR_COURSE_WORKS1,
GR_EXAMINATION_ID2,
GR_EXAMINATION_NAME2,
GR_RESULT_DATE2,
GR_UNIVERSITY_ID2,
GR_UNIVERSITY_NAME2,
GR_BOARD_OTHER2,
GR_GRADE2,
GR_DIVISION2,
GR_CGP2,
GR_MAJOR_COURSE_WORKS2,
GR_EXAMINATION_ID3,
GR_EXAMINATION_NAME3,
GR_RESULT_DATE3,
GR_UNIVERSITY_ID3,
GR_UNIVERSITY_NAME3,
GR_BOARD_OTHER3,
GR_GRADE3,
GR_DIVISION3,
GR_CGP3,
GR_MAJOR_COURSE_WORKS3,
GR_EXAMINATION_ID4,
GR_EXAMINATION_NAME4,
GR_RESULT_DATE4,
GR_UNIVERSITY_ID4,
GR_UNIVERSITY_NAME4,
GR_BOARD_OTHER4,
GR_GRADE4,
GR_DIVISION4,
GR_CGP4,
GR_MAJOR_COURSE_WORKS4,
GR_EXAMINATION_ID5,
GR_EXAMINATION_NAME5,
GR_RESULT_DATE5,
GR_UNIVERSITY_ID5,
GR_UNIVERSITY_NAME5,
GR_BOARD_OTHER5,
GR_GRADE5,
GR_DIVISION5,
GR_CGP5,
GR_MAJOR_COURSE_WORKS5,
GR_POST_NAME1,
GR_BPS1,
GR_ORGANIZATION_NAME1,
GR_EXP_FROM_DATE1,
GR_EXP_TO_DATE1,
GR_JOB_STATUS1,
GR_JOB_NATURE1,
GR_MAIN_DUTIES1,
GR_POST_NAME2,
GR_BPS2,
GR_ORGANIZATION_NAME2,
GR_EXP_FROM_DATE2,
GR_EXP_TO_DATE2,
GR_JOB_STATUS2,
GR_JOB_NATURE2,
GR_MAIN_DUTIES2,
GR_POST_NAME3,
GR_BPS3,
GR_ORGANIZATION_NAME3,
GR_EXP_FROM_DATE3,
GR_EXP_TO_DATE3,
GR_JOB_STATUS3,
GR_JOB_NATURE3,
GR_MAIN_DUTIES3,
GR_POST_NAME4,
GR_BPS4,
GR_ORGANIZATION_NAME4,
GR_EXP_FROM_DATE4,
GR_EXP_TO_DATE4,
GR_JOB_STATUS4,
GR_JOB_NATURE4,
GR_MAIN_DUTIES4,
GR_POST_NAME5,
GR_BPS5,
GR_ORGANIZATION_NAME5,
GR_EXP_FROM_DATE5,
GR_EXP_TO_DATE5,
GR_JOB_STATUS5,
GR_JOB_NATURE5,
GR_MAIN_DUTIES5,
GR_PHOTO
)
VALUES(
:GR_APPLICANT_ID,
trim(upper(:GR_APPLICANT_NAME)),
trim(upper(:GR_FATHER_NAME)),
to_date(:GR_DOB,'dd-mm-yyyy'),
:GR_NEW_NIC,
:GR_GENDER,
:GR_RELIGION,
upper(:GR_POSTAL_ADD1)||', '||upper(:GR_POSTAL_ADD2),
lower(:GR_APPLICANT_EMAIL),
:GR_APPLICANT_PHONE_OFF,
:GR_APP_MOBILE,
upper(:GR_AGEREX1),
:GR_RELAX_YEARS,
upper(:GR_DOMICILE),
upper(:GR_DISTRICT_DOMICILE),
upper(:GR_DISABILITY),
upper(:GR_HELPER),
:GR_JOB_ID,
to_date(:TR_DATE,'dd-mm-yyyy'),
:GR_AMOUNT,
:GR_BANK_BRANCH_NAME,
:GR_BANK_CODE,
:GR_BANK_DISTRICT,
to_date(:DATE_APPLIED,'dd-mm-yyyy hh:mi:ss AM'),
:GR_CENTER_ID,
upper(:GR_CENTER_NAME),
:GR_INTERVIEW_ID,
upper(:GR_INTERVIEW_NAME),
:GR_REQUIRED_QUALEXP,
to_date(:GR_RDD,'dd-mm-yyyy'),
:GR_EXAMINATION_ID1,
:GR_EXAMINATION_NAME1,
to_date(:GR_RESULT_DATE1,'dd-mm-yyyy'),
:GR_UNIVERSITY_ID1,
:GR_UNIVERSITY_NAME1,
:GR_BOARD_OTHER1,
:GR_GRADE1,
:GR_DIVISION1,
:GR_CGP1,
:GR_MAJOR_COURSE_WORKS1,
:GR_EXAMINATION_ID2,
:GR_EXAMINATION_NAME2,
to_date(:GR_RESULT_DATE2,'dd-mm-yyyy'),
:GR_UNIVERSITY_ID2,
:GR_UNIVERSITY_NAME2,
:GR_BOARD_OTHER2,
:GR_GRADE2,
:GR_DIVISION2,
:GR_CGP2,
:GR_MAJOR_COURSE_WORKS2,
:GR_EXAMINATION_ID3,
:GR_EXAMINATION_NAME3,
to_date(:GR_RESULT_DATE3,'dd-mm-yyyy'),
:GR_UNIVERSITY_ID3,
:GR_UNIVERSITY_NAME3,
:GR_BOARD_OTHER3,
:GR_GRADE3,
:GR_DIVISION3,
:GR_CGP3,
:GR_MAJOR_COURSE_WORKS3,
:GR_EXAMINATION_ID4,
:GR_EXAMINATION_NAME4,
to_date(:GR_RESULT_DATE4,'dd-mm-yyyy'),
:GR_UNIVERSITY_ID4,
:GR_UNIVERSITY_NAME4,
:GR_BOARD_OTHER4,
:GR_GRADE4,
:GR_DIVISION4,
:GR_CGP4,
:GR_MAJOR_COURSE_WORKS4,
:GR_EXAMINATION_ID5,
:GR_EXAMINATION_NAME5,
to_date(:GR_RESULT_DATE5,'dd-mm-yyyy'),
:GR_UNIVERSITY_ID5,
:GR_UNIVERSITY_NAME5,
:GR_BOARD_OTHER5,
:GR_GRADE5,
:GR_DIVISION5,
:GR_CGP5,
:GR_MAJOR_COURSE_WORKS5,
:GR_POST_NAME1,
:GR_BPS1,
:GR_ORGANIZATION_NAME1,
to_date(:GR_EXP_FROM_DATE1,'dd-mm-yyyy'),
to_date(:GR_EXP_TO_DATE1,'dd-mm-yyyy'),
:GR_JOB_STATUS1,
:GR_JOB_NATURE1,
:GR_MAIN_DUTIES1,
:GR_POST_NAME2,
:GR_BPS2,
:GR_ORGANIZATION_NAME2,
to_date(:GR_EXP_FROM_DATE2,'dd-mm-yyyy'),
to_date(:GR_EXP_TO_DATE2,'dd-mm-yyyy'),
:GR_JOB_STATUS2,
:GR_JOB_NATURE2,
:GR_MAIN_DUTIES2,
:GR_POST_NAME3,
:GR_BPS3,
:GR_ORGANIZATION_NAME3,
to_date(:GR_EXP_FROM_DATE3,'dd-mm-yyyy'),
to_date(:GR_EXP_TO_DATE3,'dd-mm-yyyy'),
:GR_JOB_STATUS3,
:GR_JOB_NATURE3,
:GR_MAIN_DUTIES3,
:GR_POST_NAME4,
:GR_BPS4,
:GR_ORGANIZATION_NAME4,
to_date(:GR_EXP_FROM_DATE4,'dd-mm-yyyy'),
to_date(:GR_EXP_TO_DATE4,'dd-mm-yyyy'),
:GR_JOB_STATUS4,
:GR_JOB_NATURE4,
:GR_MAIN_DUTIES4,
:GR_POST_NAME5,
:GR_BPS5,
:GR_ORGANIZATION_NAME5,
to_date(:GR_EXP_FROM_DATE5,'dd-mm-yyyy'),
to_date(:GR_EXP_TO_DATE5,'dd-mm-yyyy'),
:GR_JOB_STATUS5,
:GR_JOB_NATURE5,
:GR_MAIN_DUTIES5,
(select case when
exists(
(
select aa.gr_photo
from new_gr_app_update aa where aa.gr_applicant_id=".$data->gr_applicant_id."
and aa.date_applied=(select max(aaa.date_applied) from new_gr_app_update aaa where aaa.gr_applicant_id=".$data->gr_applicant_id." )
)
)
then (
select aa.gr_photo
from new_gr_app_update aa where aa.gr_applicant_id=".$data->gr_applicant_id."
and aa.date_applied=(select max(aaa.date_applied) from new_gr_app_update aaa where aaa.gr_applicant_id=".$data->gr_applicant_id." )
) else
(select gr_photo from new_gr_app aa where aa.gr_applicant_id=".$data->gr_applicant_id.")
end
from dual)
) returning GR_APPLICANT_ID INTO :GR_APPLICANT_ID";
$stid = ociparse($conn, $sql_update);
//$mobile_num=92+str_replace(substr($data->gr_mobile,strpos($data->gr_mobile,'3')),'-','');
//echo $data->gr_helper."----".$data->gr_disability;
$mobile_num='92'.str_replace('-','',substr($data->gr_mobile,strpos($data->gr_mobile,'3')));
$current_date=date('d-m-Y h:i:s A');
$GR_APPLICANT_ID=$data->gr_applicant_id;
OCIBindByName($stid, ':GR_APPLICANT_ID', $data->gr_applicant_id, 32);
ocibindbyname($stid, ':GR_APPLICANT_NAME', $data->gr_applicant_name);
ocibindbyname($stid, ':GR_FATHER_NAME', $data->gr_father_name);
ocibindbyname($stid, ':GR_DOB', $data->gr_dob);
ocibindbyname($stid, ':GR_NEW_NIC', $data->gr_cnic);
ocibindbyname($stid, ':GR_GENDER', $data->gr_gender);
ocibindbyname($stid, ':GR_RELIGION', $data->gr_religion);
ocibindbyname($stid, ':GR_POSTAL_ADD1', $data->gr_postal_adress1);
ocibindbyname($stid, ':GR_POSTAL_ADD2', $data->gr_postal_adress2);
ocibindbyname($stid, ':GR_APPLICANT_EMAIL', $data->gr_email);
ocibindbyname($stid, ':GR_APPLICANT_PHONE_OFF', $data->gr_phone_off);
ocibindbyname($stid, ':GR_APP_MOBILE', $mobile_num);
ocibindbyname($stid, ':GR_AGEREX1', $data->gr_age_relaxation);
ocibindbyname($stid, ':GR_RELAX_YEARS', $data->gr_relaxation_years);
ocibindbyname($stid, ':GR_DOMICILE', $data->gr_domicile);
ocibindbyname($stid, ':GR_DISTRICT_DOMICILE', $data->gr_district);
ocibindbyname($stid, ':GR_DISABILITY', $data->gr_disability);
ocibindbyname($stid, ':GR_HELPER', $data->gr_helper);
ocibindbyname($stid, ':GR_JOB_ID', $data->gr_job_id);
ocibindbyname($stid, ':TR_DATE', $data->gr_TR_Date);
ocibindbyname($stid, ':GR_AMOUNT', $data->gr_TR_Amount);
ocibindbyname($stid, ':GR_BANK_BRANCH_NAME', $data->gr_TR_Bank_Branch_Name);
ocibindbyname($stid, ':GR_BANK_CODE', $data->gr_TR_Bank_Code);
ocibindbyname($stid, ':GR_BANK_DISTRICT', $data->gr_TR_Bank_District);
ocibindbyname($stid, ':DATE_APPLIED', $current_date);
ocibindbyname($stid, ':GR_CENTER_ID', $data->gr_test_centre);
ocibindbyname($stid, ':GR_CENTER_NAME', $data->gr_test_centre_name);
ocibindbyname($stid, ':GR_INTERVIEW_ID', $data->gr_interview_centre);
ocibindbyname($stid, ':GR_INTERVIEW_NAME', $data->gr_interview_centre_name);
ocibindbyname($stid, ':GR_RDD', $data->gr_RDD);
ocibindbyname($stid, ':GR_REQUIRED_QUALEXP', $data->gr_REQUIRED_QUALEXP);
ocibindbyname($stid, ':GR_EXAMINATION_ID1', $data->gr_education[0]->degree);
ocibindbyname($stid, ':GR_EXAMINATION_NAME1', $data->gr_education[0]->degree_name);
ocibindbyname($stid, ':GR_RESULT_DATE1', $data->gr_education[0]->result_date);
ocibindbyname($stid, ':GR_UNIVERSITY_ID1', $data->gr_education[0]->institute);
ocibindbyname($stid, ':GR_UNIVERSITY_NAME1', $data->gr_education[0]->institute_name);
ocibindbyname($stid, ':GR_BOARD_OTHER1', $data->gr_education[0]->other_institute);
ocibindbyname($stid, ':GR_GRADE1', $data->gr_education[0]->grade);
ocibindbyname($stid, ':GR_DIVISION1', $data->gr_education[0]->division);
ocibindbyname($stid, ':GR_CGP1', $data->gr_education[0]->cgpa);
ocibindbyname($stid, ':GR_MAJOR_COURSE_WORKS1', $data->gr_education[0]->major_subjects);
ocibindbyname($stid, ':GR_EXAMINATION_ID2', $data->gr_education[1]->degree);
ocibindbyname($stid, ':GR_EXAMINATION_NAME2', $data->gr_education[1]->degree_name);
ocibindbyname($stid, ':GR_RESULT_DATE2', $data->gr_education[1]->result_date);
ocibindbyname($stid, ':GR_UNIVERSITY_ID2', $data->gr_education[1]->institute);
ocibindbyname($stid, ':GR_UNIVERSITY_NAME2', $data->gr_education[1]->institute_name);
ocibindbyname($stid, ':GR_BOARD_OTHER2', $data->gr_education[1]->other_institute);
ocibindbyname($stid, ':GR_GRADE2', $data->gr_education[1]->grade);
ocibindbyname($stid, ':GR_DIVISION2', $data->gr_education[1]->division);
ocibindbyname($stid, ':GR_CGP2', $data->gr_education[1]->cgpa);
ocibindbyname($stid, ':GR_MAJOR_COURSE_WORKS2', $data->gr_education[1]->major_subjects);
ocibindbyname($stid, ':GR_EXAMINATION_ID3', $data->gr_education[2]->degree);
ocibindbyname($stid, ':GR_EXAMINATION_NAME3', $data->gr_education[2]->degree_name);
ocibindbyname($stid, ':GR_RESULT_DATE3', $data->gr_education[2]->result_date);
ocibindbyname($stid, ':GR_UNIVERSITY_ID3', $data->gr_education[2]->institute);
ocibindbyname($stid, ':GR_UNIVERSITY_NAME3', $data->gr_education[2]->institute_name);
ocibindbyname($stid, ':GR_BOARD_OTHER3', $data->gr_education[2]->other_institute);
ocibindbyname($stid, ':GR_GRADE3', $data->gr_education[2]->grade);
ocibindbyname($stid, ':GR_DIVISION3', $data->gr_education[2]->division);
ocibindbyname($stid, ':GR_CGP3', $data->gr_education[2]->cgpa);
ocibindbyname($stid, ':GR_MAJOR_COURSE_WORKS3', $data->gr_education[2]->major_subjects);
ocibindbyname($stid, ':GR_EXAMINATION_ID4', $data->gr_education[3]->degree);
ocibindbyname($stid, ':GR_EXAMINATION_NAME4', $data->gr_education[3]->degree_name);
ocibindbyname($stid, ':GR_RESULT_DATE4', $data->gr_education[3]->result_date);
ocibindbyname($stid, ':GR_UNIVERSITY_ID4', $data->gr_education[3]->institute);
ocibindbyname($stid, ':GR_UNIVERSITY_NAME4', $data->gr_education[3]->institute_name);
ocibindbyname($stid, ':GR_BOARD_OTHER4', $data->gr_education[3]->other_institute);
ocibindbyname($stid, ':GR_GRADE4', $data->gr_education[3]->grade);
ocibindbyname($stid, ':GR_DIVISION4', $data->gr_education[3]->division);
ocibindbyname($stid, ':GR_CGP4', $data->gr_education[3]->cgpa);
ocibindbyname($stid, ':GR_MAJOR_COURSE_WORKS4', $data->gr_education[3]->major_subjects);
ocibindbyname($stid, ':GR_EXAMINATION_ID5', $data->gr_education[4]->degree);
ocibindbyname($stid, ':GR_EXAMINATION_NAME5', $data->gr_education[4]->degree_name);
ocibindbyname($stid, ':GR_RESULT_DATE5', $data->gr_education[4]->result_date);
ocibindbyname($stid, ':GR_UNIVERSITY_ID5', $data->gr_education[4]->institute);
ocibindbyname($stid, ':GR_UNIVERSITY_NAME5', $data->gr_education[4]->institute_name);
ocibindbyname($stid, ':GR_BOARD_OTHER5', $data->gr_education[4]->other_institute);
ocibindbyname($stid, ':GR_GRADE5', $data->gr_education[4]->grade);
ocibindbyname($stid, ':GR_DIVISION5', $data->gr_education[4]->division);
ocibindbyname($stid, ':GR_CGP5', $data->gr_education[4]->cgpa);
ocibindbyname($stid, ':GR_MAJOR_COURSE_WORKS5', $data->gr_education[4]->major_subjects);
ocibindbyname($stid, ':GR_POST_NAME1', $data->gr_experience[0]->experience_post);
ocibindbyname($stid, ':GR_BPS1', $data->gr_experience[0]->experience_BS);
ocibindbyname($stid, ':GR_ORGANIZATION_NAME1', $data->gr_experience[0]->experience_OMDD);
ocibindbyname($stid, ':GR_EXP_FROM_DATE1', $data->gr_experience[0]->experience_fdate);
ocibindbyname($stid, ':GR_EXP_TO_DATE1', $data->gr_experience[0]->experience_tdate);
ocibindbyname($stid, ':GR_JOB_STATUS1', $data->gr_experience[0]->experience_status);
ocibindbyname($stid, ':GR_JOB_NATURE1', $data->gr_experience[0]->experience_nature);
ocibindbyname($stid, ':GR_MAIN_DUTIES1', $data->gr_experience[0]->experience_duties);
ocibindbyname($stid, ':GR_POST_NAME2', $data->gr_experience[1]->experience_post);
ocibindbyname($stid, ':GR_BPS2', $data->gr_experience[1]->experience_BS);
ocibindbyname($stid, ':GR_ORGANIZATION_NAME2', $data->gr_experience[1]->experience_OMDD);
ocibindbyname($stid, ':GR_EXP_FROM_DATE2', $data->gr_experience[1]->experience_fdate);
ocibindbyname($stid, ':GR_EXP_TO_DATE2', $data->gr_experience[1]->experience_tdate);
ocibindbyname($stid, ':GR_JOB_STATUS2', $data->gr_experience[1]->experience_status);
ocibindbyname($stid, ':GR_JOB_NATURE2', $data->gr_experience[1]->experience_nature);
ocibindbyname($stid, ':GR_MAIN_DUTIES2', $data->gr_experience[1]->experience_duties);
ocibindbyname($stid, ':GR_POST_NAME3', $data->gr_experience[2]->experience_post);
ocibindbyname($stid, ':GR_BPS3', $data->gr_experience[2]->experience_BS);
ocibindbyname($stid, ':GR_ORGANIZATION_NAME3', $data->gr_experience[2]->experience_OMDD);
ocibindbyname($stid, ':GR_EXP_FROM_DATE3', $data->gr_experience[2]->experience_fdate);
ocibindbyname($stid, ':GR_EXP_TO_DATE3', $data->gr_experience[2]->experience_tdate);
ocibindbyname($stid, ':GR_JOB_STATUS3', $data->gr_experience[2]->experience_status);
ocibindbyname($stid, ':GR_JOB_NATURE3', $data->gr_experience[2]->experience_nature);
ocibindbyname($stid, ':GR_MAIN_DUTIES3', $data->gr_experience[2]->experience_duties);
ocibindbyname($stid, ':GR_POST_NAME4', $data->gr_experience[3]->experience_post);
ocibindbyname($stid, ':GR_BPS4', $data->gr_experience[3]->experience_BS);
ocibindbyname($stid, ':GR_ORGANIZATION_NAME4', $data->gr_experience[3]->experience_OMDD);
ocibindbyname($stid, ':GR_EXP_FROM_DATE4', $data->gr_experience[3]->experience_fdate);
ocibindbyname($stid, ':GR_EXP_TO_DATE4', $data->gr_experience[3]->experience_tdate);
ocibindbyname($stid, ':GR_JOB_STATUS4', $data->gr_experience[3]->experience_status);
ocibindbyname($stid, ':GR_JOB_NATURE4', $data->gr_experience[3]->experience_nature);
ocibindbyname($stid, ':GR_MAIN_DUTIES4', $data->gr_experience[3]->experience_duties);
ocibindbyname($stid, ':GR_POST_NAME5', $data->gr_experience[4]->experience_post);
ocibindbyname($stid, ':GR_BPS5', $data->gr_experience[4]->experience_BS);
ocibindbyname($stid, ':GR_ORGANIZATION_NAME5', $data->gr_experience[4]->experience_OMDD);
ocibindbyname($stid, ':GR_EXP_FROM_DATE5', $data->gr_experience[4]->experience_fdate);
ocibindbyname($stid, ':GR_EXP_TO_DATE5', $data->gr_experience[4]->experience_tdate);
ocibindbyname($stid, ':GR_JOB_STATUS5', $data->gr_experience[4]->experience_status);
ocibindbyname($stid, ':GR_JOB_NATURE5', $data->gr_experience[4]->experience_nature);
ocibindbyname($stid, ':GR_MAIN_DUTIES5', $data->gr_experience[4]->experience_duties);
$_SESSION['cnic']=$data->gr_cnic;
$_SESSION['job']=$data->gr_job_id;
session_write_close();
$r = OCIExecute($stid, OCI_DEFAULT);
/* Start : For updating no of edits*/
$query="";
if(($date_diff>=0 && $edits_before_closing==0))
$query ="update new_gr_app a set a.edits_before_closing=a.edits_before_closing+1 where a.gr_applicant_id=".$data->gr_applicant_id ;
if(($date_diff<0 && $edits_after_closing==0))
$query ="update new_gr_app a set a.edits_after_closing=a.edits_after_closing+1 where a.gr_applicant_id=".$data->gr_applicant_id ;
if($query!=""){
$stid = oci_parse($conn, $query);
$r = OCIExecute($stid, OCI_NO_AUTO_COMMIT);
}
/* End : For updating no of edits*/
if($r)
{
OCICommit($conn);
OCIFreeStatement($stid);
// sms code
$sql_sms="select t.gr_applicant_id, t.gr_app_mobile, s.case_no, s.job_title, t.gr_center_name
from new_gr_app_update t, gr_job_cache s
where t.gr_job_id=s.gr_job_id
and t.gr_applicant_id = $GR_APPLICANT_ID";
//echo $sql_sms;
$rs_sms=OCIParse($conn,$sql_sms);
OCIExecute($rs_sms);
OCIFetchInto($rs_sms,$rs_sms_data,OCI_ASSOC);
$sms_track_id=$rs_sms_data["GR_APPLICANT_ID"];
$sms_mobile=$rs_sms_data["GR_APP_MOBILE"];
$sms_case_no=$rs_sms_data["CASE_NO"];
$sms_job_title=$rs_sms_data["JOB_TITLE"];
$sms_job_center=$rs_sms_data["GR_CENTER_NAME"];
//SendJobSMS(); // Should be commented as following code is directly embedded
$response = file_get_contents('http://bsms.ufone.com/bsms_app5/sendapi.jsp?id=03343912571&message=Your%20Application%20for%20'.urlencode($sms_case_no).'%20'.urlencode($sms_job_title).'%20updated%20successfully%20against%20tracking%20ID%20'.urlencode($sms_track_id).'%20Your%20opted%20test%20center%20is%20'.urlencode($sms_job_center).'&shortcode=FPSC&lang=English&mobilenum='.urlencode($sms_mobile).'&password=745896');
return $GR_APPLICANT_ID;
}
else
{
oci_rollback($conn);
OCIFreeStatement($stid);
return oci_error($stid);
}
}
function Religion_List($job_id,$domicile_code,$conn, $u_religion)
{
//Start: To Get Province ID by Domicile Code
$q="select p.gr_province_id from gr_province p, domicile d
where p.gr_province_id=d.prov_id
and d.domicile_code=" . $domicile_code;
$q_parse=OCIParse($conn,$q);
OCIExecute($q_parse);
OCIFetchInto($q_parse,$q_row, OCI_ASSOC);
$province_id= $q_row["GR_PROVINCE_ID"];
//End: To Get Province ID by Domicile Code
//Start: To Get Parent Id for Sub Cases by SE
$query1="select parent_id from gr_job_post where gr_job_id=".$job_id;
$rgender= OCIParse($conn,$query1);
OCIExecute($rgender);
OCIFetchInto($rgender,$mod_row1, OCI_ASSOC);
if($mod_row1['PARENT_ID'])
$job_id = $mod_row1['PARENT_ID'];
else
$job_id = $job_id;
// End: To Get Parent Id for Sub Cases by SE
$selReligion = "select t.gr_eligible_religion from gr_post_calculation t where t.gr_post_id=" . $job_id . " and t.gr_province_id=" . $province_id;
$rsReligion = OCIParse($conn,$selReligion);
OCIExecute($rsReligion);
$Select_Religion = "";
$Select_Religion = '';
OCIFetchInto($rsReligion,$mod_row, OCI_ASSOC);
$tableValue = $mod_row["GR_ELIGIBLE_RELIGION"];
if ($tableValue == "0"){
$selected_muslim = ($u_religion == 'Muslim') ? 'selected' : "";
$selected_n_muslim = ($u_religion == 'Non Muslim') ? 'selected' : "";
//print_r($selected_option);exit;
$Select_Religion = $Select_Religion . '';
}
if ($tableValue == "1"){
$selected_option = ($u_religion == 'Non Muslim') ? 'selected' : "";
$Select_Religion = $Select_Religion . '';
}
return $Select_Religion;
}
function valid_jobs($conn,$job_id)
{
$query = "select jp.GR_JOB_ID,
'F.4-'||jp.gr_case_no||'/'||trim(to_char(jp.GR_JOB_POST_DATE,'YYYY'))||'-R ['||jp.gr_job_title||']'||js.gr_sub_name as GR_JOB_TITLE
from GR_JOB_POST jp, gr_job_subs js, gr_job_sub_depend jsd
where jp.gr_job_id = jsd.gr_dep_job_id(+)
and jsd.gr_sub_id = js.gr_sub_id(+)
and jp.gr_job_online = 1
and jp.gr_job_id not in (6888)
and jp.gr_job_id=$job_id
and GR_ADVERT_ID in(
select GR_ADVERTISEMENT_ID from GR_POST_ADVERTISEMENT where (trunc(SYSDATE) - trunc(CLOSE_DATE)) <= 0)
order by to_number(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(jp.gr_case_no,'A',''),'B',''),'C',''),'D',''),'E',''),'F',''),'G',''),'H',''),'I',''),'J',''),'K',''),'L',''),'M',''),'N',''),'O',''),'P',''),'Q',''),'R',''),'S',''),'T',''),'U',''),'V',''),'W',''),'X',''),'Y',''),'Z',''))
";
/* $query = "select jp.GR_JOB_ID,
'F.4-'||jp.gr_case_no||'/'||trim(to_char(jp.GR_JOB_POST_DATE,'YYYY'))||'-R ['||jp.gr_job_title||']'||js.gr_sub_name as GR_JOB_TITLE
from GR_JOB_POST jp, gr_job_subs js, gr_job_sub_depend jsd
where jp.gr_job_id = jsd.gr_dep_job_id(+)
and jsd.gr_sub_id = js.gr_sub_id(+)
and jp.gr_job_online = 1
and jp.gr_job_id not in (6657,6658,6659,6660,6661,6662,6663)
and jp.gr_job_id=$job_id";
//and GR_ADVERT_ID =2117"; //Ad No 02/2018
*/
$r_update_jobs = OCIParse($conn,$query);
OCIExecute($r_update_jobs);
$Select_jobs = "";
while(OCIFetchInto($r_update_jobs,$mod_row, OCI_ASSOC))
{
$tableValue = $mod_row["GR_JOB_ID"];
$tableShow = $mod_row["GR_JOB_TITLE"];
$selected = ($job_id == $tableValue) ? ' selected="selected"' : '';
$Select_jobs = $Select_jobs . "";
} // end while
return $Select_jobs;
}
function edt_update($conn,$gr_applicant_id)
{
$query= "select * from new_gr_app_update a where a.gr_applicant_id=".$gr_applicant_id .
" and a.date_applied=(select max(aa.date_applied) from new_gr_app_update aa where aa.gr_applicant_id=".$gr_applicant_id. ")";
$parse= OCIParse($conn,$query);
OCIExecute($parse);
oci_fetch_all($parse, $array);
// Won't actually be needing the data, so we can unset that.
unset($array);
$numberofrows = oci_num_rows($parse);
if($numberofrows <= 0){
$query= "select * from new_gr_app where gr_applicant_id=".$gr_applicant_id;
}
$update_rec= OCIParse($conn,$query);
OCIExecute($update_rec);
OCIFetchInto($update_rec,$mod_row, OCI_ASSOC);
return $mod_row;
}
function valid_gender($job_id,$domicile_code,$conn, $u_gender)
{
//Start: To Get Province ID by Domicile Code
$q_province="select p.gr_province_id from gr_province p, domicile d where p.gr_province_id=d.prov_id and d.domicile_code=" . $domicile_code;
$province_parse=OCIParse($conn,$q_province);
OCIExecute($province_parse);
OCIFetchInto($province_parse,$province_row, OCI_ASSOC);
$province_id= $province_row["GR_PROVINCE_ID"];
//End: To Get Province ID by Domicile Code
//Start: To Get Parent Id for Sub Cases by SE
$query1="select parent_id from gr_job_post where gr_job_id=".$job_id;
$rgender= OCIParse($conn,$query1);
OCIExecute($rgender);
OCIFetchInto($rgender,$mod_row1, OCI_ASSOC);
if($mod_row1['PARENT_ID'])
$job_id = $mod_row1['PARENT_ID'];
else
$job_id = $job_id;
// End: To Get Parent Id for Sub Cases by SE
// job_id & province_id query
$query="select GR_ELIGIBLE_GENDER from gr_post_calculation c where c.gr_post_id=".$job_id . " and c.gr_province_id=".$province_id;
$rgender = OCIParse($conn,$query);
OCIExecute($rgender);
$select_genders = "";
OCIFetchInto($rgender,$mod_row, OCI_ASSOC);
$tableValue = $mod_row["GR_ELIGIBLE_GENDER"];
if($tableValue=="0"){
$selected_male = ($u_gender == 'Male') ? " selected" : "";
$selected_female = ($u_gender == 'Female') ? " selected" : "";
$select_genders.= "";
}
if($tableValue=="1"){
$selected_option = ($u_gender == 'Male') ? " selected" : "";
$select_genders.= "";
}
if($tableValue=="2"){
$selected_option = ($u_gender == 'Female') ? " selected" : "";
$select_genders.= "";
}
return $select_genders;
} // end function
//:: Method For Edit GR Application ::
?>