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


Current Path : /var/www/oasis/src_old/
Upload File :
Current File : /var/www/oasis/src_old/student.php

<?php
class applicationForm
{
	function __construct($aobj_context)
	{
		session_start();
		$this->aobj_context=$aobj_context;
		include_once("/JSON.php"); 
		$this->json = new Services_JSON();
		$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);	
		$this->aobj_context=$aobj_context;
		$this->ip=$_SERVER["REMOTE_ADDR"];
		$this->collcode = $_SESSION['collcode'];
		$this->login_cnt=$_SESSION['login_cnt'];
		$this->u_id = $_SESSION['user_id'];
		$this->log_name = $_SESSION['usr'];

	}

	function assignParams()
	{
		$this->add_edit=trim($aobj_context->mobj_data["add_edit"]);
		$this->edit_app_no = trim($this->aobj_context->mobj_data["stud_admno"]);
		$this->degree=trim($this->aobj_context->mobj_data["degree"]);
		$this->rgMultiMarks=trim($this->aobj_context->mobj_data["rgMultiMarks"]);
		
		$this->examno='A';
		$this->stud_admno = trim($this->aobj_context->mobj_data["stud_admno"]);
		$this->candidate_name = strtoupper(trim($this->aobj_context->mobj_data["candidate_name"]));
		$this->fatname=strtoupper(trim($this->aobj_context->mobj_data["fname"]));
		$this->motname=strtoupper(trim($this->aobj_context->mobj_data["mname"]));
		$this->dob=trim($this->aobj_context->mobj_data["dob"]);
		$this->dobplace = trim($this->aobj_context->mobj_data["dobplace"]);
		$this->gender=trim($this->aobj_context->mobj_data["gender"]);
		$this->bloodgrp =  trim($this->aobj_context->mobj_data["bloodgrp"]); 
		$this->nationality=trim($this->aobj_context->mobj_data["nationality"]);
		$this->candidateNational=trim($this->aobj_context->mobj_data["candidateNational"]);
		$this->religion=trim($this->aobj_context->mobj_data["religion"]);
		$this->caste=trim($this->aobj_context->mobj_data["caste"]);
		$this->categoryByBirth=trim($this->aobj_context->mobj_data["categoryByBirth"]);
		$this->aadharno=trim($this->aobj_context->mobj_data["aadharno"]);
		$this->chkHydKar =  trim($this->aobj_context->mobj_data["chkHydKar"]);
		$this->area = trim($this->aobj_context->mobj_data["area"]);
		$this->state=trim($this->aobj_context->mobj_data["state"]);
		$this->peradd1=trim($this->aobj_context->mobj_data["peradd1"]);
		$this->peradd2=trim($this->aobj_context->mobj_data["peradd2"]);
		$this->peradd3=trim($this->aobj_context->mobj_data["peradd3"]);
		$this->peradd4=trim($this->aobj_context->mobj_data["peradd4"]);
		$this->commaddr1=trim($this->aobj_context->mobj_data["commaddr1"]);
		$this->commaddr2=trim($this->aobj_context->mobj_data["commaddr2"]);
		$this->commaddr3=trim($this->aobj_context->mobj_data["commaddr3"]);
		$this->commaddr4=trim($this->aobj_context->mobj_data["commaddr4"]);
		$this->email=trim($this->aobj_context->mobj_data["email"]);
		$this->mobile=trim($this->aobj_context->mobj_data["mobile"]);
		$this->incomeCrtificate = trim($this->aobj_context->mobj_data["incomeCrtificate"]);
		$this->acadyear=trim($this->aobj_context->mobj_data["acadyear"]);
		$this->admcat=trim($this->aobj_context->mobj_data["admcat"]);
		$this->sltCombination=trim($this->aobj_context->mobj_data["sltCombination"]);
		$this->sltSemester=trim($this->aobj_context->mobj_data["sltSemester"]);
		$this->admdate=trim($this->aobj_context->mobj_data["admdate"]);
		$this->admintake=trim($this->aobj_context->mobj_data["admintake"]);
		$this->admquota=trim($this->aobj_context->mobj_data["admquota"]);
		$this->lateralEnrty=trim($this->aobj_context->mobj_data["lateralEnrty"]);
		$this->rdbEnglish=trim($this->aobj_context->mobj_data["rdbEnglish"]);
		$this->rdbKannada=trim($this->aobj_context->mobj_data["rdbKannada"]);
		$this->sltLanguage1=trim($this->aobj_context->mobj_data["sltLanguage1"]);
		$this->sltLanguage2=trim($this->aobj_context->mobj_data["sltLanguage2"]);
		$this->fincome=trim($this->aobj_context->mobj_data["fincome"]);
		$this->mincome=trim($this->aobj_context->mobj_data["mincome"]);
		$this->phoneno=trim($this->aobj_context->mobj_data["phoneno"]);
		$this->lingMinority=trim($this->aobj_context->mobj_data["lingMinority"]);
		$this->regMinority=trim($this->aobj_context->mobj_data["regMinority"]);
		$this->padNational=trim($this->aobj_context->mobj_data["padNational"]);
		$this->padState=trim($this->aobj_context->mobj_data["padState"]);
		$this->typequlexam=trim($this->aobj_context->mobj_data["typequlexam"]);
		$this->instname=trim($this->aobj_context->mobj_data["instname"]);
		$this->location=trim($this->aobj_context->mobj_data["location"]);
		$this->univname=trim($this->aobj_context->mobj_data["univname"]);
		$this->examregno=trim($this->aobj_context->mobj_data["examregno"]);
		$this->language1=trim($this->aobj_context->mobj_data["language1"]);
		$this->specialization=trim($this->aobj_context->mobj_data["specialization"]);
		$this->modeEdu=trim($this->aobj_context->mobj_data["modeEdu"]);
		$this->interval=trim($this->aobj_context->mobj_data["interval"]);
		$this->degmarks=trim($this->aobj_context->mobj_data["degmarks"]);
		$this->entexammarks=trim($this->aobj_context->mobj_data["entexammarks"]);
		$this->unvregfee = trim($this->aobj_context->mobj_data["unvregfee"]);
		$this->unvregrecno = trim($this->aobj_context->mobj_data["unvregrecno"]);
		$this->admfee = trim($this->aobj_context->mobj_data["admfee"]);
		$this->admrecno = trim($this->aobj_context->mobj_data["admrecno"]);
		$this->yrpass = trim($this->aobj_context->mobj_data["yrpass"]);
		$this->mnthpass = trim($this->aobj_context->mobj_data["mnthpass"]);
		$this->mrksecure = trim($this->aobj_context->mobj_data["mrksecure"]);
		$this->mrktotal = trim($this->aobj_context->mobj_data["mrktotal"]);
		$this->mrkper = trim($this->aobj_context->mobj_data["mrkper"]);
		$this->wghtAvgMarks = trim($this->aobj_context->mobj_data["wghtAvgMarks"]);
		$this->nosemYear =  trim($this->aobj_context->mobj_data["nosemYear"]);  
		$this->phtype =  trim($this->aobj_context->mobj_data["phtype"]);
		$this->wrtExamLang = trim($this->aobj_context->mobj_data["wrtExamLanguage"]);
		$this->eligbFee =  trim($this->aobj_context->mobj_data["eligbFee"]);
		$this->eligbRecNo =  trim($this->aobj_context->mobj_data["eligbRecNo"]);
		$this->lstr_param = stripslashes($this->aobj_context->mobj_data["sub_arr"]);
		$this->mobj_jsondata = $this->json->decode($this->lstr_param);
		$this->sub_arr_data = get_object_vars($this->mobj_jsondata);

		$this->pnrno     = trim($this->aobj_context->mobj_data["pnrno"]);
		$this->univphoneno     = trim($this->aobj_context->mobj_data["univphoneno"]);
		$this->univaddres     = trim($this->aobj_context->mobj_data["univaddres"]);
		$this->institutephoneno     = trim($this->aobj_context->mobj_data["institutephoneno"]);

		$this->trg = trim($this->aobj_context->mobj_data["trg"]);
		$this->kai = trim($this->aobj_context->mobj_data["kai"]);
		$this->exs = trim($this->aobj_context->mobj_data["exs"]);
		$this->dfp = trim($this->aobj_context->mobj_data["dfp"]);
		$this->nss = trim($this->aobj_context->mobj_data["nss"]);
		$this->ncc = trim($this->aobj_context->mobj_data["ncc"]);
		$this->phd = trim($this->aobj_context->mobj_data["phd"]);

		$this->spr = trim($this->aobj_context->mobj_data["spr"]);
		$this->obs = trim($this->aobj_context->mobj_data["obs"]);
		$this->osb = trim($this->aobj_context->mobj_data["osb"]);
		$this->month      = trim($this->aobj_context->mobj_data["month"]);
		$this->year       = trim($this->aobj_context->mobj_data["year"]);
		$this->maxmarks   = trim($this->aobj_context->mobj_data["maxmarks"]);
		$this->secmarks   = trim($this->aobj_context->mobj_data["secmarks"]);
		$this->percentage = trim($this->aobj_context->mobj_data["percentage"]);
		/*
		******************	SSLC Details Begin **********************
		*/
		$this->examregno10 = trim($this->aobj_context->mobj_data["examregno10"]);
		$this->pnrno10 = trim($this->aobj_context->mobj_data["pnrno10"]);
		$this->instname10 = trim($this->aobj_context->mobj_data["instname10"]);
		$this->location10 = trim($this->aobj_context->mobj_data["location10"]);
		$this->padState10 = trim($this->aobj_context->mobj_data["padState10"]);
		$this->univname10 = trim($this->aobj_context->mobj_data["univname10"]);
		$this->univphoneno10 = trim($this->aobj_context->mobj_data["univphoneno10"]);
		$this->univaddres10 = trim($this->aobj_context->mobj_data["univaddres10"]);
		$this->institutephoneno10 = trim($this->aobj_context->mobj_data["institutephoneno10"]);
		$this->month10      = trim($this->aobj_context->mobj_data["month10"]);
		$this->year10       = trim($this->aobj_context->mobj_data["year10"]);
		$this->maxmarks10   = trim($this->aobj_context->mobj_data["maxmarks10"]);
		$this->secmarks10   = trim($this->aobj_context->mobj_data["secmarks10"]);
		$this->percentage10 = trim($this->aobj_context->mobj_data["percentage10"]);

		$this->lstr_param = stripslashes($this->aobj_context->mobj_data["fee_com"]);

		$this->mobj_jsondata = $this->json->decode($this->lstr_param);

		$this->fee_arr_data = get_object_vars($this->mobj_jsondata);

		/*
			******************	SSLC Details End **********************
		*/

		$get_year="SELECT FADYEAR FROM degree
		WHERE FDEGREE='{$this->degree}' AND FEXAMNO='{$this->examno}'";
		$lobj_get_year = $this->aobj_context->mobj_db->getRow($get_year);
		$this->f_year=$lobj_get_year['FADYEAR'];

	}
		 
	function SaveDetails()
	{
		if(trim($this->collcode) == true)
		{
			//$check_adminsion_freeze ="  select FCADSTATUS, ifnull(fadmstop,'') as FADMSTOP from colldeg 
			//where FCOLLCODE='{$this->collcode}' 
			//and FDEGREE='{$this->degree}'";								
		//$lobj_check_adminsion_freeze = $this->aobj_context->mobj_db->getRow($check_adminsion_freeze); 

			$qry = "select * from collexam where fdegree = '{$this->degree}' and fcollcode = '{$this->collcode}' 
			and DATE_FORMAT(NOW(),'%Y-%m-%d') 
			BETWEEN DATE_FORMAT(fadmfrom,'%Y-%m-%d') 
			AND DATE_FORMAT(fadmto,'%Y-%m-%d')";
			$student_exam_details = $this->aobj_context->mobj_db->GetAll($qry);
		
			if(count($student_exam_details) <= 0)
			{
				$arr='Last date for student admission is over';
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
				return;		
			}

			$get_last_no="select right(concat('0000',ifnull(max(FSLNO),0)+01),4) as app_no 
			from studadm
			WHERE FDEGREE='{$this->degree}' and FCOLLCODE = '{$this->collcode}'";
			$obj =  $this->aobj_context->mobj_db->GetRow($get_last_no); 
			$sl_no = "0000".$obj['app_no']; 
			$this->app_no= substr($sl_no, -4);

			$query = "select FADMPREFIX from control";
			$results = $this->aobj_context->mobj_db->GetRow($query);
			$FADMPREFIX = $results['FADMPREFIX'];

			$query = "select internal_code+1 as FAUTOINCREMENT from studadm 
			order by internal_code desc limit 1";
			$results = $this->aobj_context->mobj_db->GetRow($query);
			$FAUTOINCREMENT = $results['FAUTOINCREMENT'];

			$appno = $FADMPREFIX.$FAUTOINCREMENT;
			$this->fappno = $appno;

			$totalfee = $this->unvregfee + $this->admfee + $this->eligbFee;

			$insert_qry="insert into studadm 
			(FSLNO,FDEGREE,FCOLLCODE,FNAME,FGENDER,FDOB,											
			FEXAMNO,FFATNAME,FMOTNAME,FEMAIL,FCASTE,
			FCONTACT_NO,FNATIONAL,FCURRADD1,FCURRADD2,FCURRADD3,FCURRADD4,FPERMADD1,
			FPERMADD2,FPERMADD3,FPERMADD4,FLATERAL_ENTRY,FRELIGION,
			FCOMBCODE,FMOBILE_NO,
			FMARITALSTATUS,FNATCANDIDATE,FSTATE,FKARBIRTH,FCATBIRTH,
			FINCOMECRT,FACADYEAR,FADMCAT,FADMDATE,FADMINTAKE,FADMQUOTA,
			FLANGEXAM,FLANGUAGE1,FLANGUAGE2,FFATINCOME,FMOTHINCOME,
			FLINGMINORITY,FREGMINORITY,FAADHARNO,FNATQUALEXAM,FSTATEQUALEXM,
			FTYPEQUALEXAM,FINSTNAME,FINSTLOCAT,FUNIVNAME,FQUALEXREGNO,
			FLANGUAGE,FSUBSPECIAL,FMODEDU,FEXAMINTERVAL,FENTEXMARKS,
			FUSERID,  FLOGNAME, FLOGDATE, FUNIVFEE, FUNIVRECNO, FLATADMFEE, FLATRECNO,
			FPASSYER, FPASSMNTH, FMARKSECURED, FMARKTOTAL, FPERMARK, 
			FWGHTAVGMARKS, FNOSEMYEAR,FPHTYPE,
			FELIGFEE, FELIGRECNO,FHK,FAPPNO,FPOB,FAREA,FHANDICAP,FNCC,FNSS,FDEFENCE,FEXSERVE,FKASHIMG,
			FTRANS,FUNIVADD,FUNIVPHONE,FPRNNO,FCOLLPHONE,FSPORTS,FOBSATE,TOTAL_FEE,
			FWOBSATE,FQMONTH,FQYEAR,FQMAXMARKS,FQSECMARKS,FQPERCENTAGE,FBLOOD_GROUP, 
			FPRNNO10, FQUALEXREGNO10, FINSTNAME10, FCOLLADD10, FCOLLSTATE10,
			FCOLLPHONE10, FUNIVNAME10, FUNIVADD10, FUNIVPHONE10, FQMONTH10,
			FQYEAR10, FQMAXMARKS10,	FQSECMARKS10, FQPERCENTAGE10 )
			values   
			(  
			'{$this->app_no}','{$this->degree}','{$this->collcode}','{$this->candidate_name}',
			'{$this->gender}',
			date_format('{$this->dob}','%Y-%m-%d'),'{$this->examno}','{$this->fatname}',
			'{$this->motname}','{$this->email}',
			'{$this->caste}','{$this->phoneno}','{$this->nationality}',
			'{$this->commaddr1}','{$this->commaddr2}','{$this->commaddr3}','{$this->commaddr4}',
			'{$this->peradd1}','{$this->peradd2}','{$this->peradd3}','{$this->peradd4}',
			'{$this->lateralEnrty}','{$this->religion}','{$this->sltCombination}','{$this->mobile}',
			'{$this->maritalStatus}','{$this->candidateNational}',
			'{$this->state}','{$this->belkarbirth}','{$this->categoryByBirth}',
			'{$this->incomeCrtificate}','{$this->acadyear}','{$this->admcat}',
			date_format('{$this->admdate}','%Y-%m-%d'),
			'{$this->admintake}','{$this->admquota}','{$this->wrtExamLang}',
			'{$this->sltLanguage1}','{$this->sltLanguage2}','{$this->fincome}','{$this->mincome}',
			'{$this->lingMinority}','{$this->regMinority}',
			'{$this->aadharno}','{$this->padNational}','{$this->padState}','{$this->typequlexam}',
			'{$this->instname}','{$this->location}','{$this->univname}','{$this->examregno}',
			'{$this->language1}','{$this->specialization}','{$this->modeEdu}','{$this->interval}',
			'{$this->entexammarks}','{$this->u_id}','{$this->log_name}', NOW(), '{$this->unvregfee}',
			'{$this->unvregrecno}', '{$this->admfee}', '{$this->admrecno}',
			'{$this->yrpass}', '{$this->mnthpass}', '{$this->mrksecure}', '{$this->mrktotal}', 
			'{$this->mrkper}',
			'{$this->wghtAvgMarks}', '{$this->nosemYear}','{$this->phtype}',
			'{$this->eligbFee}','{$this->eligbRecNo}','{$this->chkHydKar}','{$appno}','{$this->dobplace}',
			'{$this->area}','{$this->phd}','{$this->ncc}','{$this->nss}','{$this->dfp}','{$this->exs}',
			'{$this->kai}','{$this->trg}','{$this->univaddres}','{$this->univphoneno}','{$this->pnrno}',
			'{$this->institutephoneno}','{$this->spr}','{$this->obs}','{$totalfee}','{$this->osb}','{$this->month}',
			'{$this->year}','{$this->maxmarks}','{$this->secmarks}','{$this->percentage}', '{$this->bloodgrp}','{$this->pnrno10 }',
			 '{$this->examregno10 }',  '{$this->instname10}','{$this->location10}',	'{$this->padState10 }',	'{$this->institutephoneno10 }', 
			 '{$this->univname10 }', '{$this->univaddres10 }', 
			 '{$this->univphoneno10}', '{$this->month10}',	'{$this->year10}',	
			 '{$this->maxmarks10}',	'{$this->secmarks10}',	'{$this->percentage10}')";     
					 
			$insert_obj=$this->aobj_context->mobj_db->Execute($insert_qry);	
			//var_dump($insert_qry);
			$this->last_inserted_id = $this->aobj_context->mobj_db->Insert_ID();
		
			if($this->last_inserted_id)
			{
				$this->UpdateApplicationUniqueNo();
			}
			else
			{
				$data="Error While Inserting" ;
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
				return;
			}
			
			$data['message'] = " Inserted Successful. Admission No :  ".$this->fappno;
			$data['fappno'] = $this->fappno;
			$data['fdegree'] = $this->degree;
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
		}
		else
		{
			$arr='Session Expired,please login';
			echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-9,"Failure");
			return;	
		}	
	}

	function UpdateStuDocsTables()
	{
		
		$update="update studoc set app_no='{$this->app_no}', fdegree ='{$this->degree}'  
						where 
						login_cnt='{$this->login_cnt}'";
						//var_dump($update);
		$lobj_update= $this->aobj_context->mobj_db->Execute($update);	

		$delete="delete from studoc where 
					login_cnt='{$this->login_cnt}'
					and app_no is null";	
		$lobj_delete= $this->aobj_context->mobj_db->Execute($delete);	
	}

	function UpdateApplicationUniqueNo()
	{

		$fine = 0;
		$total = 0; 

		for($k=0;$k<count($this->fee_arr_data);$k++)
		{
			$insert_options ="insert into admfeedetl 
			(FYEAR,FDEGREE,
			FEXAMNO,FCOLLCODE,
			FSLNO,FHEADCODE,
			FAMOUNT)
			values
			(
			'2018',
			'{$this->degree}',
			'A',
			'{$this->collcode}',
			'{$this->app_no}',
			'{$this->fee_arr_data[$k]->head_id}',
			'{$this->fee_arr_data[$k]->fee_paid}' 
			)
			";
			$lobj_insert_options = $this->aobj_context->mobj_db->Execute($insert_options);
			
			if($this->fee_arr_data[$k]->head_id == '06 Fine')
				$fine = $this->fee_arr_data[$k]->fee_paid;
			else
				$total += $this->fee_arr_data[$k]->fee_paid;	
		}

	
		
		$this->UpdateStuDocsTables();

		$this->mobj_jsondata = json_decode($this->rgMultiMarks,true);
		//var_dump($this->mobj_jsondata);
		
		$sub_marks = array();
		for($i=0; $i<count($this->mobj_jsondata); $i++)
		{
			
			for($j=0;$j<count($this->mobj_jsondata[$i]);$j++)
			{
				$sub_marks[$i][$this->mobj_jsondata[$i][$j]['name']] = $this->mobj_jsondata[$i][$j]['value']; 	

			}	
		}


		$query = "update studadm set TOTAL_FEE = '{$total}',FADMFINE = '{$fine}'
		WHERE FAPPNO = '{$this->fappno}'";
		$results = $this->aobj_context->mobj_db->Execute($query);

		$sql = array();
		$j=0;
		for($i=1; $i<=count($sub_marks);$i++)
		{
			$sql[] = "('{$this->app_no}'
			,'{$this->fappno}'
			,'{$this->collcode}'
			,'{$this->degree}'
			,'{$sub_marks[$j]["subsem1_$i"]}',
			'{$sub_marks[$j]["subsem1mo_$i"]}'
			,'{$sub_marks[$j]["subsem1mm_$i"]}'
			,'{$sub_marks[$j]["subsem2mo_$i"]}'
			,'{$sub_marks[$j]["subsem2mm_$i"]}'
			,'{$sub_marks[$j]["subsem3mo_$i"]}'
			,'{$sub_marks[$j]["subsem3mm_$i"]}'
			,'{$sub_marks[$j]["subsem4mo_$i"]}'
			,'{$sub_marks[$j]["subsem4mm_$i"]}'
			,'{$sub_marks[$j]["subsem5mo_$i"]}'
			,'{$sub_marks[$j]["subsem5mm_$i"]}'
			,'{$sub_marks[$j]["subsem6mo_$i"]}'
			,'{$sub_marks[$j]["subsem6mm_$i"]}'
			,'{$sub_marks[$j]["subtotalmo_$i"]}'
			,'{$sub_marks[$j]["subtotalmm_$i"]}'
			,'{$sub_marks[$j]["subpercentagemm_$i"]}')";
			
			$j++;
		}

		$query = 'INSERT INTO qualdet(fslno, fappno,
		fcollcode, fdegree, 
		fsubname, fsecmarksa , fmaxmarksa, 
		fsecmarksb, fmaxmarksb,
		fsecmarksc, fmaxmarksc,
		fsecmarksd, fmaxmarksd,
		fsecmarkse, fmaxmarkse,
		fsecmarksf, fmaxmarksf,
		ftotsecmarks, ftotmaxmarks,
		fsubpercent
		) VALUES '.implode(',', $sql);
		$resultqualdets = $this->aobj_context->mobj_db->Execute($query);
		//var_dump($query);
		include_once($this->aobj_context->main_src."/JSON.php"); 
		$json = new Services_JSON();
		
			for($k=0;$k<count($this->sub_arr_data);$k++)
			{
				$this->sub_arr_data[$k]->sub_code = strtoupper($this->sub_arr_data[$k]->sub_code);
				
				$insert_options="insert into options(FYEAR, FDEGREE,
				FEXAMNO,
				FCOLLCODE,
				FSLNO,
				FSUBCODE,
				FDELETED,fappno)
				values
				(
				{$this->f_year},
				'{$this->degree}',
				'{$this->examno}',
				'{$this->collcode}',
				'{$this->app_no}',
				'{$this->sub_arr_data[$k]->sub_code}',
				'F','{$this->fappno}')";
				 
				$lobj_insert_options = $this->aobj_context->mobj_db->Execute($insert_options);
				
			}
			
		$lstr_save_schema_details_arr = stripslashes($this->exam_obj);
		$mobj_jsondata = $json->decode($lstr_save_schema_details_arr);
		
			$college_path=$this->aobj_context->main_src."/student_photos/{$this->collcode}";
			$degree_path=$this->aobj_context->main_src."/student_photos/{$this->collcode}/".$this->degree;;
			$folder_path=$this->aobj_context->main_src."/student_photos/{$this->collcode}/".$this->degree;;
			$file_name=basename($_FILES['student_entry_upload']['name']);
			$path_arr=pathinfo($_FILES['student_entry_upload']['name']);
			$file_ext=$path_arr['extension'];
			$full_file_path= $folder_path.'/'.$this->f_year."_".$this->degree."_".$this->app_no."_".$file_name;;
			$image_path="student_photos/{$this->collcode}/".$this->degree.'/'.$this->f_year."_".$this->degree."_".$this->app_no."_".$file_name;;
 		  
		if(!file_exists($college_path))
		{
			mkdir($college_path);
		}

		if(!file_exists($degree_path))
		{
			mkdir($degree_path);
		}
		
		if(isset($_FILES['student_entry_upload']['name']) && $_FILES['student_entry_upload']['name'] != '')         
		{ 
			if(move_uploaded_file($_FILES['student_entry_upload']['tmp_name'],$full_file_path))
			 {
				$update="update studadm set FPHOTOPATH='{$image_path}' 
						where internal_code=  {$this->last_inserted_id} ";
				$up_obj=$this->aobj_context->mobj_db->Execute($update); 
				$arr['app_no']=$this->app_no;
				//echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
				
			 }
			 else
			 {
			 $data="Error While Moving the Image";
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
				return;
			 }
		}
			
		$file_name=basename($_FILES['student_entry_signupload']['name']);
		$path_arr=pathinfo($_FILES['student_entry_signupload']['name']);
		$file_ext=$path_arr['extension'];
		$full_file_signpath= $folder_path.'/'.$this->f_year."_".$this->degree."_".$this->app_no."_s_".$file_name;;
		$image_signpath="student_photos/{$this->collcode}/".$this->degree.'/'.$this->f_year."_".$this->degree."_".$this->app_no."_s_".$file_name;;
	 		  

		if(isset($_FILES['student_entry_signupload']['name']) && $_FILES['student_entry_signupload']['name'] != '')         
		{ 
			if(move_uploaded_file($_FILES['student_entry_signupload']['tmp_name'],$full_file_signpath))
			 {
				$update="update studadm set FSIGNPATH = '{$image_signpath}' 
						where internal_code=  {$this->last_inserted_id} ";
				$up_obj=$this->aobj_context->mobj_db->Execute($update); 
				//$arr['app_no']=$this->app_no;
				//echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 	
			 }
			 else
			 {
				$data="Error While Moving the Image";
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
				return;
			 }
		}
	}	
		 
	function GetApplicationDetails()
	{
		$this->app_no = trim($this->aobj_context->mobj_data["app_no"]);

		$get_data = "select internal_code, app_no, pget_val, subject, candidate_name, 
					mother_name, father_name, spouse_name, 
					date_format(dob,'%d/%m/%Y') as dob, sex, 
					s.pob, pob_others, 
					nationality,
					s.college,
					college_others, 
					s.univ ,univ_others, cncl_reg_no, 
					cncl_reg_name, date_format(rotary,'%d/%m/%Y') as rotary, marks, 
					u_pg, phq, religion, 
					s.category, category_others, 
					caste, sub_caste, dd_amt, dd_no, date_format(dd_date,'%d/%m/%Y') as dd_date,
					dd_bank, address, pin,IFNULL(debared,'No') as debared, email, phone, 
					mobile, in_service_status,  
					s.dept , '' as dept_others, plc_of_working, 
					 date_format(date_of_entry,'%d/%m/%Y') as date_of_entry, prob_period, date_format(prob_date,'%d/%m/%Y') as  prob_date,
					 doing_pg, pg_degree_course, 
					date_format(pg_degree_date,'%d/%m/%Y') as pg_degree_date, 
					pg_diploma_course, date_format(pg_diploma_date,'%d/%m/%Y') as pg_diploma_date, 
					speciality, enq_pending, suspension, absence, remarks, photo_path, 
					created_date, f_max_marksa, f_sec_marksa, 
					f_no_attaa, f_max_marksb, f_sec_marksb, 
					f_no_attbb, f_max_marksc, f_sec_marksc, 
					f_no_attcc, f_max_marksd, f_sec_marksd, 
					f_no_attdd, f_tot_max_marks, f_tot_sec_marks ,ip_address,created_date,
					FAPPNO,FPOB,FAREA,FHANDICAP,FNCC,FNSS,FDEFENCE,FEXSERVE,FKASHIMG,
					FTRANS,FUNIVADD,FUNIVPHONE,FPRNNO,FCOLLPHONE 
					from 
					student s						 
					where app_no={$this->app_no}";
					//echo $get_data;die();
	   $lobj_get_data = $this->aobj_context->mobj_db->GetRow($get_data); 
	   $data="Error While Moving the Image";
	 
		echo $this->aobj_context->mobj_output->ToJSONEnvelope($lobj_get_data,0,"Success"); 
		return;
	}
	 
	function UpdateDetails()
	{
		//$check_adminsion_freeze ="select FCADSTATUS, ifnull(fadmstop,'') as FADMSTOP 
		//from colldeg 
		//where FCOLLCODE='{$this->collcode}' 
		//and FDEGREE='{$this->degree}'";								
		//$lobj_check_adminsion_freeze = $this->aobj_context->mobj_db->getRow($check_adminsion_freeze); 
		
		$qry = "select * from collexam where fdegree = '{$this->degree}' and fcollcode = '{$this->collcode}' 
		and DATE_FORMAT(NOW(),'%Y-%m-%d') 
		BETWEEN DATE_FORMAT(fadmfrom,'%Y-%m-%d') 
		AND DATE_FORMAT(fadmto,'%Y-%m-%d')";
		$student_exam_details = $this->aobj_context->mobj_db->GetAll($qry);

		if(count($student_exam_details) <= 0)
		{
			$arr = 'Last date for student admission is over';
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
			return;		
		}

		$update = "update studadm set 
		FNAME='{$this->candidate_name}',FGENDER='{$this->gender}',
		FDOB= date_format('{$this->dob}','%Y-%m-%d'),				
		FFATNAME='{$this->fatname}',FMOTNAME='{$this->motname}',
		FEMAIL='{$this->email}',FCASTE='{$this->caste}', FCONTACT_NO='{$this->phoneno}', FNATIONAL='{$this->nationality}', FCURRADD1='{$this->commaddr1}',
		FCURRADD2='{$this->commaddr2}', FCURRADD3='{$this->commaddr3}', 
		FCURRADD4='{$this->commaddr4}', FPERMADD1='{$this->peradd1}',
		FPERMADD2='{$this->peradd2}', FPERMADD3='{$this->peradd3}',
		FPERMADD4='{$this->peradd4}', FRELIGION='{$this->religion}',
		FCOMBCODE='{$this->sltCombination}',FMOBILE_NO='{$this->mobile}',
		FMARITALSTATUS='{$this->maritalStatus}',
		FNATCANDIDATE='{$this->candidateNational}',
		FSTATE='{$this->state}',FKARBIRTH='{$this->belkarbirth}', 
		FCATBIRTH='{$this->categoryByBirth}', FINCOMECRT='{$this->incomeCrtificate}',
		FACADYEAR='{$this->acadyear}', FADMCAT='{$this->admcat}',
		FADMDATE=date_format('{$this->admdate}','%Y-%m-%d'), 
		FADMINTAKE='{$this->admintake}',FADMQUOTA='{$this->admquota}',
		FLANGEXAM='{$this->wrtExamLang}', FLANGUAGE1='{$this->sltLanguage1}', 
		FLANGUAGE2='{$this->sltLanguage2}',
		FFATINCOME='{$this->fincome}',FMOTHINCOME='{$this->mincome}',
		FLINGMINORITY='{$this->lingMinority}',FREGMINORITY='{$this->regMinority}', 
		FAADHARNO='{$this->aadharno}', FNATQUALEXAM='{$this->padNational}', 
		FSTATEQUALEXM='{$this->padState}', FTYPEQUALEXAM='{$this->typequlexam}', 
		FINSTNAME='{$this->instname}', FINSTLOCAT='{$this->location}', 
		FUNIVNAME='{$this->univname}', FQUALEXREGNO='{$this->examregno}',
		FLANGUAGE='{$this->language1}', FSUBSPECIAL='{$this->specialization}', 
		FMODEDU='{$this->modeEdu}', FEXAMINTERVAL='{$this->interval}', 
		FENTEXMARKS='{$this->entexammarks}',
		FUSERID='{$this->u_id}',  FLOGNAME='{$this->log_name}', FLOGDATE=NOW(), FUNIVFEE='{$this->unvregfee}',
		FUNIVRECNO='{$this->unvregrecno}', FLATADMFEE='{$this->admfee}', FLATRECNO='{$this->admrecno}',
		FPASSYER='{$this->yrpass}', FPASSMNTH='{$this->mnthpass}', FMARKSECURED='{$this->mrksecure}',
		FMARKTOTAL='{$this->mrktotal}', FPERMARK='{$this->mrkper}', 
		FWGHTAVGMARKS='{$this->wghtAvgMarks}',
		FNOSEMYEAR='{$this->nosemYear}',FPHTYPE='{$this->phtype}',
		FELIGFEE='{$this->eligbFee}', FELIGRECNO='{$this->eligbRecNo}', FHK='{$this->chkHydKar}',
		FPOB = '{$this->dobplace}',
		FAREA = '{$this->area}',
		FHANDICAP = '{$this->phd}',
		FNCC = '{$this->ncc}',
		FNSS = '{$this->nss}',
		FDEFENCE = '{$this->dfp}',
		FEXSERVE = '{$this->exs}',
		FKASHIMG = '{$this->kai}',
		FTRANS = '{$this->trg}',
		FUNIVADD = '{$this->univaddres}',
		FUNIVPHONE = '{$this->univphoneno}',
		FCOLLPHONE = '{$this->institutephoneno}',
		FPRNNO = '{$this->pnrno}',
		FWOBSATE = '{$this->osb}',
		FQMONTH = '{$this->month}',
		FQYEAR = '{$this->year}',
		FQMAXMARKS = '{$this->maxmarks}',
		FQSECMARKS = '{$this->secmarks}',
		FQPERCENTAGE = '{$this->percentage}',
		FPRNNO10='{$this->pnrno10}',
		FQUALEXREGNO10='{$this->examregno10}',
		FINSTNAME10='{$this->instname10}',
		FCOLLADD10='{$this->location10}',
		FCOLLSTATE10='{$this->padState10}',
		FCOLLPHONE10='{$this->institutephoneno10}',
		FUNIVNAME10='{$this->univname10}',
		FUNIVADD10='{$this->univaddres10}',
		FUNIVPHONE10='{$this->univphoneno10}',
		FQMONTH10='{$this->month10}',
		FQYEAR10='{$this->year10}',
		FQMAXMARKS10='{$this->maxmarks10}',
		FQSECMARKS10='{$this->secmarks10}',
		FQPERCENTAGE10='{$this->percentage10}',
		FBLOOD_GROUP = '{$this->bloodgrp}'
		where FCOLLCODE='{$this->collcode}' and FSLNO='{$this->edit_app_no}' 
		and FDEGREE = '{$this->degree}'";
		$up_obj=$this->aobj_context->mobj_db->Execute($update);
				
	
		$delete_from_options="delete from options where FDEGREE='{$this->degree}'
						and FEXAMNO='{$this->examno}' and FCOLLCODE='{$_SESSION['collcode']}' 
						and FSLNO='{$this->edit_app_no}' and fyear = '{$this->f_year}'";
		$lobj_delete_from_options = $this->aobj_context->mobj_db->Execute($delete_from_options);
			 $insert_optionquy= count($this->sub_arr_data);

		$query = "select fappno, fdegree from studadm 
		where FCOLLCODE='{$this->collcode}' and FSLNO='{$this->edit_app_no}' 
		and FDEGREE = '{$this->degree}'";
		$results = $this->aobj_context->mobj_db->GetRow($query);
		$appno = $results['fappno'];

	

		$query = "delete from admfeedetl where FDEGREE = '{$this->degree}' and FCOLLCODE = '{$this->collcode}'
		and FSLNO = '{$this->edit_app_no}'";
		$result = $this->aobj_context->mobj_db->Execute($query);

		for($k=0;$k<count($this->fee_arr_data);$k++)
		{
			$insert_options ="insert into admfeedetl 
			(FYEAR,FDEGREE,
			FEXAMNO,FCOLLCODE,
			FSLNO,FHEADCODE,
			FAMOUNT)
			values
			(
			'2018',
			'{$this->degree}',
			'A',
			'{$this->collcode}',
			'{$this->edit_app_no}',
			'{$this->fee_arr_data[$k]->head_id}',
			'{$this->fee_arr_data[$k]->fee_paid}' 
			)
			";
			$lobj_insert_options = $this->aobj_context->mobj_db->Execute($insert_options);
			
			if($this->fee_arr_data[$k]->head_id == '06 Fine')
				$fine = $this->fee_arr_data[$k]->fee_paid;
			else
				$total += $this->fee_arr_data[$k]->fee_paid;	
		}

			$query = "update studadm set TOTAL_FEE = '{$total}',FADMFINE = '{$fine}'
		WHERE fdegree = '{$this->degree}' and fcollcode = '{$this->collcode}' and fslno = '{$this->edit_app_no}'";
		$sturesult = $this->aobj_context->mobj_db->Execute($query);

			
		for($k=0;$k<count($this->sub_arr_data);$k++)
		{
			$this->sub_arr_data[$k]->sub_code = strtoupper($this->sub_arr_data[$k]->sub_code);
			$insert_options="insert into options(FYEAR, FDEGREE,
			FEXAMNO,
			FCOLLCODE,
			FSLNO,
			FSUBCODE,
			FDELETED,fappno)
			values
			(
			'{$this->f_year}',
			'{$this->degree}',
			'{$this->examno}',
			'{$this->collcode}',
			'{$this->edit_app_no}',
			'{$this->sub_arr_data[$k]->sub_code}',
			'F','{$appno}')";
			$insert_optionquy = $lobj_insert_options;
			$lobj_insert_options = $this->aobj_context->mobj_db->Execute($insert_options);
		}	 
		
		
		/************* for queldet only for pg */

		$query ="delete from qualdet 
		where fdegree='{$this->degree}' 
		and fcollcode='{$_SESSION['collcode']}' 
		and fslno ='{$this->edit_app_no}'";
		$resultqualdets = $this->aobj_context->mobj_db->Execute($query);


		$this->mobj_jsondata = json_decode($this->rgMultiMarks,true);
		//var_dump($this->mobj_jsondata);
		
		$sub_marks = array();
		for($i=0; $i<count($this->mobj_jsondata); $i++)
		{
			
			for($j=0;$j<count($this->mobj_jsondata[$i]);$j++)
			{
				$sub_marks[$i][$this->mobj_jsondata[$i][$j]['name']] = $this->mobj_jsondata[$i][$j]['value']; 	

			}	
		}

		$sql = array();
		$j=0;
		for($i=1; $i<=count($sub_marks);$i++)
		{
			$sql[] = "('{$this->edit_app_no}'
			,'{$appno}'
			,'{$this->collcode}'
			,'{$this->degree}'
			,'{$sub_marks[$j]["subsem1_$i"]}',
			'{$sub_marks[$j]["subsem1mo_$i"]}'
			,'{$sub_marks[$j]["subsem1mm_$i"]}'
			,'{$sub_marks[$j]["subsem2mo_$i"]}'
			,'{$sub_marks[$j]["subsem2mm_$i"]}'
			,'{$sub_marks[$j]["subsem3mo_$i"]}'
			,'{$sub_marks[$j]["subsem3mm_$i"]}'
			,'{$sub_marks[$j]["subsem4mo_$i"]}'
			,'{$sub_marks[$j]["subsem4mm_$i"]}'
			,'{$sub_marks[$j]["subsem5mo_$i"]}'
			,'{$sub_marks[$j]["subsem5mm_$i"]}'
			,'{$sub_marks[$j]["subsem6mo_$i"]}'
			,'{$sub_marks[$j]["subsem6mm_$i"]}'
			,'{$sub_marks[$j]["subtotalmo_$i"]}'
			,'{$sub_marks[$j]["subtotalmm_$i"]}'
			,'{$sub_marks[$j]["subpercentagemm_$i"]}')";
			
			$j++;
		}

		$query = 'INSERT INTO qualdet(fslno, fappno,
		fcollcode, fdegree, 
		fsubname, fsecmarksa , fmaxmarksa, 
		fsecmarksb, fmaxmarksb,
		fsecmarksc, fmaxmarksc,
		fsecmarksd, fmaxmarksd,
		fsecmarkse, fmaxmarkse,
		fsecmarksf, fmaxmarksf,
		ftotsecmarks, ftotmaxmarks,
		fsubpercent
		) VALUES '.implode(',', $sql);
		$resultsqualdet = $this->aobj_context->mobj_db->Execute($query);
		
		/*********************  END  ****/

		$college_path=$this->aobj_context->main_src."/student_photos/{$this->collcode}";
		$folder_path=$this->aobj_context->main_src."/student_photos/{$this->collcode}/".$this->degree;;
		$file_name=basename($_FILES['student_entry_upload']['name']);
		$path_arr=pathinfo($_FILES['student_entry_upload']['name']);
		$file_ext=$path_arr['extension'];
		$full_file_path= $folder_path.'/'.$this->f_year."_".$this->degree."_".$this->edit_app_no."_".$file_name;;
		$image_path="student_photos/{$this->collcode}/".$this->degree.'/'.$this->f_year."_".$this->degree."_".$this->edit_app_no."_".$file_name;;
		
		if(!file_exists($college_path))
		{
			mkdir($college_path);
		}
		if(!file_exists($folder_path))
		{
			mkdir($folder_path);
		}


		if(isset($_FILES['student_entry_upload']['name']) && $_FILES['student_entry_upload']['name'] != '')         
		{ 
			if(move_uploaded_file($_FILES['student_entry_upload']['tmp_name'],$full_file_path))
			{
				$update="update studadm set FPHOTOPATH='{$image_path}' 
				where FCOLLCODE='{$this->collcode}' and FSLNO='{$this->edit_app_no}' and FDEGREE = '{$this->degree}'";
				$up_obj=$this->aobj_context->mobj_db->Execute($update); 
				$arr['app_no']=$this->edit_app_no;
			}
			else
			{
			 	$data="Error While Moving the Image";
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
				return;
			}
		}
			
		$file_name=basename($_FILES['student_entry_signupload']['name']);
		$path_arr=pathinfo($_FILES['student_entry_signupload']['name']);
		$file_ext=$path_arr['extension'];
		$full_file_signpath= $folder_path.'/'.$this->f_year."_".$this->degree."_".$this->edit_app_no."_s_".$file_name;;
		$image_signpath="student_photos/{$this->collcode}/".$this->degree.'/'.$this->f_year."_".$this->degree."_".$this->edit_app_no."_s_".$file_name;;
	 		  

		if(isset($_FILES['student_entry_signupload']['name']) && $_FILES['student_entry_signupload']['name'] != '')         
		{ 
			if(move_uploaded_file($_FILES['student_entry_signupload']['tmp_name'],$full_file_signpath))
			 {
				$update="update studadm set FSIGNPATH = '{$image_signpath}' 
						where FCOLLCODE='{$this->collcode}' and FSLNO='{$this->edit_app_no}' and FDEGREE = '{$this->degree}'";
				$up_obj=$this->aobj_context->mobj_db->Execute($update); 
				$arr['app_no']=$this->edit_app_no;
				//echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 	
			 }
			 else
			 {
			 	$data="Error While Moving the Image";
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
				return;
			 }
		} 

		if($up_obj)
		{
			//$data="Updated Successfully" ;
			//echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
			$data['message'] = " Updated Successful. Admission No :  ".$results['fappno'];
			$data['fappno'] = $results['fappno'];
			$data['fdegree'] = $results['fdegree'];
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
			return;
		}
		else
		{
			$data="Updation Failed";
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
			return;
		}	
	}		
	function GetCMSDropDownMenuValues()
	{
		$get_coll_data="SELECT FCOLLCODE AS int_code,CONCAT(FCOLLCODE,' - ',FCOLLNAME) AS val FROM college";
		$up_obj=$this->aobj_context->mobj_db->GetAll($get_coll_data);
		$arr['college']=$up_obj;
		$get_data="SELECT FDEGREE AS int_code,CONCAT(FDEGREE,' - ',FDESCPN) AS val FROM degree";
		$up_obj=$this->aobj_context->mobj_db->GetAll($get_data);
		$arr['degree']=$up_obj;
		$get_data="SELECT FCATCODE AS int_code,CONCAT(FCATCODE,' - ',FCATDESC) AS val FROM mascat ORDER BY FORDER";
		$up_obj=$this->aobj_context->mobj_db->GetAll($get_data);
		$arr['category']=$up_obj;
		echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
		return;
	}

	function GetCMSAmountValue()
	{
		$degree=trim($this->aobj_context->mobj_data["degree"]);
		$nationality=trim($this->aobj_context->mobj_data["nationality"]);
	
		$amt=empty($amt)?0:$amt;
		$arr['amount']=$amt;
		
		//$sub_arr=$this->GetSubjectDetails($degree);
		$doc_arr=$this->GetStudentDocumentsTable($degree,$nationality);
		$arr['subjects']=$sub_arr;
		$arr['doc_arr']=$doc_arr;
		echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
	}

	function ValidatePaymentApplicationData()
	{
		$p_candidate_name=trim($this->aobj_context->mobj_data["p_candidate_name"]);
		$p_dob=trim($this->aobj_context->mobj_data["p_dob"]);
		$p_reg_no=trim($this->aobj_context->mobj_data["p_reg_no"]);
	 
		$qry="SELECT  FAPPNO
				from 
				student
				WHERE FDOB='{$p_dob}'
				AND FNAME='{$p_candidate_name}'
				AND FQAULEXAMREGNO='{$p_reg_no}'";
		 $up_obj=$this->aobj_context->mobj_db->GetRow($qry);
	 
		$FAPPNO=$up_obj['FAPPNO'];
		if(empty($FAPPNO))
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
		else
		{
			$arr['app_no']=$FAPPNO;
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
		}
			
	}	

	function ValidatePrintCertificateApplicationData()
	{
		$p_candidate_name=trim($this->aobj_context->mobj_data["c_candidate_name"]);
		$p_dob=trim($this->aobj_context->mobj_data["c_dob"]);
		$p_reg_no=trim($this->aobj_context->mobj_data["c_reg_no"]);
	 
		$qry="SELECT  FAPPNO
				from 
				student
				WHERE FDOB='{$p_dob}'
				AND FNAME='{$p_candidate_name}'
				AND FQAULEXAMREGNO='{$p_reg_no}'
				";
		 $up_obj=$this->aobj_context->mobj_db->GetRow($qry);
	 
			$FAPPNO=$up_obj['FAPPNO'];
			 if(empty($FAPPNO))
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
			else
			{
				$arr['app_no']=$FAPPNO;
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
			}
			
	}	
	function GetSubjectDetails($degree)
	{
		$get_sub="SELECT FQUALSUB FROM massub
					WHERE FDEGREE='{$degree}'";	
		 $up_get_sub=$this->aobj_context->mobj_db->GetAll($get_sub);			
		$i=0;
		$sl=1;
		$html="";
		foreach($up_get_sub	 as $ak=>$av)
		{
			$FQUALSUB=$av['FQUALSUB'];
			$html.="<tr>";
		 
			$html.="<td id='sub_td_{$i}'>{$FQUALSUB}</td>";
			$html.="<td><input type='text' id='sub_max_{$i}' placeholder='{$FQUALSUB} Marks' maxlength=10 class='form-control'></td>";
			$html.="<td><input type='text' id='sub_sec_{$i}' placeholder='{$FQUALSUB} Secured' maxlength=10 class='form-control'></td>";
			$html.="</tr>";
			$i++;
			$sl++;
		}
		return $html;
	}

	function GetpaymentLinkForAppNo()
	{
	$app_no=trim($this->aobj_context->mobj_data["app_no"]);
	$get_details="SELECT FAPPNO,FCOLLCODE,FDEGREE,FGENDER,FDOB,FQAULEXAMREGNO,FDATE,FAMOUNT,
					FNATIONAL,FNAME,FFATNAME,FMOTNAME,FCATCODE,FPHONENO,FMOBILENO,FEMAIL 
					FROM student WHERE FAPPNO='{$app_no}' ";
	 $objget_details=$this->aobj_context->mobj_db->GetRow($get_details);	
	$FDATE=$objget_details['FDATE'];	 
	$FCOLLCODE=$objget_details['FCOLLCODE'];	 
	$FDEGREE=$objget_details['FDEGREE'];	
	$FNAME=$objget_details['FNAME'];	
	$FDOB=$objget_details['FDOB'];	 
	$FQAULEXAMREGNO=$objget_details['FQAULEXAMREGNO'];	 
	$FAMOUNT=$objget_details['FAMOUNT'];	 
	$FNATIONAL=$objget_details['FNATIONAL'];	 
	$FNATIONAL=$objget_details['FNATIONAL'];	 
		 
	$FFATNAME=$objget_details['FFATNAME'];	 
	$FMOTNAME=$objget_details['FMOTNAME'];	 
	$FCATCODE=$objget_details['FCATCODE'];	 
	$FMOBILENO=$objget_details['FMOBILENO'];	 
	$FEMAIL=$objget_details['FEMAIL'];	 
	$html='	<h2 class="col-md-offset-1" style="color:green;"> Successfully Applied. Your Application No. is - '.$app_no.' <br> Keep this number for feature correspondance with University.</h2> <div class="row">
	
											<div class="col-md-6 col-sm-12">
											
												<div class="portlet yellow box">
													<div class="portlet-title">
														<div class="caption">
															<i class="fa fa-cogs"></i>Application Details
														</div>
														 
													</div>
													<div class="portlet-body">
														<div class="row static-info">
															<div class="col-md-5 name">
																 Application #:
															</div>
															<div class="col-md-7 value">
																 '.	$app_no.'
																 
															</div>
														</div>
														<div class="row static-info">
															<div class="col-md-5 name">
																 Application Date &amp; Time:
															</div>
															<div class="col-md-7 value">
																'.$FDATE.'
															</div>
														</div>
														<div class="row static-info">
															<div class="col-md-5 name">
																 College:
															</div>
															<div class="col-md-7 value">
																'.$FCOLLCODE.'
															</div>
														</div>
														<div class="row static-info">
															<div class="col-md-5 name">
																Degree:
															</div>
															<div class="col-md-7 value">
																'.$FDEGREE.'
															</div>
														</div>
														<div class="row static-info">
															<div class="col-md-5 name">
																 Candidate Name:
															</div>
															<div class="col-md-7 value">
																	'.$FNAME.'
															</div>
														</div>
														<div class="row static-info">
															<div class="col-md-5 name">
																Amount:
															</div>
															<div class="col-md-7 value">
																	<i style="color:red;" class="fa fa-rupee"></i> '.$FAMOUNT.'
															</div>
														</div>
													</div>
												</div>
											</div>
											<div class="col-md-6 col-sm-12">
												<div class="portlet blue box">
													<div class="portlet-title">
														<div class="caption">
															<i class="fa fa-cogs"></i>Personnal Information
														</div>
														 
													</div>
													<div class="portlet-body">
														<div class="row static-info">
															<div class="col-md-5 name">
																 FFATNAME:
															</div>
															<div class="col-md-7 value">
																'.$FFATNAME.'
															</div>
														</div>
														<div class="row static-info">
															<div class="col-md-5 name">
																DOB:
															</div>
															<div class="col-md-7 value">
																'.$FDOB.'
															</div>
														</div>
														<div class="row static-info">
															<div class="col-md-5 name">
																Reg No:
															</div>
															<div class="col-md-7 value">
																'.$FQAULEXAMREGNO.'
															</div>
														</div>
														<div class="row static-info">
															<div class="col-md-5 name">
																Category:
															</div>
															<div class="col-md-7 value">
																'.$FCATCODE.'
															</div>
														</div>
														<div class="row static-info">
															<div class="col-md-5 name">
																 Nationality:
															</div>
															<div class="col-md-7 value">
																'.$FNATIONAL.' 
															</div>
														</div>
														<div class="row static-info">
															<div class="col-md-5 name">
																 Mobile:
															</div>
															<div class="col-md-7 value">
																'.$FMOBILENO.'
															</div>
														</div>
														 
													</div>
												</div>
											</div>
										</div>';
		$html.='<div class="form-actions fluid">
									<div class="row">
										<div class="col-md-12">
											<div class="col-md-offset-3 col-md-4">
												<button class="btn green" onclick=\'CMS.MakeOnlinePayment("'.$app_no.'");\' type="button"><i class="fa fa-rupee"></i> Make Online Payment</button>
												<button class="btn red" onclick="home();" type="button"  ><i class="fa fa-times"></i> Pay Later</button>
											</div>
										</div>
									</div>
								</div>'
			 ;									
	 echo $this->aobj_context->mobj_output->ToJSONEnvelope($html,0,"success"); 
			return;
	}
	function recurseRmdir($dir) {
		  $files = array_diff(scandir($dir), array('.','..'));
		 
		  foreach ($files as $file) {
			(is_dir("$dir/$file")) ? recurseRmdir("$dir/$file") : unlink("$dir/$file");
		  }
		  return rmdir($dir);
		}

	function GetStudentDocumentsTable($degree)
	{
	     
		 $delete="delete from studoc where 
							login_cnt='{$this->login_cnt}'
							and app_no is null
							";	
				$lobj_delete= $this->aobj_context->mobj_db->Execute($delete);	
		$dir_path=$this->aobj_context->main_src."/certificates/{$this->login_cnt}/";
		if($this->login_cnt>0)
		{
		$this->recurseRmdir($dir_path);
		 rmdir($dir_path);
		}
		$get_document_data="select internal_code as int_code, 
								FCERTDESC as doc_type ,
								ifnull(FFILENAME,REPLACE(REPLACE(FCERTDESC,' ','_'),'+','_')) as FFILENAME
									from 
									masdoc
									WHERE FDEGREE='{$degree}' order by forder";
		  							
		$lobj_get_document_data= $this->aobj_context->mobj_db->GetAll($get_document_data);
		
	    $this->html="";
		$this->html.='	
					<!-- MY TASK BEGIN CONDENSED TABLE PORTLET-->
						<div class="span11"><div class="portlet box blue">
							
							<div class="portlet-body">
							<div class="scroller" data-height="380px">
								<table id="upload_table" class="table table-bordered table-hover" cellpadding="2" cellspacing="2">
									<thead>
										<tr>											
											<th style="width:20px;"></th>																	
											<th style="width:300px;text-align:left;"><i class="icon-briefcase"></i>&nbsp;Docoment Type</th>																		
											<th style="width:250px;text-align:left">File Type</th>											
											<th style="width:200px;">Attachment</th>	
										 			
										</tr>
									</thead>
									<tbody>';
									$sl=1;
									$sl = 'A';
		foreach($lobj_get_document_data as $mk=>$mv)
		{
		    $int_code=$mv[int_code];
		    $doc_type=$mv[doc_type];
		    $attachment_path=$mv[attachment_path];
		    $FFILENAME=$mv[FFILENAME];
		    $file_name=$mv[file_name];
			$file_type_id="ed_{$int_code}";
			$doc_file_path=$attachment_path;
			
			if(!empty($attachment_path))
				$selected=" <span class='label label-success' id='uploded_{$int_code}'>Yes</span> ";
			else
				$selected=" <span class='label label-warning' id='uploded_{$int_code}'>No</span>";
				 
			 
			$this->html.='<tr>						
						<td>'.$sl.'. </td>						
						<td id="doc_upload_'.$int_code.'">'.$doc_type.'</td>						
						<td><div style="float:left;"><input type="file"  name='.'"'.$file_type_id.'"'.'  id='.'"'.$file_type_id.'"'.' style="width:120px;padding:5px 0px;" /></div><div style="float:left;padding-left:20px;"><button><a class="btn btn-sm blue" href="#" style = "text-decoration:none;" onclick=UploadEmployeeDocuments("'.$int_code.'","'.$FFILENAME.'")>&nbsp;Upload</a></button></div></td>';	
			if(!empty($attachment_path))
			{
				$this->html.='<td><a style="color:#AB45F9; padding-right:5px;" href="'.$doc_file_path.'" target="_blank">'.$file_name.'</a><span style="cursor:pointer;" class="label label-danger" onclick=CMS.DeleteEmployeeDocuments("'.$int_code.'")>Delete</span></td>';
			}
			else
			{
				$this->html.='<td id="attach_td_'.$int_code.'">&nbsp;</td>';
			}
		 
			
			$this->html.='</tr>';	$sl++;	
		}
		$this->html.='</tbody></table>
						</div>
					</div>
					</div>
					</div>
					<!-- END CONDENSED TABLE PORTLET-->';
		return $this->html;							
	} 
	function UploadEmployeeDocuments()
	{		 
	  
			 $dir_path=$this->aobj_context->main_src."/certificates/{$this->login_cnt}";
			mkdir($dir_path);
			chmod($dir_path,7777);
			$cert_file_name=trim($this->aobj_context->mobj_data["file_name"]);
			$this->doc_type_int_code=trim($this->aobj_context->mobj_data["doc_type_int_code"]);
		 
		 
		$file_id="ed_{$this->doc_type_int_code}";
		$file_name=$_FILES[$file_id]['name'];
		if(isset($file_name) && $file_name != '')         
		{ 		
				$path_arr=pathinfo($_FILES[$file_id]['name']);
				$file_ext=$path_arr['extension'];
				
		$root_file_name=$dir_path."/{$cert_file_name}.".$file_ext;	
		$attachement_path="certificates/{$this->login_cnt}/{$cert_file_name}.".$file_ext;	
		if(move_uploaded_file($_FILES[$file_id]['tmp_name'],$root_file_name))
		  {
				
				
				$arr['path']=$attachement_path;					
				$arr['id']=$this->doc_type_int_code;					
				$arr['file_name']=$file_name;	
				$delete="delete from studoc where 
							ref_mas_doc_code='{$this->doc_type_int_code}'
							and login_cnt='{$this->login_cnt}'
							";	
				$lobj_delete= $this->aobj_context->mobj_db->Execute($delete);			
				$insert="INSERT INTO studoc
					( 
					ref_mas_doc_code, 
					login_cnt, 
					file_path, 
					created_date
					)
					values
					(
					'{$this->doc_type_int_code}',
					'{$this->login_cnt}',
					'{$attachement_path}',now()
					)";	
					
				$lobj_insert= $this->aobj_context->mobj_db->Execute($insert);
				// echo $insert;
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");	
				return; 
			 			
		  }
		  else
		  {
				$data = "Moving {$file_name} to emp_doc_attchments failed";						
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");	
				return;
		  }
		} 
		else
		{
			$data="File is empty, not moved";						
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");	
			return;
		}
	}	
	function SendMailOtPToUser()
	{
		$mobile_no=trim($this->aobj_context->mobj_data["s_mobile_no"]);
		$s_email_id=$this->aobj_context->mobj_data['s_email_id'];
 
		require_once("cManualMailer.php");
		$otp="1234";
			$message="<html>";
			$message.="<body>";
			$message.="<style>";		
			$message.=".mail_tbl td{text-align:left; padding:2px; font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif;}";	
			$message.="</style>";
			$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>Hi,</p>";
			$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>Your OTP Password is :{$otp}</p>";			
			 
			$message.="</br>";			
		//	$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>Regards,</p>";
			//$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>PF Team</p>";
			$message.="</body>";
			$message.="</html>";
		
			$subject="OTP Password" ;	 
			$data='true';
			 $data= send_manual_mail($s_email_id,$subject,$message,$replay_to=null,$cc=null,$bcc=null);
			 if($data=='true')
			{
			$data="Please Enter OTP Password has been sent to you Mail/Mobile";
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
			}
			else
			{
			 
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"success"); 
			}
			
	}		

}

