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


Current Path : /var/www/results/gcg/
Upload File :
Current File : /var/www/results/gcg/resultsold.php

<?php
class results
{ 
	public $drop_down_arr;
	
	function __construct($aobj_context)
	{
		session_start();
		$this->aobj_context=$aobj_context;
		$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
		$this->coll_code = $_SESSION['FCOLLCODE'];//cug
		$query = "select FUNIVCODE from control";
		$result = $this->aobj_context->mobj_db->GetRow($query);
		$FUNIVCODE=$result['FUNIVCODE'];	
		$_SESSION['FUNIVCODE']=$FUNIVCODE;
	}
	
	function ValidateRegNo($aobj_context)
	{
		session_start();
		
		$regroll = $_SESSION['G_FREGROLL'];
		$FUNIVCODE = $_SESSION['FUNIVCODE'];
		
		$reg_no=trim($this->aobj_context->mobj_data['reg_no']);
		$exam=trim($this->aobj_context->mobj_data['exam']);
		
		$lsql="select fdegree, fregno, fname, fcollcode
		from student where fregno = '{$reg_no}'";
		$tmprs = $this->aobj_context->mobj_db->GetRow($lsql);
		$fdegree = $tmprs['fdegree'];
		if(count($tmprs) == 0)
		{
			$data="Invalid ".$regroll;
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
			return false;
		}
		$lsql="select * from degree where fdegree  = '{$fdegree}' 
		and fexamno = '{$exam}' ";
		$tmprs = $this->aobj_context->mobj_db->GetRow($lsql);
		if(count($tmprs) == 0)
		{
			$data="Invalid Year / Semister";
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
			return false;
		}
		
		$lsql="select * from res_fee where fdegree  = '{$fdegree}' 
		and fexamno = '{$exam}' and fregno = '{$reg_no}' ";
		$tmprs = $this->aobj_context->mobj_db->GetRow($lsql);
		if(count($tmprs) == 0)
		{
			$data="No result found for the given details.";
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
			return false;
		} 				
			$data = "$FUNIVCODE";
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,0,"success");		
		
	}
	
	function dashboardMessageBoard()
	{
		$get_all_message="select message from message_board where current_date() between 
		display_from and display_to and college_code='RES' 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 PopulateResultDegreeList()
	{
		session_start();
		$FUNIVCODE = $_SESSION['FUNIVCODE'];
		$this->html.="";
		
		$this->html.="<table  align='center' id='degree_table_data' width='100%' border='0' cellspacing='0' cellpadding='0'>";
		$this->html.="<tr class='tr_bg'>";
		if($FUNIVCODE  =='031')
		{
			$this->html.="<td  width='50%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;padding:1px 10px;' align='left'>Programme</td>";
			$this->html.="<td  width='20%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;padding:1px 10px;' align='left'>Semester</td>";
			$this->html.="<td  width='10%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Result Date </td>";
		}
		else
		{
			$this->html.="<td  width='10%' style='border-left:1px solid #a1a1a1; border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Degree</td>";
			$this->html.="<td  width='50%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Reference</td>";
			$this->html.="<td  width='20%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Exam</td>";
			$this->html.="<td  width='10%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Scheme </td>";
			$this->html.="<td  width='10%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Result Date </td>";
		}
		$this->html.="</tr>";					
		$k=0;
		$sl=1;

		$get_data="SELECT FDEGREE,FDESCPN,FEXAMNO,FEXAMNAME,
		DATE_FORMAT(FRESULTDATE,'%d/%m/%Y') AS FRESULTDATE,FRESULTSCHEME
		FROM degree WHERE IFNULL(FRESULTDATE,'0000-00-00')!='0000-00-00'
		ORDER BY FRESULTORDER desc, FDEGREE, FEXAMNO";
		$this->app_data=$this->aobj_context->mobj_db->GetAll($get_data); 			
		foreach($this->app_data as $k=>$v)
		{
			$FDEGREE=$v[FDEGREE];
			$FDESCPN=$v[FDESCPN];
			$FEXAMNO=$v[FEXAMNO];
			$FEXAMNAME=$v[FEXAMNAME];
			$FRESULTDATE=$v[FRESULTDATE];
			$FRESULTSCHEME=$v[FRESULTSCHEME];

			if($k%2==0)
				$class='tbl_row';
			else
				$class='tbl_row_alter';
			if($FUNIVCODE  =='031')
			{
				$this->html.="<td class={$class} style='text-align:left; border-right:1px solid #a1a1a1;padding:1px 10px;' align='left'>{$FDESCPN}</td>";
				$this->html.="<td class={$class} style='text-align:left; border-right:1px solid #a1a1a1;padding:1px 10px;'>{$FEXAMNAME}</td>";							
				$this->html.="<td class={$class} style='line-height: 22px;text-align:center; border-right:1px solid #a1a1a1;'>{$FRESULTDATE}</td>";	
			}
			else
			{
				$this->html.="<tr>";
				$this->html.="<td class={$class} style='border-left:1px solid #a1a1a1; border-right:1px solid #a1a1a1;' align='center'>{$FDEGREE}</td>";
				$this->html.="<td class={$class} style='text-align:left; border-right:1px solid #a1a1a1;' align='center'>{$FDESCPN}</td>";
				$this->html.="<td class={$class} style='text-align:left; border-right:1px solid #a1a1a1;'>{$FEXAMNAME}</td>";				
				$this->html.="<td class={$class} style='text-align:center; border-right:1px solid #a1a1a1;'>{$FRESULTSCHEME}</td>";				
				$this->html.="<td class={$class} style='line-height: 22px;text-align:center; border-right:1px solid #a1a1a1;'>{$FRESULTDATE}</td>";	
			}
			$this->html.="</tr>";
			$sl++;
			$k++;
		}	

		$this->html.=" </table>";
		$arr["funivcode"]=$FUNIVCODE;
		$arr["html"]=$this->html;
		$arr["mess_data"]=$this->mess_data;
		echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
		return;			
	}
	
	function DisplayStudentResult()
	{
		session_start();
		$FUNIVCODE = $_SESSION['FUNIVCODE'];
		$this->reg_no=trim($this->aobj_context->mobj_data['r']);		 
		$this->exam=trim($this->aobj_context->mobj_data['e']);
		if($FUNIVCODE == '026')
		{
			$this->category=trim($this->aobj_context->mobj_data['ct']);
		}
		if(empty($this->reg_no) || $this->reg_no=="undefined")
		{
			$arr['html']="Register number should be entered";
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
			return;	
		}
		else if(empty($this->exam) || $this->exam=="undefined")
		{
			$arr['html']="Year / Semester should be selected";
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
			return;	
		}
		$get_result_date="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,FCORRTYPE
		from res_fee where FREGNO='{$this->reg_no}' and FEXAMNO='{$this->exam}'";

		$obj_get_result_date=$this->aobj_context->mobj_db->GetRow($get_result_date);
		$_SESSION['g_reg_no']=$this->reg_no;
		$_SESSION['g_FEXAMNO']=$this->exam;
		if($FUNIVCODE == '026')
		{
			$_SESSION['g_category']=$this->category;
		}
		$_SESSION['g_FCOLLCODE']=$obj_get_result_date['FCOLLCODE'];
		$FRESULTDATE=$obj_get_result_date['FRESULTDATE'];		
		$FRVLASTDATE=$obj_get_result_date['FRVLASTDATE'];		
		$FRTLASTDATE=$obj_get_result_date['FRTLASTDATE'];		
		$FCVLASTDATE=$obj_get_result_date['FCVLASTDATE'];		
		$FXEROXLASTDATE=$obj_get_result_date['FXEROXLASTDATE'];	
		$FCORRTYPE=$obj_get_result_date['FCORRTYPE'];
		if($FUNIVCODE   =='031' || $FUNIVCODE   =='030'  || $FUNIVCODE == '005' || $FUNIVCODE =='018' || $FUNIVCODE =='026')
		{
			if($FCORRTYPE=='RV')
			{
				$FCORRTYPE="REVALUATION RESULTS";
			}else if($FCORRTYPE=='RT')
			{
				$FCORRTYPE="RETOTALLING RESULTS";
			}else if($FCORRTYPE=='CV')
			{
				$FCORRTYPE="CHALLENGE VALUATION RESULTS";
			}else
			{
				$FCORRTYPE="";
			}
		}
		$scroll_txt=" Last Date for ";
		if($FRVLASTDATE!="00/00/0000")
		{
			$scroll_txt.=" RV : {$FRVLASTDATE} &nbsp;&nbsp;";
		}
		if($FRTLASTDATE!="00/00/0000")
		{
			$scroll_txt.=" RT : {$FRTLASTDATE} &nbsp;&nbsp; ";
		}
		if($FXEROXLASTDATE!="00/00/0000")
		{
			$scroll_txt.=" Photo Copy : {$FXEROXLASTDATE} &nbsp;&nbsp;";
		}
		if($FCVLASTDATE!="00/00/0000")
		{
			$scroll_txt.=" CV : {$FCVLASTDATE} &nbsp;&nbsp;";
		}
		$get_data="SELECT IFNULL(FRVFEE,0)+IFNULL(FRTFEE,0)+IFNULL(FXEROXFEE,0)+IFNULL(FCVFEE,0) AS rv_rt_total_fee,
		s.FDEGREE,d.FDESCPN, s.FEXAMNO,d.FEXAMNAME,s.FCOLLCODE,concat(c.FCOLLNAME,', ', c.FTOWN) as FCOLLNAME,d.FRESEXAMDATE,
		s.FREGNO,s.FNAME,s.FAYEAR,d.FELIGREM01,d.FELIGREM02,
		ifnull(s.FFATNAME,'') as FFATNAME,ifnull(s.FMOTNAME,'') as MOTNAME FROM student s INNER JOIN college c
		ON c.FCOLLCODE=s.FCOLLCODE INNER JOIN degree d ON d.FDEGREE=s.FDEGREE
		where s.FREGNO='{$this->reg_no}'  and d.fexamno = '{$this->exam}' ";
		$obj_student=$this->aobj_context->mobj_db->GetRow($get_data); 
		$_SESSION['g_FDEGREE']=$obj_student['FDEGREE'];
		
		if(empty($obj_student))
		{
			$arr['html']="Invalid Register number / No Results found";
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
			return;	
		}
		$rv_rt_total_fee=$obj_student['rv_rt_total_fee'];
		$FDEGREE=$obj_student['FDEGREE'];
		$FDESCPN=$obj_student['FDESCPN'];
		$FEXAMNO=$obj_student['FEXAMNO'];
		$FEXAMDATE=$obj_student['FRESEXAMDATE'];
		$FEXAMNAME=$obj_student['FEXAMNAME'];
		$FCOLLCODE=$obj_student['FCOLLCODE'];
		$this->FCOLLCODE=$obj_student['FCOLLCODE'];
		$FCOLLNAME=$obj_student['FCOLLNAME'];
		$this->FCOLLNAME=$obj_student['FCOLLNAME'];
		$FREGNO=$obj_student['FREGNO'];
		$FNAME=$obj_student['FNAME'];
		$FFATNAME=$obj_student['FFATNAME'];
		$MOTNAME=$obj_student['MOTNAME'];
		$FAYEAR=$obj_student['FAYEAR'];
		$FELIGREM01=$obj_student['FELIGREM01'];
		$this->FELIGREM01=$obj_student['FELIGREM01'];
		$FELIGREM02=$obj_student['FELIGREM02'];
		$this->FELIGREM02=$obj_student['FELIGREM02'];
		
		$tr1=" {$FEXAMNAME} {$FDESCPN} {$FEXAMDATE} Examinations";			

		$get_remarks="SELECT FRESULT_REMARKS, FUNIVCODE FROM control";
		$obj_get_remarks=$this->aobj_context->mobj_db->GetRow($get_remarks);
		$remarks=$obj_get_remarks['FRESULT_REMARKS'];	
		$univcode=$obj_get_remarks['FUNIVCODE'];	
		$tr2=" Reg. No. : {$FREGNO}";
		if($FUNIVCODE == '031')
			$tr2="{$FREGNO}";
		if($univcode=='018')
		{
			$tr2=" Roll No. : {$FREGNO}";			
		}

		$tr3=" Name of the Student : {$FNAME}";
		if($FUNIVCODE == '005' || $FUNIVCODE == '018' || $FUNIVCODE == '026' )
		{	
			if($FCORRTYPE!=='')
			{
				$tr4=" {$FCORRTYPE}";
			}
		}
		if($FUNIVCODE  =='031' || $FUNIVCODE  =='030')
		{
			if($FCORRTYPE!=='')
			{
				$tr4=" {$FCORRTYPE}";
			}
			############ Writing Student Info START########################	
 			if($FUNIVCODE  =='030')
			{
				if($FCORRTYPE!=='')
				{
					$this->html.="<table width=70% align=center class='result_table_header' id='student_info'>
					<tr style='height:22px;'><td align=center>{$tr1}</td></tr>
					<tr style='height:22px;' ><td align=center >{$tr2}</td></tr>
					<tr style='height:22px;' ><td align=center >{$tr3}</td></tr>
					<tr style='height:22px;color:red;' ><td align=center >{$tr4}</td></tr>
					</table>";
				}
				else
				{
					$this->html.="<table width=70% align=center class='result_table_header' id='student_info'>
					<tr style='height:22px;'><td align=center>{$tr1}</td></tr>
					<tr style='height:22px;' ><td align=center >{$tr2}</td></tr>
					<tr style='height:22px;' ><td align=center >{$tr3}</td></tr>
					</table>";
				}
			} else
			{
				if($FCORRTYPE!=='')
				{	
					$this->html.="<table width=70% align=left class='result_table_header' id='student_info'>
					<tr style='height:22px;'>
					<td align=left>Enrollment No. :</td>
					<td align=left>Examination :</td>
					</tr>
					</table>
					<table width=70% align=left class='result_table_header' id='student_info'>
					<tr style='height:22px;' ><td align=left style='width:100px;'>Name :</td></tr>
					<tr style='height:22px;' ><td align=left style='width:100px;'>Center :</td></tr>
					<tr style='height:22px;color:red;' ><td align=left style='width:100px;'>Program :</td></tr>
					</table>";
				}
				else
				{
					$this->html.="<table width=100% cellpadding='5' cellspacing ='0' class='result_table_header' id='student_info'>
					<tr style='height:22px;'>
					<td align=left style='width:181px;border-left:1px solid #a1a1a1; border-right:1px solid #a1a1a1; border-top:1px solid #a1a1a1;'>Enrollment No.</td><td style='width:200px;border-top:1px solid #a1a1a1;border-right:1px solid #a1a1a1;'>{$tr2}</td>
					<td align=left style='width:182px;border-right:1px solid #a1a1a1;border-top:1px solid #a1a1a1;'>Examination</td><td style='border-top:1px solid #a1a1a1;border-right:1px solid #a1a1a1;'>{$FEXAMNAME} {$FEXAMDATE}</td>
					</tr>
					</table>
					<table width=100% align=left cellpadding='5' cellspacing ='0' style='margin-bottom:20px;' class='result_table_header' id='student_info'>
					<tr style='height:22px;border-right:1px solid #a1a1a1;' ><td align=left style='width:105px;border-left:1px solid #a1a1a1;border-right:1px solid #a1a1a1;border-top:1px solid #a1a1a1;'>Name </td><td style='width:400px;border-right:1px solid #a1a1a1;border-top:1px solid #a1a1a1;'> {$FNAME}</td></tr>
					<tr style='height:22px;border-right:1px solid #a1a1a1;' ><td align=left style='width:105px;border-left:1px solid #a1a1a1;border-right:1px solid #a1a1a1;border-top:1px solid #a1a1a1;'>Center / School </td><td style='width:400px;border-right:1px solid #a1a1a1;border-top:1px solid #a1a1a1;'> {$this->FCOLLNAME}</td></tr>
					<tr style='height:22px;border-right:1px solid #a1a1a1;' ><td align=left style='width:105px;border-left:1px solid #a1a1a1;border-right:1px solid #a1a1a1;border-top:1px solid #a1a1a1;border-bottom:1px solid #a1a1a1;'>Programme</td><td style='width:400px;border-right:1px solid #a1a1a1;border-top:1px solid #a1a1a1;border-bottom:1px solid #a1a1a1;'>{$FDESCPN}</td></tr>
					</table>";
				}
			}
		}
		if($FUNIVCODE  =='030' || $FUNIVCODE == '005') // cug or nehu
		{	
			############ Writing Student Info START########################	
			/*  Display Application status - 06/07/2015      */
			$get_rvrtStatus="select fcorrtype from res_stud 
			where fregno = '{$this->reg_no}' and fexamno = '{$this->exam}' and fpaymentstatus = 'success'";
			$obj_get_rvrtStatus=$this->aobj_context->mobj_db->GetAll($get_rvrtStatus);
			$rvDesp = '';
			$rtDesp = '';
			$cvDesp = '';
			$vrSlash = 0;
			$vrSlashSymb ='';
			$vrSlash2 = 0;
			$rspending='';
			
			foreach($obj_get_rvrtStatus as $rvrtkey=>$rvrtVal)
			{
				if($rvrtVal[fcorrtype] == 'RV')
				{
					$rvDesp = 'Re-valuation';
					$rspending='Result pending';
					$vrSlash =1;
				}
				if($rvrtVal[fcorrtype] == 'CV')
				{	
					if($vrSlash == 1)
					$vrSlashSymb = ' / ';
					$cvDesp = $vrSlashSymb.'Challenge valuation';
					$rspending='Result pending';
				}
			}
			
			$rcrtcvDesp = '';
			if($obj_get_rvrtStatus)
			{	
				$get_rvrtFeeStatus="select ifnull(fcorrtype,'') as fcorrtype from res_fee 
				where fregno = '{$this->reg_no}' and fexamno = '{$this->exam}'";
				$obj_get_rvrtFeeStatus=$this->aobj_context->mobj_db->GetRow($get_rvrtFeeStatus);
				$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($slashRV == 1 && $slashRT == 1)
							$vrSlashSymb = ' / ';
						if($slashRT == 1 && $slashCV == 1)
							$vrSlashSymb2 = ' / ';
						if($slashRV == 1 && $slashCV == 1)
							$vrSlashSymb2 = ' / ';	

						$rcrtcvDesp = $rvFeeDesp .'  '.$vrSlashSymb.$rtFeeDesp.'  '.$vrSlashSymb2.$cvFeeDesp.' '.'Result';
						$this->html.="<div style='text-align:center;font-size:18px;width:100%;font-weight:bold;color:green;margin-bottom:10px;'><u>{$rcrtcvDesp}</u></div>";
					}
					else
					{
						$rcrtcvDesp = $rvDesp .'  '.$rtDesp.'  '.$cvDesp.' '.$rspending;
						$this->html.="<div style='text-align:center;font-size:18px;width:100%;font-weight:bold;color:red;margin-bottom:10px;'><u>{$rcrtcvDesp}</u></div>";
					}
				}

			}
		}
		/*  End      */
		if($FUNIVCODE != '031' && $FUNIVCODE  !='030' && $FUNIVCODE != '005' && $FUNIVCODE != '018' && $FUNIVCODE != '026' )
		{
			$this->html.="<table width=70% align=center class='result_table_header' id='student_info'>
			<tr style='height:22px;'><td align=center>{$tr1}</td></tr>
			<tr style='height:22px;' ><td align=center >{$tr2}</td></tr>
			<tr style='height:22px;' ><td align=center >{$tr3}</td></tr>
			</table>";
		} 
		if($FUNIVCODE == '005' || $FUNIVCODE == '018' || $FUNIVCODE == '026')
		{
			
			$this->html.="<table width=70% align=center class='result_table_header' id='student_info'>
			<tr style='height:22px;'><td align=center>{$tr1}</td></tr>
			<tr style='height:22px;' ><td align=center >{$tr2}</td></tr>
			<tr style='height:22px;' ><td align=center >{$tr3}</td></tr>";
			$this->html.="<tr style='height:22px;color:red;' ><td align=center >{$tr4}</td></tr></table>";
			
		}

		############ Writing Student Info END########################

		############ Writing Student Info START########################	

		if(!empty($FFATNAME) || !empty($MOTNAME))
		{
			$this->html.="<table width=100% align=center class='result_table_header' id='student_info'>
			<tr style='height:22px;'><td align=left>Father Name :  {$FFATNAME}</td><td align=right>Mother Name : {$MOTNAME}</td></tr> 
			</table>";
		}
		############ Writing Student Info END########################	
		$get_data="select  count(1) as held_cnt, if(ifnull(fmcnumber,'')='','',concat('Withheld Reason : ',fmcnumber)) as fwhrem
		from resmarks rm where FREGNO='{$this->reg_no}' and rm.FEXAMNO='{$this->exam}' and FCLASS='WITHHELD' ";
		$obj_held=$this->aobj_context->mobj_db->GetRow($get_data); 
		$held_cnt=$obj_held['held_cnt'];

		$this->with_held_text="";
		if($held_cnt==0)
		{
			$this->WriteSubjectWiseResult();
		}
		else
		{	
			if($FUNIVCODE  =='031' || $FUNIVCODE  =='030' || $FUNIVCODE  =='017' || $FUNIVCODE == '018' || $FUNIVCODE == '008')
			{
				$this->with_held_text="<br><br><br><span style='font-weight:bold;color:red;margin-left:375px;font-size: 21px;'>WITHHELD</span><br><br><br>";
			}else if($FUNIVCODE == '005')
			{
				$this->with_held_text="<table width='900px' align=center class='result_table_header'><tr style='height:22px;'><td align=center><span style='font-weight:bold;color:red;font-size: 21px;'>WITHHELD</span></td></tr><tr></tr>
				<tr style='height:22px;'><td align=center><span style='font-weight:bold;font-size: 18px;align:center;'>{$obj_held['fwhrem']}</span><td></tr></table>";
			}
			else
			{
				$this->with_held_text="<table width='900px' align=center class='result_table_header'><tr style='height:22px;'><td align=center><span style='font-weight:bold;color:red;font-size: 21px;'>WITHHELD</span></td></tr><tr></tr>
				<tr style='height:22px;'><td align=center><span style='font-weight:bold;font-size: 18px;align:center;'>{$obj_held['fwhrem']}</span><td></tr></table>";
			}
		}

		if($this->error_found==1)
		{
			$arr['html']="Invalid Register number / No Results found";
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
			return;	
		}

		$this->html.="{$this->with_held_text}<br><table width=100% align=left class='result_table_remarks'>
		<tr><td align=left style='text-align:justify;'>{$remarks} </td></tr>
		</tr>
		</table>";

		$arr['html']=$this->html;
		if($FUNIVCODE != '031' && $FUNIVCODE != '019' && $FUNIVCODE  !='030' && $FUNIVCODE  !='017' && $FUNIVCODE  !='014' && $FUNIVCODE  !='021' && $FUNIVCODE != '005' && $FUNIVCODE != '011')		
			$arr['scroll_txt']="<marquee  direction='left' scrollamount='3' onmouseover='scrollAmount=\"0\"' onmouseout='scrollAmount=\"3\"'>".$scroll_txt."</marquee>";		
		$arr['FRESULTDATE']=$FRESULTDATE;		
		$arr['rv_rt_total_fee']=$rv_rt_total_fee;		

		echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
		return;	
	}
	
	function WriteSubjectWiseResult()
	{
		session_start();
		$FUNIVCODE = $_SESSION['FUNIVCODE'];
		if($FUNIVCODE == '031')
		{
			$get_datacug="select s.FSUBNAME, ifnull(sh.fsubname,'') as fhindi, s.FLTP,
			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,
			rm.FMAXMARKS,FTOTMARKS,FPREVMAX,FPREVTOT,FPERCENT,FCLASS,FMCNUMBER,FYEAR,FEXAMTYPE, FSCHEME,
			sum(s.FSMAXMARKS) as fsmax, s.FSUBSHORT, rm.FDEGREE
			from resmarks rm
			inner join subject s on s.FDEGREE=rm.FDEGREE
			and s.FEXAMNO=rm.FEXAMNO and s.FSUBCODE=rm.FSUBCODE 
			left outer join sub_hindi sh on
			s.fdegree = sh.fdegree and s.fsubcode = left(sh.fsubcode,4)
			where rm.FREGNO='{$this->reg_no}' and 
			rm.FEXAMNO='{$this->exam}'
			group by s.FSUBCODE order by s.fprintord, s.fsubcode";
			mysql_query("SET NAMES utf8");
			
			$this->app_data=$this->aobj_context->mobj_db->GetAll($get_datacug); 
			$this->error_found=0;			
			if(count($this->app_data)>0)
			{	
				$get_remarks="SELECT FRESULT_REMARKS, FUNIVCODE FROM control";
				$obj_get_remarks=$this->aobj_context->mobj_db->GetRow($get_remarks);
				$univcode=$obj_get_remarks['FUNIVCODE'];	

				$this->error_found=0;
				$this->html.="<br>";
				$this->html.="<table  align='center' id='results_subject_table' width='100%' border='0' cellspacing='0' cellpadding='1'>";
				$this->html.="<tr class='tr_bg1'>";
				if($univcode=='031')
				$this->html.="<td  width='8%' style='border-left:1px solid #a1a1a1; border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Course Code</td>";
				else
				$this->html.="<td  width='8%' style='border-left:1px solid #a1a1a1; border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Sl. No.</td>";
				if($FUNIVCODE == '030') // reva
					$this->html.="<td  width='44%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Subject Name</td>";
				else
					$this->html.="<td  width='44%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Course Title</td>";
				$this->srcdeg = substr($this->app_data[0][FDEGREE],-1);
				$this->FMAXMARKS=$this->app_data[0][FMAXMARKS];
				$this->FTOTMARKS=$this->app_data[0][FTOTMARKS];
				$this->FPREVMAX=$this->app_data[0][FPREVMAX];
				$this->FPREVTOT=$this->app_data[0][FPREVTOT];
				$this->FPERCENT=$this->app_data[0][FPERCENT];
				$this->FCLASS=$this->app_data[0][FCLASS];
				$this->FMCNUMBER=$this->app_data[0][FMCNUMBER];
				$this->FYEAR=$this->app_data[0][FYEAR];
				$this->FEXAMTYPE=$this->app_data[0][FEXAMTYPE];	
				$this->FSCHEME=$this->app_data[0][FSCHEME];	
				var_dump($this->FSCHEME);
				if($univcode=='018' || $univcode=='030' || $univcode=='031')
				{
					if($univcode=='030')
					{
						$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>L:T:P</div></td>";
					}
					else if($univcode !=='031')
					{
						$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Theory / Practical</div><div></div></td>";
					}
					if($univcode === '031')
					{	
						if($this->srcdeg == 2)
						{	
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Max</div><div>Marks</div>   </td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Marks</div><div>Obtained</div>   </td>";
						}
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Credits</div></td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Grade</div><div>Point</div>   </td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Credit</div><div>Point</div>   </td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Grade</td>";
					}
					else
					{
						$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Total</div><div>Marks</div>   </td>";
						$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Credit</div><div>Hours</div>   </td>";
						$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Grade</div><div>Point</div>   </td>";
						$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Credit</div><div>Point</div>   </td>";
						$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Grade</td>";
					}
				}
				else
				{
					$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Th</div><div>Pr</div></td>";
					$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Univ</div><div>Exam</div>   </td>";
					$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Viva</td>";
					$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>I.A.</td>";
					$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Total</td>";
					IF($this->FSCHEME=='CR')
					{
						$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Grade</td>";
					}
					else
					{
						$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Remarks</td>";
					}
				}
				$this->html.="</tr>";
				$sl_no=1;
				foreach($this->app_data as $k=>$v)
				{
					$FSUBNAME=$v[FSUBNAME];
					$FHINDI=$v[fhindi];
					$FTHUE=$v[FTHUE];
					$FPRUE=$v[FPRUE];

					$FTHVV=$v[FTHVV];
					$FPRVV=$v[FPRVV];

					$FTHIA=$v[FTHIA];
					$FPRIA=$v[FPRIA];

					$FTHTOT=$v[FTHTOT];
					$FPRTOT=$v[FPRTOT];

					$FTHPASSMTH=trim($v[FTHPASSMTH]);
					$FPRPASSMTH=trim($v[FPRPASSMTH]);
					$fsmax = $v[fsmax];
					$FSUBSHORT = $v[FSUBSHORT];
					if($univcode != '031')
					{	
						$FTHPASSMTH=preg_replace("/[^A-Za-z0-9+-]/","",$FTHPASSMTH); 
						$FPRPASSMTH=preg_replace("/[^A-Za-z0-9+-]/","",$FPRPASSMTH); 
					}
					$FEXAMNO=$v[FEXAMNO];
					$FEXAMNAME=$v[FEXAMNAME];
					$FRESULTDATE=$v[FRESULTDATE];
					$FRESULTSCHEME=$v[FRESULTSCHEME];
					$FLTP=$v[FLTP];
					if($k%2==0)
						$class='tbl_row1';
					else
						$class='tbl_row_alter1';

						if($FTHUE!="-" && $FPRUE!="-")
						{
							$mthprue="Th. Pr.";
							$uni_exam="{$FTHUE} {$FPRUE}";
							$mthprue=GetTdData("Th.","Pr.");
							$uni_exam=GetTdData($FTHUE,$FPRUE);
						}
						else if($FTHUE!="-")
						{
							$mthprue="Th.";
							$uni_exam="{$FTHUE}";
							$mthprue=GetTdData("Th.","");
						$uni_exam=GetTdData($FTHUE,"");
					}
					else
					{
						$mthprue="Pr.";
						$uni_exam="{$FPRUE}";
						$mthprue=GetTdData("Pr.","");
						$uni_exam=GetTdData($FPRUE,"");
					}
					if($univcode=='018')
					{
						$mthprue="-";
					}
					if($univcode=='030')
					{
						$mthprue=$FLTP;
					}

					#########viva$########
					if($FTHVV!="-" && $FPRVV!="-")
					{
						$viva_exam=GetTdData($FTHVV,$FPRVV);
					}
					else if($FTHVV!="-")
					{
						$viva_exam=GetTdData($FTHVV,"");
					}
					else
					{
						$viva_exam=GetTdData($FPRVV,""); 
					}
					#########viva$########

					#########IA########
					if($FTHIA!="-" && $FPRIA!="-")
					{
						$ia_exam=GetTdData($FTHIA,$FPRIA); 
					}
					else if($FTHIA!="-")
					{
						$ia_exam=GetTdData($FTHIA,"");  
					}
					else
					{
						$ia_exam=GetTdData($FPRIA,"");  
					}
					#########IA$########
					#########TOTAl########
					if($FTHTOT!="-" && $FPRTOT!="-")
					{
						$total=GetTdData($FTHTOT,$FPRTOT);  
					}
					else if($FTHTOT!="-")
					{
						$total=GetTdData($FTHTOT,"");
					}
					else
					{
						$total=GetTdData($FPRTOT,""); 
					}
					#########TOTAl$########
					#########Remarks########
					//echo strtolower($FTHPASSMTH).'--'.strtolower($FPRPASSMTH);
					if($univcode=='018' || $univcode=='030' || $univcode=='031')
					{
						$FPRPASSMTH="";
					}
					$pass_color="green;";
					if(strtolower($FTHPASSMTH)==strtolower($FPRPASSMTH))
					{
						$remarks= GetTdData1($FTHPASSMTH,""); 
					}
					else if(strtolower($FTHPASSMTH)=="pass" && strtolower($FPRPASSMTH)=="pass")
					{
						$remarks= GetTdData1("Pass",""); 
					}
					else if(strtolower($FTHPASSMTH)=="fail" && strtolower($FPRPASSMTH)=="fail")
					{
						$pass_color="red;";
						$remarks=GetTdData1("Fail",""); 
					}
					else if(strtolower($FTHPASSMTH)!="-" && strtolower($FPRPASSMTH)=="-")
					{
						$remarks= GetTdData1($FTHPASSMTH,""); 
					}
					else if(strtolower($FTHPASSMTH)=="-" && strtolower($FPRPASSMTH)!="-")
					{
						$remarks= GetTdData1($FPRPASSMTH,""); 
					}						
					else 
					{
						$remarks=GetTdData1($FTHPASSMTH,$FPRPASSMTH); 
					}
					
					#########Remarks$########

						$this->html.="<tr>";
						if($univcode === '031')
						{
							$this->html.="<td class={$class} style='border-left:1px solid #a1a1a1; border-right:1px solid #a1a1a1;text-align:center; ' >{$FSUBSHORT}</td>";

							if(strlen($FHINDI)>0)
							{
							$this->html.="<td class={$class} style='letter-spacing:0.6px;text-align:left; border-right:1px solid #a1a1a1;'  >{$FHINDI}</td>";
							}
							else
							{
							$this->html.="<td class={$class} style='letter-spacing:0.6px;text-align:left; border-right:1px solid #a1a1a1;'  >{$FSUBNAME}</td>";
							}
							if($this->srcdeg == 2)
							{
								$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;' >{$fsmax}</td>";
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;' >{$uni_exam}</td>";	
							}	
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$viva_exam}</td>";
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$ia_exam}</td>";				
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$total}</td>";	
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;color:{$pass_color}'>{$remarks}</td>";	

						}
						else
						{
							$this->html.="<td class={$class} style='border-left:1px solid #a1a1a1; border-right:1px solid #a1a1a1;text-align:center; ' >{$sl_no}</td>";
							$this->html.="<td class={$class} style='letter-spacing:0.6px;text-align:left; border-right:1px solid #a1a1a1;'  >{$FSUBNAME}</td>";
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;' >{$mthprue}</td>";				
							//$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$uni_exam}</td>";				
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$viva_exam}</td>";				
							//$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$ia_exam}</td>";				
							//$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$total}</td>";				
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;color:{$pass_color}'>{$remarks}</td>";	
						}
						$this->html.="</tr>";
					
					$sl_no++;
					$k++;
				}
				$this->html.="</table>";
				$tr1="";
				$tr2="";
				$tr6 ="";
				$tr3="";
				$tr4="";
				$tr5="";
				$pass_color="green;";
				if(strtolower($this->FCLASS)=='fail')
					$pass_color="red;";
				IF($this->FSCHEME=='CR')
				{
					$this->html.="<br><table width=100% align=center class='result_table_footer'>";
					if($univcode=='031' && $this->srcdeg == 2)
					{	
						$per = round($this->FTOTMARKS*100/$this->FMAXMARKS,2);
						$this->html.="<tr><td align=center >Max. Marks : {$this->FMAXMARKS}    Marks Obtained : {$this->FTOTMARKS}   Percentage :{$per} </span> </td></tr>";
					}	

					if($this->FPREVTOT=="0000")
					{
						$this->html.="<tr><td align=center>S.G.P.A : {$this->FPERCENT} </td></tr>";
					}
					else
					{
						$this->html.="<tr><td align=center>S.G.P.A : {$this->FPERCENT} &nbsp;&nbsp;&nbsp;&nbsp;C.G.P.A : {$this->FPREVTOT} </td></tr>";
					}
				}
				else
				{
					$this->html.="<br><table width=100% align=center class='result_table_footer'>
					<tr><td align=center>Percentage : {$this->FPERCENT}     Result : <span style='color:{$pass_color};'>{$this->FCLASS}</td></tr>
					<tr><td align=center >Max. Marks : {$this->FMAXMARKS}    Sec. Marks : {$this->FTOTMARKS}</span> </td></tr>";
				}
				if($this->FPREVMAX!="0000" && !empty($this->FPREVMAX))
					$this->html.="<tr><td align=center >Earlier Exams      [Max. Marks : {$this->FPREVMAX}    Sec. Marks : {$this->FPREVTOT} ] </td></tr>";
				if($univcode=='030' || $univcode=='031')
				{
					if($univcode!='031')
					{
						$this->html.="<tr><td align=center >School : {$this->FCOLLCODE}  -  {$this->FCOLLNAME}</td></tr>";
					}
				}
				else
				{
					$this->html.="<tr><td align=center >College : {$this->FCOLLCODE}  -  {$this->FCOLLNAME}</td></tr>";
				}
				if(!empty($this->FMCNUMBER) && $this->FMCNUMBER!=".")
					$this->html.="<tr><td align=center >[Marks Card Number : {$this->FMCNUMBER}] </td></tr>";

				if($univcode!='031')
					$this->html.="<tr><td align=center >{$this->FELIGREM01}   {$this->FELIGREM02}</td></tr>";

				$this->html.="</table>";
				if($this->srcdeg == 2)
					$this->html.="<a class='sub_wise_anchar' href='subjectDetails.php?r={$this->reg_no}&e={$this->exam}'>Click here to view Subjectwise Details</a>";
				$this->html.="<span style='color: blue;
				cursor: pointer;
				font-size: 13px;
				font-weight: bold;
				line-height: 18px;
				margin-top: 15px;
				padding-left: 14px;
				text-decoration: underline;' onclick='print();'> Print </span><br>	";				
			}
			else
			{
			$this->error_found=1;
			$this->html.="<table  align='center' id='results_subject_table' width='100%' border='0' cellspacing='0' cellpadding='3'>";
			$this->html.="<th align='center' colspan='8'  style='color:red;height:34px;font-size:15px;'> No Results found </th>";        			
			$this->html.="</table><div style='height:200px;'></div>";
			}
						
			
		}else
		{	
				if($FUNIVCODE == '030' || $FUNIVCODE == '017' || $FUNIVCODE == '008' || $FUNIVCODE == '032') //reva or gcm
				{
					$get_data="select s.FSUBNAME, s.FLTP,
					 
						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,
						FMAXMARKS,FTOTMARKS,FPREVMAX,FPREVTOT,FPERCENT,FCLASS,FMCNUMBER,FYEAR,FEXAMTYPE, 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='{$this->reg_no}' and 
						rm.FEXAMNO='{$this->exam}'
						group by s.FSUBCODE";
						//var_dump($get_data);
			$this->app_data=$this->aobj_context->mobj_db->GetAll($get_data); 
			$this->error_found=0;			
			if(count($this->app_data)>0)
			{	
					$this->error_found=0;
					$this->html.="<br>";
					
					$this->html.="<table  align='center' id='results_subject_table' width='100%' border='0' cellspacing='0' cellpadding='3'>";
					$this->html.="<tr class='tr_bg1'>";
					$this->html.="<td  width='8%' style='border-left:1px solid #a1a1a1; border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Sl. No.</td>";
					$this->html.="<td  width='44%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Subject Name</td>";
					
					$get_remarks="SELECT FRESULT_REMARKS, FUNIVCODE FROM control";
					$obj_get_remarks=$this->aobj_context->mobj_db->GetRow($get_remarks);
					$univcode=$obj_get_remarks['FUNIVCODE'];	

					$this->FMAXMARKS=$this->app_data[0][FMAXMARKS];
					$this->FTOTMARKS=$this->app_data[0][FTOTMARKS];
					$this->FPREVMAX=$this->app_data[0][FPREVMAX];
				 
					$this->FPREVTOT=$this->app_data[0][FPREVTOT];
					$this->FPERCENT=$this->app_data[0][FPERCENT];
					$this->FCLASS=$this->app_data[0][FCLASS];
					$this->FMCNUMBER=$this->app_data[0][FMCNUMBER];
					$this->FYEAR=$this->app_data[0][FYEAR];
					$this->FEXAMTYPE=$this->app_data[0][FEXAMTYPE];	
					$this->FSCHEME=$this->app_data[0][FSCHEME];	
					if($FUNIVCODE == '017' || $FUNIVCODE == '008')
					{
						IF($this->FSCHEME=='CR' || $this->FSCHEME=='C')
						{
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>L:T:P</div></td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Total</div><div>Marks</div>   </td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Credit</div><div>Hours</div>   </td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Grade</div><div>Point</div>   </td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Credit</div><div>Point</div>   </td>";
							if($univcode=='017')
							{
								$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Remarks</td>";
							}
							else
							{
								$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Grade</td>";
							}
						}
						else
						{
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Th</div><div>Pr</div></td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Univ</div><div>Exam</div>   </td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Viva</td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>I.A.</td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Total</td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Remarks</td>";
						}
							
					}else
					{
						if(($univcode=='018' || $univcode=='030' || $univcode=='032') && $this->FSCHEME=='CR')
						{
							if($univcode=='030' && $this->FSCHEME=='CR')
							{
								$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>L:T:P</div></td>";
							}
							else
							{
								$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Th</div><div>Pr</div></td>";
								$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Total</div><div>Marks</div>   </td>";
							}
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Credit</div><div>Hours</div>   </td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Grade</div><div>Point</div>   </td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Credit</div><div>Point</div>   </td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Grade</td>";
						}
						else
						{
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Th</div><div>Pr</div></td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Univ</div><div>Exam</div>   </td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Viva</td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>I.A.</td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Total</td>";
							if($this->FSCHEME=='CR')
							{
								$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Grade</td>";
							}
							else
							{
								$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Remarks</td>";
							}
						}
					}
					$this->html.="</tr>";
					
					$sl_no=1;
					foreach($this->app_data as $k=>$v)
					{
						$FSUBNAME=$v[FSUBNAME];
						$FTHUE=$v[FTHUE];
						$FPRUE=$v[FPRUE];
						
						$FTHVV=$v[FTHVV];
						$FPRVV=$v[FPRVV];
						
						$FTHIA=$v[FTHIA];
						$FPRIA=$v[FPRIA];
						
						$FTHTOT=$v[FTHTOT];
						$FPRTOT=$v[FPRTOT];
						
						$FTHPASSMTH=trim($v[FTHPASSMTH]);
						$FPRPASSMTH=trim($v[FPRPASSMTH]);
						
						$FTHPASSMTH=preg_replace("/[^A-Za-z0-9+-]/","",$FTHPASSMTH); 
						$FPRPASSMTH=preg_replace("/[^A-Za-z0-9+-]/","",$FPRPASSMTH); 
						
						$FEXAMNO=$v[FEXAMNO];
						$FEXAMNAME=$v[FEXAMNAME];
						$FRESULTDATE=$v[FRESULTDATE];
						$FRESULTSCHEME=$v[FRESULTSCHEME];
						$FLTP=$v[FLTP];
						if($k%2==0)
							$class='tbl_row1';
						else
							$class='tbl_row_alter1';
						
						if($FTHUE!="-" && $FPRUE!="-")
						{
						$mthprue="Th. Pr.";
						$uni_exam="{$FTHUE} {$FPRUE}";
						$mthprue=GetTdData("Th.","Pr.");
						$uni_exam=GetTdData($FTHUE,$FPRUE);
						}
						else if($FTHUE!="-")
						{
						$mthprue="Th.";
						$uni_exam="{$FTHUE}";
						$mthprue=GetTdData("Th.","");
						$uni_exam=GetTdData($FTHUE,"");
						}
						else
						{
						$mthprue="Pr.";
						$uni_exam="{$FPRUE}";
						$mthprue=GetTdData("Pr.","");
						$uni_exam=GetTdData($FPRUE,"");
						}
						if($FUNIVCODE == '017' || $FUNIVCODE == '008') //gcm and kswu
						{
							if($univcode=='018')
							{
								$mthprue="-";
							}
							if($this->FSCHEME=='CR' || $this->FSCHEME=='C')
							{
								$mthprue=$FLTP;
							}
							
						}else
						{	
							if($univcode=='018')
							{
								$mthprue="-";
							}
							if($univcode=='030')
							{
								$mthprue=$FLTP;
							}
						}
						
						#########viva$########
						if($FTHVV!="-" && $FPRVV!="-")
						{
							$viva_exam=GetTdData($FTHVV,$FPRVV);
						}
						else if($FTHVV!="-")
						{
							$viva_exam=GetTdData($FTHVV,"");
						}
						else
						{
							$viva_exam=GetTdData($FPRVV,""); 
						}
						#########viva$########
						
						#########IA########
						if($FTHIA!="-" && $FPRIA!="-")
						{
							$ia_exam=GetTdData($FTHIA,$FPRIA); 
						}
						else if($FTHIA!="-")
						{
							$ia_exam=GetTdData($FTHIA,"");  
						}
						else
						{
							$ia_exam=GetTdData($FPRIA,"");  
						}
						#########IA$########
						#########TOTAl########
						if($FTHTOT!="-" && $FPRTOT!="-")
						{
							$total=GetTdData($FTHTOT,$FPRTOT);  
						}
						else if($FTHTOT!="-")
						{
							$total=GetTdData($FTHTOT,"");
						}
						else
						{
							$total=GetTdData($FPRTOT,""); 
						}
						#########TOTAl$########
						#########Remarks########
						//echo strtolower($FTHPASSMTH).'--'.strtolower($FPRPASSMTH);
						if($univcode=='018' || $univcode=='030')
						{
							$FPRPASSMTH="";
						}
						$pass_color="green;";
						if(strtolower($FTHPASSMTH)==strtolower($FPRPASSMTH))
						{
							$remarks= GetTdData1($FTHPASSMTH,""); 
						}
						else if(strtolower($FTHPASSMTH)=="pass" && strtolower($FPRPASSMTH)=="pass")
						{
							$remarks= GetTdData1("Pass",""); 
						}
						else if(strtolower($FTHPASSMTH)=="fail" && strtolower($FPRPASSMTH)=="fail")
						{
							$pass_color="red;";
							$remarks=GetTdData1("Fail",""); 
						}
						else if(strtolower($FTHPASSMTH)!="-" && strtolower($FPRPASSMTH)=="-")
						{
							$remarks= GetTdData1($FTHPASSMTH,""); 
						}
						else if(strtolower($FTHPASSMTH)=="-" && strtolower($FPRPASSMTH)!="-")
						{
							$remarks= GetTdData1($FPRPASSMTH,""); 
						}						
						else 
						{
							$remarks=GetTdData1($FTHPASSMTH,$FPRPASSMTH); 
						}
						#########Remarks$########
						if($FUNIVCODE == '017' || $FUNIVCODE == '008') //gem
						{
							$this->html.="<tr>";
							$this->html.="<td class={$class} style='border-left:1px solid #a1a1a1; border-right:1px solid #a1a1a1;text-align:center; ' >{$sl_no}</td>";
							$this->html.="<td class={$class} style='letter-spacing:0.6px;text-align:left; border-right:1px solid #a1a1a1;'  >{$FSUBNAME}</td>";
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;' >{$mthprue}</td>";				
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$uni_exam}</td>";				
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$viva_exam}</td>";				
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$ia_exam}</td>";				
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$total}</td>";				
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;color:{$pass_color}'>{$remarks}</td>";	
							$this->html.="</tr>";
							
						}else
						{
							$this->html.="<tr>";
							$this->html.="<td class={$class} style='border-left:1px solid #a1a1a1; border-right:1px solid #a1a1a1;text-align:center; ' >{$sl_no}</td>";
							$this->html.="<td class={$class} style='letter-spacing:0.6px;text-align:left; border-right:1px solid #a1a1a1;'  >{$FSUBNAME}</td>";
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;' >{$mthprue}</td>";			
							if($univcode!='030')
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$uni_exam}</td>";				
							
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$viva_exam}</td>";				
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$ia_exam}</td>";				
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$total}</td>";				
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;color:{$pass_color}'>{$remarks}</td>";	
							$this->html.="</tr>";
						}
						$sl_no++;
						$k++;
					}
				$this->html.="</table>";
				$tr1="";
				$tr2="";
				$tr6 ="";
				$tr3="";
				$tr4="";
				$tr5="";
				$pass_color="green;";
				if(strtolower($this->FCLASS)=='fail')
				$pass_color="red;";
				if($univcode=='018' || $univcode=='030')
				{
					$this->html.="<br><table width=100% align=center class='result_table_footer'>
					<tr><td align=center>Percentage / S.G.P.A : {$this->FPERCENT},    Result : <span style='color:{$pass_color};'>{$this->FCLASS}</td></tr>";
				}
				else
				{
					IF($this->FSCHEME=='CR')
					{
						$this->html.="<br><table width=100% align=center class='result_table_footer'>
						<tr><td align=center>S.G.P.A : {$this->FPERCENT}     Result : <span style='color:{$pass_color};'>{$this->FCLASS}</td></tr>
						<tr><td align=center >Max. Marks : {$this->FMAXMARKS}    Sec. Marks : {$this->FTOTMARKS}</span> </td></tr>";
					}
					else
					{
						$this->html.="<br><table width=100% align=center class='result_table_footer'>
						<tr><td align=center>Percentage : {$this->FPERCENT}     Result : <span style='color:{$pass_color};'>{$this->FCLASS}</td></tr>
						<tr><td align=center >Max. Marks : {$this->FMAXMARKS}    Sec. Marks : {$this->FTOTMARKS}</span> </td></tr>";
					}
				}
				if($this->FPREVMAX!="0000" && !empty($this->FPREVMAX))
				$this->html.="<tr><td align=center >Earlier Exams      [Max. Marks : {$this->FPREVMAX}    Sec. Marks : {$this->FPREVTOT} ] </td></tr>";
				if($univcode=='030')
				{
					$this->html.="<tr><td align=center >Faculty / School : {$this->FCOLLCODE}  -  {$this->FCOLLNAME}</td></tr>";
				}
				else
				{
					$this->html.="<tr><td align=center >College : {$this->FCOLLCODE}  -  {$this->FCOLLNAME}</td></tr>";
				}
				if(!empty($this->FMCNUMBER) && $this->FMCNUMBER!=".")
				$this->html.="<tr><td align=center >[Marks Card Number : {$this->FMCNUMBER}] </td></tr>";
				$this->html.="<tr><td align=center >{$this->FELIGREM01}   {$this->FELIGREM02}</td></tr>";
				$this->html.="</table>";
				$this->html.="<a class='sub_wise_anchar' href='subjectDetails.php?r={$this->reg_no}&e={$this->exam}'>Click here to view Subjectwise Details</a> <span style='color: blue;
					cursor: pointer;
					font-size: 13px;
					font-weight: bold;
					line-height: 18px;
					margin-top: 15px;
					padding-left: 14px;
					text-decoration: underline;' onclick='print();'> Print </span><br>	";				
			}		
		}else
		{
			 $get_data="select s.FSUBNAME,
			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,
			FMAXMARKS,FTOTMARKS,FPREVMAX,FPREVTOT,FPERCENT,FCLASS,FMCNUMBER,FYEAR,FEXAMTYPE, 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='{$this->reg_no}' and 
			rm.FEXAMNO='{$this->exam}' group by s.FSUBCODE";
			$this->app_data=$this->aobj_context->mobj_db->GetAll($get_data); 
			$this->error_found=0;			
			if(count($this->app_data)>0)
			{	
					$this->error_found=0;
					$this->html.="<br>";
				if($FUNIVCODE == '021' || $FUNIVCODE == '032' || $FUNIVCODE == '033') // jssu
				{
					$this->html.="<table  align='center' id='results_subject_table' width='870px;' border='0' cellspacing='0' cellpadding='3'>";
					$this->html.="<tr class='tr_bg1'>";
					$this->html.="<td  width='8%' style='border-left:1px solid #a1a1a1; border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Sl. No.</td>";
					$this->html.="<td  width='44%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Subject Name</td>";
					$this->FSCHEME=$this->app_data[0][FSCHEME];
					
					if($this->FSCHEME!='CR')
					{
						$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Th</div><div>Pr</div></td>";
					}
				}else
				{
					$this->html.="<table  align='center' id='results_subject_table' width='100%' border='0' cellspacing='0' cellpadding='3'>";
					$this->html.="<tr class='tr_bg1'>";
					$this->html.="<td  width='8%' style='border-left:1px solid #a1a1a1; border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Sl. No.</td>";
					$this->html.="<td  width='44%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Subject Name</td>";
					if($FUNIVCODE != '018')
						$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Th</div><div>Pr</div></td>";
				}	
					$get_remarks="SELECT FRESULT_REMARKS, FUNIVCODE FROM control";
					$obj_get_remarks=$this->aobj_context->mobj_db->GetRow($get_remarks);
					$univcode=$obj_get_remarks['FUNIVCODE'];	

					$this->FMAXMARKS=$this->app_data[0][FMAXMARKS];
					$this->FTOTMARKS=$this->app_data[0][FTOTMARKS];
					$this->FPREVMAX=$this->app_data[0][FPREVMAX];
				 
					$this->FPREVTOT=$this->app_data[0][FPREVTOT];
					$this->FPERCENT=$this->app_data[0][FPERCENT];
					$this->FCLASS=$this->app_data[0][FCLASS];
					$this->FMCNUMBER=$this->app_data[0][FMCNUMBER];
					$this->FYEAR=$this->app_data[0][FYEAR];
					$this->FEXAMTYPE=$this->app_data[0][FEXAMTYPE];	
					$this->FSCHEME=$this->app_data[0][FSCHEME];	
					if($FUNIVCODE == '021' || $FUNIVCODE == '032' || $FUNIVCODE == '033')
					{
						if($univcode=='018' || $this->FSCHEME=='CR')
						{
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Total</div><div>Marks</div>   </td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Credit</div><div>Hours</div>   </td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Grade</div><div>Point</div>   </td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Credit</div><div>Point</div>   </td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Grade</td>";
						}
						else
						{
							if($univcode=='005')
							{	
								$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Marks</div><div>Secured</div>   </td>";

							}
							else
							{
								$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Univ</div><div>Exam</div>   </td>";
								$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Viva</td>";
							}
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>I.A.</td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Total</td>";
							IF($this->FSCHEME=='CR')
							{
								$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Grade</td>";
							}
							else
							{
								$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Remarks</td>";
							}
						}
							
					}else
						{	
							if($univcode=='018')
							{
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Total</div><div>Marks</div>   </td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Credit</div><div>Hours</div>   </td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Grade</div><div>Point</div>   </td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Credit</div><div>Point</div>   </td>";
							$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Grade</td>";
							}
							else
							{ 	if($FUNIVCODE == '005') //nehu
								{
									if($univcode=='005')
									{	
										$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Marks</div><div>Secured</div>   </td>";

									}
									else
									{
										$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Univ</div><div>Exam</div>   </td>";
										$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Viva</td>";
									}
									$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>I.A.</td>";
									$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Total</td>";
									IF($this->FSCHEME=='CR')
									{
										$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Grade</td>";
									}
									else
									{
										$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Remarks</td>";
									}
												
								}else
								{
									$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'><div style='padding:5px;'>Univ</div><div>Exam</div>   </td>";
									$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Viva</td>";
									$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>I.A.</td>";
									$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Total</td>";
									IF($this->FSCHEME=='CR')
									{
										$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Grade</td>";
									}
									else
									{
									$this->html.="<td  width='8%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Remarks</td>";
									}
								}
							}
						}
						$this->html.="</tr>";			
					$sl_no=1;
					foreach($this->app_data as $k=>$v)
					{
					
						$FSUBNAME=$v[FSUBNAME];
						$FTHUE=$v[FTHUE];
						$FPRUE=$v[FPRUE];
						
						$FTHVV=$v[FTHVV];
						$FPRVV=$v[FPRVV];
						
						$FTHIA=$v[FTHIA];
						$FPRIA=$v[FPRIA];
						
						$FTHTOT=$v[FTHTOT];
						$FPRTOT=$v[FPRTOT];
						
						$FTHPASSMTH=trim($v[FTHPASSMTH]);
						$FPRPASSMTH=trim($v[FPRPASSMTH]);
						
						$FTHPASSMTH=preg_replace("/[^A-Za-z0-9+-]/","",$FTHPASSMTH); 
						$FPRPASSMTH=preg_replace("/[^A-Za-z0-9+-]/","",$FPRPASSMTH); 
						
						$FEXAMNO=$v[FEXAMNO];
						$FEXAMNAME=$v[FEXAMNAME];
						$FRESULTDATE=$v[FRESULTDATE];
						$FRESULTSCHEME=$v[FRESULTSCHEME];
						
						if($k%2==0)
							$class='tbl_row1';
						else
						$class='tbl_row_alter1';
						
						if($FTHUE!="-" && $FPRUE!="-")
						{
						$mthprue="Th. Pr.";
						$uni_exam="{$FTHUE} {$FPRUE}";
						$mthprue=GetTdData("Th.","Pr.");
						$uni_exam=GetTdData($FTHUE,$FPRUE);
						}
						else if($FTHUE!="-")
						{
						$mthprue="Th.";
						$uni_exam="{$FTHUE}";
						$mthprue=GetTdData("Th.","");
						$uni_exam=GetTdData($FTHUE,"");
						}
						else
						{
						$mthprue="Pr.";
						$uni_exam="{$FPRUE}";
						$mthprue=GetTdData("Pr.","");
						$uni_exam=GetTdData($FPRUE,"");
						}
						if($univcode=='018')
						{
						$mthprue="-";
						}
						#########viva$########
						if($FTHVV!="-" && $FPRVV!="-")
						{
						 
						$viva_exam=GetTdData($FTHVV,$FPRVV);
						}
						else if($FTHVV!="-")
						{
						 
						$viva_exam=GetTdData($FTHVV,"");
						}
						else
						{
						$viva_exam=GetTdData($FPRVV,""); 
						}
						#########viva$########
						
						#########IA########
						if($FTHIA!="-" && $FPRIA!="-")
						{
							$ia_exam=GetTdData($FTHIA,$FPRIA); 
						}
						else if($FTHIA!="-")
						{
							$ia_exam=GetTdData($FTHIA,"");  
						}
						else
						{
							$ia_exam=GetTdData($FPRIA,"");  
						}
						#########IA$########
						#########TOTAl########
						if($FTHTOT!="-" && $FPRTOT!="-")
						{
							$total=GetTdData($FTHTOT,$FPRTOT);  
						}
						else if($FTHTOT!="-")
						{
							$total=GetTdData($FTHTOT,"");
						}
						else
						{
							$total=GetTdData($FPRTOT,""); 
						}
						#########TOTAl$########
						#########Remarks########
						//echo strtolower($FTHPASSMTH).'--'.strtolower($FPRPASSMTH);
						if($univcode=='018')
						{
							$FPRPASSMTH="";
						}
						$pass_color="green;";
						if(strtolower($FTHPASSMTH)==strtolower($FPRPASSMTH))
						{
							$remarks= GetTdData1($FTHPASSMTH,""); 
						}
						else if(strtolower($FTHPASSMTH)=="pass" && strtolower($FPRPASSMTH)=="pass")
						{
							$remarks= GetTdData1("Pass",""); 
						}
						else if(strtolower($FTHPASSMTH)=="fail" && strtolower($FPRPASSMTH)=="fail")
						{
							$pass_color="red;";
							$remarks=GetTdData1("Fail",""); 
						}
						else if(strtolower($FTHPASSMTH)!="-" && strtolower($FPRPASSMTH)=="-")
						{
							$remarks= GetTdData1($FTHPASSMTH,""); 
						}
						else if(strtolower($FTHPASSMTH)=="-" && strtolower($FPRPASSMTH)!="-")
						{
							$remarks= GetTdData1($FPRPASSMTH,""); 
						}						
						else 
						{
							$remarks=GetTdData1($FTHPASSMTH,$FPRPASSMTH); 
						}
						#########Remarks$########
					if($FUNIVCODE == '021' ||$FUNIVCODE == '032')
						{
							$this->html.="<tr>";
							$this->html.="<td class={$class} style='border-left:1px solid #a1a1a1; border-right:1px solid #a1a1a1;text-align:center; ' >{$sl_no}</td>";
							$this->html.="<td class={$class} style='letter-spacing:0.6px;text-align:left; border-right:1px solid #a1a1a1;'  >{$FSUBNAME}</td>";
							if($this->FSCHEME!='CR')
							{
								$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;' >{$mthprue}</td>";		// Not exist for Sikkim.		
							}
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$uni_exam}</td>";
							if($univcode!='005')
								$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$viva_exam}</td>";				
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$ia_exam}</td>";				
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$total}</td>";				
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;color:{$pass_color}'>{$remarks}</td>";	
							$this->html.="</tr>";
						}else if($FUNIVCODE == '005')
						{
							$this->html.="<tr>";
							$this->html.="<td class={$class} style='border-left:1px solid #a1a1a1; border-right:1px solid #a1a1a1;text-align:center; ' >{$sl_no}</td>";
							$this->html.="<td class={$class} style='letter-spacing:0.6px;text-align:left; border-right:1px solid #a1a1a1;'  >{$FSUBNAME}</td>";
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;' >{$mthprue}</td>";		// Not exist for Sikkim.		
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$uni_exam}</td>";
							if($univcode!='005')
								$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$viva_exam}</td>";				
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$ia_exam}</td>";				
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$total}</td>";				
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;color:{$pass_color}'>{$remarks}</td>";	
							$this->html.="</tr>";
							
						}
						else
						{
							$this->html.="<tr>";
							$this->html.="<td class={$class} style='border-left:1px solid #a1a1a1; border-right:1px solid #a1a1a1;text-align:center; ' >{$sl_no}</td>";
							$this->html.="<td class={$class} style='letter-spacing:0.6px;text-align:left; border-right:1px solid #a1a1a1;'  >{$FSUBNAME}</td>";
							if($FUNIVCODE != '018')
								$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;' >{$mthprue}</td>";				
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$uni_exam}</td>";				
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$viva_exam}</td>";				
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$ia_exam}</td>";				
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$total}</td>";				
							$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;color:{$pass_color}'>{$remarks}</td>";	
							$this->html.="</tr>";
						}
						$sl_no++;
						$k++;
					}
				$this->html.="</table>";
				$tr1="";
				$tr2="";
				$tr6 ="";
				$tr3="";
				$tr4="";
				$tr5="";
				$pass_color="green;";
				if(strtolower($this->FCLASS)=='fail')
				$pass_color="red;";
				if($univcode=='018')
				{
					$this->html.="<br><table width=100% align=center class='result_table_footer'>
					<tr><td align=center>S.G.P.A : {$this->FPERCENT},    Result : <span style='color:{$pass_color};'>{$this->FCLASS}</td></tr>";
				}
				else
				{
					IF($this->FSCHEME=='CR')
					{
						$this->html.="<br><table width=100% align=center class='result_table_footer'>
						<tr><td align=center>S.G.P.A : {$this->FPERCENT}     Result : <span style='color:{$pass_color};'>{$this->FCLASS}</td></tr>
						<tr><td align=center >Max. Marks : {$this->FMAXMARKS}    Sec. Marks : {$this->FTOTMARKS}</span> </td></tr>";
					}
					else
					{
						$this->html.="<br><table width=100% align=center class='result_table_footer'>
						<tr><td align=center>Percentage : {$this->FPERCENT}     Result : <span style='color:{$pass_color};'>{$this->FCLASS}</td></tr>
						<tr><td align=center >Max. Marks : {$this->FMAXMARKS}    Sec. Marks : {$this->FTOTMARKS}</span> </td></tr>";
					}
				}
				if($this->FPREVMAX!="0000" && !empty($this->FPREVMAX))
				$this->html.="<tr><td align=center >Earlier Exams      [Max. Marks : {$this->FPREVMAX}    Sec. Marks : {$this->FPREVTOT} ] </td></tr>";
				$this->html.="<tr><td align=center >College : {$this->FCOLLCODE}  -  {$this->FCOLLNAME}</td></tr>";
				if(!empty($this->FMCNUMBER) && $this->FMCNUMBER!=".")
				$this->html.="<tr><td align=center >[Marks Card Number : {$this->FMCNUMBER}] </td></tr>";
				$this->html.="<tr><td align=center >{$this->FELIGREM01}   {$this->FELIGREM02}</td></tr>";
				$this->html.="</table>";
				if($FUNIVCODE == '021')
				{
					if($univcode=='005')
					$this->html.="<span style='color: blue;
					cursor: pointer;
					font-size: 13px;
					font-weight: bold;
					line-height: 18px;
					margin-top: 15px;
					padding-left: 14px;
					text-decoration: underline;' onclick='print();'> Print </span><br>	";
				else
					$this->html.="<a class='sub_wise_anchar' href='subjectDetails.php?r={$this->reg_no}&e={$this->exam}'>Click here to view Subjectwise Details</a> <span style='color: blue;
					cursor: pointer;
					font-size: 13px;
					font-weight: bold;
					line-height: 18px;
					margin-top: 15px;
					padding-left: 14px;
					text-decoration: underline;' onclick='print();'> Print </span><br>	";
					
				}else
				$this->html.="<a class='sub_wise_anchar' href='subjectDetails.php?r={$this->reg_no}&e={$this->exam}'>Click here to view Subjectwise Details</a> <span style='color: blue;
					cursor: pointer;
					font-size: 13px;
					font-weight: bold;
					line-height: 18px;
					margin-top: 15px;
					padding-left: 14px;
					text-decoration: underline;' onclick='print();'> Print </span><br>	";				
			}
			else
			{
			$this->error_found=1;
			$this->html.="<table  align='center' id='results_subject_table' width='100%' border='0' cellspacing='0' cellpadding='3'>";
			$this->html.="<th align='center' colspan='8'  style='color:red;height:34px;font-size:15px;'> No Results found </th>";        			
			$this->html.="</table><div style='height:200px;'></div>";
			}
			
		}
		}
	}	
	
	function DisplayStudentsubjectDetailsResult()
	{
		session_start();
		$FUNIVCODE = $_SESSION['FUNIVCODE'];
		$this->reg_no=trim($this->aobj_context->mobj_data['r']);		 
		$this->exam=trim($this->aobj_context->mobj_data['e']);
		if(empty($this->reg_no) || $this->reg_no=="undefined")
		{
			$arr['html']="Register number should be entered";
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
			return;	
		}
		else if(empty($this->exam) || $this->exam=="undefined")
		{
			$arr['html']="Year / Semester should be selected";
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
			return;	
		}
		$get_data="SELECT s.FDEGREE,d.FDESCPN, s.FEXAMNO,d.FEXAMNAME,s.FCOLLCODE,concat(c.FCOLLNAME,', ',c.FTOWN) AS FCOLLNAME,d.FRESEXAMDATE,
		s.FREGNO,s.FNAME,s.FAYEAR,d.FELIGREM01,d.FELIGREM02
		FROM student s INNER JOIN college c ON c.FCOLLCODE=s.FCOLLCODE INNER JOIN degree d ON d.FDEGREE=s.FDEGREE
		where s.FREGNO='{$this->reg_no}'  and d.fexamno = '{$this->exam}' ";
		$obj_student=$this->aobj_context->mobj_db->GetRow($get_data);   

		if(empty($obj_student))
		{
			$arr['html']="Invalid Register number";
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
			return;	
		}
		
		$FDEGREE=$obj_student['FDEGREE'];
		$FDESCPN=$obj_student['FDESCPN'];
		$FEXAMNO=$obj_student['FEXAMNO'];
		$FEXAMDATE=$obj_student['FRESEXAMDATE'];
		$FEXAMNAME=$obj_student['FEXAMNAME'];
		$FCOLLCODE=$obj_student['FCOLLCODE'];
		$FCOLLNAME=$obj_student['FCOLLNAME'];
		$FREGNO=$obj_student['FREGNO'];
		$FNAME=$obj_student['FNAME'];
		$FAYEAR=$obj_student['FAYEAR'];
		$FELIGREM01=$obj_student['FELIGREM01'];
		$FELIGREM02=$obj_student['FELIGREM02'];
		$get_remarks="SELECT FRESULT_REMARKS, FUNIVCODE FROM control";
		$obj_get_remarks=$this->aobj_context->mobj_db->GetRow($get_remarks);
		$remarks=$obj_get_remarks['FRESULT_REMARKS'];	
		$univcode=$obj_get_remarks['FUNIVCODE'];	
		$tr1=" {$FEXAMNAME} {$FDESCPN} {$FEXAMDATE} Examinations";		
		$tr2=" Reg. No. : {$FREGNO}";			
		if($univcode=='018')
		{
			$tr2=" Roll No. : {$FREGNO}";			
		}
		$tr3=" Name of the Student : {$FNAME}";
		if($FUNIVCODE  =='031')
		{
			$get_result_date="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, FCORRTYPE
				from res_fee
				where FREGNO='{$this->reg_no}'
				and FEXAMNO='{$this->exam}'";
				$obj_get_result_date=$this->aobj_context->mobj_db->GetRow($get_result_date);
				$FCORRTYPE=$obj_get_result_date['FCORRTYPE'];
			if($FCORRTYPE!=='')
			{
				$tr4=" {$FCORRTYPE}";
			}
			############ Writing Student Info START########################	
			if($FCORRTYPE!=='')
			{
				$this->html.="<table style = '870px;' align=left class='result_table_header' id='student_info'>
				<tr style='height:22px;'>
				<td align=left>Enrollment No. :</td>
				<td align=left>Examination :</td>
				</tr>
				</table>
				<table style = '870px;' align=left class='result_table_header' id='student_info'>
				<tr style='height:22px;' ><td align=left style='width:100px;'>Name :</td></tr>
				<tr style='height:22px;' ><td align=left style='width:100px;'>Center :</td></tr>
				<tr style='height:22px;color:red;' ><td align=left style='width:100px;'>Program :</td></tr>
				</table>";
			}
			else
			{
				$this->html.="<table style = style = '870px;' cellpadding='5' cellspacing ='0' class='result_table_header' id='student_info'>
				<tr style='height:22px;'>
				<td align=left style='width:181px;border-left:1px solid #a1a1a1; border-right:1px solid #a1a1a1; border-top:1px solid #a1a1a1;'>Enrollment No.</td><td style='width:200px;border-top:1px solid #a1a1a1;border-right:1px solid #a1a1a1;'>{$tr2}</td>
				<td align=left style='width:182px;border-right:1px solid #a1a1a1;border-top:1px solid #a1a1a1;'>Examination</td><td style='border-top:1px solid #a1a1a1;border-right:1px solid #a1a1a1;'>{$FEXAMNAME} {$FEXAMDATE}</td>
				</tr>
				</table>
				<table style = '870px;' align=left cellpadding='5' cellspacing ='0' style='margin-bottom:20px;' class='result_table_header' id='student_info'>
				<tr style='height:22px;border-right:1px solid #a1a1a1;' ><td align=left style='width:105px;border-left:1px solid #a1a1a1;border-right:1px solid #a1a1a1;border-top:1px solid #a1a1a1;'>Name </td><td style='width:400px;border-right:1px solid #a1a1a1;border-top:1px solid #a1a1a1;'> {$FNAME}</td></tr>
				<tr style='height:22px;border-right:1px solid #a1a1a1;' ><td align=left style='width:105px;border-left:1px solid #a1a1a1;border-right:1px solid #a1a1a1;border-top:1px solid #a1a1a1;'>Center / School </td><td style='width:400px;border-right:1px solid #a1a1a1;border-top:1px solid #a1a1a1;'> {$FCOLLNAME}</td></tr>
				<tr style='height:22px;border-right:1px solid #a1a1a1;' ><td align=left style='width:105px;border-left:1px solid #a1a1a1;border-right:1px solid #a1a1a1;border-top:1px solid #a1a1a1;border-bottom:1px solid #a1a1a1;'>Programme</td><td style='width:400px;border-right:1px solid #a1a1a1;border-top:1px solid #a1a1a1;border-bottom:1px solid #a1a1a1;'>{$FDESCPN}</td></tr>
				</table>";
			}
			
		}
		if($this->error_found==1)
		{
		$arr['html']="Invalid Register number / No Results found";
		echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
		return;	
		}
		//$this->html.="</table>";
		if($FUNIVCODE != '031')
		{
		############ Writing Student Info START########################	
			$this->html.="<br>";
			$this->html.="<table width=100% align=center class='result_table_header' id='student_info'>
			<tr style='height:22px;'><td align=center>{$tr1}</td></tr>
			<tr style='height:22px;' ><td align=center >{$tr2}</td></tr>
			<tr style='height:22px;' ><td align=center >{$tr3}</td></tr>
			</table>";
		}
		############ Writing Student Info END########################	
		$this->WriteSubjectWiseDetailedResult();
		$this->html.="<a class='sub_wise_anchar' href='result.php?r={$this->reg_no}&e={$this->exam}'>Click here to view Brief Results</a> <span style='color: blue;
		cursor: pointer;
		font-size: 13px;
		font-weight: bold;
		line-height: 18px;
		margin-top: 15px;
		padding-left: 14px;
		text-decoration: underline;' onclick='print();'> Print </span><br>	";
		$this->html.="<br><table width=100% align=left class='result_table_remarks'>
		<tr><td align=left style='text-align:justify;'>{$remarks} </td></tr>
		</tr>
		</table>";

		$arr['html']=$this->html;		

		echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
		return;	
	}
	
	function WriteSubjectWiseDetailedResult()
	{	
		session_start();
		$FUNIVCODE = $_SESSION['FUNIVCODE'];
		if($FUNIVCODE  =='031')
		{
			$get_data="select s.FSUBNAME,s.FSUBSHORT, ifnull(sh.fsubname,'') as FHINDISUB,
			rm.fsubcode,rm.fssubname,rm.fmarks,rm.fyear,rm.fexamtype
			from resmarksdet rm 
			left join subject s on 
			s.FDEGREE=rm.fdegree
			and s.FEXAMNO=rm.fexamno and s.FCSUBCODE=rm.fsubcode
			left outer join sub_hindi sh on
			s.fdegree = sh.fdegree and s.fsubcode = left(sh.fsubcode,4)
			where fregno='{$this->reg_no}' and rm.fexamno='{$this->exam}'
			order by  s.fprintord, s.fsubcode, s.fssubcode
			";
			mysql_query("SET NAMES utf8");
		}
		else
		{
			$get_data="select s.FSUBNAME, 
			rm.fsubcode,rm.fssubname,rm.fmarks,rm.fyear,rm.fexamtype
			from resmarksdet rm 
			left join subject s on 
			s.FDEGREE=rm.fdegree
			and s.FEXAMNO=rm.fexamno and s.FCSUBCODE=rm.fsubcode
			where fregno='{$this->reg_no}' and rm.fexamno='{$this->exam}'
			order by  s.fsubcode, s.fssubcode";
		}
		$this->app_data=$this->aobj_context->mobj_db->GetAll($get_data); 	
		//echo $get_data;			
		$this->html.="<br>";

		$this->html.="<table  align='center' id='results_subject_table' width='870px' border='0' cellspacing='0' cellpadding='3'>";
		//$this->html.="<th align='center' colspan='8'  class='header_grid'>Following course results are available </th>";        			
		$this->html.="<tr class='tr_bg1'>";
		if($FUNIVCODE == '031')
			$this->html.="<td  width='10%' style='border-left:1px solid #a1a1a1; border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Course code</td>";
		else
			$this->html.="<td  width='10%' style='border-left:1px solid #a1a1a1; border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Sl. No.</td>";
		$this->html.="<td  width='50%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Subject Name</td>";
		$this->html.="<td  width='20%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Component Name</td>";
		$this->html.="<td  width='20%' style='border-right:1px solid #a1a1a1; border-bottom:1px solid #a1a1a1;' align='center'>Marks</td>";

		$this->html.="</tr>";

		$final_arr=array();
		$sl_no=1;
		foreach($this->app_data as $k=>$v)
		{
			if($FUNIVCODE  =='031')
			{
				$FHINDISUB=$v[FHINDISUB];
				if(strlen($FHINDISUB)>0)
				{
				$FSUBNAME=$FHINDISUB;
				}
				else
				{
				$FSUBNAME=$v[FSUBNAME];
				}

				$fssubname=$v[fssubname];
				$fmarks=$v[fmarks];
				$fsubcode=$v[fsubcode];
				$fsubshort = $v[FSUBSHORT];
				$fsubcodearr[$FSUBNAME]=$fsubshort;
				$final_arr[$FSUBNAME][$fsubcode]['s']=$fssubname;
				$final_arr[$FSUBNAME][$fsubcode]['m']=$fmarks;

			}
			else
			{
				$FSUBNAME=$v[FSUBNAME];
				$fssubname=$v[fssubname];
				$fmarks=$v[fmarks];
				$fsubcode=$v[fsubcode];
				$final_arr[$FSUBNAME][$fsubcode]['s']=$fssubname;
				$final_arr[$FSUBNAME][$fsubcode]['m']=$fmarks;
			}
		}
		$sl_no=1;
		foreach($final_arr	as $ak=>$av)
		{	
			if($k%2==0)
			$class='tbl_row1';
			else
			$class='tbl_row_alter1';

			$this->html.="<tr>";
			if($FUNIVCODE  =='031')
				$this->html.="<td class={$class} style='border-left:1px solid #a1a1a1; border-right:1px solid #a1a1a1;text-align:center; ' >{$fsubcodearr[$ak]}</td>";
			else
				$this->html.="<td class={$class} style='border-left:1px solid #a1a1a1; border-right:1px solid #a1a1a1;text-align:center; ' >{$sl_no}</td>";
			$this->html.="<td class={$class} style='letter-spacing:0.6px;text-align:left; border-right:1px solid #a1a1a1;'  >{$ak}</td>";
			$arr=GetSubjectData($av);
			$sub_html=$arr['sub_html'];
			$marks_html=$arr['marks_html'];
			$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;' >{$sub_html}</td>";				
			$this->html.="<td class={$class} style=' text-align:center; border-right:1px solid #a1a1a1;'>{$marks_html}</td>";	

			$this->html.="</tr>";
			$sl_no++;
			$k++;
		}
		$this->html.="</table>";
	}	

} 
function GetTdData($div1,$div2)
{
	$html="";
	if(empty($div2))
	$html="{$div1}";
	else
		$html="<div style='padding:5px;'>{$div1}</div><div>{$div2}</div>";
	return $html;
}

