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.133.133.251


Current Path : /var/www/student/jssm/
Upload File :
Current File : /var/www/student/jssm/candidate_list.php

<?php

class candidate_list
{ 
    public $drop_down_arr;
	function __construct($aobj_context)
	{
		session_start();
		$this->aobj_context=$aobj_context;
		$this->g_reg_no=$_SESSION['g_reg_no'];
		$lquery = "select FUNIVCODE from control";
		$restemp = $this->aobj_context->mobj_db->GetRow($lquery);
		$FUNIVCODE=$restemp['FUNIVCODE'];
		$_SESSION['FUNIVCODE']=$FUNIVCODE;
		$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	}
	
	function dashboardMessageBoard()
	{
		$lquery="select message from message_board
		where current_date() between 
		display_from
		and display_to and college_code='EAF' 
		order by 1 desc ";
		$restemp = $this->aobj_context->mobj_db->GetRow($lquery);	

		$this->mess_data=$restemp['message'];

		if(empty($this->mess_data))
		{
			$this->mess_data="<br><b>All the best.</b><br>
			<br><p justify></p>";
		}
	} 
	
	function DisplayStudentSubjectDetails()
	{
		$this->regno = $this->aobj_context->mobj_data["r"];
		$this->regno = strtoupper($this->regno);
		$this->category = $this->aobj_context->mobj_data["c"];
		$this->li = $this->aobj_context->mobj_data["li"];
		
		$lquery="select FDEGREE,FCOLLCODE,FNAME from student 
		where FREGNO='{$this->regno}' 
		and ifnull(fexamappblk,'') <> 'T' and ifnull(fmp,'') <> 'T'";	 
		$restemp = $this->aobj_context->mobj_db->GetRow($lquery);
		
		$this->college_code=$restemp['FCOLLCODE'];
		$this->degree=$restemp['FDEGREE'];
		$this->student_name=$restemp['FNAME'];
		if(empty($this->college_code))
		{
			$arr['data']='No details found for the student';
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
			return false;
		}
		else
		{
			$this->GenerateCandidateDetails();

		}
	}
	
	function SubjectCodeDetails($exam)
	{
		$lquery="select FSUBCODE as id,FSUBNAME,
		FSUBCODE  from degree d inner join subject s on 
		s.FDEGREE=d.FDEGREE  and  d.FEXAMNO=s.FEXAMNO
		where d.FDEGREE='{$this->degree}' and s.FEXAMNO='{$exam}' 
		and ifnull(FSUSPEND,'F')!='T'							 
		group by  FSUBCODE";
		$restemp = $this->aobj_context->mobj_db->GetAll($lquery); 

		$option="<option value='None'>None</option>";
			foreach($restemp as $ak=>$av)
			{
			$code=$av['FSUBCODE'];
			$FSUBNAME=$av['FSUBNAME'];
			$option.="<option value='{$code}'>{$code} {$FSUBNAME}</option>";
			}
			return $option;
	}
	
