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


Current Path : /proc/thread-self/root/var/www/html/univadmin_bkp/univadmin/src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/univadmin_bkp/univadmin/src/uGetResult.php

<?php

$resultObj = "";

function uGetResult($aobj_context)
{
    
 $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
 $regno = $aobj_context->mobj_data['regno'];
 $fexamno = $aobj_context->mobj_data['examno'];
 $univcode = $aobj_context->mobj_data['univcode'];

 
if($regno!="" && $fexamno!="" && $univcode!="")
{
	$withHeldDetails = getWithHeldDetails($aobj_context,$regno,$fexamno,$univcode);
	 
	if($withHeldDetails->withHeldMsg=='-1')
	{
        $errmsg="Withheld";
		echo $aobj_context->mobj_output->ToJSONEnvelope($errmsg,-1,"failure");
		die();
	}
	
 $studentDetails = getBasicStudentDetails($aobj_context,$regno,$fexamno);
// header student details
  $resultObj->header->studentDetails = $studentDetails;

// header reval details
 $revalDetails = getRevalDetails($aobj_context,$regno,$fexamno);
 $resultObj->header->revalDetails = $revalDetails;


 $studentMarksDetails = getStudentMarksDetails($aobj_context,$regno,$fexamno,$univcode);
 $resultObj->resultTable = $studentMarksDetails;
 if($studentMarksDetails->errorCode=='-1')
 {
	$errmsg="No data found!";
	echo $aobj_context->mobj_output->ToJSONEnvelope($errmsg,-1,"failure");
	die();
 }

 $footerNote = getFooterNote($aobj_context,$regno,$fexamno,$univcode);
 $resultObj->footerNote = $footerNote;

 $resultObj->error_code=0;
 $resultObj->status="success";

  $resultObj = JSON_encode($resultObj);
  echo $resultObj;
}
else
{
	$errmsg = "regno,examno,univcode all 3 prams are required!";
        echo $aobj_context->mobj_output->ToJSONEnvelope($errmsg,-1,"failure");
        return;
}


 
  
 
}


function getBasicStudentDetails($aobj_context,$regno,$fexamno){

    $query = "select s.FDEGREE, CONCAT(d.FEXAMNAME, ' ' ,d.FDESCPN) as FDESCPN ,d.FEXAMNAME,s.FCOLLCODE,concat(s.FCOLLCODE, ' ',c.FCOLLNAME,', ', c.FTOWN) as FCOLLNAME,concat(d.FRESEXAMDATE, ' Examination') as FRESEXAMDATE,
		s.FREGNO,s.FNAME,concat(d.FELIGREM01,d.FELIGREM02) as FELIGREM01 ,ifnull(s.FFATNAME,'') as FFATNAME,
		ifnull(s.FMOTNAME,'') as MOTNAME, d.fexamno 
		from student s inner join college c on c.FCOLLCODE=s.FCOLLCODE inner join degree d on d.FDEGREE=s.FDEGREE 
        where s.FREGNO = '{$regno}' and d.fexamno = '{$fexamno}' ";
        
        $result = $aobj_context->pobj_db->GetRow($query);
        return $result;
}

