0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.140.195.205


Current Path : /var/www/html/gcg/adm/src/
Upload File :
Current File : //var/www/html/gcg/adm/src/saveRerigistration.php

<?php

$app_number = '';

function saveReRigistrationPersonal($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$reg_no = $aobj_context->mobj_data["reg_no"];

	include_once($aobj_context->main_src."/json.php"); 
	$json = new Services_JSON();
	
	$lstr_param = stripslashes($aobj_context->mobj_data["personal_info"]);
	$per_arr_data = json_decode($lstr_param, true);
	
	$fields = array('slnocnt'=>'FSLNO', 'examno'=> 'FEXAMNO', 'studname'=>'FNAME',
					'motname' => 'FMOTNAME', 'caste' => 'FSUBCASTE',
					'fatname' => 'FFATNAME', 'ocupation' => 'FFAT_OCC', 
					'category' => 'FCASTE', 'religion' => 'FRELIGION',
					'gender' => 'FSEX', 'adhar' => 'FAADHARNO',
					'pstate' => 'FPERSTATE', 'cadd1'=> 'FCURRADD1',
					'cadd2'=> 'FCURRADD2','cadd3'=> 'FCURRADD3',
					'cdistrict' => 'FCURDISTRICT', 'cpincode' => 'FCURPINCODE',
					'cstate' => 'FCURSTATE', 'landline' => 'FLANDLINE',
					'income' => 'FINCOME', 'sign_path' => 'FSIGNPATH',
					'photo_path' => 'FPHOTOPATH', 'dob' => 'FDOB',
					'handicap' => 'FHANDICAP', 'nationality' =>  'FNATIONAL',
					'padd1' => 'FPERMADD1',
					'padd2' => 'FPERMADD2','padd3' => 'FPERMADD3',
					'pdistrict' => 'FPERDISTRICT', 'ppincode' => 'FPERPINCODE',
					'email' => 'FEMAIL', 'mobile' => 'FMOBILENO',
					'accnumber' => 'FBANKACNO', 'branch' => 'FBANKBRANCH',
					'ifsc' => 'FIFSCCODE');
	$field ='';
	$update ='';
	
	for($i=0; $i<count($per_arr_data); $i++)
	{
		$value = $per_arr_data[$i]['value'];
		if($per_arr_data[$i]['id'] == 'photo_path')
		{
			$photo_filename = $value;
			continue;
		}
		$field = $fields[$per_arr_data[$i]['id']];
		if($per_arr_data[$i]['id'] == 'dob')
		{
			$update = "$field =date_format(str_to_date('{$value}','%d/%m/%Y'),'%Y-%m-%d'),";
			continue;
		}
		$update .= "$field = '{$value}',";
	}
	
	$update  = rtrim($update,',');
	$query = "update student set {$update} where fregno = '{$reg_no}'";
	//var_dump($query);
	$update_student = $aobj_context->mobj_db->Execute($query);

	if(!strpos($photo_filename, '/'))
	{
		$sql = "select fcollcode,fdegree from student where fregno = '{$reg_no}'";
		$results = $aobj_context->mobj_db->getRow($sql);
		
		$centercode = $results['fcollcode'];
		$degree = $results['fdegree'];
		
		$college_path=$aobj_context->main_src."student_photos/{$centercode}";
		$degree_path=$aobj_context->main_src."student_photos/{$centercode}/".$degree;
		$image_path = $aobj_context->main_src."upload/{$photo_filename}";
		$folder_path=$aobj_context->main_src."student_photos/{$centercode}/".$degree;
		
		if(!file_exists($college_path))
		{
			mkdir($college_path);
		}

		if(!file_exists($degree_path))
		{
			mkdir($degree_path);
		}
		if(!file_exists($sign_folder_path))
		{
			mkdir($sign_folder_path);
		}
		$photo_path = $aobj_context->main_src."upload/{$photo_filename}";

		$filename = explode(".", $photo_filename);
		$ext = strtolower($filename[1]);
		$photo_filename = $reg_no;
		$photo_filename = $photo_filename.".".$ext;

		$full_file_path = $folder_path.'/'.$photo_filename;
		$photo = "student_photos/{$centercode}/".$degree.'/'.$photo_filename;
		
		

		if(copy($image_path,$full_file_path))
		{
			$update="update student set FPHOTOPATH='{$photo}' 
					where fregno = '{$reg_no}' ";
			$up_obj=$aobj_context->mobj_db->Execute($update); 
			unlink($sign_path);
		}
		else
		{
			$update="update student set FPHOTOPATH='{$photo}' 
					where fregno = '{$reg_no}' ";
			$up_obj=$aobj_context->mobj_db->Execute($update);	
		}
	}

	if($update_student) 
	{
		$arr = 'updated';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
		return;
	}
	else
	{
		$arr='Updation failed';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"error"); 
		return;
	}
}