	function GenerateCandidateDetails()
	{
		session_start();
		$FUNIVCODE=$_SESSION['FUNIVCODE'];
		$exam_appear=array();
		$qry=" select * from collexam where fdegree = '{$this->degree}' and fcollcode = '{$this->college_code}' 
			and DATE_FORMAT(NOW(),'%Y-%m-%d') 
			BETWEEN DATE_FORMAT(fappfrom,'%Y-%m-%d') 
			AND DATE_FORMAT(fappto,'%Y-%m-%d')";
		$student_exam_details = $this->aobj_context->mobj_db->GetRow($qry); 
		
		if(count($student_exam_details) > 0)
		{	
			
			$lquery=" select c.FDEGREE,c.FEXAMNO,c.FCOLLCODE,c.FREGNO,IF(IFNULL(c.FCATEGORY,'')='',s.FCASTE,c.FCATEGORY) AS FCATEGORY,
			if(c.Fgender='',s.Fgender,c.Fgender) as Fgender,c.FAPPEARA,c.FEXAMFEEA,
			c.FAPPEARB,c.FEXAMFEEB,c.FAPPEARC,c.FEXAMFEEC,c.FAPPEARD,c.FEXAMFEED,c.FAPPEARE,
			c.FEXAMFEEE,c.FAPPEARF,c.FEXAMFEEF,c.FAPPEARG,c.FEXAMFEEG,c.FAPPEARH,c.FEXAMFEEH,
			c.FAPPEARI,c.FEXAMFEEI,c.FAPPEARJ,c.FEXAMFEEJ,round(c.FTOTALFEE,2) as FTOTALFEE,
			c.FYEAR,c.FEXAMTYPE,c.FDELETED,FRECPTNO,DATE_FORMAT(FRECPTDATE,'%d/%m/%Y') as FRECPTDATE
			,FREMARKS,
			FRECPTNOA,DATE_FORMAT(FRECPTDATEA,'%d/%m/%Y') AS FRECPTDATEA,
			FRECPTNOB,DATE_FORMAT(FRECPTDATEB,'%d/%m/%Y') AS FRECPTDATEB,
			FRECPTNOC,DATE_FORMAT(FRECPTDATEC,'%d/%m/%Y') AS FRECPTDATEC ,
			FRECPTNOD,DATE_FORMAT(FRECPTDATED,'%d/%m/%Y') AS FRECPTDATED ,
			FRECPTNOE,DATE_FORMAT(FRECPTDATEE,'%d/%m/%Y') AS FRECPTDATEE ,
			FRECPTNOF,DATE_FORMAT(FRECPTDATEF,'%d/%m/%Y') AS FRECPTDATEF ,
			FRECPTNOG,DATE_FORMAT(FRECPTDATEG,'%d/%m/%Y') AS FRECPTDATEG ,
			FRECPTNOH,DATE_FORMAT(FRECPTDATEH,'%d/%m/%Y') AS FRECPTDATEH ,
			FRECPTNOI,DATE_FORMAT(FRECPTDATEI,'%d/%m/%Y') AS FRECPTDATEI ,
			FRECPTNOJ,DATE_FORMAT(FRECPTDATEJ,'%d/%m/%Y') AS FRECPTDATEJ ,
			FFRESHEXAM  
			from candsum c left join student s on s.FDEGREE=c.FDEGREE 
			and s.FREGNO=c.FREGNO
			where c.FDEGREE='{$this->degree}' 
			and c.FCOLLCODE='{$this->college_code}'
			and c.FREGNO='{$this->regno}' 
			and ifnull(s.fexamappblk,'') <> 'T' 
			and ifnull(s.fmp,'') <> 'T'";
			$student_exam_details = $this->aobj_context->mobj_db->GetRow($lquery);

			//var_dump($student_exam_details);
			$e_data="<table style='padding:3px 4px 3px 3px;' class='tr_ventor_row'  width='100%' border='0' cellspacing='0' cellpadding='0'>";
			$e_data.="<th align='left' colspan='10' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='back-ground:yellow;font-size:12px; padding-left:6px; height:24px;'>Exam Details</th>";
			$e_data.="<tr class='ui-state-default ui-jqgrid-hdiv'>";
			$e_data.="<td align='center' style='  font-size:12px;   border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>A</td>";
			$e_data.="<td align='center' style='font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>B </td>";
			$e_data.="<td align='center' style='font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>C </td>";
			$e_data.="<td align='center' style='font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>D </td>";
			$e_data.="<td align='center' style='font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>E </td>";
			$e_data.="<td align='center' style='font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>F</td>";
			$e_data.="<td align='center' style='font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>G</td>";
			$e_data.="<td align='center' style='font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>H</td>";
			$e_data.="<td align='center' style='font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>I</td>";
			$e_data.="<td align='center' style='font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>J</td>";
			$e_data.="</tr>";	
			$e_data.="<tr  style='border-bottom:1px solid #C5DBEC;'>";
		}
		else
		{	if($FUNIVCODE != '026')
			{
				if(strlen($this->college_code) >2)
				{
					if(substr($this->college_code,0,1) == 2 || substr($this->college_code,0,1) == 3 || substr($this->college_code,0,2) == 'B1' || substr($this->college_code,0,2) == 'B2')
					{
						$get_student_data= "SELECT S.FDEGREE,S.FREGNO,S.FCOLLCODE,
						ifnull(FPHOTOPATH,'') as photo_path,
						concat(col.FCOLLNAME,',',space(2), col.FTOWN) as CollDetails  ,
						concat(ec.FCOLLNAME,', ',ec.ftown) AS exam_center_name,
						col.FCOLLNAME as FCOLLNAME,
						cs.FCNTRCODE AS FEXAMCNTR,col.FCOLLCODE,
						CONCAT(D.FDESCPN) AS COURSE, D.FEXAMDATE,
						S.FNAME,S.FFATNAME,S.FMOTNAME,S.fstudid,
						DATE_FORMAT(S.FDOB,'%d/%m/%Y') AS FDOB
						FROM student S INNER JOIN degree D ON
						S.FDEGREE=D.FDEGREE AND S.FEXAMNO=D.FEXAMNO
						INNER JOIN college col ON S.FCOLLCODE=col.FCOLLCODE
						inner join candsum cs on S.fdegree = cs.fdegree
						and S.fregno = cs.fregno
						LEFT JOIN college ec ON ec.FCOLLCODE=cs.FCNTRCODE
						inner join colldeg on colldeg.fdegree = cs.fdegree
						and colldeg.fcollcode = cs.fcollcode
						WHERE S.FREGNO ='{$this->regno}' 
						AND S.FDEGREE='{$this->degree}' 
						and cs.FCOLLCODE='{$this->college_code}'
						and cs.frecptdate is not null 
						and ifnull(colldeg.fhtstop,'F') <> 'T'
						and ifnull(S.fexamappblk,'') <> 'T' 
						and ifnull(S.fmp,'') <> 'T' ";					
							
						$lobj_get_student_data = $this->aobj_context->mobj_db->GetAll($get_student_data);
						$this->std_adm_count = count($lobj_get_student_data);
						$reg_photo_path='student_photos/'.$this->college_code.'/'.strtoupper($this->degree).'/'.strtoupper($this->regno).'.jpg';
						$url = $this->aobj_context->main_src;
						$url = str_replace('student','oasis/kus',$url);	
						$url_img = trim($url."/".$reg_photo_path);
						//$photoPath=trim($this->aobj_context->main_src."/".$reg_photo_path);
						//var_dump($url_img);
						if(file_exists($url_img))
						{
							$arr['photo_present']='true';
						}
						if($this->std_adm_count == 1)
						{
							$arr['adm_ticket']='true';
						}	
					}
				} 
			}
			
			$arr['data']="<span style='font-weight:bold;font-size:20px;color:red;'>Last date is over for online exam application form</span>";
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
			return;	 
		
		}
		
		$fee_td="";
		$FFRESHEXAM=$student_exam_details[FFRESHEXAM];
		
				 
		for($i=65;$i<75;$i++)
		{   
			$html_id="candidate_list_exam_".chr($i)."_details";
			$exam_fee["{$html_id}"]=$student_exam_details['FEXAMFEE'.chr($i)];
			$exam_receipt_no["{$html_id}"]=$student_exam_details['FRECPTNO'.chr($i)];
			$exam_receipt_no_date["{$html_id}"]=is_null($student_exam_details['FRECPTDATE'.chr($i)])?date('d/m/Y'):($student_exam_details['FRECPTDATE'.chr($i)]);
			$border_left=($i==65)?" border-left:1px solid #ccc;":" border-left:0px solid #ccc;";
			if($student_exam_details['FAPPEAR'.chr($i)]=='N')
			{		
				$td_data="NE";
				$id=" id ='cand_entry_".chr($i)."'";
			}	
			else if($student_exam_details['FAPPEAR'.chr($i)]=='P')
			{
				$td_data="Pass";
				$id=" id ='cand_entry_".chr($i)."'";
			}	
			else  if($student_exam_details['FAPPEAR'.chr($i)]=='A' || $student_exam_details['FAPPEAR'.chr($i)]=='E')
			{
				array_push($exam_appear,chr($i));
				$id=" id='cand_entry_".chr($i)."'";
				$td_data="<Input  onclick=showExamNosDiv('{$html_id}'); {$id}  name='radio_common' type='radio'>";
				$id='';
			}
			else  
			{
				$td_data="<font color=red>&nbsp;</font>";
				$id=" id ='cand_entry_".chr($i)."'";
			}
			$e_data.="<td align=center style='padding:2px;  border-bottom:1px solid #ccc; {$border_left}border-right:1px solid #ccc;'  {$id} >{$td_data}</td>";
			$fee_td.="<td align=center style='padding:2px;  border-bottom:1px solid #ccc; {$border_left}border-right:1px solid #ccc; color: #B52DA0;    font-weight: bold; ' id='ssub_fee_".chr($i)."' >&nbsp;</td>";
		}
				 
				 
		$e_data.="</tr>";
		$e_data.="</tr>{$fee_td}</tr>";
		$e_data.="</table>";
				
		$get_total_sub_for_degree="select * from degree where FDEGREE='{$this->degree}'";
		$lobj_get_total_sub_for_degree = $this->aobj_context->mobj_db->GetAll($get_total_sub_for_degree); 
				 
		for($j=0;$j<count($lobj_get_total_sub_for_degree);$j++)
		{
			if($lobj_get_total_sub_for_degree[$j]['FEXAMNO']=='A')
			{ $exam_A_limit=$lobj_get_total_sub_for_degree[$j]['FTOTSUB'];$semister_names['A']=$lobj_get_total_sub_for_degree[$j]['FEXAMNAME'];}
			else if($lobj_get_total_sub_for_degree[$j]['FEXAMNO']=='B')
			{ $exam_B_limit=$lobj_get_total_sub_for_degree[$j]['FTOTSUB'];$semister_names['B']=$lobj_get_total_sub_for_degree[$j]['FEXAMNAME'];}
			else if($lobj_get_total_sub_for_degree[$j]['FEXAMNO']=='C')
			{$exam_C_limit=$lobj_get_total_sub_for_degree[$j]['FTOTSUB'];$semister_names['C']=$lobj_get_total_sub_for_degree[$j]['FEXAMNAME'];}
			else if($lobj_get_total_sub_for_degree[$j]['FEXAMNO']=='D')
			{$exam_D_limit=$lobj_get_total_sub_for_degree[$j]['FTOTSUB'];$semister_names['D']=$lobj_get_total_sub_for_degree[$j]['FEXAMNAME'];}
			else if($lobj_get_total_sub_for_degree[$j]['FEXAMNO']=='E')
			{$exam_E_limit=$lobj_get_total_sub_for_degree[$j]['FTOTSUB'];$semister_names['E']=$lobj_get_total_sub_for_degree[$j]['FEXAMNAME'];}
			else if($lobj_get_total_sub_for_degree[$j]['FEXAMNO']=='F')
			{$exam_F_limit=$lobj_get_total_sub_for_degree[$j]['FTOTSUB'];$semister_names['F']=$lobj_get_total_sub_for_degree[$j]['FEXAMNAME'];}	
			else if($lobj_get_total_sub_for_degree[$j]['FEXAMNO']=='G')
			{$exam_G_limit=$lobj_get_total_sub_for_degree[$j]['FTOTSUB'];$semister_names['G']=$lobj_get_total_sub_for_degree[$j]['FEXAMNAME'];}
			else if($lobj_get_total_sub_for_degree[$j]['FEXAMNO']=='H')
			{$exam_H_limit=$lobj_get_total_sub_for_degree[$j]['FTOTSUB'];$semister_names['H']=$lobj_get_total_sub_for_degree[$j]['FEXAMNAME'];}
			else if($lobj_get_total_sub_for_degree[$j]['FEXAMNO']=='I')
			{$exam_I_limit=$lobj_get_total_sub_for_degree[$j]['FTOTSUB'];$semister_names['I']=$lobj_get_total_sub_for_degree[$j]['FEXAMNAME'];}
			else if($lobj_get_total_sub_for_degree[$j]['FEXAMNO']=='J')
			{$exam_J_limit=$lobj_get_total_sub_for_degree[$j]['FTOTSUB'];$semister_names['J']=$lobj_get_total_sub_for_degree[$j]['FEXAMNAME'];}
		}
		for($i=65;$i<75;$i++)
		{ 
			if(in_array(chr($i),$exam_appear))
			{
				$id='';
				$remaining_count=0;
				$id="\$exam_".chr($i);
				$html_id="candidate_list_exam_".chr($i)."_details";

				$char_name=chr($i);
				$max_limit="\$exam_".$char_name."_limit";
				eval("\$max_limit = \"$max_limit\";");

				$FEXAMNO=chr($i);	
				$id="<table  class='tr_ventor_row' width='100%' border='0' cellspacing='0' cellpadding='0'>";	
				$id.="<th align='left' colspan='10' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:10px; padding-left:6px; height:20px;'>{$semister_names[$FEXAMNO]}</th>";
				// $id="<table   width='95%' align='center' cellspacing='0' cellpadding='0' border='0' >";
				//$id.=" <tr><td class='act_txtclr' colspan='5' style='background-color:#3D83CC; color:#fff; font-weight:700; width:222px; padding-left:5px; letter-spacing:0.5pt;'>{$semister_names[$FEXAMNO]} </td> </tr>";
				$id.="<tr class='ui-state-default ui-jqgrid-hdiv'>";
				$id.="<td align='center' style='  font-size:12px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;font-weight:bold;'>Sub Code</td>";			
				$id.="<td align='center' style='  font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;font-weight:bold;'>QP Code</td>";			
				$id.="<td align='center' style='  font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;font-weight:bold;'>Description</td>";			
				$id.="<td align='center' style='  font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;font-weight:bold;'>Pass Mth<input type=checkbox id='{$html_id}^{$char_name}' onclick='checkAllCandidateSemisterSub(this.id);' ></td>";			
				/* $id.="<tr style='background-image:url(../jqGrid3/themes/tarka/images/grid-blue-hd.gif);border-bottom:1px solid #CBC7B8; color:#000; font-weight:700; padding:3px 6px; letter-spacing:0.5pt;'>";
				$id.="<td  align=center style='padding:2px;  border-bottom:1px solid #ccc; border-left:1px solid #ccc; border-right:1px solid #ccc;width:23px;'>Code</td>";
				$id.="<td align=center  style='padding:2px;   border-bottom:1px solid #ccc;border-left:0px solid #ccc; border-right:1px solid #ccc;width:90px'>Short Name</td>";
				$id.="<td align=center  style='padding:2px;  width:160px; border-bottom:1px solid #ccc;border-left:0px solid #ccc; border-right:1px solid #ccc;'>Description</td>";
				$id.="<td  align=center style='padding:2px;  border-bottom:1px solid #ccc; border-left:0px solid #ccc; border-right:1px solid #ccc;width:80px'>Pass M/Y<input type=checkbox id='{$html_id}^{$char_name}' onclick='checkAllCandidateSemisterSub(this.id);' ></td>";
				*/ $id.="</tr>";
					  
				$lquery="select c.FSUBCODE,s.FSUBNAME,
				ifnull(c.FPASSMTH,'') as FPASSMTH,
				s.FQPCODE AS FSUBSHORT,c.FEXAMTYPE,
				ifnull(c.FPRESENT,'N') as FPRESENT,
				if(c.FINSERTED='','F',c.FINSERTED) as FINSERTED,
				ifnull(c.fthpr,'') as fthpr 
				from canddet c 
				inner join subject s on s.FDEGREE=c.FDEGREE
				and s.fexamno = c.fexamno and s.FSUBCODE=c.FSUBCODE 
				where c.FDEGREE='{$this->degree}' and c.FCOLLCODE='{$this->college_code}' and 
				c.FEXAMNO='{$FEXAMNO}'  and
				c.FREGNO='{$this->regno}' group by c.FSUBCODE order by c.fsubcode,
				s.fqpcode desc limit $max_limit ";
				$lobj_rs = $this->aobj_context->mobj_db->GetAll($lquery); 
				
				$remaining_count=$max_limit-count($lobj_rs);
				$k=0;
				$txt_id=0;
					
				for($m=0;$m<count($lobj_rs);$m++)
				{
					$code_pop_up_field="";
					$FSUBCODE=$lobj_rs[$m]['FSUBCODE']; 
					$FTHPR=$lobj_rs[$m]['fthpr']; 
					$Fcounttype='count(1)';
					if($FUNIVCODE=='017' )
					{
						$Fcounttype='count(distinct 1)';
					}
					
					$get_theroy_cnt ="SELECT {$Fcounttype} AS t_cnt FROM subject 
					WHERE FDEGREE='{$this->degree}' AND fexamno='{$FEXAMNO}'
					AND FSUBCODE='{$FSUBCODE}' AND IFNULL(ftheory,'') = 'T' 
					AND IFNULL(fintass,'') <> 'T' AND IFNULL(fretain,'') <> 'T'  ";
					$lobj_get_theroy_cnt = $this->aobj_context->mobj_db->GetRow($get_theroy_cnt); 
					//var_dump($get_theroy_cnt);
					$th_cnt=$lobj_get_theroy_cnt['t_cnt'];

					$get_prc_cnt="SELECT {$Fcounttype} AS p_cnt FROM subject 
					WHERE FDEGREE='{$this->degree}' AND fexamno='{$FEXAMNO}'
					AND FSUBCODE='{$FSUBCODE}' AND IFNULL(ftheory,'') <> 'T' 
					AND IFNULL(fretain,'') <> 'T'";
					$lobj_get_prc_cnt = $this->aobj_context->mobj_db->GetRow($get_prc_cnt); 
					//var_dump($get_prc_cnt);
					$pr_cnt = $lobj_get_prc_cnt['p_cnt'];
					if($th_cnt>1) $th_cnt=max(2,$th_cnt);
					if($pr_cnt>1) $pr_cnt=max(2,$pr_cnt);
					if($FUNIVCODE !='012')
					{
						if($FTHPR=='T') $th_cnt=0;
						if($FTHPR=='F') $pr_cnt=0;
					}
					$FSUBSHORT = $lobj_rs[$m]['FSUBSHORT']; 
					$FSUBNAME  = $lobj_rs[$m]['FSUBNAME']; 
					if($FTHPR == 'T')
						$FSUBNAME = $FSUBNAME." (Practical only)";
					else if($FTHPR == 'F')
						$FSUBNAME = $FSUBNAME." (Theory only)";
					else
						$FSUBNAME = $FSUBNAME;
					if($lobj_rs[$m]['FPASSMTH']=='' or is_null($lobj_rs[$m]['FPASSMTH']))// to display pass M/Y based on the  value
					{
						$FPASSMTH="<input type='checkbox'   onclick='UpdateExamFeeForEachSelectedSubject();' id='exam_{$char_name}_ce_pass_{$txt_id}'> ";	
						$FPASSMTH.="<input type='hidden'   id='exam_{$char_name}_th_cnt_{$txt_id}' value='{$th_cnt}' /> ";	
						$FPASSMTH.="<input type='hidden'   id='exam_{$char_name}_pr_cnt_{$txt_id}' value='{$pr_cnt}' /> ";	
						$FPASSMTH.="<input type='hidden'   id='exam_{$char_name}_fi_{$txt_id}' value='F' /> ";	
						$FPASSMTH_TD="";
						$code_pop_up_field="";					
					}
					else  
					{
						$FPASSMTH=$lobj_rs[$m]['FPASSMTH'];	
						$FPASSMTH_TD=" id='exam_{$char_name}_ce_pass_{$txt_id}' ";
						$code_pop_up_field='readonly=true;';					
					}
					if($lobj_rs[$m]['FINSERTED']=='CT' || $lobj_rs[$m]['FINSERTED']=='ssT')// to display text box for the value if FINSERTED=''T
					{
						$sub_code_input_border=	"";
						$sub_code_input_popup=" onblur='getSubDetails(this.id,{$txt_id});'  onkeydown='return keyboardSubjectAppearingPopup(event,this.id);'";
						$sub_code_input_name="di";
						$input_tab_indx=" tabindex={$txt_id}";
						$read_only=" ";
					}
					else  
					{
						$sub_code_input_border=	" border:none;";
						$sub_code_input_name="update";
						$input_tab_indx=" tabindex=-1";
						$read_only=" readonly";
						if($FUNIVCODE=='016')
						$sub_code_input_popup=	"";	
					}
					if($k%2==0)
					{
						$class='tbl_row';
						$inp_class='tbl_row_input';
					}
					else
					{
						$input_class='tbl_row1'; 
						$inp_class='tbl_row1_input';
					}  
						$id.="<tr>";
						$id.="<td align='center' style='  font-size:12px;   border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><input {$code_pop_up_field} {$inp_class} type=text style='width:55px;{$sub_code_input_border}' {$read_only} {$sub_code_input_popup} name='{$sub_code_input_name}'   id='exam_{$char_name}_ce_sub_code_{$txt_id}' {$input_tab_indx} value='{$FSUBCODE}'></td>";
						$id.="<td align='center'  style='  font-size:12px;   border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'id='exam_{$char_name}_ce_short_name_{$txt_id}' > {$FSUBSHORT}</td>";
						$id.="<td align='left' id='exam_{$char_name}_ce_desc_{$txt_id}'  style='  font-size:12px;    border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>   {$FSUBNAME}</td>";
						$id.="<td style='  font-size:12px;    border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;' align='center'  {$FPASSMTH_TD} >{$FPASSMTH} </td>";
						$id.="</tr>";   
						$k++;
						$txt_id++;
				}
				if($remaining_count>0)
				{
					$k=0;
					$subject_options = $this->SubjectCodeDetails($char_name);
					for($j=0;$j<$remaining_count;$j++)
					{
						if($k%2==0)
						{
							$class='tbl_row';
							$inp_class='tbl_row_input';
						}
						else
						{
							$input_class='tbl_row1'; 
							$inp_class='tbl_row1_input';
						}  
						$id.="<tr>";
						$id.="<td align='center'   style=' font-size:12px;   border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'> <select style='width:60px;' tabindex={$txt_id}   onchange =\"getSubjectNamesForSelectedSub({$txt_id},this.value,'{$this->degree}','{$char_name}')\" id='exam_{$char_name}_ce_sub_code_{$txt_id}'>{$subject_options}</select></td>";
						$id.="<td align='center'  style=' font-size:12px;   border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'id='exam_{$char_name}_ce_short_name_{$txt_id}'>&nbsp;</td>";
						$id.="<td align='left'  id='exam_{$char_name}_ce_desc_{$txt_id}'   style=' font-size:12px;   border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>&nbsp;</td>";
						$pr_th_cnt="<input type='hidden'   id='exam_{$char_name}_th_cnt_{$txt_id}' value='0' /> ";	
						$pr_th_cnt.="<input type='hidden'   id='exam_{$char_name}_pr_cnt_{$txt_id}' value='0' /> ";	
						$pr_th_cnt.="<input type='hidden'   id='exam_{$char_name}_fi_{$txt_id}' value='F' /> ";	
						$id.="<td  style='padding:2px;  font-size:12px;   border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;' align='center'  ><input type='checkbox'  onclick='UpdateExamFeeForEachSelectedSubject();' id='exam_{$char_name}_ce_pass_{$txt_id}' /> {$pr_th_cnt} </td>";
						$id.="</tr>";											 
						$k++;
						$txt_id++;
					}		 
				}
						 
				$total_count_of_each_div[$html_id] = $txt_id;			
				$exam_fee_val = $exam_fee[$html_id];
				$exam_receipt_no_val = $exam_receipt_no[$html_id];
				$exam_receipt_no_date_val = $exam_receipt_no_date[$html_id];
				$category =  $this->category;
				
			
				if($FUNIVCODE=='017')
				{	
					$query = "select COUNT(*) as stu_count From candsum 
					where INSTR('BA011*BA012*BA013*BM011*BM012*BM013*BCA11*BCA12*BCA13*BC011*BC012*BC013*BS011*BS012*BS013*',(CONCAT(SUBSTR('{$this->regno}',1,5),'*'))) > 0";
					$results = $this->aobj_context->mobj_db->GetRow($query); 
					
					if($results['stu_count'] > 0)
					{
						if($this->category == 'SC' ||$this->category == 'ST')
						{
							$category = 'GM';
						}
						else
						{
							$category =  $this->category;
						}
					}
				}
				/* if($FUNIVCODE=='011')
				{	
					if($this->category == 'SC' ||$this->category == 'ST')
					{
						$category = 'GM';
					}else
					{
						$category =  $this->category;
					}
				} */				
				$this->li = $this->li;
				if($FUNIVCODE =='035' && trim($this->category) != 'SC' && trim($this->category) != 'ST')
				{
					//var_dump($this->category);	
					$lquery="select 
							case when ifnull(FAPPEARA,'') = 'P' then 1 else 0 end as fpenda, 
							case when ifnull(FAPPEARB,'') = 'P' then 1 else 0 end as fpendb, 
							case when ifnull(FAPPEARC,'') = 'P' then 1 else 0 end as fpendc, 
							case when ifnull(FAPPEARD,'') = 'P' then 1 else 0 end as fpendd,
							case when ifnull(FAPPEARE,'') = 'P' then 1 else 0 end as fpende,
							case when ifnull(FAPPEARF,'') = 'P' then 1 else 0 end as fpendf,ffreshexam
							from candsum where fregno = '{$this->regno}'";
							 
					$results = $this->aobj_context->mobj_db->GetRow($lquery); 
					$sema = $results['fpenda'];
					$semb = $results['fpendb'];
					$semc = $results['fpendc'];
					$semd = $results['fpendd'];
					$seme = $results['fpende'];
					$semf = $results['fpendf'];
					$freshexam = $results['ffreshexam']; 
					
					if($freshexam == 'B' and $sema == 0)
						$this->li = 'Normal Fee';
					if($freshexam == 'C' and ($sema == 0 or $semb == 0))
						$this->li = 'Normal Fee';
					if($freshexam == 'D' and ($sema == 0 or $semb == 0 or $semc == 0))
						$this->li = 'Normal Fee';
				}

				/*if($FUNIVCODE == '011')
				{
					$query = "select COUNT(*) as stu_count from candsum where (INSTR('YBB13*YBB12*YBB14*YBC14*YBC13*YBC12*YB14*YB13*YB12*',(CONCAT(SUBSTR('{$this->regno}',1,5),'*'))) > 0 or
								INSTR('YBB13*YBB12*YBB14*YBC14*YBC13*YBC12*YB14*YB13*YB12*',(CONCAT(SUBSTR('{$this->regno}',1,4),'*'))) > 0)";
					$results = $this->aobj_context->mobj_db->GetRow($query); 
					//var_dump($query);
					if($results['stu_count'] > 0)
					{		$this->li = 'Normal Fee';
							//var_dump($results['stu_count']);
					}
				}*/
				//var_dump($this->li);
					
				if($FUNIVCODE=='012' || $FUNIVCODE=='008')
				{	
					$get_fee_data="SELECT  FHEADCODE,FFEE,FREPFEE,FREPPRFEE,
					IF('{$FFRESHEXAM}'='{$char_name}',if('Low Income'='{$this->li}' && ('SC'='{$this->category}' or 'ST'='{$this->category}'),FFEE,FFEE), FREPFEE) AS O_FFEE,
					IF('{$FFRESHEXAM}'='{$char_name}',if('Low Income'='{$this->li}' && ('SC'='{$this->category}' or 'ST'='{$this->category}'),FPRFEE,FPRFEE),FREPPRFEE) AS FPRFEE,
					if('Low Income'='{$this->li}' && 'GM' <> '{$this->category}'&&'{$FFRESHEXAM}'='{$char_name}',FFEE,FMAXFEE) as FMAXFEE
					FROM admfeestr a
					WHERE FDEGREE='{$this->degree}'
					AND FEXAMNO='{$char_name}'
					AND FCOMBCODE='EXAM' {$cond}
					AND FCATCODE='{$category}'
					and FCONSTYPE='{$this->li}' 
					and ifnull(FADMFEESDATE,'') <> '' and ifnull(FADMFEEEDATE,'') <> ''
					and DATE_FORMAT(NOW(),'%Y-%m-%d') 
					BETWEEN DATE_FORMAT(FADMFEESDATE,'%Y-%m-%d') 
					AND DATE_FORMAT(FADMFEEEDATE,'%Y-%m-%d')				
					and IF(IFNULL(FREGRANGE,'') = '', '1=1', 
					1=1 and (INSTR(FREGRANGE,(CONCAT(SUBSTR('{$this->regno}',1,3),'*'))) > 0 
					or INSTR(FREGRANGE,(CONCAT(SUBSTR('{$this->regno}',1,4),'*'))) > 0
					or INSTR(FREGRANGE,(CONCAT(SUBSTR('{$this->regno}',1,5),'*'))) > 0))
					and IF(IFNULL(FCOLLRANGE,'') = '', '1=1', 
					1=1 and INSTR(FCOLLRANGE,(CONCAT('{$this->college_code}','*'))) <= 0)
					order by FHEADCODE";
					//var_dump($get_fee_data);
				}else
				{
					$get_fee_data="SELECT  FHEADCODE,FFEE,
					IF('{$FFRESHEXAM}'='{$char_name}',FFEE,FREPFEE) AS O_FFEE,
					IF('{$FFRESHEXAM}'='{$char_name}',FPRFEE,FREPPRFEE) AS FPRFEE ,if('{$FFRESHEXAM}'='{$char_name}',FFEE,FMAXFEE) as FMAXFEE
					FROM admfeestr a
					WHERE FDEGREE='{$this->degree}'
					AND FEXAMNO='{$char_name}'
					AND FCOMBCODE='EXAM' {$cond}
					AND FCATCODE='{$category}'
					and FCONSTYPE='{$this->li}' 
					and ifnull(FADMFEESDATE,'') <> '' and ifnull(FADMFEEEDATE,'') <> ''
					and DATE_FORMAT(NOW(),'%Y-%m-%d') 
					BETWEEN DATE_FORMAT(FADMFEESDATE,'%Y-%m-%d') 
					AND DATE_FORMAT(FADMFEEEDATE,'%Y-%m-%d')				
					and IF(IFNULL(FREGRANGE,'') = '', '1=1', 
					1=1 and (INSTR(FREGRANGE,(CONCAT(SUBSTR('{$this->regno}',1,3),'*'))) > 0 
					or INSTR(FREGRANGE,(CONCAT(SUBSTR('{$this->regno}',1,4),'*'))) > 0
					or INSTR(FREGRANGE,(CONCAT(SUBSTR('{$this->regno}',1,5),'*'))) > 0))
					and IF(IFNULL(FCOLLRANGE,'') = '', '1=1', 
					1=1 and INSTR(FCOLLRANGE,(CONCAT('{$this->college_code}','*'))) <= 0)
					order by FHEADCODE";
				}	
				//var_dump($get_fee_data);
				$lobj_get_fee_data = $this->aobj_context->mobj_db->GetAll($get_fee_data); 	
							 
				$fee_cnt = count($lobj_get_fee_data)+1;
				//var_dump($lobj_get_fee_data);
				$this->li = $this->li;
				$flag = 'F';
				if($FUNIVCODE == '012')
				{
					$query = "select COUNT(*) as stu_count from candsum where INSTR('JCL10*JCM10*JCN10*JCP10*',(CONCAT(SUBSTR('{$this->regno}',1,5),'*'))) > 0";
					$results = $this->aobj_context->mobj_db->GetRow($query); 
					//var_dump($query);
					if($results['stu_count'] > 0)
							$flag = 'T';
				}

				/* if($FUNIVCODE == '011')
				{
					$query = "select COUNT(*) as stu_count from candsum where INSTR('YMN10*YPH10*YMA10*YEN10*YCH10*YBO10*YFN10*YMN09*YPH09*YMA09*YEN09*YCH09*YBO09*YFN09*YMN11*YPH11*YMA11*YEN11*YCH11*YBO11*YFN11*YMN12*YPH12*YMA12*YEN12*YCH12*YBO12*YFN12*YCH07*YMN08*YPH08*YMA08*YEN08*YCH08*YBO08*YFN08*YMN07*YPH07*YMA07*YEN07*YCH06*YBO06*YFN06*YMN06*YPH06*YMA06*YEN07*YCH06*YBO06*YFN06*',(CONCAT(SUBSTR('{$this->regno}',1,5),'*'))) > 0";
					$results = $this->aobj_context->mobj_db->GetRow($query); 
					//var_dump($query);
					if($results['stu_count'] > 0)
							$flag = 'T';
				} */	
//YCH07128				
				$id.="<tr>";
				$id.="<td colspan='4' style=' border-bottom:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-left:1px solid #C5DBEC;'>";
				$id.="";  
				$tr="<table id='fee_table_{$char_name}' style='margin:9px;width:50%;'  class='tr_ventor_row'   border='0' cellspacing='0' cellpadding='0' >	 <th align='left' colspan='2' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:12px; padding-left:6px; height:17px;background:#C48F2D;'>Fee Details</th>";
				$tr.="<tr class='ui-state-default ui-jqgrid-hdiv'>";
				$tr.="<td align='center' style=' font-weight:bold; font-size:12px; border-left:1px solid #C5DBEC; border-top:1px solid #C5DBEC ; border-right:1px solid #C5DBEC;  '>Fee Details</td>";			
				$tr.="<td align='center' style=' font-weight:bold; font-size:12px; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC ; border-bottom:1px solid #C5DBEC;'> Amount</td>";			
				$tr.="</tr>";
				$tot=0;
				
				foreach($lobj_get_fee_data as $ak=>$av)
				{			      
					$tr.=" <tr class='ui-state-default ui-jqgrid-hdiv'>";
					$h_code = substr($av['FHEADCODE'],0,2);	
					$tr.="<td align='left' style='border-top:1px solid #C5DBEC ;border-left:1px solid #C5DBEC; ' id='tfh_{$char_name}_{$h_code}'>{$av[FHEADCODE]}</td>";
					$input_val=$av['FFEE'];	
					//var_dump($flag);
					if($flag == 'T' && $av['FHEADCODE'] == '02 Exam Fee')
					{
						if($FUNIVCODE == '011')
						{
							$O_FFEE = $av['O_FFEE']*5;	
							$FPRFEE = $av['FPRFEE']*5;
							$max_fee = $av['FMAXFEE']*5;
							
						}else
						{
							$O_FFEE = $av['O_FFEE']*3;	
							$FPRFEE = $av['FPRFEE']*3;
							$max_fee = $av['FMAXFEE']*3;
						}			
					}else
					{
						$O_FFEE  = $av['O_FFEE'];
						$FPRFEE  = $av['FPRFEE']; 
						$max_fee = $av['FMAXFEE'];
					}
					//jcp14009
					//var_dump($char_name);
					//var_dump($h_code); 
					/* 
					if($av['FHEADCODE'] == '08 FINE')
						$i++;
					$tot+=$input_val;*/
					//var_dump($FSUBNAME);
					/* if($av['FHEADCODE'] == '07 PRACTICAL FEE' && $FFRESHEXAM != $char_name)
					{	
						if($av['FHEADCODE'] == '07 PRACTICAL FEE' && $FPASSMTH == '' && $FSUBNAME == 'PROJECT REPORT AND VIVA-VOCE')					
						{	
							$tr.="<td  align='center'  style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;' > <input  type=hidden value='{$O_FFEE}' id='o_fee_{$char_name}_{$h_code}' /> <input  type=hidden value='{$FPRFEE}' id='prfee_{$char_name}_{$h_code}' />  <input  type=hidden value='{$max_fee}' id='minnfee_{$char_name}_{$h_code}' /> <input readonly='true' onblur='CalculateNewwFeeTotals();' style='border:none;text-align:center;;'  type=text value='0' id='nfee_{$char_name}_{$h_code}'></td>";
							$tr.=" </tr>";
						}
						else 
							$tr.="";		
					}else
					{	 */
						$tr.="<td  align='center'  style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;' > <input  type=hidden value='{$O_FFEE}' id='o_fee_{$char_name}_{$h_code}' /> <input  type=hidden value='{$FPRFEE}' id='prfee_{$char_name}_{$h_code}' />  <input  type=hidden value='{$max_fee}' id='minnfee_{$char_name}_{$h_code}' /> <input readonly='true' onblur='CalculateNewwFeeTotals();' style='border:none;text-align:center;;'  type=text value='0' id='nfee_{$char_name}_{$h_code}'></td>";
						$tr.=" </tr>";
					//}	
				}
				$tr.=" <tr class='ui-state-default ui-jqgrid-hdiv'>";
				$tr.="<td align='center' style='font-weight:bold;border-left:1px solid #C5DBEC ;background:#27E87A; border-top:1px solid #C5DBEC ;border-right:1px solid #C5DBEC;   border-bottom:1px solid #C5DBEC;'> Total </td>";
				$tr.="<td align='center' style=' border-right:1px solid #C5DBEC;border-right:1px solid #C5DBEC;background:#27E87A;   border-bottom:1px solid #C5DBEC;'><input style='text-align:center;border:none;font-weight:bold;background:#27E87A;' readonly=true id='nfee_{$char_name}_total' value=0 /><input type='hidden' id='fresh_exam_{$char_name}' value='{$FFRESHEXAM}' /></td>";
				$tr.=" </tr>";
				$tr.="</table>";
							 
				$id.=$tr ;
				$id.="</td>";
				$id.="</tr>";
			
				$id.="</table>";
				$arr[$html_id]=$id;  
			}		
		}	
			   
		$student_info="<table width=70% align=center class='result_table_header' id='student_info'>
		<tr style='height:22px;'><td align=center>Reg. No. : {$this->regno}</td></tr>
		<tr style='height:22px;' ><td align=center >Name of the Student : {$this->student_name}</td></tr>
		<tr style='height:22px;' ><td align=center >Category : {$this->category}</td></tr>
		<tr style='height:22px;' ><td align=center >Fee Type : {$this->li}</td></tr>			
		</table>";
		
		$get_data="SELECT  FUNIVCODE FROM control WHERE IFNULL(FUNIVCODE,'')<>'' ";
		$lobj_get_data = $this->aobj_context->mobj_db->GetRow($get_data); 	
		$arr['table_data']=$student_exam_details;
		$arr['student_info']=$student_info;
		$arr['html_data']=$e_data;
		$arr['fee_details']=$this->li;
		$arr['FUNIVCODE']=$lobj_get_data['FUNIVCODE'];
		$arr['date']=is_null($student_exam_details['FRECPTDATE'])?date('d/m/Y'):$student_exam_details['FRECPTDATE'];

		$arr['total_count_of_each_div']=$total_count_of_each_div;

		$get_data="SELECT payment_type,bank_name FROM acc_mas where ifnull(fsuspend ,'') <> 'T' ";
		$lobj_payment_type= $this->aobj_context->mobj_db->GetAll($get_data); 
		$arr['paymode_type']=$lobj_payment_type;
		
		$photo_path = $this->aobj_context->main_src."/student_photos/".$this->college_code."/".replaceChars(strtolower($this->degree))."/".$this->regno.".jpg";
		$photo_path_real = "student_photos/".$this->college_code."/".replaceChars(strtolower($this->degree))."/".$this->regno.".jpg";
		//var_dump($photo_path);
		//YCH16101
		if(!empty($photo_path) && file_exists($photo_path)) 
		{			
			$arr['photo_path']= $photo_path_real;
			//var_dump($photo_path_real);
		}
		else
		{
			
			$arr['photo_path']="img/default_photo.jpg";
		}	
					
		if($lobj_get_total_sub_for_degree)	
		echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
		else
		echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
		return;
	}
	