function getRevalDetails($aobj_context,$regno,$fexamno)
{
    $returnObj = "";
    $query="select FCOLLCODE,
		DATE_FORMAT(FRESULTDATE,'%d/%m/%Y') as FRESULTDATE,
		DATE_FORMAT(IFNULL(FRVLASTDATE,'0000-00-00'),'%d/%m/%Y') as FRVLASTDATE,
		DATE_FORMAT(IFNULL(FRTLASTDATE,'0000-00-00'),'%d/%m/%Y') as FRTLASTDATE,
		DATE_FORMAT(IFNULL(FXEROXLASTDATE,'0000-00-00'),'%d/%m/%Y') as FXEROXLASTDATE,
		DATE_FORMAT(IFNULL(FCVLASTDATE,'0000-00-00'),'%d/%m/%Y') as FCVLASTDATE,
		DATE_FORMAT(IFNULL(FRILASTDATE,'0000-00-00'),'%d/%m/%Y') as FRILASTDATE,
		ifnull(fdeleted,'') as fdeleted
		from res_fee
		where FREGNO='{$regno}'
        and FEXAMNO='{$fexamno}'";
    
        $result_dates = $aobj_context->pobj_db->GetRow($query);

        $FRESULTDATE=$result_dates['FRESULTDATE'];		
		$FRVLASTDATE=$result_dates['FRVLASTDATE'];		
		$FRTLASTDATE=$result_dates['FRTLASTDATE'];		
		$FCVLASTDATE=$result_dates['FCVLASTDATE'];		
		$FXEROXLASTDATE=$result_dates['FXEROXLASTDATE'];	
		$dates['resultDate'] = $FRESULTDATE;
		$dates['scroll_txt']=" Last Date for ";
		if($FRVLASTDATE!="00/00/0000")
		{
		$dates['scroll_txt'].=" RV : {$FRVLASTDATE}";
		}
		if($FRTLASTDATE!="00/00/0000")
		{
		$dates['scroll_txt'].=" RT : <b>{$FRTLASTDATE}";
		}if($FXEROXLASTDATE!="00/00/0000")
		{
		$dates['scroll_txt'].=" Photo Copy :{$FXEROXLASTDATE}";
		}if($FCVLASTDATE!="00/00/0000")
		{
		$dates['scroll_txt'].=" CV : {$FCVLASTDATE}";
		}
        //return $dates;
        $returnObj->dates = $dates;

        //return $returnObj;
        $get_rvrtStatus="select fcorrtype from res_stud 
        where fregno = '{$regno}' and fexamno = '{$fexamno}' and fpaymentstatus = 'success'";
        
        $obj_get_rvrtStatus=$aobj_context->pobj_db->GetAll($get_rvrtStatus);

        $rvDesp = '';
		$rtDesp = '';
		$cvDesp = '';
		$vrSlash = 0;
		$vrSlashSymb ='';
		$vrSlash2 = 0;
		$corrtype='';

			foreach($obj_get_rvrtStatus as $rvrtVal)
			{
				
				if($rvrtVal['fcorrtype'] == 'RV')
				{
					$rvDesp = 'Re-valuation';
					$vrSlash =1;
				}
				if($rvrtVal['fcorrtype'] == 'RT')
				{
					if($vrSlash == 1)
					$vrSlashSymb = ' / ';
					$vrSlash2 =1;
					$rtDesp = $vrSlashSymb.'Re-totalling';
				}
				 if($rvrtVal['fcorrtype'] == 'CV')
				{	
					if($vrSlash == 1 || $vrSlash2 == 1)
					$vrSlashSymb = ' / ';
					$cvDesp = $vrSlashSymb.'Challenge valuation';
				}
            }
            
            // $display = "T";
		$rcrtcvDesp = '';
		if($obj_get_rvrtStatus)
		{	// after result announced this table data is updated
			$get_rvrtFeeStatus="select ifnull(fcorrtype,'') as fcorrtype from res_fee 
			where fregno = '{$regno}' and fexamno = '{$fexamno}'";
			//$obj_get_rvrtFeeStatus=$conn->query($get_rvrtFeeStatus);
			$obj_get_rvrtFeeStatus=$aobj_context->pobj_db->GetRow($get_rvrtFeeStatus);
			//$obj_get_rvrtFeeStatus = $obj_get_rvrtFeeStatus->fetch_assoc();

			$rvrtArray = (explode(",",$obj_get_rvrtFeeStatus['fcorrtype']));
			if($obj_get_rvrtFeeStatus)
			{
			if($obj_get_rvrtFeeStatus['fcorrtype'] != '')
			{
				$vrSlash =0;
				$vrSlashSymb ='';
				foreach($rvrtArray as $rvrtArrayVal)
				{
					if($rvrtArrayVal == 'RV')
					{
						$rvFeeDesp = 'Re-valuation';
						$slashRV =1;
					}
					if($rvrtArrayVal == 'RT')
					{
						$rtFeeDesp = 'Re-totalling';
						$slashRT =1;
					}
					if($rvrtArrayVal == 'CV')
					{
						$cvFeeDesp = $vrSlashSymb.'Challenge valuation';
						$slashCV =1;
					}
					if($rvrtArrayVal == 'RI')
					{
						$cvFeeDesp = $vrSlashSymb.'Result Improvement';
						$slashCV =1;
					}
					
				}
					if($slashRV == 1 && $slashRT == 1)
						$vrSlashSymb = ' / ';
					if($slashRT == 1 && $slashCV == 1)
						$vrSlashSymb2 = ' / ';
					if($slashRV == 1 && $slashCV == 1)
						$vrSlashSymb2 = ' / ';	
						
					$rcrtcvDesp = $rvFeeDesp .'  '.$vrSlashSymb.$rtFeeDesp.'  '.$vrSlashSymb2.$cvFeeDesp.' '.'Result';
					$corrtype.="{$rcrtcvDesp}";
			}
			else
			{
				$display = 'F';	
				$rcrtcvDesp = $rvDesp .'  '.$rtDesp.'  '.$cvDesp.' '.'Result pending';
				$corrtype.="{$rcrtcvDesp}";
		
			}
			}
			
		}
   
        // $returnObj->rvDesp = $rvDesp;
        // $returnObj->rtDesp= $rtDesp;
        // $returnObj->cvDesp=$cvDesp;
		// $returnObj->vrSlash = $vrSlash;
		// $returnObj->vrSlashSymb=$vrSlashSymb;
		// $returnObj->vrSlash2= $vrSlash2;
        // $returnObj->corrtype = $corrtype;
        $returnObj->rcrtcvDesp = $rcrtcvDesp;
        return $returnObj;
}

