Current File : /home/inlingua/public_html/dwarka/icentex/admin_fd/class_ajax_____.php
<?php 
require('../dbConnection.php');

// Include common functions
require('../commonFunc.php');

// Include common functions
require('../globalVars.php');

// Include the table handler class
require('../dbHandler.class.php');
// Init and connect to database
$dbObject = new dbHandler();
$dbObject->connect();
$code_prefix=$_REQUEST['location'];

if($code_prefix=='C')
{
$course_id="select recNo,location from timesheet_location where code_prefix='SE'";
$rescourse_id=mysql_query($course_id) or die(mysql_query());

$cid=mysql_fetch_array($rescourse_id);	
	
$location=$cid['recNo'];	
$center='Corporate';
$sqlQuery = "select * from ingl_class where is_active='1'  ";	
}else {
$course_id="select recNo,location from timesheet_location where code_prefix='".$code_prefix."'";	
$rescourse_id=mysql_query($course_id) or die(mysql_query());

$cid=mysql_fetch_array($rescourse_id);	
	
$location=$cid['recNo'];	
$center=$cid['location'];
$sqlQuery = "select * from ingl_class where c_location='".$location."'  and is_active='1' ";
}
 	
 

//$rescourse_id=mysql_query($course_id) or die(mysql_query());

//$cid=mysql_fetch_array($rescourse_id);	
	
//$location=$cid['recNo'];	
//$center=$cid['location'];	

//echo $sqlQuery;
$result=mysql_query($sqlQuery) or die();
//$echovalue ="<select name='courseid'>";
$echovalue .="<option value=''>".'Select Class'."</option>";
while($row=mysql_fetch_object($result))
{
$echovalue .="<option value='".$row->id."'>".$row->c_name.'-'.$row->c_capacity."</option>";
}

if($code_prefix=='C')
{
 $sqlQuery1 = "select recNo, name from timesheet_user where status='Active' and primarycenter='".$center."' order by name ";	
}else {
	$sqlQuery1 = "select recNo, name from timesheet_user where usertype='FD' and status='Active' and primarycenter='".$center."' order by name ";
}	
//$sqlQuery1 = "select recNo, name from timesheet_user where usertype='FD' and status='Active' and primarycenter='".$center."' order by name ";
//echo $sqlQuery;
$res=mysql_query($sqlQuery1) or die();
//$echovalue ="<select name='courseid'>";
$b .="<option value=''>".'Select'."</option>";
while($row=mysql_fetch_object($res))
{
$b .="<option value='".$row->name."'>".$row->name."</option>";
}

if($code_prefix=='C')
{
$course_count="SELECT courseid  FROM ingl_course  WHERE courseid LIKE '".$code_prefix."%' and branch = 'Corporate' ORDER BY recNo DESC LIMIT 0,1";	
}else {
$course_count="SELECT courseid  FROM ingl_course  WHERE courseid LIKE '".$code_prefix."%' ORDER BY recNo DESC LIMIT 0,1";	
}
$totcourse_id=mysql_query($course_count) or die(mysql_query());

$ctotal=mysql_fetch_array($totcourse_id);
$getid=explode(' ',$ctotal['courseid']);
$sysid=$getid[1];


if($code_prefix=='SE')
{
$getid='17574';	
}
else if($code_prefix=='CP')
{
$getid='11120';	
}	
else if($code_prefix=='C')
{
$getid='10750';	
}
else if($code_prefix=='ED')
{
$getid='11478';	
}
else if($code_prefix=='G')
{
$getid='11983';	
}

else if($code_prefix=='V')
{
$getid='11';	
}
else if($code_prefix=='ND')
{
$getid='1046';	
}
else if($code_prefix=='P')
{
$getid='12128';	
}
if($sysid>$getid)
{
$roll=$sysid+1;	
}else {
$roll=$getid+1;	
}


	   
	   if(strlen($roll)=="1")
	   {
	   $rid="00".$roll."";
	   }
	   else if(strlen($roll)=="2")
	   {
	   $rid="0".$roll."";
	   }
	   else if(strlen($roll)=="3")
	   {
	   $rid="".$roll."";
	   }
	   else
	   {
	  $rid="".$roll.""; 
	   }
//echo $rid;
//$echovalue .="</select>";
//echo $echovalue;
$car = array(
		array('name'=>$echovalue),
		array('name'=>$b),
		array('name'=>$rid)
		);
		  
       echo json_encode($car); exit;
?>