	function GetNextNumber()
	{
		
		$get_prefix_running_number = "select last_number from res_reval_code_generator
		where college_code = '{$this->college_code}' and type='Candidate' ";		
		$lobj_get_prefix_running_number = $this->aobj_context->mobj_db->GetRow($get_prefix_running_number); 

		$query= " Select FEXAMPREFIX from control";
		$result = $this->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
			(
			'{$this->college_code}',
			{$next_number},'Candidate'
			)";
			$lobj_insert_into = $this->aobj_context->mobj_db->Execute($insert_into);
			$last_number = str_pad($next_number,4, "0", STR_PAD_LEFT);		
		}
		$this->UpdateNextNumber();
		return $result['FEXAMPREFIX'].$this->college_code.$last_number;	
	}
	
	function UpdateNextNumber()
	{							 
		$update_code_generator = "update res_reval_code_generator set last_number = last_number+1
		where college_code = '{$this->college_code}' and type='Candidate' ";
		$lobj_update_code_generator = $this->aobj_context->mobj_db->Execute($update_code_generator);
	}	
	function InsertEmptyAppCandSumm()
	{
		session_start();
		$FUNIVCODE=$_SESSION['FUNIVCODE'];
		$this->app_number=$this->GetNextNumber($this->aobj_context);
		
		 if($FUNIVCODE=='029')
		{
			$insert=" 
			INSERT INTO  appcandsum 
			(APPNO, FDATE,FPAYMENTYPE,
			FDEGREE,FEXAMNO, FCOLLCODE, FREGNO, 
			FCATEGORY,  FAPPEARA, FEXAMFEEA, 
			FRECPTNOA, 	FRECPTDATEA, FAPPEARB, 
			FEXAMFEEB, 	FRECPTNOB, 	FRECPTDATEB, 
			FAPPEARC, 	FEXAMFEEC, FRECPTNOC, 
			FRECPTDATEC, FAPPEARD, 	FEXAMFEED, 
			FRECPTNOD, 	FRECPTDATED,FAPPEARE, 
			FEXAMFEEE, 	FRECPTNOE, 	FRECPTDATEE, FAPPEARF, 
			FEXAMFEEF, 	FRECPTNOF, 	FRECPTDATEF, 	FAPPEARG, 
			FEXAMFEEG, 	FRECPTNOG, 	FRECPTDATEG, 	FAPPEARH, 
			FEXAMFEEH, 	FRECPTNOH, 	FRECPTDATEH, FAPPEARI, 
			FEXAMFEEI, 	FRECPTNOI,	FRECPTDATEI, 
			FAPPEARJ, FEXAMFEEJ, 	FRECPTNOJ, 
			FRECPTDATEJ, FRECPTNO, FRECPTDATE, 	FTOTALFEE, 
			FREMARKS, 	FYEAR, 	FEXAMTYPE, 	FAPPNO, FCNTRCODE, 	FGENDER,FFRESHEXAM
			)
			SELECT '{$this->app_number}',current_date(),'{$this->payment_type}',
			FDEGREE,FEXAMNO, FCOLLCODE, FREGNO, 
			FCATEGORY,  FAPPEARA, FEXAMFEEA, 
			FRECPTNOA, 	FRECPTDATEA, FAPPEARB, 
			FEXAMFEEB, 	FRECPTNOB, 	FRECPTDATEB, 
			FAPPEARC, 	FEXAMFEEC, FRECPTNOC, 
			FRECPTDATEC, FAPPEARD, 	FEXAMFEED, 
			FRECPTNOD, 	FRECPTDATED,FAPPEARE, 
			FEXAMFEEE, 	FRECPTNOE, 	FRECPTDATEE, FAPPEARF, 
			FEXAMFEEF, 	FRECPTNOF, 	FRECPTDATEF, 	FAPPEARG, 
			FEXAMFEEG, 	FRECPTNOG, 	FRECPTDATEG, 	FAPPEARH, 
			FEXAMFEEH, 	FRECPTNOH, 	FRECPTDATEH, FAPPEARI, 
			FEXAMFEEI, 	FRECPTNOI,	FRECPTDATEI, 
			FAPPEARJ, FEXAMFEEJ, 	FRECPTNOJ, 
			FRECPTDATEJ, FRECPTNO, FRECPTDATE, 	FTOTALFEE, 
			FREMARKS, 	FYEAR, 	FEXAMTYPE, 	FAPPNO, FCNTRCODE, 	FGENDER,FFRESHEXAM
			FROM candsum 	
			where  FDEGREE='{$this->degree}'
			AND FCOLLCODE='{$this->college_code}'
			AND  FREGNO='{$this->reg_no}'
			LIMIT 1"; 
		}	
		else
		{ 
			$insert="INSERT INTO  appcandsum 
					(APPNO, FDATE,FPAYMENTYPE,
					FDEGREE,FEXAMNO, FCOLLCODE, FREGNO, 
					FCATEGORY, 	FSEX, FAPPEARA, FEXAMFEEA, 
					FRECPTNOA, 	FRECPTDATEA, FAPPEARB, 
					FEXAMFEEB, 	FRECPTNOB, 	FRECPTDATEB, 
					FAPPEARC, 	FEXAMFEEC, FRECPTNOC, 
					FRECPTDATEC, FAPPEARD, 	FEXAMFEED, 
					FRECPTNOD, 	FRECPTDATED,FAPPEARE, 
					FEXAMFEEE, 	FRECPTNOE, 	FRECPTDATEE, FAPPEARF, 
					FEXAMFEEF, 	FRECPTNOF, 	FRECPTDATEF, 	FAPPEARG, 
					FEXAMFEEG, 	FRECPTNOG, 	FRECPTDATEG, 	FAPPEARH, 
					FEXAMFEEH, 	FRECPTNOH, 	FRECPTDATEH, FAPPEARI, 
					FEXAMFEEI, 	FRECPTNOI,	FRECPTDATEI, 
					FAPPEARJ, FEXAMFEEJ, 	FRECPTNOJ, 
					FRECPTDATEJ, FRECPTNO, FRECPTDATE, 	FTOTALFEE, 
					FREMARKS, 	FYEAR, 	FEXAMTYPE, 	FAPPNO, FCNTRCODE, 	FGENDER,FFRESHEXAM
					)
					 SELECT '{$this->app_number}',current_date(),'{$this->payment_type}',
					FDEGREE,FEXAMNO, FCOLLCODE, FREGNO, 
					FCATEGORY, 	FSEX, FAPPEARA, FEXAMFEEA, 
					FRECPTNOA, 	FRECPTDATEA, FAPPEARB, 
					FEXAMFEEB, 	FRECPTNOB, 	FRECPTDATEB, 
					FAPPEARC, 	FEXAMFEEC, FRECPTNOC, 
					FRECPTDATEC, FAPPEARD, 	FEXAMFEED, 
					FRECPTNOD, 	FRECPTDATED,FAPPEARE, 
					FEXAMFEEE, 	FRECPTNOE, 	FRECPTDATEE, FAPPEARF, 
					FEXAMFEEF, 	FRECPTNOF, 	FRECPTDATEF, 	FAPPEARG, 
					FEXAMFEEG, 	FRECPTNOG, 	FRECPTDATEG, 	FAPPEARH, 
					FEXAMFEEH, 	FRECPTNOH, 	FRECPTDATEH, FAPPEARI, 
					FEXAMFEEI, 	FRECPTNOI,	FRECPTDATEI, 
					FAPPEARJ, FEXAMFEEJ, 	FRECPTNOJ, 
					FRECPTDATEJ, FRECPTNO, FRECPTDATE, 	FTOTALFEE, 
					FREMARKS, 	FYEAR, 	FEXAMTYPE, 	FAPPNO, FCNTRCODE, 	FGENDER,FFRESHEXAM
					FROM candsum 	
					where  FDEGREE='{$this->degree}'
					AND FCOLLCODE='{$this->college_code}'
					AND  FREGNO='{$this->reg_no}'
					 LIMIT 1";
		}
		
		$lobj_insert = $this->aobj_context->mobj_db->Execute($insert); 
		if($lobj_insert)
		{
			//$this->UpdateNextNumber();
			return true;
		}
		else
		{
			return false;
		}
	}
	
	function saveCandidateEntryDetails()
	{
		session_start();
		$FUNIVCODE = $_SESSION['FUNIVCODE'];
		$this->reg_no = $this->aobj_context->mobj_data["reg_no"];
		$this->moi = $this->aobj_context->mobj_data["moi"];
		$this->category = $this->aobj_context->mobj_data["c"];
		$this->li = $this->aobj_context->mobj_data["li"];
		$this->payment_type = $this->aobj_context->mobj_data["payment_type"];
		$this->candidate_mobile = $this->aobj_context->mobj_data["candidate_mobile"];
		$this->prevPhotoStatus = $this->aobj_context->mobj_data["prevPhotoStatus"];
		$fpaymode=$this->payment_type;
		
		$lquery="select date_format(current_date,'%d/%m/%Y') as curr_date,
		FDEGREE,FCOLLCODE,FNAME
		from student where   FREGNO='{$this->reg_no}' ";	 
		$lobj_get_name = $this->aobj_context->mobj_db->GetRow($lquery);

		$this->college_code = $lobj_get_name['FCOLLCODE'];
		$this->degree = $lobj_get_name['FDEGREE'];
		$this->student_name = $lobj_get_name['FNAME'];
		$this->curr_date = $lobj_get_name['curr_date'];
		if($FUNIVCODE == '008')
			$moi = ",FLANGUAGE = '{$this->moi}'";
		else
			$moi = '';
		$update_student_details ="update candsum set FMOBILE = '{$this->candidate_mobile}' {$moi}
		where fregno ='{$this->reg_no}'";								
		$lobj_update_student_details = $this->aobj_context->mobj_db->Execute($update_student_details);		
		
		if(empty($this->college_code))
		{
			$arr['data']='No details found for the student';
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
			return;
		}
		if(!$this->InsertEmptyAppCandSumm())
		{
			$arr['data']='Error While Inserting AppCandSum';
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
			return;
		}
		
		$total_fee = $this->aobj_context->mobj_data["total_fee"];
		$candidate_list_receipt_no = $this->aobj_context->mobj_data["candidate_list_receipt_no"];
		$candidate_list_remarks = trim($this->aobj_context->mobj_data["candidate_list_remarks"]);
		$candidate_list_date = trim($this->aobj_context->mobj_data["candidate_list_date"]);   
		include_once($this->aobj_context->main_src."/json.php"); 
		$json = new Services_JSON();
		$check_admission_freeze ="select distinct c.FCCLSTATUS, d.fmeyear, d.fmeexamtyp 
		from colldeg c, degree d 
		where c.fdegree = d.fdegree and c.FCOLLCODE='{$this->college_code}' 
		and c.FDEGREE='{$this->degree}'";								
		$lobj_check_admission_freeze = $this->aobj_context->mobj_db->getRow($check_admission_freeze); 

		$lstr_param = stripslashes($this->aobj_context->mobj_data["details"]);
		$mobj_jsondata = $json->decode($lstr_param);
		$sub_arr_data = get_object_vars($mobj_jsondata);
		
		$lstr_sub_fee = stripslashes($this->aobj_context->mobj_data["sub_fee"]);
		$mobj_lstr_sub_fee = $json->decode($lstr_sub_fee);
		$sub_fee_data = get_object_vars($mobj_lstr_sub_fee);
		 	
		for($i=65;$i<75;$i++)
		{
			$exam_data='';
			$char_id=chr($i);
			$exam_data=get_object_vars($sub_arr_data[$char_id]);
			if(!empty($exam_data))
			{		
				for($k=0;$k<count($exam_data);$k++)
				{
					if($exam_data[$k]->sub!='' && $exam_data[$k]->sub!='None'  &&  $exam_data[$k]->smy!=-1)
					{
						$FRESENT=($exam_data[$k]->smy=='1')?"P":"N";
						
						$insert_canddet_records = "insert into appcanddet 
							(appno,fdegree,fexamno,fcollcode,fregno,fsubcode,finserted,fpresent, fyear, fexamtype) 
							select distinct '{$this->app_number}',FDEGREE,'{$exam_data[$k]->ex}',FCOLLCODE,
							FREGNO,'{$exam_data[$k]->sub}','{$exam_data[$k]->fi}','{$FRESENT}',
							FYEAR,FEXAMTYPE from candsum 
							where FDEGREE = '{$this->degree}' and FREGNO = '{$this->reg_no}'";
						
						
						/* $insert_canddet_records="insert into appcanddet 
						(APPNO,
						FDEGREE,
						FEXAMNO,
						FCOLLCODE,
						FREGNO,
						FSUBCODE,
						FINSERTED,
						FPRESENT, fyear, fexamtype) values
						(
						'{$this->app_number}',
						'{$this->degree}',
						'{$exam_data[$k]->ex}',
						'{$this->college_code}',
						'{$this->reg_no}',
						'{$exam_data[$k]->sub}',
						'{$exam_data[$k]->fi}',								 
						'{$FRESENT}', '{$lobj_check_admission_freeze['fmeyear']}', '{$lobj_check_admission_freeze['fmeexamtyp']}'	
						)"; */
						$lobj_insert_canddet_records = $this->aobj_context->mobj_db->Execute($insert_canddet_records);
						 
					}
				}	
							 
			} 
		} 
		if($FUNIVCODE == '016' || $FUNIVCODE == '026' || $FUNIVCODE == '012' || $FUNIVCODE == '008' || $FUNIVCODE == '011')
		{
			$update_appcanddet = "update appcanddet a, canddet b
			set a.fthpr = b.fthpr
			where a.fdegree = b.fdegree
			and a.fexamno = b.fexamno 
			and a.fsubcode = b.fsubcode
			and a.fregno = b.fregno
			and b.fdegree = '{$this->degree}'
			and b.fregno = '{$this->reg_no}'
			and ifnull(b.fthpr,'') <> ''";
			//var_dump($update_appcanddet);
			$lobj_insert_update_appcanddet = $this->aobj_context->mobj_db->Execute($update_appcanddet);	
		}	
				// to update the exam a/b details
		for($i=65;$i<75;$i++)
		{
			$char_id=chr($i);
			$sub_fee_datas=get_object_vars($sub_fee_data[$char_id]);
			if(!empty($sub_fee_datas))
			{
				$update_records="update appcandsum set  
				FEXAMFEE{$char_id}='{$sub_fee_datas[0]->total_fee}' 
				where  FDEGREE='{$this->degree}' and  FCOLLCODE='{$this->college_code}' 
				and FREGNO='{$this->reg_no}'
				and APPNO='{$this->app_number}'";  
				$lobj_update_records = $this->aobj_context->mobj_db->Execute($update_records);
			} 
		}
		//if($FUNIVCODE == '017')
			$total_fee = $total_fee; 
		if($FUNIVCODE == '012')
			//modified on 11.09.17
			//$total_fee = $total_fee+500;
			$total_fee = $total_fee;
		$update_total_fee = "update appcandsum set FTOTALFEE={$total_fee},
		FCATEGORY='{$this->category}', 
		FFEETYPE = '{$this->li}',		
		FLOGDATE=now()
		where  FDEGREE='{$this->degree}' and 
		FCOLLCODE='{$this->college_code}' 
		and FREGNO='{$this->reg_no}' 
		and APPNO='{$this->app_number}'	";

		$lobj_update_total_fee = $this->aobj_context->mobj_db->Execute($update_total_fee);
				 // to insert STUDFEE	
				if($this->prevPhotoStatus == 0)
				{
					$student_entry_photo_path=$this->aobj_context->mobj_data["student_entry_photo_path"];
					
					$ext_arr=explode(".",$student_entry_photo_path);
					$app_img=strtoupper($this->reg_no).".".array_pop($ext_arr);
					$src_path=$this->aobj_context->main_src."/".$student_entry_photo_path;
					$college_path=$this->aobj_context->main_src."/student_photos/{$this->college_code}";
					$folder_path=$this->aobj_context->main_src."/student_photos/{$this->college_code}/".replaceChars(strtoupper($this->degree));
					if(!file_exists($college_path))
					{
						mkdir($college_path);
					} 
					if(!file_exists($folder_path))
					{
						mkdir($folder_path);
					}		
					$path = "student_photos/{$this->college_code}/".replaceChars(strtoupper($this->degree))."/".$app_img;
					$dest_path=$folder_path.'/'.$app_img;
					copy($src_path,$dest_path);
					$query = "update student set FPHOTOPATH = '{$path}' where fregno = '{$this->reg_no}'";
					$results = $this->aobj_context->mobj_db->Execute($query);

				}	
		$this->insertStudFeeDetails($this->aobj_context);
		if($lobj_update_total_fee) 
		{
			$html="<table border=0 align='center' style='width:100%;font-weight:bold;font-size:16px;line-height:22px;padding:6px;'>";
			$html.="<tr><td align='center' style='color:green;'>Registered Successfully</td></tr>";
			$html.="<tr><td align='center' style='color:green;'>&nbsp;</td></tr>";
			$html.="<tr><td align='center'  style='font-weight:normal;'>Your Application No. : <span style='font-weight:bold'>{$this->app_number}</span></td></tr>";
			$html.="<tr><td align='center' style='font-weight:normal;' >Date : <span style='font-weight:bold'>{$this->curr_date}</span></td></tr>";
			$html.="<tr><td align='center' style='color:green;'>&nbsp;</td></tr>";

			if($fpaymode=="DEBIT/CREDIT/NET BANKING")
			{
			$html.="<tr><td align='center'  > <div class='raval_submit' style='width:193px;float:none;' >
			<span  onclick='MakeOnlinePayment(\"{$this->app_number}\");' style='float:left;margin-left:8px;cursor: pointer; line-height: 19px;font-size:14px;font-weight:bold;'>Make Online Payment</span>
			</div></td></tr>";
			}
			else
			{	$html.="<tr><td align='center'  >Please take a printout and submit to college with documents</td></tr>";
			$html.="<tr><td >&nbsp;</td></tr>";	
			$html.="<tr><td align='center'  > <div class='raval_submit' style='width:241px;float:none;' >
			<span onclick=\"PrintApplicationForm('{$this->payment_type}','{$this->app_number}');\" style='float:left;margin-left:8px;cursor: pointer; line-height: 19px;font-size:14px;font-weight:bold;'>Click here to take a PrintOut</span>
			</div></td></tr>";
			}
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($html,0,"success"); 
			return;
		}
		else
		{
			$arr='Updation failed';
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"success"); 
			return;
		}
		 
	} 
	
	function insertStudFeeDetails()
	{
		session_start();
		$FUNIVCODE = $_SESSION['FUNIVCODE'];
		
		include_once($this->aobj_context->main_src."/json.php"); 
		$json = new Services_JSON();
		$lstr_fee_details = stripslashes($this->aobj_context->mobj_data["new_fee_details"]);
		$z = 1;
		$mobj_lstr_fee_details = $json->decode($lstr_fee_details);
		$fee_details_data = get_object_vars($mobj_lstr_fee_details);
		//var_dump($fee_details_data);  
		for($i=65;$i<75;$i++)
		{
			$char_id = chr($i);
			
			if(($fee_details_data[$char_id])!=0)
			{ 	
				$insert_arr=get_object_vars($fee_details_data[$char_id]);					
				if(count($insert_arr)>0)
				{
					foreach( $insert_arr as $ak=>$av)
					{
						$FFEECODE=$ak;
						$FAMOUNT=$av;

						$insert_into_student_fee="insert into appstudfee
						(
						APPNO,FDEGREE,FEXAMNO,FCOLLCODE,FREGNO,FFEECODE,FAMOUNT,FLOGDATE
						) VALUES
						(
						'{$this->app_number}',
						'{$this->degree}',
						'{$char_id}',
						'{$this->college_code}',
						'{$this->reg_no}',
						'{$FFEECODE}',
						'{$FAMOUNT}',
						NOW()
						)";
						$lobj_insert_into_student_fee = $this->aobj_context->mobj_db->Execute($insert_into_student_fee);	
						
						/* if($FUNIVCODE == '017' || $FUNIVCODE == '012')
						{	
							if($z == 1 && $FFEECODE == '02 MARKS CARD' && $FAMOUNT >0.00)
							{	
								$insert_into_student_fee="insert into appstudfee
								(
								APPNO,FDEGREE,FEXAMNO,FCOLLCODE,FREGNO,FFEECODE,FAMOUNT,FLOGDATE
								) VALUES
								(
								'{$this->app_number}',
								'{$this->degree}',
								'{$char_id}',
								'{$this->college_code}',
								'{$this->reg_no}',
								'08 FINE',
								'500',
								NOW()
								)";
								$lobj_insert_into_student_fee = $this->aobj_context->mobj_db->Execute($insert_into_student_fee);
								$z++;
							}
							
						} */
					}
					
						
				} 
			} 
		} 
	}
	
	function DisplayApplications()
	{
		$reg_no=($this->aobj_context->mobj_data["r"]);	

		$str_reval.="<table style='padding:3px 4px 3px 3px;' class='tr_ventor_row' id='reval_table_data' width='100%' border='0' cellspacing='0' cellpadding='0'>";
		$str_reval.="<tr class='tr_bg1'>";
		$str_reval.="<td align='center' style=' font-size:12px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Sl No</td>";
		$str_reval.="<td align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Application No</td>";
		$str_reval.="<td align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Amount</td>";
		$str_reval.="<td align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Applied Date</td>";
		$str_reval.="<td align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Payment Type</td>";
		$str_reval.="<td align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Payment Status</td>";
		$str_reval.="<td align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'> Print</td>";
		$str_reval.="</tr>";
		
		$get_data="select distinct  APPNO,FTOTALFEE,DATE_FORMAT(FDATE,'%d/%m/%Y') as FAPPDATE ,
		FPAYMENTYPE,FPAYMENTCONFIRM
		from appcandsum
		where FREGNO='{$reg_no}'  ";
		$lobj_get_data = $this->aobj_context->mobj_db->GetAll($get_data);	
		
		$k=0;
		$sl_no=1;
		foreach($lobj_get_data as $ak=>$av)
		{
			$APPNO=$av['APPNO'];
			$FTOTAL=$av['FTOTALFEE'];
			$FAPPDATE=$av['FAPPDATE'];
			$FPAYMENTYPE=$av['FPAYMENTYPE'];
			$FPAYMENTSTATUS=$av['FPAYMENTSTATUS'];
			$FCHALLANNO=$av['FCHALLANNO'];
			$app_status=$av['app_status'];
			$FPAYMENTCONFIRM=$av['FPAYMENTCONFIRM'];
			if($k%2==0)
			$class='tbl_row1';
			else
			$class='tbl_row_alter1';
			$str_reval.="<tr>";		
			$str_reval.="<td class='{$class}' style='text-align:center; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;' >{$sl_no}</td>";
			$str_reval.="<td class='{$class}' style='border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center; ' >&nbsp;{$APPNO}</td>";
			$str_reval.="<td class='{$class}' style='text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;  ' >{$FTOTAL}&nbsp;</td>";
			$str_reval.="<td class='{$class}' style='text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;  ' >&nbsp;{$FAPPDATE}</td>";
			$str_reval.="<td class='{$class}' style='text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;  ' >&nbsp;{$FPAYMENTYPE}</td>";

			if($FPAYMENTCONFIRM=='success')
			$str_reval.="<td class='{$class}' style='text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;color:green; ;text-align:center; ' >Received at University for processing</td>";
			else
			{
			if($FPAYMENTYPE=="POSTOFFICE")
			$str_reval.="<td class='{$class}' style='text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;color:red; ;text-align:center; '>Payment not made at {$FPAYMENTYPE} </td>";
			else if($FPAYMENTYPE=="DEBIT/CREDIT/NET BANKING")
			$str_reval.="<td class='{$class}' style='text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;color:red; ;text-align:center; '>Online Payment Pending</td>";
			else
			$str_reval.="<td class='{$class}' style='text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;color:red; ;text-align:center; '>Payment Pending</td>";
			} 

			$div_data="";
			if($FPAYMENTYPE=="DEBIT/CREDIT/NET BANKING")
			{
				if($FPAYMENTCONFIRM=="success")
				{
				$div_data.="<div class='raval_submit' style='margin-right:19px;width:125px;  ' >
				<span  onclick=\"PrintApplicationFormNETBANKING('{$APPNO}');\" style='float:left;margin-left:26px;cursor: pointer; line-height: 19px;font-size:14px;font-weight:bold;'>Print App</span>
				</div>";
				}
				else
				{
				$div_data="<div class='raval_submit' style='margin-right:19px;width:129px;  ;' >
				<span  onclick=\"MakeOnlinePayment('{$APPNO}');\" style='float:left;margin-left:8px;cursor: pointer; line-height: 19px;font-size:14px;font-weight:bold;'>Make Payment</span>
				</div>";
				}
			}
			else if($FPAYMENTYPE=="POSTOFFICE")
			{	 
				$div_data="<div class='raval_submit' style='margin-right:19px;width:129px;  ;' >
				<span  onclick=\"PrintApplicationForm('{$FPAYMENTYPE}','{$APPNO}');\" style='float:left;margin-left:26px;cursor: pointer; line-height: 19px;font-size:14px;font-weight:bold;'>Print App</span>
				</div>";	 
			}
			else
			{
				$div_data="<div class='raval_submit' style='margin-right:19px;width:129px;  ;' >
				<span  onclick=\"PrintApplicationForm('{$FPAYMENTYPE}','{$APPNO}');\" style='float:left;margin-left:8px;cursor: pointer; line-height: 19px;font-size:14px;font-weight:bold;'>Print Challan</span>
				</div>";
			}
			$str_reval.="<td class='{$class}' align='center' style='border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;font-weight:bold;text-align:center;' >{$div_data}</td>";
			$str_reval.="</tr>";
			$sl_no++;
			$k++;
			/* $str_reval.="<td class='{$class}' style='text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;  ' >&nbsp;{$FPAYMENTYPE}</td>"; 
			$str_reval.="<td class='{$class}' align='center' style='border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;font-weight:bold;text-align:center;' ><div class='raval_submit' style='width:59px; margin: 0 auto;' >
			<span  onclick=\"PrintApplicationForm('{$FPAYMENTYPE}','{$APPNO}');\" style='float:left;margin-left:8px;cursor: pointer; line-height: 19px;font-size:14px;font-weight:bold;'>Print</span>
			</div></td>";
			$str_reval.="</tr>";
			$sl_no++;
			$k++; */
		}	
		
		$str_reval.="</table>";
		$arr['html']=$str_reval;
		echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 					
	}
	
}//end of classs

