session_start(); include '../conn.php'; function findrank($id = null) { $results=mysql_query("select rank_eng from rank_master where rank_id=".$id) or die(mysql_error()); if($x = mysql_fetch_array($results)) { return $x['rank_eng']; } else { return 'N/A'; } } if(isset($_POST['B1'])){ $_SESSION['pno']=$_REQUEST['Personal_number']; if($_SESSION['defType']=="2"){ $unitName=''; if($_POST['Joining_Unit_Name']==null){ if($_POST['Joining_District']!=null) $unitName=unitCode($_POST['Joining_District'],"unit1"); else if($_POST['Joining_Range']!=null) $unitName=$_POST['Joining_Range']; else if($_POST['tempas']!=null) $unitName=zoneCode($_POST['tempas'],"unit1"); }else{ $unitName=$_POST['Joining_Unit_Name'] ; } $subunitName=''; if($_POST['Joining_Sub_Unit_Name']==null){ if($_POST['Joining_Unit_Name']!=null) $subunitName=$_POST['Joining_Unit_Name']; else if($_POST['Joining_District']!=null) $subunitName=unitCode($_POST['Joining_District'],"subunit1"); else if($_POST['Joining_Range']!=null) $subunitName=$_POST['Joining_Range']; else if($_POST['tempas']!=null) $subunitName=zoneCode($_POST['tempas'],"subunit1"); }else $subunitName=$_POST['Joining_Sub_Unit_Name'] ; } // echo $unitName."::".$subunitName; @mysql_query("Insert into allotted_posting_detail select * from new_posting_detail where personal_number='".$_POST['Personal_number']."'"); @mysql_query("UPDATE allotted_posting_detail set joining_unit = '".$unitName."', joining_sub_unit = '".$subunitName."', transfer_posting_flag ='A' where personal_number = ".$_POST['Personal_number']); @mysql_query("UPDATE new_posting_detail set transfer_posting_flag ='A' where personal_number = ".$_POST['Personal_number']); } function zoneCode($zonename,$unitType){ if($_SESSION['defType']=="1"){ if($unitType=="unit"){ $q=mysql_query("SELECT Distinct pno_unit_code FROM sub_unitmaster where unit = '".$zonename."'"); $zoneCode=mysql_fetch_array($q); return $zoneCode['pno_unit_code']; }else if($unitType=="subunit"){ $q = mysql_query("select Distinct sub_unit_code FROM sub_unitmaster where unit ='".$zonename."'"); $unitCode=mysql_fetch_array($q); return $unitCode['sub_unit_code']; } }else if($_SESSION['defType']=="2"){ $q=mysql_query("SELECT Distinct hqrs_code FROM nondef where hqrs = '".$zonename."'"); $zoneCode=mysql_fetch_array($q); return $zoneCode['hqrs_code']; } return null; } function rangeCode($rangeCode){ $q = mysql_query("select Distinct sub_unit_code FROM sub_unitmaster where pno_unit_code ='".$rangeCode."'"); $unitCode=mysql_fetch_array($q); return $unitCode['sub_unit_code']; } function unitCode($unitName,$unitType){ if($_SESSION['defType']=="1"){ if($unitType=="unit"){ $q = mysql_query("select Distinct pno_unit_code FROM sub_unitmaster where unit ='".$unitName."'"); $unitCode=mysql_fetch_array($q); return $unitCode['pno_unit_code']; }else if($unitType=="subunit"){ $q = mysql_query("select Distinct sub_unit_code FROM sub_unitmaster where unit ='".$unitName."'"); $unitCode=mysql_fetch_array($q); return $unitCode['sub_unit_code']; } }else if($_SESSION['defType']=="2"){ $q=mysql_query("SELECT distinct sub_unit,sub_unit_code FROM sub_unitmaster WHERE sub_unit='".$unitName."'"); $unitCode=mysql_fetch_array($q); return $unitCode['sub_unit_code']; }return ; } function subUnitCode($unitCode){ $q = mysql_query("select Distinct sub_unit_code FROM sub_unitmaster where pno_unit_code ='".$unitCode."'"); $unitCode1=mysql_fetch_array($q); return $unitCode1['sub_unit_code']; } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(!isset($_REQUEST['pno'])) { header('Location: ../posting_detail/search1.php'); exit(0); } //echo 'select * from new_posting_detail where personal_number = '.$_REQUEST['pno']; $rsq = mysql_query('select transfer_posting_flag from new_posting_detail where personal_number = '.$_REQUEST['pno']); $rsq = mysql_fetch_array($rsq); if($rsq['transfer_posting_flag']=='T') { header('Location: transfer1.php?pno='.$_REQUEST['pno']); exit(0); } $results=mysql_query("select * from new_posting_detail where personal_number='".$_REQUEST['pno']."' ") or die(mysql_error()); if(mysql_num_rows($results)==0) { $_SESSION['error1'] = true; header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/posting.php" ); exit; ?> } $arow=mysql_fetch_array($results); extract($arow); /* if($unit_name == $_SESSION['Unit']) {} else { header('Location: search1.php'); exit(0); } */ ?>