function saveReRigistrationDetails($aobj_context)
{
	session_start();
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$reg_no = $aobj_context->mobj_data["regno"];
	$category = $aobj_context->mobj_data["cat"];
	$payment_type = $aobj_context->mobj_data["payment_type"];
	$fexamno = $aobj_context->mobj_data['FEXAMNO'];
	$total_fee = $aobj_context->mobj_data["total_fee"];

	$aadhar = $aobj_context->mobj_data["aadhar"];
	$acno = $aobj_context->mobj_data["acno"];
	$ifsc = $aobj_context->mobj_data["ifsc"];
	$fcombcode = $aobj_context->mobj_data["fcombcode"];
	$fcaste = $aobj_context->mobj_data["fcaste"];
	$fmob = $aobj_context->mobj_data["fmob"];
	
	include_once($aobj_context->main_src."/json.php"); 
	$json = new Services_JSON();
	
	$lstr_param = stripslashes($aobj_context->mobj_data["mand_sub"]);
	//var_dump($lstr_param);
	$mobj_jsondata = $json->decode($lstr_param);
	$sub_arr_data = get_object_vars($mobj_jsondata);

	$lquery="select date_format(current_date,'%d/%m/%Y') as curr_date,
	FDEGREE,FCOLLCODE,fexamno, ifnull(fpaymentstatus,'') as fpaymentstatus
	from regcandsum where FREGNO='{$reg_no}'";	 
	$lobj_get_name = $aobj_context->mobj_db->GetRow($lquery);
	$college_code = $lobj_get_name['FCOLLCODE'];
	$degree = $lobj_get_name['FDEGREE'];
	$fexamno = $lobj_get_name['fexamno'];
	$curr_date = $lobj_get_name['curr_date'];
	$fpaymentstatus = $lobj_get_name['fpaymentstatus'];	
	
	$lquery="select FAUTOINCREMENT
	from regcandsum where fdegree='{$degree}' and fexamno ='{$fexamno}'
	and fregno = '{$reg_no}'";

	$lobj_get_date = $aobj_context->mobj_db->GetRow($lquery);	 
	$auto = $lobj_get_date['FAUTOINCREMENT'];

	if(empty($college_code))
	{
		$arr['data']='No details found for the student';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
		return;
	}

	$appno = '533'.$auto;

	$update_candsum = "update regcandsum 
	set fappno = '{$appno}', fregfee = '{$total_fee}',
	fregdate = now(),
	fpaymentype = 'razorpay',
	facountno = '{$acno}',
	fifsccode = '{$ifsc}',
	faadharno = '{$aadhar}'
	where fdegree = '{$degree}' 
	and fexamno = '{$fexamno}'
	and fregno = '{$reg_no}'";
	//var_dump($update_candsum);
	$lobj_update = $aobj_context->mobj_db->Execute($update_candsum);


	$query = "update student 
	set fcombcode = '{$fcombcode}', FSUBCASTE = '{$fcaste}', 
	fmobileno = '{$fmob}'
	where fregno = '{$reg_no}'";
	//var_dump($update_candsum);
	$res = $aobj_context->mobj_db->Execute($query);

	
	if($lobj_update) 
	{
		for($i = 0; $i<count($sub_arr_data); $i++) {
		
				$value[] .= "('{$degree}', '{$fexamno}', '{$college_code}', '{$reg_no}','{$sub_arr_data[$i]->sub_code}','{$appno}','{$i}')";
		}

		$query = "delete from regcanddet where fregno = '{$reg_no}' and fexamno = '{$fexamno}'";
		$aobj_context->mobj_db->Execute($query);

		$query = "insert into regcanddet(FDEGREE, FEXAMNO, FCOLLCODE, FREGNO,FSUBCODE,FAPPNO,FORDER) values".implode(',', $value);
		$aobj_context->mobj_db->Execute($query);
	
		$arr['app_no'] = $appno;
		$arr['amount'] = $total_fee;
		$arr['fregno'] = $reg_no;
		$arr['fpaymentstatus'] = $fpaymentstatus;		
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
		return;
	}
	else
	{
		$arr='Updation failed';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"success"); 
		return;
	}
}