function UploadEmployeeDocuments($aobj_context)
{ 
$obj=new applicationForm($aobj_context);
$obj->UploadEmployeeDocuments();
}
function HandleUserInputFiles($aobj_context)
{ 
$obj=new applicationForm($aobj_context);
$obj->HandleUserInputFiles();
}
function SaveCertificateDetails($aobj_context)
{ 
	$obj=new applicationForm($aobj_context);
	$obj->assignParams();
	$add_edit=trim($aobj_context->mobj_data["add_edit"]);
	if($add_edit=='Add')
	{
		$obj->SaveDetails();
	}
	else
	{
		$obj->UpdateDetails();
	}
	
}

function GetCMSAmountValue($aobj_context)
{ 
$obj=new applicationForm($aobj_context);
$obj->GetCMSAmountValue();
}

function DiaplayUserSelectedPhoto($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
	session_start();
	 
	 
	$folder_path=$aobj_context->main_src."/student_photos/";
	 $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="/{$collcode}_{$user_id}_{$file_name}";
 	$temp_path.=$file_path;
  
		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;
			 }
			}
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
				return;	
	
}
function replaceChars($name)
{
	$spl_char = array("*","/","~","!","@","#","$","%","^","&",":",";","?","/","\\","_","-","'"," ","");
	$link_name = strtolower(str_replace($spl_char,"_",$name));
	return str_ireplace("__","_",$link_name);
}