function getStudentMarksDetails($aobj_context,$regno,$fexamno,$univcode)
{
    $returnObj = "";
    $query = "select if(FSUBSIDARY = 'T',concat(s.FSUBNAME,' **'),s.FSUBNAME) as FSUBNAME,if(ifnull(s.FLTP,'') = '','',s.FLTP) as FLTP,
		sum(s.FSMAXMARKS) as FSMAXMARKS,
		if(FTHUE='','-',FTHUE) as FTHUE ,
		if(FPRUE='','-',FPRUE) as FPRUE ,
		if(FTHVV='','-',FTHVV) as FTHVV ,
		if(FPRVV='','-',FPRVV) as FPRVV,
		if(FTHIA='','-',FTHIA) as FTHIA,
		if(FPRIA='','-',FPRIA) as FPRIA,
		if(FTHTOT='','-',FTHTOT) as FTHTOT,
		if(FPRTOT='','-',FPRTOT) as FPRTOT,
		if(FTHPASSMTH='','-',FTHPASSMTH) as FTHPASSMTH,
		if(FPRPASSMTH='','-',FPRPASSMTH) as FPRPASSMTH,
		if(rm.FCREDITS = '','-',rm.FCREDITS) as FCREDITS,
		if(ifnull(FGP,'') = '','-',FGP) as FGP,
		if(ifnull(FCP,'') = '','-',FCP) as FCP,
		if(ifnull(FGRADE,'') = '','-',FGRADE) as FGRADE,
		if(ifnull(FSGPA,'') = '','-',FSGPA) as FSGPA,
		if(ifnull(FCGPA,'') = '','-',FCGPA) as FCGPA,
		rm.FMAXMARKS,rm.FTOTMARKS,rm.FPREVMAX,rm.FPREVTOT,rm.FPERCENT,
		rm.FCLASS,rm.FMCNUMBER,rm.FYEAR,rm.FEXAMTYPE, rm.FSCHEME
		from resmarks rm
		inner join subject s on s.FDEGREE=rm.FDEGREE
		and s.FEXAMNO=rm.FEXAMNO and s.FSUBCODE=rm.FSUBCODE 
		where rm.FREGNO='{$regno}' and rm.fexamno='{$fexamno}'
        group by s.FSUBCODE";
        
		$result = $aobj_context->pobj_db->GetAll($query);
        $title1 = array();
		$send_data = array();
		$final_data = array();
		$marks = "";
        if($row = $result[0])
        {
			
			
            $FSCHEME = $row['FSCHEME'];
            if($FSCHEME == 'CR')
			{
			//$w      = array('5','50','5','8','8','8','8','10');
									
				if($univcode == '023')
				{						
					$title1 = ["Sl.\nNo.",'Subject Name',
					"Th\nPr",
					"Univ\nExam",
					'Viva',
					'I.A',
					'Total',
					"Credit\nHrs",
					"Grade\nPoints",
					"Credit\nPoints",
					'Remarks'];
				}
				else if($univcode == '017'){
					//$rem = "Remarks";
					$title1 = ['Sl.\nNo.','Subject Name','L:T:P',
					"Total\nMarks",
							"Credits",
							"Grade\nPoints",
							"Credit\nPoints",
							'Remarks'];
				}else if($univcode == '041' || $univcode == '042' || $univcode == '001'){
					$title1 = ["Sl.\nNo.",'Subject Name',"Th\nPr",
					"Max.\nMarks",
							"Sec.\nMarks",	
							"Credit\nHrs",
							"Grade\nPoints",
							"Credit\nPoints",
							'Remarks'];
				}
				else if($univcode == '040'){
					$title1 = ['Sl.\nNo.','Subject Name',"Th\nPr",
					"L:T:P",
							"Credits\nHrs",
							"Grade\nPoints",
							"Credit\nPoints",
							'Grade'];
				}
				else if($univcode == '034'){
					$title1 = ['Sl.\nNo.','Subject Name',"Th\nPr",
					"Total\nMarks",
							"Credits\nHrs",
							"Grade\nPoints",
							"Credit\nPoints",
							'Grade'];
				}
				else if($univcode == '039' || $univcode == '035'){
					$title1 = ['Sl.\nNo.','Subject Name',
					"Th\nPr",
							"Sem.\nEnd Exam",	'Viva',
							'I.A',
							'Total',
							"Credit\nHrs",
							"Grade\nPoints",
							"Credit\nPoints",
							'Remarks'];
				}
				else if($univcode == '036'){
					$title1 = ['Sl.\nNo.','Subject Name',
					"Max.\nMarks",
							"Sec.\nMarks",	
							"Credit\nHrs",
							"Grade\nPoints",
							"Credit\nPoints",
							'Grade'];
				}else if($univcode == '038'){
					$title1 = ['Sl.\nNo.','Course Title',"Th\nPr",
					"Sem.\nEnd Exam",
							"Credits\nHrs",
							"Grade\nPoints",
							"Credit\nPoints",
							'Remarks'];
				}else if($univcode == '008'){
					$title1 = ['Sl.\nNo.','Subject Name','L:T:P',
					"Total\nMarks",
							"Credits\nHours",
							"Grade\nPoints",
							"Credit\nPoints",
							'Grade'];
				}else if($univcode == '037'){
					$title1 = ['Sl.\nNo.','Subject Name',
					"Total\nMarks",
							"Credits",
							"Grade\nPoints",
							"Credit\nPoints",
							'Grade'];
				}else
				{
					$title1 = ["Sl.\nNo.",'Subject Name',
					"Th\nPr",
							"Univ\nExam",
							"Credit\nHrs",
							"Grade\nPoints",
							"Credit\nPoints",
							'Remarks'];
				}	
						
				$w = ['5','50','5','8','8','8','8','8','8','8','10'];
					
            }
            else
			{		
				if($univcode == '034'){
					$title1 = ['Sl. No.','Subject Name',
					"Th Pr",
							"Sem. End Exam",	'Viva',
							'I.A',
							'Total',
							'Remarks'];
				}else if($univcode == '035'){
					$title1 = ['Sl. No.','Subject Name',
					"Th Pr",
							"Sem. End Exam",	'Viva',
							'I.A',
							'Total',
							'Remarks'];
				}else if($univcode == '040'){
					$title1 = ["Sl.\nNo.",'Subject Name',
					"Th\nPr",
					"Univ\nExam",
					'I.A',
					'Total',
					'Remarks'];
				}else{
					$title1 = ["Sl.\nNo.",'Subject Name',
					"Th\nPr",
					'Univ Exam',
					'Viva','I.A',
					'Total',
					'Remarks'];
					$w = ['5','50','5','8','8','8','8','10'];
				}
            }
            $FMAXMARKS = $row['FMAXMARKS'];
			$FTOTMARKS = $row['FTOTMARKS'];
			$FPREVMAX  = $row['FPREVMAX'];
			$FPREVTOT  = $row['FPREVTOT'];
			$FPERCENT  = $row['FPERCENT'];
			$FCLASS    = $row['FCLASS'];
			$FMCNUMBER = $row['FMCNUMBER'];
			$FYEAR     = $row['FYEAR'];
			$FEXAMTYPE = $row['FEXAMTYPE'];	
            $FSCHEME   = $row['FSCHEME'];
            
            $sl_no=0;
            foreach($result as $k=>$v)
            {
				
				$sl_no++;
				$FSUBNAME   = $v['FSUBNAME'];
				$FSMAXMARKS = $v['FSMAXMARKS']; 
				$FLTP       = $v['FLTP'];
				$FTHUE      = $v['FTHUE'];
				$FPRUE      = $v['FPRUE'];
				$FTHVV      = $v['FTHVV'];
				$FPRVV      = $v['FPRVV'];
				$FTHIA      = $v['FTHIA'];
				$FPRIA      = $v['FPRIA'];
				$FTHTOT     = $v['FTHTOT'];
				$FPRTOT     = $v['FPRTOT'];
				$FGRADE     = $v['FGRADE']; 
				$FTHPASSMTH = trim($v['FTHPASSMTH']);
                $FPRPASSMTH = trim($v['FPRPASSMTH']);
                $FCREDITS      = $v['FCREDITS'];
				$FGP           = $v['FGP'];
				$FCP           = $v['FCP'];
				$FSGPA         = $v['FSGPA'];
				$FCGPA         = $v['FCGPA'];
				
				// send data

				$send_data['FSUBNAME']   = $v['FSUBNAME'];
				$send_data['FSMAXMARKS'] = $v['FSMAXMARKS']; 
				$send_data['FLTP']       = $v['FLTP'];
				$send_data['FTHUE']      = $v['FTHUE'];
				$send_data['FPRUE']      = $v['FPRUE'];
				$send_data['FTHVV']      = $v['FTHVV'];
				$send_data['FPRVV']      = $v['FPRVV'];
				$send_data['FTHIA']      = $v['FTHIA'];
				$send_data['FPRIA']      = $v['FPRIA'];
				$send_data['FTHTOT']     = $v['FTHTOT'];
				$send_data['FPRTOT']     = $v['FPRTOT'];
				$send_data['FGRADE']     = $v['FGRADE']; 
				$send_data['FTHPASSMTH'] = trim($v['FTHPASSMTH']);
                $send_data['FPRPASSMTH'] = trim($v['FPRPASSMTH']);
                $send_data['FCREDITS']      = $v['FCREDITS'];
				$send_data['FGP']           = $v['FGP'];
				$send_data['FCP']           = $v['FCP'];
				$send_data['FSGPA']         = $v['FSGPA'];
                $send_data['FCGPA']         = $v['FCGPA'];
                
                if($FTHUE != "-" && $FPRUE != "-")
				{
					$mthprue  = "Th.\nPr.";
					$uni_exam = "{$FTHUE}\n{$FPRUE}";
				}
				else if($FTHUE != "-")
				{
					$mthprue  = "Th.";
					$uni_exam = "{$FTHUE}";
				}
				else
				{
					$mthprue  = "Pr.";
					$uni_exam = "{$FPRUE}";
                }
                if($univcode=='018')
				{
						$mthprue = "-";
				}

						#########viva$########
				if($FTHVV!="-" && $FPRVV!="-")
				{					
					if(empty($FPRVV))
							$viva_exam = $FTHVV;
					else
							$viva_exam = $FPRVV;
				}
				else if($FTHVV!="-")
				{
						$viva_exam = $FTHVV;
				}
				else
				{
						$viva_exam = $FPRVV; 
				}
                        #########IA########
                        if($FTHIA!="-" && $FPRIA!="-")
                        {
                            if(empty($FPRIA))
                                    $ia_exam = $FTHIA;
                            else
                                    $ia_exam = $FPRIA;
                                    $ia_exam = "{$FTHIA}\n{$FPRIA}";
        
                        }
                        else if($FTHIA != "-")
                        {
                                $ia_exam = $FTHIA;
                        }
                        else
                        {
                                $ia_exam = $FPRIA;  
                        }
                                    #########TOTAl########
                                    if($FTHTOT!="-" && $FPRTOT!="-")
                                    {
                                            if(empty($FPRTOT))
                                                    $total = $FTHTOT;
                                            else
                                                    $total = $FPRTOT;
                                        $total = "{$FTHTOT}\n{$FPRTOT}";					
                                    }
                                    else if($FTHTOT != "-")
                                    {
                                            $total= $FTHTOT;
                                    }else
                                    {
                                            $total= $FPRTOT; 
                                    }
                                                #########Remarks########
                                    if($univcode == '018')
                                    {
                                            $FPRPASSMTH="";
                                    }
                                    if(strtolower($FTHPASSMTH) == strtolower($FPRPASSMTH))
                                    {
                                            $remarks = $FTHPASSMTH; 
                                    }
                                    else if(strtolower($FTHPASSMTH)=="pass" && strtolower($FPRPASSMTH)=="pass")
                                    {
                                            $remarks = "Pass"; 
                                    }
                                    else if(strtolower($FTHPASSMTH)=="fail" && strtolower($FPRPASSMTH)=="fail")
                                    {
                                            $pass_color = "red;";
                                            $remarks    = "Fail"; 
                                    }
                                    else if(strtolower($FTHPASSMTH)!="-" && strtolower($FPRPASSMTH)=="-")
                                    {
                                            $remarks  = $FTHPASSMTH; 
                                    }
                                    else if(strtolower($FTHPASSMTH)=="-" && strtolower($FPRPASSMTH)!="-")
                                    {
                                            $remarks  = $FPRPASSMTH; 
                                    }else
                                    {
                                        if(empty($FPRPASSMTH))
                                            $remarks = $FTHPASSMTH;
                                        else
                                            $remarks = $FTHPASSMTH."\n".$FPRPASSMTH;
                    
                                        // if(empty($FPRPASSMTH))
                                        // 		$remarks = $FTHPASSMTH;
                                        // else
                                        // 		$remarks = $FPRPASSMTH;
                                        // return $remarks;
                                    }

                                    $send_data['sl_no'] = $sl_no;
                                    $send_data['subject'] = $FSUBNAME;
                                    
                                    if($univcode == '040' && $FSCHEME == 'CR'){
                                        $send_data['mthprue'] = $mthprue;
                                        $send_data['uni_exam'] = $FLTP; 
                                        $send_data['viva_exam'] = $viva_exam; 
                                        $send_data['ia_exam'] = $ia_exam; 
                                        $send_data['thtot'] = $total;
                                    }else if($univcode == "037" && $FSCHEME!="CR"){
                                        $send_data['mthprue'] = $mthprue;
                                        $send_data['uni_exam'] = $uni_exam; 
                                        $send_data['viva_exam'] = $viva_exam; 
                                        $send_data['ia_exam'] = $ia_exam; 
										$send_data['thtot'] = $total;
										
                                    }else
                                    {
                                        $send_data['mthprue'] = $mthprue;
                                        $send_data['uni_exam'] = $uni_exam; 
                                        $send_data['viva_exam'] = $viva_exam; 
                                        $send_data['ia_exam'] = $ia_exam; 
                                        $send_data['thtot'] = $total;
                                    }
                    
                                    if($univcode == '035' || $univcode == '039' || $univcode == '023')
                                    {	
                                        if($FSCHEME == 'CR')
                                        {	
                                                $send_data['FCREDITS'] =$FCREDITS;
                                                $send_data['FGP'] =$FGP;
                                                $send_data['FCP'] =$FCP;
                                                //$send_data['FCGPA']
                                        }
                                    }
                    
                                    if(($univcode == '017' || $univcode == '008' )&& $FSCHEME == 'CR' ){
                                        $send_data['mthprue']= $FLTP;
                                    }				
                    
                                    if($univcode == '036' && $FSCHEME == 'CR' ){
                                        $send_data['mthprue']= $FSMAXMARKS;
                                    }		
                    
                                    if(($univcode == '041' || $univcode == '042' || $univcode == '001') && $FSCHEME == 'CR' )
                                        $send_data['fsmaxmarks']= $FSMAXMARKS;
                    
                                if(($univcode == '035' || $univcode == '039' || $univcode == '023') && $FSCHEME == 'CR')
                                {	
                                    if($FCLASS == 'Fail, Promoted')
                                        $result =$FCLASS;//grade
                                    else
                                        $result = $FCLASS;
                                }else
                                    $result = $FCLASS;
                                                    
                                $send_data['result'] = $result;
                                $send_data['remarks'] = $remarks;
                                if($FSCHEME != 'CR' || ($univcode == '035' || $univcode == '039' || $univcode == '023')){
                                    $send_data['FMAXMARKS'] = $FMAXMARKS;
                                    $send_data['FTOTMARKS'] = $FTOTMARKS;
                                }
                                if($FSCHEME == 'CR' && $univcode == '033' || $univcode == '008' || $univcode == '034' || $univcode == '036'){
                                    $send_data['FMAXMARKS'] = $FMAXMARKS;
                                    $send_data['FTOTMARKS'] = $FTOTMARKS;
                                }
                                if($FSCHEME == 'CR')
                                {	
                                    if($FCGPA != '0.00'){
                                        $send_data['FCGPA'] = $FCGPA;
                                        $send_data['FSGPA'] = $FSGPA;
                                        $send_data['FPERCENT'] = $FPERCENT;
                                    }
                                    else{
                                        $send_data['FPERCENT'] = $FPERCENT;
                                    }
                                }else
                                    $send_data['FPERCENT'] = $FPERCENT;
                    
                                if($FCGPA == '-' && $FPREVTOT !="0000")
                                    $send_data['FCGPA'] = $FPREVTOT;
                                if($FPREVMAX != "0000" && !empty($FPREVMAX))
                                    $send_data['FCGPA'] = $FPREVTOT;$send_data['FPREVMAX'] = $FPREVMAX;
                    
                                $send_data['FSCHEME'] =$FSCHEME;
                                array_push($final_data,$send_data);
                        
            } // foreach loop ends
            
			$returnObj->title = $title1;
			$final_data=send_particular_data($univcode,$final_data,$title1);
			$returnObj->sendData = $final_data;
			$returnObj->errorCode=0;
			$returnObj->status="success";
            return $returnObj;
            
            
		} // result ends
		else
		{
			$returnObj = "";
			$returnObj->errorCode=-1;
			$returnObj->errorMsg="No data found!";
			$returnObj->status="failure";
			return $returnObj;
			
		}
			
}