/*function InsertEmptyAppCandSumm($degree, $college_code, $reg_no,$examno, $aobj_context, $payment_type)
{
	//session_start();
	global $app_number;
	$app_number = GetNextNumber($aobj_context, $college_code);
	
	$slno = substr($app_number,-4);
	
	$insert="INSERT INTO  studadm( 
			FSLNO,fappno,fregno,fdegree,fcollcode,FEXAMNO,FNAME,FFATNAME,FFAT_OCC, 
					FCASTE,FRELIGION,
					FSEX,FAADHARNO,
					FCURRADD1,FCURRADD2,FCURRADD3,FCURSTATE,FCURPINCODE,FLANDLINE,
					FINCOME,FSIGNPATH,FCURDISTRICT,FPHOTOPATH,
					FHANDICAP,FNATIONAL,
					FDOB,FPERSTATE,FPERMADD1,
					FPERMADD2,FPERMADD3,
					FPERDISTRICT,FPERPINCODE,FCENDISTRICT,FBASICQAL,FPREVREGNO,FPREVCOMB,FPREVELECTIVE,FPASSMTHYEAR,FPREVCOLLEGE,
					FEMAIL,FCONTACT_NO,FENGLISH,fcombcode)
			 SELECT '{$slno}','{$app_number}',fregno,fdegree,fcollcode,'{$examno}',fname,
			FFATNAME, FFAT_OCC,FCASTE,FRELIGION,FSEX,FAADHARNO,FCURRADD1,FCURRADD2,FCURRADD3,FCURRSTATE,
			FCURRPINCODE,FLANDLINE,FINCOME,FSIGNPATH,FCURRDISTRICT,FPHOTOPATH,FHANDICAP,FNATIONAL,FDOB,
			FPERMSTATE,FPERMADD1,FPERMADD2,FPERMADD3,FPERMDISTRICT,FPERMPINCODE,FCENDISTRICT,FBASICQAL,FPREVREGNO,FPREVCOMB,FPREVELECTIVE,FPASSMTHYEAR,FPREVCOLLEGE,FEMAIL,FMOBILENO,FENGLISH,fcombcode
			from student where fregno = '{$reg_no}'";
	//var_dump($insert);				
	$lobj_insert = $aobj_context->mobj_db->Execute($insert);
	//var_dump($lobj_insert); 
	if($lobj_insert)
	{
		//$UpdateNextNumber();
		return true;
	}
	else
	{
		return false;
	}
}

//mohan sir app no generation
function GetNextNumber($aobj_context, $college_code)
{	
	$get_prefix_running_number = "select last_number from res_reval_code_generator
	where college_code = '{$college_code}' and type='Candidate' ";		
	$lobj_get_prefix_running_number = $aobj_context->mobj_db->GetRow($get_prefix_running_number); 

	$query= " Select FEXAMPREFIX from control";
	$result = $aobj_context->mobj_db->GetRow($query);

	if(!empty($lobj_get_prefix_running_number['last_number']))
	{			
		$next_number = $lobj_get_prefix_running_number['last_number'];
		$last_number = str_pad($next_number,4, "0", STR_PAD_LEFT);
	}
	else
	{	
		$next_number=0001;			
		$insert_into="insert into res_reval_code_generator(college_code,last_number,type)
		values
		(
		'{$college_code}',
		{$next_number},'Candidate'
		)";
		$lobj_insert_into = $aobj_context->mobj_db->Execute($insert_into);
		$last_number = str_pad($next_number,4, "0", STR_PAD_LEFT);		
	}
	UpdateNextNumber($aobj_context, $college_code);
	return $result['FEXAMPREFIX'].$college_code.$last_number;	
}

function UpdateNextNumber($aobj_context, $college_code)
{							 
	$update_code_generator = "update res_reval_code_generator set last_number = last_number+1
	where college_code = '{$college_code}' and type='Candidate' ";
	$lobj_update_code_generator = $aobj_context->mobj_db->Execute($update_code_generator);
}*/