function dashboardMessageBoard($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$class_obj=new candidate_list($aobj_context);
	$class_obj->dashboardMessageBoard();	 
}  
function DisplayStudentSubjectDetails($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$class_obj=new candidate_list($aobj_context);
	$class_obj->DisplayStudentSubjectDetails();	 
}
function saveCandidateEntryDetails($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$class_obj=new candidate_list($aobj_context);
	$class_obj->saveCandidateEntryDetails();	 
} 
function DisplayApplications($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$class_obj=new candidate_list($aobj_context);
	$class_obj->DisplayApplications();	 
} 

function validateCandidateRegno($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$regno = $aobj_context->mobj_data["r"];
	$category = $aobj_context->mobj_data["c"];
	$li = $aobj_context->mobj_data["li"];
	
	$query = "select FDEGREE,FCOLLCODE,FNAME,ifnull(fexamappblk,'') as fexamappblk,
			ifnull(fmp,'') as fmp,FCASTE,ifnull(FCONSTYPE,'Normal Fee') as FCONSTYPE  from student 
			where FREGNO='{$regno}'";	 
	$rst = $aobj_context->mobj_db->GetRow($query);
	/* $queryl = "select FCONSTYPE from candsum where fregno = '{$regno}'";
	$results = $aobj_context->mobj_db->GetRow($queryl); */
	if($rst)
	{
		$college_code=$rst['FCOLLCODE'];
		$degree=$rst['FDEGREE'];
		$student_name=$rst['FNAME'];
		$fexamappblk=$rst['fexamappblk'];
		$fmp=$rst['fmp'];
		$category = $rst['FCASTE'];
		$fconstype = $rst['FCONSTYPE']; 
		if($fexamappblk == 'T'|| $fmp == 'T' )
		{
			$data ='Register number has been bloked';
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"Failure");
			return false;
		}	
		else
		{
			$data['category'] = $category;
			$data['fconstype'] = $fconstype;
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success");
		
		} 	
	}
	else
	{
		$data ='Not a valid Register no.';
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"Failure");
		return false;
	}	
	
}
############other functions############
function PopulateCategoryList($aobj_context)
{
	session_start();
	$query = "select FUNIVNAME,FUNIVCODE from control";
	$rst = $aobj_context->mobj_db->GetRow($query); 		
	$_SESSION['FUNIVCODE']=$rst[FUNIVCODE];
	
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$get_category_names="select FCATEGORY as internal_code,FCATEGORY as value from category ";
	
	$get_fconst="SELECT DISTINCT FCONSTYPE as internal_code,FCONSTYPE as value 
				 FROM admfeestr ORDER BY 1 DESC";
	$lobj_get_category_names = $aobj_context->mobj_db->GetAll($get_category_names);
	$lobj_get_fconst = $aobj_context->mobj_db->GetAll($get_fconst);
	
	$arr['category']=$lobj_get_category_names;
	$arr['FCONSTYPE']=$lobj_get_fconst;
	
	$get_all_message="select message from message_board
					where current_date() between display_from and display_to and college_code='EAF' 
					order by 1 desc ";
	$lobj_get_all_message = $aobj_context->mobj_db->GetRow($get_all_message);	
	$mess_data=$lobj_get_all_message['message'];

	if(empty($mess_data))
	{
		$mess_data="<ul class='index_message_ul'> 
						<li>Use Mozilla Firefox for best view</li>
						<li>Enter Register Number, Select Category and the Fee Type to fill the Exam Application Form</li>
						
					</ul>";
	}
	
	$arr['mess_data']=$mess_data;
	$arr['FUNIVCODE']=$_SESSION['FUNIVCODE'];
	if($lobj_get_category_names!= 0)	
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 

}