function getWithHeldDetails($aobj_context,$regno,$fexamno,$univcode)
{
	$returnObj="";
	$get_data="select  count(1) as held_cnt, if(ifnull(fmcnumber,'')='','',concat(fmcnumber)) as fwhrem						 
			from resmarks rm					 
			where FREGNO='{$regno}' and 
			rm.FEXAMNO='{$fexamno}' and FCLASS='WITHHELD'";
	
			
			$rest=$aobj_context->pobj_db->GetRow($get_data);
			$count = sizeof($rest);
			$data = $rest;
			$held_cnt = $data['held_cnt'];
		    //var_dump($held_cnt);
			if($held_cnt == "0")
			{
			  $returnObj->withHeldMsg="0";
			  return $returnObj;
			}
			else
			{
				$returnObj->withHeldMsg="-1";
				return $returnObj;
			}
}

function getFooterNote($aobj_context,$regno,$fexamno,$univcode){
	$get_remarks="SELECT FRESULT_REMARKS, FUNIVCODE FROM control";
		$remarksDet=$aobj_context->pobj_db->GetAll($get_remarks);
		$returnObj = $remarksDet;
		return $returnObj;
}



function send_particular_data($univcode,$send_data)
{
	// var_dump($title1);
	
    if(($univcode == '041' || $univcode == '042' || $univcode=='001') && $send_data[0]['FSCHEME']=='CR')
	   { $title1 = array("sl_no","subject","mthprue","fsmaxmarks","uni_exam","viva_exam","ia_exam","thtot","remarks");
	   }
	else if(($univcode == '041' || $univcode == '042' || $univcode=='001') && $send_data[0]['FSCHEME']!='CR')
	{
		$title1 = array("sl_no","subject","mthprue","uni_exam","viva_exam","ia_exam","thtot","remarks");
	}
	else
	{
		$title1 = array("sl_no","subject","mthprue","uni_exam","viva_exam","ia_exam","thtot","remarks");
	}
		
	
	if($send_data[0]['FSCHEME']=='CR' && $univcode=='023')
	{
		array_pop($title1);
	 array_push($title1,"FCREDITS","FGP","FCP","remarks");
	}
	
	//var_dump($title1);

	$i = 0;
	
	$final = array();
    foreach($send_data as $k=>$v)
    {
		$data = array();
		for($n = 0;$n<count($title1);$n++)
		{			
			$arr[$i][$title1[$n]] =  $v[$title1[$n]];
        }
        
		$i++;
    }
    
	$z = 0;
	foreach($arr as $value)
	{
		$data[$z] = $value;
		$z++;
	}

	
	 //var_dump($data);
	 

	 $overallResult = "";
	 if($send_data[0]['FSCHEME']=='CR' && $univcode=='023')
	{
	 //array_push($title1,"FCREDITS","FGP","FCP");
	 $overallResult->FMAXMARKS = $send_data[0]['FMAXMARKS'];
	 $overallResult->FTOTMARKS = $send_data[0]['FTOTMARKS'];
	 $overallResult->result = $send_data[0]['result'];
	 $overallResult->FSGPA = $send_data[0]['FSGPA'];
	 $overallResult->FCGPA = $send_data[0]['FCGPA'];


	

	 $result = strtoupper($send_data[0]['result']);

	 if(strpos($result,"FAIL")!==false)
	 {
		 
		$overallResult->result=$send_data[0]['result'];
		$overallResult->GRADE="-";
		$overallResult->ResultBoolean ="FAIL";

	 }
	 else
	 {
		$overallResult->result = "PASS";
		$overallResult->GRADE = $send_data[0]['result'];
		$overallResult->ResultBoolean ="PASS";
	 }

	}
	else
	{
		
		$overallResult->FSGPA = $send_data[0]['FPERCENT'];
		//added one extra columns
		$overallResult->FMAXMARKS = $send_data[0]['FMAXMARKS'];
		$overallResult->FTOTMARKS = $send_data[0]['FTOTMARKS'];
		$overallResult->result=$send_data[0]['result'];
		$result = strtoupper($send_data[0]['result']);
		if(strpos($result,"FAIL")!==false)
		{
			$overallResult->ResultBoolean ="FAIL";
		}
		else{
			$overallResult->ResultBoolean ="PASS";
		}

		if($send_data[0]['FPREVMAX']=="0000")
		{

		}
		else
		{
			$overallResult->FCGPA = $send_data[0]['FPREVMAX'];
		}
		
	}

	 
	 $data->overallResult = $overallResult;
	 $overallResult->FSCHEME = $send_data[0]['FSCHEME'];
	 $resultTableValues->$data = $data;
	 $resultTableValues->$overallResult = $overallResult;
	 
	 //var_dump($resultTableValues);
	return $resultTableValues;

}

?>