function getStudDet($aobj_context)
{

	session_start();
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$regno = $aobj_context->mobj_data["regno"];	

	$query = "select fmobileno from logisys3_comexam.masuser 
	where funivcode = '033' and fregno = '{$regno}'";
	$res = $aobj_context->mobj_db->GetRow($query);
	$mob = $res['fmobileno'];

	$query = "select cs.fdegree,s.fname,s.ffatname,d.fdescpn,d.fexamname,
	IFNULL(s.fcaste,'GM') as fcaste, a.ffee,cs.fexamno,
	cs.fregno,ifnull(d.ftotsub,'') as ftotsub,
	ifnull(cs.facountno,'') as facountno,
	ifnull(cs.fifsccode,'') as fifsccode,
	ifnull(cs.faadharno,'') as faadharno, ifnull(s.fcombcode,'') as fcombcode,
	s.fmotname, '{$mob}' as fmob,ifnull(FSUBCASTE,'') as FSUBCASTE,
	cs.fcollcode
	from regcandsum cs inner join student s
	on cs.fregno = s.fregno and cs.fdegree = s.fdegree and cs.fcollcode = s.fcollcode
	inner join degree d on cs.fdegree = d.fdegree and cs.fexamno = d.fexamno
	inner join admfeestr a on cs.fdegree = a.fdegree 
	and cs.fexamno = a.fexamno 
	and a.fcatcode = if(s.fgender = 'F' and s.fadmdeggrp = 'UG','SC',if(s.fcaste = '','GM',IFNULL(s.fcaste,'GM'))) 
	and  a.fcombcode = 'ADM' 
	where IFNULL(cs.fdeleted,'') <> 'T' and cs.fregno = '{$regno}'";

	$result = $aobj_context->mobj_db->GetRow($query);

	
	if($result) 
	{
		
		$degree = $result['fdegree'];
		$ftotsub = $result['ftotsub'];
		$fexamno = $result['fexamno'];
		$fcombcode = $result['fcombcode'];
		$fcollcode = $result['fcollcode'];


		if($fexamno == 'C')
		{
			$query1 = "select distinct s.fsubcode,s.fsubname,ifnull(rg.fsubcode,'zz') as oldsubcode
			from subject s left join regcanddet rg 
			on s.fdegree = rg.fdegree and s.fexamno = rg.fexamno 
			and s.fsubcode = rg.fsubcode
			and rg.fregno = '{$regno}'
			where 
			s.fdegree = '{$degree}' 
			and s.fexamno = '{$result['fexamno']}'
			and ifnull(s.fsuspend,'') <> 'T'
			order by oldsubcode";
			//var_dump($query1);
			$res = $aobj_context->mobj_db->GetAll($query1);
			$arr['sub']  = $res;
			

			$query = "select distinct s.fsubcode,s.fsubname,rg.fsubcode as oldsubcode
			from subject s inner join mascomb rg 
			on s.fdegree = rg.fdegree 
			and s.fexamno = rg.fexamno 
			and s.fsubcode = rg.fsubcode
			where 
			s.fdegree = '{$degree}' 
			and s.fexamno = '{$fexamno}'
			and rg.fcombcode = 'SEC'
			and rg.fexamno = '{$fexamno}'
			and ifnull(s.fsuspend,'') <> 'T'
			order by oldsubcode desc";
			$res = $aobj_context->mobj_db->GetAll($query);
			$arr['secsub']  = $res;

		}else
		{

			
			// $query1 = "select distinct s.fsubcode,s.fsubname,'' as oldsubcode
			// from subject s inner join mascomb rg 
			// on s.fdegree = rg.fdegree and s.fexamno = rg.fexamno 
			// and s.fsubcode = rg.fsubcode
			// where 
			// s.fdegree = '{$degree}' 
			// and s.fexamno = '{$result['fexamno']}'
			// and rg.fcombcode = '{$fcombcode}'
			// and rg.fexamno = '{$fexamno}'
			// and ifnull(s.fsuspend,'') <> 'T'
			// order by oldsubcode";
			$query1 = "select distinct s.fsubcode,s.fsubname,ifnull(rg.fsubcode,'zz') as oldsubcode
			from subject s left join regcanddet rg 
			on s.fdegree = rg.fdegree and s.fexamno = rg.fexamno 
			and s.fsubcode = rg.fsubcode
			and rg.fregno = '{$regno}'
			where 
			s.fdegree = '{$degree}' 
			and s.fexamno = '{$result['fexamno']}'
			and ifnull(s.fsuspend,'') <> 'T'
			order by oldsubcode";
			$result1 = $aobj_context->mobj_db->GetAll($query1);
			//var_dump($query1);
			$arr['sub']  = $result1;

			$query = "select distinct s.fsubcode,s.fsubname,rg.fsubcode as oldsubcode
			from subject s inner join mascomb rg 
			on s.fdegree = rg.fdegree 
			and s.fexamno = rg.fexamno 
			and s.fsubcode = rg.fsubcode
			where 
			s.fdegree = '{$degree}' 
			and s.fexamno = '{$fexamno}'
			and rg.fcombcode = 'SEC'
			and rg.fexamno = '{$fexamno}'
			and ifnull(s.fsuspend,'') <> 'T'
			order by oldsubcode desc";
			//var_dump($query);
			$res = $aobj_context->mobj_db->GetAll($query);
			$arr['secsub']  = $res;

			if($degree != 'BSC2')
			{
				$query = "select distinct s.fsubcode,s.fsubname,rg.fsubcode as oldsubcode
				from subject s inner join mascomb rg 
				on s.fdegree = rg.fdegree 
				and s.fexamno = rg.fexamno 
				and s.fsubcode = rg.fsubcode
				where 
				s.fdegree = '{$degree}' 
				and s.fexamno = '{$fexamno}'
				and rg.fcombcode = 'GE'
				and rg.fexamno = '{$fexamno}'
				and ifnull(s.fsuspend,'') <> 'T'
				order by oldsubcode desc";
				$res = $aobj_context->mobj_db->GetAll($query);
				$arr['gesub']  = $res;
			}else
			{
				$arr['gesub']  = [];
			}
		}


		$fdegree = $degree;
		$exam = $fexamno;
		$collcode = $fcollcode;
		$appno = '';

		$query = "select * from regcanddet where fregno = '{$regno}'";
		//var_dump($query);
		$res3 = $aobj_context->mobj_db->GetRow($query);	
		if($res3)
			$appno  = $res3['FREGNO'];

		$query = "select * from subtype where fdegree = '{$fdegree}'
		order by ftorder";
		$res = $aobj_context->mobj_db->GetAll($query);
		
		if($appno == '')
		{
			$query = "select group_concat(distinct concat(su.fsubcode,'-',FMANDATORY)) as subcode , su.fsubtype,st.ftotsub from subject su 
			inner join subtype st on su.fdegree = st.fdegree 
			and su.fsubtype = st.fsubtype
			where su.fdegree = '{$fdegree}' 
			and su.fexamno = '{$exam}' 
			and su.FMANDATORY = 'T'
			group by su.fsubtype
			order by su.fsubtype,su.fsubcode";
		}else
		{
			$query = "select group_concat(distinct concat(su.fsubcode,'-',FMANDATORY)) as subcode , su.fsubtype,st.ftotsub from subject su 
			inner join subtype st on su.fdegree = st.fdegree 
			and su.fsubtype = st.fsubtype
			inner join regcanddet o on su.fdegree = o.fdegree
			and o.fexamno = su.fexamno
			and o.fsubcode = su.fsubcode
			and o.fcollcode = '{$collcode}' and o.fdegree = '{$fdegree}'
			and o.fregno = '{$appno}'
			where su.fdegree = '{$fdegree}' 
			and su.fexamno = '{$exam}' 
			group by su.fsubtype
			order by su.fsubtype,su.fsubcode";
		}	
		
		//var_dump($query);

		$res2 = $aobj_context->mobj_db->GetAll($query);	

		$div = "";
		if($res)
		{
			foreach($res as $value)
			{
				$subtype = $value['fsubtype'];
				$cnd ='';
				if($subtype == 'DSC' && $fcombcode != '')
					$cnd = "and INSTR(fscombcode,'{$fcombcode}') >0";

				$options = "";
				$options = "<option value = ''>--Select---</option>";

				$query = "select fsubcode,fsubname from subject where fdegree = '{$fdegree}' 
				and fexamno = '{$exam}' and fsubtype = '{$subtype}'
				{$cnd}
				group by fsubcode";
			//	var_dump($query);
			
				$res1 = $aobj_context->mobj_db->GetAll($query);

				foreach($res1 as $optval)
				{
					$options .= "<option value = '".$optval['fsubcode']."'>".$optval['fsubname']."</option>";	
				}

				$div .= "<span style = 'padding-left: 20px;'> <b>".$value['fdescpn']."</b></span>";
				$div .="<table  style='display:'block'; overflow:auto' cellpadding='5' cellspacing='2'>
				<tbody>
					<tr style = 'display: flex;flex-direction: column;'>";
				for($i=1;$i<=$value['ftotsub'];$i++)
				{
					$div  .="<td style = 'padding: 10px;'>
					<select id = '".$value['fsubtype'].$i."'  style = 'width: 210px;'>".
					$options	
					."</select>
					</td>";
				}
				$div .="</tr>
					</tbody>
				</table>";
							
				
			}
		}else
		{
			$div = "<h4>No Subject Details Found</h4>";
		}

		$query = "select distinct fcombcode, fcombdesc from mascomb where fdegree = '{$degree}' and fexamno = 'A'";
		$res1 = $aobj_context->mobj_db->GetAll($query);

		$arr['fexamno']  = $fexamno;
		$arr['ftotsub']  = $ftotsub;
		$arr['combdata']  = $res1;
		$arr['data']      = $result;
		$arr['subdiv']      = $div; 
		$arr['madsub'] = $res2;

		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
		return;
	}
	else
	{
		$arr='You are not eligible for re-rigistration contact college';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"); 
		return;
	}

}

