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 : 18.220.85.96


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

<?php
class candidate_list
	{ 
    public $drop_down_arr;
	function __construct($aobj_context)
	{
		session_start();
		$this->aobj_context=$aobj_context;
		$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
		
	}

	function dashboardMessageBoard()
	{
		$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 = $this->aobj_context->mobj_db->GetRow($get_all_message);	
		  
		 $this->mess_data=$lobj_get_all_message['message'];
		 
		 if(empty($this->mess_data))
		 {
			$this->mess_data="<br><b>All the best.</b><br>
			<br><p justify></p>";
		 }
	} 
		function DisplayStudentSubjectDetails()
		{
			$this->regno =  strtoupper($this->aobj_context->mobj_data["r"]);
			$this->category = $this->aobj_context->mobj_data["c"];
			$this->li = $this->aobj_context->mobj_data["li"];
			$get_other_details="select FDEGREE,FCOLLCODE,FNAME from student where   FREGNO='{$this->regno}' 
			and ifnull(fexamappblk,'') <> 'T' and ifnull(fmp,'') <> 'T'";	 
			$lobj_get_name = $this->aobj_context->mobj_db->GetRow($get_other_details);
			$this->college_code=$lobj_get_name['FCOLLCODE'];
			$this->degree=$lobj_get_name['FDEGREE'];
			$this->student_name=$lobj_get_name['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;
			}
			else
			{
				$this->GenerateCandidateDetails();
			}
		}

		function SubjectCodeDetails($exam)
		{
			$get_data="select FSUBCODE as id,FSUBNAME,fsubshort,
									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";
			$obj_get_data = $this->aobj_context->mobj_db->GetAll($get_data); 
			 
			$option="<option value='None'>None</option>";

			foreach($obj_get_data as $ak=>$av)
			{
				$fsubshort=$av['fsubshort'];
				$code=$av['FSUBCODE'];
				$FSUBNAME=$av['FSUBNAME'];
				$option.="<option value='{$code}'>{$fsubshort} {$FSUBNAME}</option>";
			}
			return $option;
		}

		function GenerateCandidateDetails()
		{
			$exam_appear=array();

			$query = "select ifnull(fappblock,'F') as fappblock from student where fregno = '{$this->regno}'";
			$res = $this->aobj_context->mobj_db->GetRow($query);
			$appblock = $res['fappblock'];

			if($appblock == 'T')
			{
				$arr['data']="<span style='font-weight:bold;font-size:20px;color:red;'>Last Date is over for exam application</span>";
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
				return;
			}

			$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);

			// $qry=" select * from colldeg where fdegree = '{$this->degree}' and fcollcode = '{$this->college_code}' 
			// and ifnull(fexregstop,'') = 'T'";
			// $student_exam_details = $this->aobj_context->mobj_db->GetRow($qry); 
		 
			if(count($student_exam_details) > 0)
			{	
				$qry=" 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,
				c.FTOTSUBA,c.FTOTSUBB,c.FTOTSUBC,c.FTOTSUBD,c.FTOTSUBE,c.FTOTSUBF,c.FTOTSUBG,c.FTOTSUBH,c.FTOTSUBI,c.FTOTSUBJ,
				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 ,
				if(FFRESHEXAM = '','G',ifnull(ucase(FFRESHEXAM),'G')) as 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($qry); 
				$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;'>Semester Details (Click on the relevant semester for Paper 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;'>I</td>";
				$e_data.="<td align='center' style='font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>II </td>";
				$e_data.="<td align='center' style='font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>III </td>";
				$e_data.="<td align='center' style='font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>IV </td>";
				$e_data.="<td align='center' style='font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>V </td>";
				$e_data.="<td align='center' style='font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>VI</td>";
				$e_data.="<td align='center' style='font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>VII</td>";
				$e_data.="<td align='center' style='font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>VIII</td>";
				$e_data.="<td align='center' style='font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>IX</td>";
				$e_data.="<td align='center' style='font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>X</td>";
				$e_data.="</tr>";	
				$e_data.="<tr  style='   border-bottom:1px solid #C5DBEC;'>";
			 
			}
			else
			{
				/* Student Admissin Ticket download for college series 2 & 3  */
					
				if(strlen($this->college_code) >2)
				{
					if(substr($this->college_code,0,1) == 2 || substr($this->college_code,0,1) == 3)
					{
							$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);
						if($this->std_adm_count == 1)
						{
							$arr['adm_ticket']='true';
						}	
					
					}
				
				}
				/* End      */
					
				$arr['data']="<span style='font-weight:bold;font-size:20px;color:red;'>Last Date is over for exam application</span>";
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
				return;

			}
				 
				 $fee_td="";
				$FFRESHEXAM=$student_exam_details['FFRESHEXAM'];

				$qry=" select count(*) as cnt from canddet 
				where fregno = '{$this->regno}' 
				and fexamno = '{$FFRESHEXAM}' 
				and ifnull(fpassmth,'') <> 'SUB-EX'
				and ifnull(fpassmth,'') <> ''";
				$resnct = $this->aobj_context->mobj_db->GetRow($qry);
				if($resnct['cnt'] >0)
				{
					$FFRESHEXAM = 'G';
				}

				$student_exam_details['FFRESHEXAM'] = $FFRESHEXAM;
				$totsub.=$student_exam_details['FTOTSUBA'].",";
				$totsub.=$student_exam_details['FTOTSUBB'].",";
				$totsub.=$student_exam_details['FTOTSUBC'].",";
				$totsub.=$student_exam_details['FTOTSUBD'].",";
				$totsub.=$student_exam_details['FTOTSUBE'].",";
				$totsub.=$student_exam_details['FTOTSUBF'].",";
				$totsub.=$student_exam_details['FTOTSUBG'].",";
				$totsub.=$student_exam_details['FTOTSUBH'].",";
				$totsub.=$student_exam_details['FTOTSUBI'].",";
				$totsub.=$student_exam_details['FTOTSUBJ'].",";



				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)];
					//is_null($student_exam_details['FRECPTDATE'])?date('d/m/Y'):$student_exam_details['FRECPTDATE'];
					$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 Subs
				// $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'];}
				// }
			  // Exam A Div
			   

			  $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); 
		$totsub = explode(',',$totsub);		 
		for($j=0;$j<count($lobj_get_total_sub_for_degree);$j++)
		{
			if($lobj_get_total_sub_for_degree[$j]['FEXAMNO'] == 'A')
			{

				//var_dump($fcnta.' - '.$lobj_get_total_sub_for_degree[$j]['FEXAMNAME']);
				if($totsub[$j] > 0)
					$exam_A_limit = $totsub[$j];
				else
					$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')
			{ 
				if($totsub[$j] > 0)
					$exam_B_limit = $totsub[$j];
				else
					$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')
			{
				if($totsub[$j] > 0)
					$exam_C_limit = $totsub[$j];
				else
					$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')
			{
				if($totsub[$j] > 0)
					$exam_D_limit = $totsub[$j];
				else
					$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')
			{
				if($totsub[$j] > 0)
					$exam_E_limit = $totsub[$j];
				else
					$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')
			{
				if($totsub[$j] > 0)
					$exam_F_limit = $totsub[$j];
				else
					$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')
			{
				if($totsub[$j] > 0)
					$exam_G_limit = $totsub[$j];
				else
					$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')
			{
				if($totsub[$j] > 0)
					$exam_H_limit = $totsub[$j];
				else
					$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')
			{
				if($totsub[$j] > 0)
					$exam_I_limit = $totsub[$j];
				else
					$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')
			{
				if($totsub[$j] > 0)
					$exam_J_limit = $totsub[$j];
				else
					$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'  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:13px; padding-left:6px; height:20px;'>{$semister_names[$FEXAMNO]} (For extra subject entries below (if any) select Paper as ‘DUMMY’ from subject drop down list)</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;'>Paper</td>";			
					$id.="<td align='center' style='  font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;font-weight:bold;'>Subject 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;width:70px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;font-weight:bold;'> Select/Deselect <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>";
					  
					$get_header_exam_details ="select c.FSUBCODE,s.FSUBNAME,ifnull(c.FPASSMTH,'') as FPASSMTH,
											s.FSUBSHORT 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($get_header_exam_details); 
					//var_dump($get_header_exam_details);
				 //echo $get_header_exam_details;
					  $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']; 
							$get_theroy_cnt="SELECT COUNT(1) 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); 	
							$th_cnt=$lobj_get_theroy_cnt['t_cnt'];
							
							$get_prc_cnt="SELECT COUNT(1) AS p_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_prc_cnt = $this->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);
							
							//if($FTHPR=='T') $th_cnt=0;
							//if($FTHPR=='F') $pr_cnt=0;
							$FSUBSHORT = $lobj_rs[$m]['FSUBSHORT']; 
							//var_dump($FSUBSHORT);
							$FSUBNAME=$lobj_rs[$m]['FSUBNAME']; 
							 if($lobj_rs[$m]['FPASSMTH']=='' or is_null($lobj_rs[$m]['FPASSMTH']))// to display pass M/Y based on the  value
							 {
							 
							//$checked=($lobj_rs[$m]['FPRESENT']=='P')?" checked ":"";	
							// Default Making as checked as Pondi Uni preffers all Subjects to Take
							//$checked= " checked " ;	//for default check status
							$FPASSMTH="<input type='checkbox'  checked = true 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')// 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($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++;
						}
						// for non entered Subjects
						 
						 
						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];
						// echo $exam_fee[$html_id];
						 $exam_receipt_no_val=$exam_receipt_no[$html_id];
						 $exam_receipt_no_date_val=$exam_receipt_no_date[$html_id];
						 
							//for Total Input Box
						/* 	 $id.="</tr><tr>";
							 $id.="<td align='right' style='padding:2px; font-size:12px;   border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><div style='border:1px solid #C5DBEC;'>Receipt No:</div></td>";
							 $id.="<td align='left'  style='font-size:12px;   border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><input type='text' style='width:85px;' id='exam_{$char_name}_receipt_no' value='{$exam_receipt_no_val}'> &nbsp;&nbsp;Date:</font></td>";
							 $id.="<td    style='font-size:12px;   border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'align=left><input style='width:75px;' value='{$exam_receipt_no_date_val}' id='exam_{$char_name}_date' type='text' />							
									<script>$('#exam_{$char_name}_date').datepicker({showOn: 'button',showButtonPanel: true, changeMonth: true, changeYear: true,dateFormat:'dd/mm/yy', buttonImage: 'images/cal.jpg', buttonImageOnly: true});</script>							
									 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>";										 
							 $id.="<td style=' background-color:Coral;font-size:12px;   border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;' align='center'><input readonly type=text onblur=showExamNosDiv('{$html_id}');CheckCheckBoxIsChecked('{$html_id}') id='{$html_id}_total' style='width:76px;background-color:Coral;border:none;' value='{$exam_fee_val}' align='right' onkeypress='return acceptNumbersOnlyForModule(event);'>  </td>";
							 $id.="</tr>";
							$id.="</table>" */;
						 
							$query = "select FFRESHEXAM from candsum where fregno = '{$this->regno}'";
							$res1 = $this->aobj_context->mobj_db->GetRow($query);
							$FFRESHEXAM = $res1['FFRESHEXAM'];

							$qry=" select count(*) as cnt from canddet 
							where fregno = '{$this->regno}' 
							and fexamno = '{$FFRESHEXAM}' 
							and ifnull(fpassmth,'') <> 'SUB-EX'
							and ifnull(fpassmth,'') <> ''";
							$resnct = $this->aobj_context->mobj_db->GetRow($qry);
							//var_dump($qry);
							if($resnct['cnt'] >0)
							{
								$FFRESHEXAM = 'G';
							}
							//var_dump($FFRESHEXAM);
							$query = "select * From studmiscfee where fregno = '{$this->regno}' and ifnull(fpaymentstatus,'') = 'success'";
							$res = $this->aobj_context->mobj_db->GetRow($query); 
							$cnd = "";
							if($res)
								$cnd = "and a.FHEADCODE <> '02 Provisional Certificate'";

							$query = "select * from candsum where fregno = '{$this->regno}' 
							and fcollcode = '1018' and fdegree = 'MA18'
							and ffreshexam = 'D'";
							$res3 = $this->aobj_context->mobj_db->GetRow($query);

							if($res3)	
							{

								$get_fee_data = "SELECT  FHEADCODE,'0' as FFEE,
								IF('{$FFRESHEXAM}'='{$char_name}',if(FHEADCODE = 'FEE','0',FFEE),FREPFEE) AS O_FFEE,
								IF('{$FFRESHEXAM}'='{$char_name}',if(FHEADCODE = 'FEE','0',FPRFEE),FREPPRFEE) AS FPRFEE ,
								IF('{$FFRESHEXAM}'='{$char_name}',if(FHEADCODE = 'FEE','0',FMAXFEE),FMAXFEE) AS FMAXFEE 
								FROM admfeestr a
								WHERE FDEGREE='{$this->degree}'
								AND FEXAMNO='{$char_name}'
								AND FCOMBCODE='EXAM' {$cond}
								AND FCATCODE='{$this->category}'
								and FCONSTYPE='{$this->li}' 
								{$cnd}
								and IF(IFNULL(FREGRANGE,'') = '', 1=1, 1=1 and (INSTR(FREGRANGE,(CONCAT(SUBSTR('{$this->regno}',1,4),'*'))) <= 0 or INSTR(FREGRANGE,(CONCAT(SUBSTR('{$this->regno}',1,4),'*'))) <= 0))
								and IF(IFNULL(FCOLLRANGE,'') = '', 1=1, 1=1 and INSTR(FCOLLRANGE,(CONCAT('{$this->college_code}','*'))) <= 0)
								order by FHEADCODE";

							}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='{$this->category}'
								and FCONSTYPE='{$this->li}' 
								{$cnd}
								and IF(IFNULL(FREGRANGE,'') = '', 1=1, 1=1 and (INSTR(FREGRANGE,(CONCAT(SUBSTR('{$this->regno}',1,4),'*'))) <= 0 or INSTR(FREGRANGE,(CONCAT(SUBSTR('{$this->regno}',1,4),'*'))) <= 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); 	
						//var_dump($get_fee_data);
							$cffreshexam = '';
							$query  = "select  ifnull(ucase(cs.ffreshexam),'G') as ffreshexam from candsum cs inner join college cl on 	
									  cs.fcollcode = cl.fcollcode 
									  where cs.fregno = '{$this->regno}' and ifnull(cl.FCONSEXITS,'') = 'T'";
							$result = $this->aobj_context->mobj_db->GetRow($query); 	
							if($result)
								$cffreshexam = $result['ffreshexam'];

								if($resnct['cnt'] >0)
								{
									$cffreshexam = 'X';
								}



							 $fee_cnt = count($lobj_get_fee_data)+1;
							
							$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)
									{

										
										if($char_name == $cffreshexam && $av['FHEADCODE'] == 'FEE')
										{
											// var_dump($char_name);
											// var_dump($cffreshexam);
											$av['O_FFEE'] = 0;
											$av['FPRFEE'] = 0;
											$av['FMAXFEE'] = 0;	
											$av['FFEE'] = 0;	
										}else
										{
											
										}

									 $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'];										 
										$O_FFEE=$av['O_FFEE'];							 
										$tot+=$input_val;							 
										$tr.="<td  align='center'  style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;' > <input  type=hidden value='{$av['O_FFEE']}' id='o_fee_{$char_name}_{$h_code}' /> <input  type=hidden value='{$av['FPRFEE']}' id='prfee_{$char_name}_{$h_code}' />  <input  type=hidden value='{$av['FMAXFEE']}' 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>Roll 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;display:none;' ><td align=center >Category : {$this->category}</td></tr>
					<tr style='height:22px;display:none;' ><td align=center >Fee Type : {$this->li}</td></tr> 
					<tr style='height:10px;' ></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['FUNIVCODE']=$lobj_get_data['FUNIVCODE'];
					$arr['fcollcode']=$this->college_code;
					$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;

					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); 
		
				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);		
				}
				return "118".$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()
	{
		$this->app_number=$this->GetNextNumber($this->aobj_context);
		$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();	
			include_once($this->aobj_context->main_src."/json.php"); 
		$json = new Services_JSON();
		 
			$this->reg_no = $this->aobj_context->mobj_data["reg_no"];
			$this->category = $this->aobj_context->mobj_data["c"];
			$this->li = $this->aobj_context->mobj_data["li"];
			$total_fee = $this->aobj_context->mobj_data["total_fee"];
			$this->payment_type = $this->aobj_context->mobj_data["payment_type"];
			$fpaymode=$this->payment_type;
			$get_other_details="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($get_other_details);
			 
			$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(empty($this->college_code))
			{
				$arr['data']='Invalid Student!!';
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
				return;
			}

			$query ="select * From candsum where fregno = '{$this->reg_no}'";
			$res = $this->aobj_context->mobj_db->GetRow($query);

			$FFRESHEXAM = $res['FFRESHEXAM'];
			
			$qry=" select count(*) as cnt from canddet 
			where fregno = '{$this->reg_no}' 
			and fexamno = '{$FFRESHEXAM}' 
			and ifnull(fpassmth,'') <> 'SUB-EX'
			and ifnull(fpassmth,'') <> ''";
			$resnct = $this->aobj_context->mobj_db->GetRow($qry);
			if($resnct['cnt'] >0)
			{
				$FFRESHEXAM = 'G';
			}

			$FDEGREE = $res['FDEGREE'];

			$lstr_param = stripslashes($this->aobj_context->mobj_data["details"]);
		$mobj_jsondata = $json->decode($lstr_param);
		$sub_arr_data = get_object_vars($mobj_jsondata);
		$x = 0;
		$prcnt = 0;

		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";

							if($exam_data[$k]->ex != $FFRESHEXAM)
							{
								if($FRESENT == 'P' )
									$x = $x+1;

									$query = "select * from subject where fdegree = '{$FDEGREE}' and fsubcode = '{$exam_data[$k]->sub}'
									and FTHEORY = 'F'";
									$res1 = $this->aobj_context->mobj_db->GetRow($query);
									
									if($res1)
										$prcnt = $prcnt+1;
							}	
						}

						
					}			
			} 
		} 
		if($total_fee == 'NaN')
		{
				$arr['data']='Subject Not Selcted';
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
				return;
		}

		if($total_fee)
		{
			$feetobepaid = $x*500;

			if($total_fee == $feetobepaid)
			{

			}else if($total_fee>$feetobepaid)
			{

			}
			
			// else
			// {
			// 	$arr['data']='Amount Not Matching';
			// 	echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
			// 	return;
			// }

		}else
		{
			$feetobepaid = $x*500;
			
			if($total_fee == $feetobepaid)
			{

			}else
			{
				
				if($prcnt > 0)
				{

				}
				else if($prcnt == '0')
				{
					$arr['data']='Total Amount cant be ZERO';
					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_adminsion_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_adminsion_freeze = $this->aobj_context->mobj_db->getRow($check_adminsion_freeze); 
	 

			$query = "select fappto from collexam where fcollcode = '{$this->college_code}' and fdegree = '{$this->degree}'";
			$res = $this->aobj_context->mobj_db->getRow($query);
			$fappto = $res['fappto'];

			$upd = "update appcandsum set FAPPLASTDATE = '{$fappto}'
			where appno = '{$this->app_number}'";
			$res = $this->aobj_context->mobj_db->Execute($upd);
		 
		$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);
		 
	// do insert/update	
				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) 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_adminsion_freeze['fmeyear']}', '{$lobj_check_adminsion_freeze['fmeexamtyp']}'	
									)";
									$lobj_insert_canddet_records = $this->aobj_context->mobj_db->Execute($insert_canddet_records);
									 
								}
							}	
							 
					} 
				} 
				 //var_dump($sub_fee_data['F']);
				// 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);
						 
					} 
				}
				$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	
					 $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" || $fpaymode=="Other Banks" && $total_fee >0)
										{
											$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
										{	
											
											if($total_fee <=0)
												$this->payment_type = "NEFT";

											$html.="<tr><td align='center'  > Please take print out of the application and submit the same to college/department with supporting documents as applicable, for further processing.</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;
							}
		 
	} //end of saveCandidateEntryDetails
	function insertStudFeeDetails()
	{
		
		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"]);
		
		$mobj_lstr_fee_details = $json->decode($lstr_fee_details);
		$fee_details_data = get_object_vars($mobj_lstr_fee_details);
		  
		$check_adminsion_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_adminsion_freeze = $this->aobj_context->mobj_db->getRow($check_adminsion_freeze); 
		
		$fmeyear = $lobj_check_adminsion_freeze['fmeyear'];
		$fmeexamtyp = $lobj_check_adminsion_freeze['fmeexamtyp'];

			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,fyear, fexamtype
												) VALUES
												(
												'{$this->app_number}',
												'{$this->degree}',
												'{$char_id}',
												'{$this->college_code}',
												'{$this->reg_no}',
												'{$FFEECODE}',
												'{$FAMOUNT}',
												NOW(),
												'{$fmeyear}',
												'{$fmeexamtyp}'
												)";
								$lobj_insert_into_student_fee = $this->aobj_context->mobj_db->Execute($insert_into_student_fee);	
									 
						}
					}
				 // 
				 
				} 
			} 
	}
	function DisplayApplications()
	{
		$reg_no=($this->aobj_context->mobj_data["r"]);	
	 
		$str_reval.="
		<div style = 'margin-top:-30px'>
			<p style='text-align: center;color: red;font-size:15px'>
				<br>
				<span>** Important **</span><br>
				If payment is not confirmed but the amount is deducted, DO NOT make a second payment. <br>
				Please wait for 2-3 hours and visit the main page again to check for payment confirmation.<br>
				In case payment is still not confirmed please contact your BANK helpdesk/ branch for further details.
			</p>
		</div>	
		<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;'>Application 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,fdegree,fcollcode,FTOTALFEE,
						DATE_FORMAT(FDATE,'%d/%m/%Y') as FAPPDATE ,
						FPAYMENTYPE,FPAYMENTCONFIRM,
						FAPPLASTDATE>now() as cnt
						from appcandsum
						where FREGNO='{$reg_no}'";
						// var_dump($get_data);die();
			$lobj_get_data = $this->aobj_context->mobj_db->GetAll($get_data);	
			$lobj_get_data['FAPPLASTDATE'];
			$k=0;
			$sl_no=1;

			$qry=" select * from collexam where fdegree = '{$lobj_get_data[0]['fdegree']}' 
			and fcollcode = '{$lobj_get_data[0]['fcollcode']}' 
			and DATE_FORMAT(NOW(),'%Y-%m-%d') 
			BETWEEN DATE_FORMAT(fappfrom,'%Y-%m-%d') 
			AND DATE_FORMAT(fappto,'%Y-%m-%d')";

			// var_dump($qry);die();
		$student_exam_details = $this->aobj_context->mobj_db->GetRow($qry);

			foreach($lobj_get_data as $ak=>$av)
			{
				$APPNO=$av['APPNO'];
				$FTOTAL=$av['FTOTALFEE'];
				$FAPPDATE=$av['FAPPDATE'];
				$FPAYMENTYPE=$av['FPAYMENTYPE'];
				$FPAYMENTYPEDISP = $av['FPAYMENTYPE'];
				if($FPAYMENTYPE == 'NEFT')
					$FPAYMENTYPEDISP = 'Challan';
				$FPAYMENTSTATUS=$av['FPAYMENTSTATUS'];
				$FCHALLANNO=$av['FCHALLANNO'];
				$app_status=$av['app_status'];
				$FPAYMENTCONFIRM=$av['FPAYMENTCONFIRM'];
				$cnt=$av['cnt'];
				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;{$FPAYMENTYPEDISP}</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 by College/Department 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" || $FPAYMENTYPE=="Other Banks" && $FTOTAL >0)
						$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. Application Incomplete</td>";
					else if($FPAYMENTYPE=="DEBIT/CREDIT/NET BANKING" || $FPAYMENTYPE=="Other Banks" && $FTOTAL <= 0)
						$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; '>Submitted to University</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" || $FPAYMENTYPE=="Other Banks" && $FTOTAL >0)
				{
					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
					{
						if($cnt)
						{
							$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
						{
						$div_data="<div class='raval_submit' style='margin-right:19px;width:129px;  ;' >
								<span  style='float:left;margin-left:8px;cursor: pointer; line-height: 19px;font-size:14px;font-weight:bold;'>Last Date is Over</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=\"PrintApplicationFormNETBANKING('{$APPNO}');\" style='float:left;margin-left:8px;cursor: pointer; line-height: 19px;font-size:14px;font-weight:bold;'>Print</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();	 
} 
############other functions############
function PopulateCategoryList($aobj_context)
{
	$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;
	 if($lobj_get_category_names!= 0)	
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
   
}
function getSubjectNamesForSelectedSub($aobj_context) // purpose to put subject name to dynamic text boxes -- naveen
{
	$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); 	//AND IFNULL(fintass,'') <> 'T' AND IFNULL(fretain,'') <> 'T'  
							$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;
	}
}

function checkhalltiket($aobj_context)
{
	$reg_no = $aobj_context->mobj_data["reg_no"];

	$query = "select fcollcode,fdegree from candsum where fregno = '{$reg_no}'";
	$res = $aobj_context->mobj_db->GetRow($query);
	//var_dump($query);
	$fcollcode = $res['fcollcode'];
	$fdegree = $res['fdegree'];

	$query = "select * from collexam 
			where fcollcode = '{$fcollcode}' 
			and fdegree = '{$fdegree}'  
			and DATE_FORMAT(NOW(),'%Y-%m-%d') between DATE_FORMAT(collexam.fhtfrom,'%Y-%m-%d') 
			AND DATE_FORMAT(collexam.fhtto,'%Y-%m-%d')";
	$result = $aobj_context->mobj_db->GetAll($query);
	//var_dump($query);
	if($result ==  false)
	{	
		$arr = "Hall Ticket is Not Enabled.";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1,"failure");
		return;	
	}

	$query = "select fappno,fregno,ifnull(fpaymentstatus,'') as fpaystatus 
	from studmiscfee where fregno = '{$reg_no}'";
	$res = $aobj_context->mobj_db->GetRow($query);
	$final = 'F';
	if($res)
	{
		$final = 'T';
	}

	$arr['final'] = $final;
	$arr['fregno'] = $res['fregno'];
	$arr['fappno'] = $res['fappno'];
	$arr['fpaystatus'] = $res['fpaystatus'];

	echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0,"success");	

}

?>