function getSubjectNamesForSelectedSub($aobj_context) 
{
	$subject_code = $aobj_context->mobj_data["subject_code"]; 
	$degree_code = $aobj_context->mobj_data["degree_code"]; 	
	$exam = $aobj_context->mobj_data["exam"]; 	
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
 	
	$get_sub_names ="select FSUBCODE as id,FSUBCODE,FSUBNAME,FSUBSHORT ,FMANDATORY 
					from degree d inner join subject s on 
					s.FDEGREE=d.FDEGREE  and  d.FEXAMNO=s.FEXAMNO
					where d.FDEGREE='{$degree_code}' and s.FEXAMNO='{$exam}'  
					and FSUBCODE='{$subject_code}'
					group by  FSUBCODE";
	$lobj_get_sub_names = $aobj_context->mobj_db->getRow($get_sub_names);	
	
	if(count($lobj_get_sub_names)==0 || empty($lobj_get_sub_names))
	{
		echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_get_sub_names,-1,"failure"); 
		return;
	}
	else
	{
		$get_theroy_cnt="SELECT COUNT(1) AS t_cnt FROM subject 
		WHERE FDEGREE='{$degree_code}' AND fexamno='{$exam}'
		AND FSUBCODE='{$subject_code}'
		AND IFNULL(ftheory,'')  =  'T' ";
		
		$lobj_get_theroy_cnt = $aobj_context->mobj_db->GetRow($get_theroy_cnt); 	  
		$th_cnt=$lobj_get_theroy_cnt['t_cnt'];

		$get_prc_cnt="SELECT COUNT(1) AS p_cnt FROM subject 
		WHERE FDEGREE='{$degree_code}' AND fexamno='{$exam}'
		AND FSUBCODE='{$subject_code}'
		AND IFNULL(ftheory,'') <> 'T' AND IFNULL(fintass,'') <> 'T' AND IFNULL(fretain,'') <> 'T' ";
		$lobj_get_prc_cnt = $aobj_context->mobj_db->GetRow($get_prc_cnt); 	
		
		$pr_cnt=$lobj_get_prc_cnt['p_cnt'];
		if($th_cnt>1) $th_cnt=max(2,$th_cnt);
		if($pr_cnt>1) $pr_cnt=max(2,$pr_cnt);

		$lobj_get_sub_names['th_cnt']=$th_cnt;		
		$lobj_get_sub_names['pr_cnt']=$pr_cnt;	
		echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_get_sub_names,0,"success"); 
		return;
	}
}