function GetTdData1($div1,$div2)
{
	$color1="color:green;";
	$color2="color:green;";
	if(trim(strtolower($div1)=="fail"))
	$color1="color:red;";
	if(trim(strtolower($div2)=="fail"))
	$color2="color:red;";
	$html="";
	if(empty($div2))
	$html="<div style=' {$color1}'>{$div1}</div>";
	else
	$html="<div style='padding:5px;{$color1}'>{$div1}</div><div style='{$color2}'>{$div2}</div>";
	return $html;
}

function GetSubjectData($arr)
{
	$sub_html="";
	$marks_html="";

	foreach($arr as $akk=>$avv)
	{
		$sub_html.="<div style='padding:5px'>{$avv['s']}</div>";
		$marks_html.="<div style='padding:5px'>{$avv['m']}</div>";
	}
	$fin_arr['sub_html']=$sub_html;
	$fin_arr['marks_html']=$marks_html;
	return $fin_arr;
}

function PopulateResultDegreeList($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$class_obj=new results($aobj_context);
	$class_obj->dashboardMessageBoard();	 
	$class_obj->PopulateResultDegreeList();	 
} 

function DisplayStudentResult($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$class_obj=new results($aobj_context);
	$class_obj->DisplayStudentResult();	 
} 

function DisplayStudentsubjectDetailsResult($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$class_obj=new results($aobj_context);
	$class_obj->DisplayStudentsubjectDetailsResult();	 
} 

function ValidateRegNo($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$class_obj=new results($aobj_context);
	$class_obj->ValidateRegNo();	 
}

?>