function getVSKUBStudDet($aobj_context)
{

	session_start();
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$regno = $aobj_context->mobj_data["regno"];	

	$query = "select * from logisys3_vku.cntrdet 
	where fregno = '{$regno}'
	and ifnull(fdeleted,'') <> 'T'";
	//var_dump($query);
	$result = $aobj_context->mobj_db->GetRow($query);

	if($result) 
	{
		$arr['data'] = $result;
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
		return;
	}
	else
	{
		$arr='Invalid Register No.';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"); 
		return;
	}

}
function getFeeDetail($aobj_context)
{
	$fdegree  = trim($aobj_context->mobj_data['fdegree']);
	$fcatcode = trim($aobj_context->mobj_data['fcatcode']);
	$fyear    = trim($aobj_context->mobj_data['fyear']);
	$fgender  = trim($aobj_context->mobj_data['fgender']);
	$foutstud  = trim($aobj_context->mobj_data['foutstud']);
	$fitdip  = trim($aobj_context->mobj_data['fitdip']);
	$fit  = trim($aobj_context->mobj_data['fit']);
	
	if(strtolower($fgender) == 'female' && strtolower($fcatcode) == 'gm')
	{
		$income = "Low Income";
	}else
	{
		$income = "Normal Fee";		
	}
	$outstudfee = 0;
	$fitdipfee = 0;
	$fitfee = 0;

	if($foutstud == 'T')
	{
		$outstudfee = 750;
	}

	if($fitdip == 'T')
	{
		$fitdipfee = 750;
	}

	if($fit == 'T')
	{
		$fitfee = 750;
	}


	$query = "select distinct fheadcode,ffee from 
			  logisys3_vku.admfeestr 
			  where fcatcode = '{$fcatcode}' 
			  and fdegree = '{$fdegree}' and FCONSTYPE = '{$income}' 
			  and fexamno = '{$fyear}'
			  and fcombcode = 'ADM'";

	$result   = $aobj_context->mobj_db->GetRow($query);
	
	if($result)
	{
		$arr['fee'] = $result['ffee']+$outstudfee+$fitfee+$fitdipfee;

		$arr['data'] = $arr;
		$arr['error_code'] = "0";
		$arr['status'] = "success";
		
		echo json_encode($arr);

		//echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");  
		return;
	}else
	{
		$arr = "Fee Structure is not defined. Contact Help Desk";
		//$arr = "Admission not enabled for CUCET RegNo. ".$curgno." Contact Deprtment";

		$result['data'] = $arr;
		$result['error_code'] = "-1";
		$result['status'] = "Faliure";
		echo json_encode($result);
		return;

		//echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");  
		//return;
	}	

}
?>