// upload student photo / 28/04/2015
function DiaplayUserSelectedPhoto($aobj_context)
{
	
	$get_last_no="select last_no+1 as lastno from last_no";
	$obj =  $aobj_context->mobj_db->GetRow($get_last_no); 

	$update_last_no="update last_no set last_no=last_no+1";
	$aobj_context->mobj_db->Execute($update_last_no); 
	
	$login_cnt=$obj[lastno];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 

	//session_start();
	 
	$file_name=replaceChars(basename($_FILES['student_entry_upload']['name']));
	$path_arr=pathinfo($_FILES['student_entry_upload']['name']);
	$file_ext=$path_arr['extension'];

	$temp_path = $aobj_context->main_src."/student_photos/temp";
	if(!file_exists($temp_path))
	{
		mkdir($temp_path);
	}
	$file_path ="/{$login_cnt}_{$file_name}";
 	$temp_path.=$file_path;
	//var_dump($_FILES['student_entry_upload']['name'].'   '.$_FILES['student_entry_upload']['name']);die();
	if(isset($_FILES['student_entry_upload']['name']) && $_FILES['student_entry_upload']['name'] != '')         
	{ 
		$size=($_FILES['student_entry_upload']['size']/1024);
		if($size>1024)
		{
			$data="Please Upload the Photo of size less than 1 MB";
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,-2,"success"); 
			return;
		}
		if(move_uploaded_file($_FILES['student_entry_upload']['tmp_name'],$temp_path))
		{
			$data="student_photos/temp/{$file_path}";
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
			return;
		}
	}

	$data="sucess";
	echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
	return;	
	
}
	