function GetUploadedStudentDocuments($aobj_context)
{
	
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
	$degree = $aobj_context->mobj_data["degree"];
	$appno = $aobj_context->mobj_data["appno"];
	session_start();
	$collcode = $_SESSION['collcode'];
	if(strtoupper($collcode) == 'VKU')
	{
		$collcode  = $aobj_context->mobj_data["collcode"];
	}	
	$get_document_data ="select  md.internal_code as int_code, md.FCERTDESC as doc_type ,
	IFNULL(md.FFILENAME,REPLACE(REPLACE(md.FCERTDESC,' ','_'),'+','_')) as FFILENAME,
	sd.file_path from masdoc md left outer join studoc sd on md.internal_code = sd.ref_mas_doc_code  and md.fdegree = sd.fdegree
	WHERE md.fdegree='{$degree}'  and app_no = '{$appno}' and fcollcode ='{$collcode}' 
	union
	select distinct md.internal_code as int_code, md.FCERTDESC as doc_type ,
	IFNULL(md.FFILENAME,REPLACE(REPLACE(md.FCERTDESC,' ','_'),'+','_')) as FFILENAME,'' as file_path
	from masdoc md where md.fdegree='{$degree}' and  md.internal_code NOT IN(select  md2.internal_code as int_code1 
	from masdoc md2 left outer join studoc sd2 on md2.internal_code = sd2.ref_mas_doc_code  
	WHERE md2.fdegree='{$degree}'  and sd2.app_no = '{$appno}' and sd2.fcollcode ='{$collcode}')";

	//var_dump($get_document_data);return;
	$lobj_get_document_data= $aobj_context->mobj_db->GetAll($get_document_data);
	$html="";
	$html.='	
				<!-- MY TASK BEGIN CONDENSED TABLE PORTLET-->
					<div class="span11"><div class="portlet box blue">
						
						<div class="portlet-body">
						<div class="scroller" data-height="380px">
							<table id="upload_table" class="table table-bordered table-hover" cellpadding="2" cellspacing="2">
								<thead>
									<tr>											
										<th style="width:20px;"></th>																	
										<th style="width:300px;text-align:left;"><i class="icon-briefcase"></i>&nbsp;Docoment Type</th>																		
																		
										<th style="width:200px;">Attachment</th>	
												
									</tr>
								</thead>
								<tbody>';
								$sl=1;
	foreach($lobj_get_document_data as $mk=>$mv)
	{

	 $int_code=$mv[int_code];
		$doc_type=$mv[doc_type];
	   // $attachment_path=$mv[attachment_path];
		$FFILENAME=$mv[FFILENAME];
		$file_path=$mv[file_path];
		$file_type_id="ed_{$int_code}";
		/* $doc_file_path=$attachment_path;
			if(!empty($attachment_path))
			$selected=" <span class='label label-success' id='uploded_{$int_code}'>Yes</span> ";
			else
			$selected=" <span class='label label-warning' id='uploded_{$int_code}'>No</span>";
		 */	 
		 
		$html.='<tr>						
					<td>'.$sl.'</td>						
					<td id="doc_upload_'.$int_code.'">'.$doc_type.'</td>						
					<td><div style="float:left;"><input type="file"  name='.'"'.$file_type_id.'"'.'  id='.'"'.$file_type_id.'"'.' style="width:120px;padding:5px 0px;" /></div><div style="float:left;padding-left:20px;"><a class="btn btn-sm blue" href="#" onclick=UploadEditEmployeeDocuments("'.$int_code.'","'.$FFILENAME.'","'.$degree.'","'.$collcode.'","'.$appno.'")><i class="fa fa-upload"></i>&nbsp;Upload</a></div></td>';	
		if(!empty($file_path))
		{
			$html.='<td><a style="color:#AB45F9; padding-right:5px;" href="'.$file_path.'" target="_blank">'.$FFILENAME.'</a></td>';
		}
		else
		{
			$html.='<td id="attach_td_'.$int_code.'">&nbsp;</td>';
		}
	 
		
		$html.='</tr>';	$sl++;	
	}
	$html.='</tbody></table>
					</div>
				</div>
				</div>
				</div>
				<!-- END CONDENSED TABLE PORTLET-->';	
		echo $aobj_context->mobj_output->ToJSONEnvelope($html,0,"success");
} 

function loaddegree($aobj_context)
{

	$get_category_names="select distinct d.fdegree as internal_code, d.FDESCPN as value from 
						 degree d 
						 where ifnull(fadmdeg,'') = 'T'
						 order by fdegree";
	 //echo $get_category_names; die();
	$lobj_get_category_names = $aobj_context->mobj_db->GetAll($get_category_names);
	if($lobj_get_category_names!= 0)	
      echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_get_category_names,0,"success"); 
    else
      echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_get_category_names,-1,"Failure");
    return;

}

?>