function replaceChars($name)
{
	$spl_char = array("*","/","~","!","@","#","$","%","^","&",":",";","?","/","\\","_","-","'"," ","");
	$link_name = strtolower(str_replace($spl_char,"_",$name));
	return str_ireplace("__","_",$link_name);
}	
		
	
function uploadAdmissionTicketPhoto($aobj_context)
{
	session_start();
	$aobj_context=$aobj_context;
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$regno = $aobj_context->mobj_data["reg_no"];
	$get_other_details="select FDEGREE,FCOLLCODE,FNAME from student where   FREGNO='{$regno}' 
		and ifnull(fmp,'') <> 'T'";	 
	$lobj_get_name = $aobj_context->mobj_db->GetRow($get_other_details);
	$college_code=$lobj_get_name['FCOLLCODE'];
	$degree=$lobj_get_name['FDEGREE'];
	$student_name=$lobj_get_name['FNAME'];
		
		
	$student_entry_photo_path=$aobj_context->mobj_data["student_entry_photo_path"];
	$ext_arr=explode(".",$student_entry_photo_path);
	$app_img=strtoupper($regno).".".array_pop($ext_arr);
	$src_path=$aobj_context->main_src."/".$student_entry_photo_path;
	$url = $aobj_context->main_src;
	$url = str_replace('student','oasis/kus',$url);	
	$college_path=$url."/student_photos/{$college_code}";
	$folder_path=$url."/student_photos/{$college_code}/".replaceChars(strtolower($degree));
	if(!file_exists($college_path))
	{
		mkdir($college_path);
	} 
	if(!file_exists($folder_path))
	{
		mkdir($folder_path);
	}		
	
	$dest_path =$folder_path.'/'.$app_img;
	copy($src_path,$dest_path);
	
	$data="Photo uploaded successfully";
	echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
	return;	

}
	
function DisplayIAmarkdetails($aobj_context)
{		
	session_start();	
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$regno = strtoupper($aobj_context->mobj_data["r"]);
	
	$query = "SELECT marks.fdegree, student.fname, marks.fexamno, subject.fsubcode, subject.fsubname, 
			GROUP_CONCAT(marks.fsubcode,'' ORDER BY marks.fsubcode) AS fsubstr,
			GROUP_CONCAT(subject.fshortname,'' ORDER BY marks.fsubcode) AS fsubshort,
			GROUP_CONCAT(CASE IFNULL(marks.fmarks,'') WHEN '-1' THEN ' - ' WHEN  '-2' THEN 'AB' ELSE fmarks END,'' ORDER BY marks.fsubcode) AS marks 
			FROM marks, subject, student
			WHERE marks.fdegree = subject.fdegree AND marks.fexamno = subject.fexamno 
			AND marks.fsubcode = subject.fcsubcode AND marks.fdegree = student.FDEGREE
			AND marks.fregno = student.fregno AND marks.fregno = '{$regno}' AND IFNULL(fmarks,-1) <> -1
			GROUP BY marks.fdegree, marks.fexamno, subject.fsubcode
			ORDER BY marks.fdegree, marks.fexamno, subject.fsubcode";
	$rst = $aobj_context->mobj_db->getAll($query);
	
	if($rst)
	{	
		$html ="<table width=70% align=center class='result_table_header' id='student_info'>
		<tr style='height:22px;'><td align=center>Reg. No. : {$regno}</td></tr>
		<tr style='height:22px;' ><td align=center >Name of the Student : {$rst[0]['fname']}</td></tr>		
		</table>";				
		$html.="<table style='padding:3px 4px 3px 3px;' class='tr_ventor_row' id='reval_table_data' width='100%' border='0' cellspacing='0' cellpadding='0'>";
		$html.="<tr class='tr_bg1' style='height:30px;'>";
		$html.="<td align='center' style=' font-size:12px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Sl. No.</td>";
		$html.="<td align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Subject Name</td>";
		$html.="<td align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Marks details</td>";
		$html.="</tr>";
		$sl_no = 1;
		$cursubcode = '';
		foreach($rst as $ak=>$av)
		{
			$subject=$av['fsubname'];
			$subjele=$av['fsubshort'];
			$subjelemrks=$av['marks'];
			
			$subjelearr = explode(',',$subjele);	
			$marksarr = explode(',',$subjelemrks);
			
			$subjelestr = '';
			for($i=0;$i<count($subjelearr);$i++)
			{
				$subjelestr .= "<div  style='width:50px;float:left;'><div style='padding:5px 0px;'>{$subjelearr[$i]}</div><div style='padding:5px 0px;'>{$marksarr[$i]}</div> </div>";
			}	
			
			if($k%2==0)
				$class='tbl_row1';
			else
				$class='tbl_row_alter1';
			$html.="<tr>";		
			$html.="<td class='{$class}' style='text-align:center;height:30px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;' >{$sl_no}</td>";
			$html.="<td class='{$class}' style='border-left:0px solid #C5DBEC;height:30px; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:left; ' >&nbsp;{$subject}</td>";
			$html.="<td class='{$class}' style='text-align:left; height:30px;border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center;  ' >{$subjelestr}&nbsp;</td>";
			$html.="</tr>";	
	
			++$sl_no;
			$cursubcode = $av['fsubcode'];
		}
		$html.="</table>";
		echo $aobj_context->mobj_output->ToJSONEnvelope($html,0,"success"); 
		return;	
	}
	else
	{
		$error_info = "";
		echo $aobj_context->mobj_output->ToJSONEnvelope($error_info,0,"success"); 
		return;	
	}	
}
	
function Displayattendance($aobj_context)
{		
	session_start();	
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$regno = strtoupper($aobj_context->mobj_data["r"]);
	
	$query = "select distinct FEXAMTYPE from attend where fregno = '{$regno}'";
	$results = $aobj_context->mobj_db->getRow($query);
	if($results['FEXAMTYPE'] == 1)
	{
		$str = "if(ifnull(fdecc,'0') = '0','NA',concat(IFNULL(fdeca,'-'), ' / ', IFNULL(fdecc,'-'))) as fdec,
		if(ifnull(fjanc,'0') = '0','NA',concat(IFNULL(fjana,'-'), ' / ', IFNULL(fjanc,'-'))) as fjan,
		if(ifnull(ffebc,'0') = '0','NA',concat(IFNULL(ffeba,'-'), ' / ', IFNULL(ffebc,'-'))) as ffeb,
		if(ifnull(fmarc,'0') = '0','NA',concat(IFNULL(fmara,'-'), ' / ', IFNULL(fmarc,'-'))) as fmar,
		if(ifnull(faprc,'0') = '0','NA',concat(IFNULL(fapra,'-'), ' / ', IFNULL(faprc,'-'))) as fapr,
		if(ifnull(fmayc,'0') = '0','NA',concat(IFNULL(fmaya,'-'), ' / ', IFNULL(fmayc,'-'))) as fmay,fper";
		$name = array('Dec','Jan','Feb','Mar','Apr','May','Percentage');
		
	}
	else
	{
		$str = "concat(IFNULL(fjuna,'-'), ' / ', IFNULL(fjunc,'-')) as fdec,
		concat(IFNULL(fjula,'-'), '/', IFNULL(fjulc,'-')) as fjan,
		concat(IFNULL(fauga,'-'), '/', IFNULL(faugc,'-')) as ffeb,
		concat(IFNULL(fsepa,'-'), '/', IFNULL(fsepc,'-')) as fmar,
		concat(IFNULL(focta,'-'), '/', IFNULL(foctc,'-')) as fapr,
		concat(IFNULL(fnova,'-'), '/', IFNULL(fnovc,'-')) as fmay,fper";
		$name = array('Jun','Jul','Aug','Sep','Oct','Nov','Percentage');
	}	
	
	$query = "select distinct a.fdegree,a.fexamno,a.fregno,st.fname,
	concat(s.fsubname,' ',s.fssubname) as fsubname,FEXAMTYPE,
	{$str}
	from attend a,student st,subject s,collatt cl
	where a.fdegree = s.FDEGREE and s.FCSUBCODE = a.FSUBCODE
	and s.fexamno = a.fexamno and a.fregno = st.fregno and 
	cl.fcollcode = a.FCOLLCODE and cl.fdegree = a.fdegree and a.fexamno = cl.fexamno
	and cl.FFREEZED = 'T' and a.fregno = '{$regno}'";
				
	$rst = $aobj_context->mobj_db->getAll($query);
	
	
	
	if($rst)
	{	
		$html ="<table width=70% align=center class='result_table_header' id='student_info'>
		<tr style='height:22px;'><td align=center>Reg. No. : {$regno}</td></tr>
		<tr style='height:22px;' ><td align=center >Name of the Student : {$rst[0]['fname']}</td></tr>		
		</table>";		
	//	var_dump($rst);
		$html.="<table style='padding:3px 4px 3px 3px;' class='tr_ventor_row' id='reval_table_data'  border='0' cellspacing='0' cellpadding='0'>";
		$html.="<tr class='tr_bg1' style='height:30px;'>";
		$html.="<td align='center' style=' font-size:12px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;width:50px;'>Sl. No.</td>";
		$html.="<td align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;width:400px;'>Subject Name</td>";
		$html.="<td align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;width:80px;'>{$name[0]}</td>";
		$html.="<td align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;width:80px;'>{$name[1]}</td>";
		$html.="<td align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;width:80px;'>{$name[2]}</td>";
		$html.="<td align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;width:80px;'>{$name[3]}</td>";
		$html.="<td align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;width:80px;'>{$name[4]}</td>";
		$html.="<td align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;width:80px;'>{$name[5]}</td>";
		$html.="<td align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;width:80px;'>{$name[6]}</td>";
		$html.="</tr>";
		$sl_no = 1;
		$cursubcode = '';
		
		foreach($rst as $ak=>$av)
		{
			$subject=$av['fsubname'];
			if($k%2==0)
				$class='tbl_row1';
			else
				$class='tbl_row_alter1';
			
			$html.="<tr>";		
			$html.="<td class='{$class}' style='text-align:center;height:30px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;' >{$sl_no}</td>";
			$html.="<td class='{$class}' style='border-left:0px solid #C5DBEC;height:30px; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:left; ' >&nbsp;{$subject}</td>";
			$html.="<td class='{$class}' align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;width:80px;text-align:center;'>{$av['fdec']}</td>";
			$html.="<td class='{$class}' align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;width:80px;text-align:center;'>{$av['fjan']}</td>";
			$html.="<td class='{$class}' align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;width:80px;text-align:center;'>{$av['ffeb']}</td>";
			$html.="<td class='{$class}' align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;width:80px;text-align:center;'>{$av['fmar']}</td>";
			$html.="<td class='{$class}' align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;width:80px;text-align:center;'>{$av['fapr']}</td>";
			$html.="<td class='{$class}' align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;width:80px;text-align:center;'>{$av['fmay']}</td>";
			$html.="<td class='{$class}' align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;width:80px;text-align:center;'>{$av['fper']}</td>";			
			$html.="</tr>";	
			++$sl_no;
		}
		
		$html.="</table>";
		$html.="<div><b style = 'color:red'>Note : </b> Attended / Conducted. NA : Not Available.</div>";
		echo $aobj_context->mobj_output->ToJSONEnvelope($html,0,"success"); 
		return;	
	}
	else
	{
		$error_info = "";
		echo $aobj_context->mobj_output->ToJSONEnvelope($error_info,0,"success"); 
		return;	
	}	
}

function DiaplayUserSelectedPhotoApp($aobj_context)
	{
		
		$get_last_no="select last_no+1 as lastno from last_no";
		$obj =  $aobj_context->mobj_db->GetRow($get_last_no); 

		$update_last_no="update last_no set last_no=last_no+1";
		$aobj_context->mobj_db->Execute($update_last_no); 
		
		$login_cnt=$obj[lastno];
		$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 

		//session_start();
		
		$file_name=replaceChars(basename($_FILES['student_entry_uploadapp']['name']));
		//var_dump($file_name);
		$path_arr=pathinfo($_FILES['student_entry_uploadapp']['name']);
		$file_ext=$path_arr['extension'];
		
		

		$temp_path=$aobj_context->main_src."/student_photos/temp";
		if(!file_exists($temp_path))
		{
		 mkdir($temp_path);
		}
		$file_path="/{$login_cnt}_{$file_name}";
		$temp_path.=$file_path;
		//var_dump($temp_path);
		//var_dump($_FILES['student_entry_upload']['name'].'   '.$_FILES['student_entry_upload']['name']);die();
			if(isset($_FILES['student_entry_uploadapp']['name']) && $_FILES['student_entry_uploadapp']['name'] != '')         
				{ 
				$size=($_FILES['student_entry_uploadapp']['size']/1024);
				if($size>1024)
				{
				$data="Please Upload the Photo of size less than 1 MB";
					echo $aobj_context->mobj_output->ToJSONEnvelope($data,-2,"success"); 
					return;
				}
				if(move_uploaded_file($_FILES['student_entry_uploadapp']['tmp_name'],$temp_path))
				 {
					$data="student_photos/temp/{$file_path}";
					echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
					return;
				 }
				}

		
				$data="success";
				echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
					return;	
	
	}
	
	
?>