0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 18.222.67.8


Current Path : /proc/thread-self/root/var/www/html/dud/Report_details/
Upload File :
Current File : //proc/thread-self/root/var/www/html/dud/Report_details/results_pdf.php

<?php

function generateResults($aobj_context)
{
	session_start();
	$FUNIVCODE = $_SESSION['FUNIVCODE'];
	
	ini_set("memory_limit",-1);
	ini_set('max_execution_time',3300);
	
	$degree =  $aobj_context->mobj_data["degree"]; 
	$regfrom =  $aobj_context->mobj_data["regfrom"]; 
	$regto =  $aobj_context->mobj_data["regto"]; 
	
	//var_dump($degree.'---'.$regfrom.'----'.$regto);die();
			
	$main_src = substr($_SERVER['SCRIPT_FILENAME'],0,strlen($_SERVER['SCRIPT_FILENAME'])-7);
	$pdf_writer_class =$main_src."/tcpdf/tcpdf.php";
	
	require_once($pdf_writer_class);
	
	$query = "SELECT rm.fregno,rm.fexamno,IF(FSUBSIDARY = 'T',CONCAT(s.FSUBNAME,' **'),s.FSUBNAME) AS FSUBNAME,s.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(FCREDITS = '','-',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,
	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 BETWEEN '{$regfrom}' AND '{$regto}' AND rm.fdegree = '{$degree}'
	GROUP BY rm.fregno,rm.fexamno,s.FSUBCODE
	ORDER BY rm.fregno,rm.fexamno,rm.fsubcode";
	
	$results = $aobj_context->mobj_db->GetAll($query);	
	
	$regnonew  = "";
	$regnoold  = "";
	$examold   = "";
	$examnew   = "";
	
	$outregnonew  = "";
	$outregnoold  = "";
	$outexamold   = "";
	$outexamnew   = "";
	
	$first     = true;
	$w = 1;
		foreach($results as $reg_v)
		{	
			$pdf = new TCPDF();;
			$pdf->SetMargins(9,10,15);	
			$pdf->aobj_context =$aobj_context ;
			$pdf->WhichReport = 'AdmissionTicket';
			//var_dump($reg_v['fregno']);
			$regnonew = $reg_v['fregno'];
			$outregnonew  = $reg_v['fregno'];
			$examnew = $reg_v['fexamno'];
			$outexamnew = $reg_v['fexamno'];
			$fscheme = $reg_v['FSCHEME'];
			$pdf->SetFillColor(248, 248 ,255);		
				$pdf->SetFont('Times','',10);
			if($regnonew != $regnoold || $examnew != $examold)
			{	
				$pdf->SetMargins(9,10,15);
				$pdf->AddPage();
				
				$get_data = "SELECT FRESULT_REMARKS, FUNIVCODE, FREGROLL,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 control,student s INNER JOIN college c ON c.FCOLLCODE=s.FCOLLCODE INNER JOIN degree d ON d.FDEGREE=s.FDEGREE
							where s.FREGNO = '{$reg_v['fregno']}' and d.fexamno = '{$reg_v['fexamno']}'";
				$reg_student = $aobj_context->mobj_db->GetRow($get_data);
		
				$rv_rt_total_fee  = $reg_student['rv_rt_total_fee'];
				$FDEGREE          = $reg_student['FDEGREE'];
				$FDESCPN          = $reg_student['FDESCPN'];
				$FEXAMNO          = $reg_student['FEXAMNO'];
				$FEXAMDATE        = $reg_student['FRESEXAMDATE'];
				$FEXAMNAME        = $reg_student['FEXAMNAME'];
				$FCOLLCODE        = $reg_student['FCOLLCODE'];
				$FCOLLCODE        = $reg_student['FCOLLCODE'];
				$FCOLLNAME        = $reg_student['FCOLLNAME'];
				$FREGNO           = $reg_student['FREGNO'];
				$FNAME            = $reg_student['FNAME'];
				$FFATNAME         = $reg_student['FFATNAME'];
				$MOTNAME          = $reg_student['MOTNAME'];
				$FAYEAR           = $reg_student['FAYEAR'];
				$FELIGREM01       = $reg_student['FELIGREM01'];
				$FELIGREM02       = $reg_student['FELIGREM02'];
				
				$remarks          = $reg_student['FRESULT_REMARKS'];	
				$univcode         = $reg_student['FUNIVCODE'];
				$FREGROLL         = $reg_student['FREGROLL'];
				
				$tr1=" {$FEXAMNAME} {$FDESCPN} ";
				$tr4=" {$FEXAMDATE} Examinations";		
				$tr2=" {$FREGROLL} : {$FREGNO}";			
				$tr3=" Name of the Student : {$FNAME}";
				
				$pdf->Cell(180,4,$tr1,"0",1,"C");
				$pdf->Cell(180,4,$tr4,"0",1,"C");
				$pdf->Cell(180,4,$tr2,"0",1,"C");
				$pdf->Cell(180,4,$tr3,"0",1,"C");
				
				if($fscheme == 'CR')
				{
					$title1 = array('Sl. No.','Subject Name','Th. Pr.',
					'Sem. End Exam','Viva','I.A.','Total','Credit Hrs','Grade Points','Credit Points','Result');
					
					$w      = array('5','50','5','8','8','8','8','8','8','8','10');
					
				}else
				{		
					$title1 = array('Sl. <br> No.','Subject Name','Th. <br> Pr.',
					'Univ <br> Exam','Viva','I.A.','Total','Remarks');
					
					$title2 = array('No.','','Pr.','Exam','','','','');
					$w      = array('20','300','25','50','25','30','30','40');
				}
				
				$html = '<table cellspacing="0" cellpadding="1" border="1">
				<tr style="">';
				for($i = 0;$i<count($w);$i++)
				{
					$html .= '<td width="'.$w[$i].'px"  align = "center">'.$title1[$i].'</td>';
				}
				$html .= "</tr></table>";
				$length = (count($w) -1);
			
				$pdf->writeHTML($html, $ln=false, $fill=true, $reseth=false, $cell=true, $align='L');
				
				
				
				$query1 = "SELECT rm.fregno,rm.fexamno,IF(FSUBSIDARY = 'T',CONCAT(s.FSUBNAME,' **'),s.FSUBNAME) AS FSUBNAME,s.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(FCREDITS = '','-',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,
					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 = '{$reg_v['fregno']}' AND rm.fexamno = '{$reg_v['fexamno']}'
					group by s.FSUBCODE
					ORDER BY rm.fregno,rm.fexamno,rm.fsubcode";

				$results1 = $aobj_context->mobj_db->GetAll($query1);
			//	var_dump($query1);
				foreach($results1 as $reg_v1)
				{
				$FSUBNAME   = $reg_v1['FSUBNAME'];
				$FSMAXMARKS = $reg_v1['FSMAXMARKS']; 
				$FLTP       = $reg_v1['FLTP'];
				$FTHUE      = $reg_v1['FTHUE'];
				$FPRUE      = $reg_v1['FPRUE'];
				$FTHVV      = $reg_v1['FTHVV'];
				$FPRVV      = $reg_v1['FPRVV'];
				$FTHIA      = $reg_v1['FTHIA'];
				$FPRIA      = $reg_v1['FPRIA'];
				$FTHTOT     = $reg_v1['FTHTOT'];
				$FPRTOT     = $reg_v1['FPRTOT'];
				$FGRADE     = $reg_v1['FGRADE']; 
				$FTHPASSMTH = trim($reg_v1['FTHPASSMTH']);
				$FPRPASSMTH = trim($reg_v1['FPRPASSMTH']);
				$FMAXMARKS = $reg_v1[FMAXMARKS];
				$FTOTMARKS = $reg_v1[FTOTMARKS];
				$FPREVMAX  = $reg_v1[FPREVMAX];
				$FPREVTOT  = $reg_v1[FPREVTOT];
				$FPERCENT  = $reg_v1[FPERCENT];
				$FCLASS    = $reg_v1[FCLASS];
				$FMCNUMBER = $reg_v1[FMCNUMBER];
				$FYEAR     = $reg_v1[FYEAR];
				$FEXAMTYPE = $reg_v1[FEXAMTYPE];	
				$FSCHEME   = $reg_v1[FSCHEME];	
				$FEXAMNO       = $reg_v1['FEXAMNO'];
				$FEXAMNAME     = $reg_v1['FEXAMNAME'];
				$FRESULTDATE   = $reg_v1['FRESULTDATE'];
				$FRESULTSCHEME = $reg_v1['FRESULTSCHEME'];
				$FCREDITS      = $reg_v1['FCREDITS'];
				$FGP           = $reg_v1['FGP'];
				$FCP           = $reg_v1['FCP'];
				$FSGPA         = $reg_v1['FSGPA'];
				$FCGPA         = $reg_v1['FCGPA'];
				
				
			if($FTHUE != "-" && $FPRUE != "-")
			{
				$mthprue  = "Th. Pr.";
				$uni_exam = "{$FTHUE} {$FPRUE}";
				$mthprue  = "Th.<br>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($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); 
				}
			
				$title1 = array("{$mthprue}","{$uni_exam}","{$viva_exam}","{$ia_exam}","{$total}");
				//$w      = array('5','50','8','8','8','8','8','8');
				$html = '<table cellspacing="0" cellpadding="1" border="1" >
				<tr style="">';

				$html .= '<td width="'.$w[0].'px"  align = "center">'.$z.'</td>';
				$html .= '<td width="'.$w[1].'px"  align = "left">'.$FSUBNAME.'</td>';
				$x = 0;
				for($i = 2;$i<count($w);$i++)
				{
					$html .= '<td width="'.$w[$i].'px"  align = "center">'.$title1[$x].'</td>';
					$x++;
				}
				$html .= "</tr></table>";
				$z++;	
			
				//$pdf->writeHTML($html, $ln=true, $fill=true, $reseth=false, $cell=true, $align='L');
				$pdf->writeHTML($html, false, false, false, false, '');
				
					
				}	
				$regnoold = $reg_v['fregno'];
				$examold = $reg_v['fexamno'];
				$pdf->Output($main_src."results/results_".$regnonew."_".$examnew.".pdf","F");
			}	
		
			$w++;
			//var_dump($reg_v['fregno']);
			/* if($regnonew != $regnoold || $examnew != $examold)
			{
				$pdf->SetFillColor(248, 248 ,255);		
				$pdf->SetFont('Times','',10);
				$pdf->AddPage();
				$pdf->SetMargins(9,10,15);
				$pdf->Rect(2,05,200,280,'D');
				$z = 1;
				$regnoold = $reg_v['fregno'];
				$examold = $reg_v['fexamno'];
				
				
				$get_data = "SELECT FRESULT_REMARKS, FUNIVCODE, FREGROLL,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 control,student s INNER JOIN college c ON c.FCOLLCODE=s.FCOLLCODE INNER JOIN degree d ON d.FDEGREE=s.FDEGREE
				where s.FREGNO = '{$reg_v['fregno']}' and d.fexamno = '{$reg_v['fexamno']}'";
				
				$reg_student = $aobj_context->mobj_db->GetRow($get_data);
		
				$rv_rt_total_fee  = $reg_student['rv_rt_total_fee'];
				$FDEGREE          = $reg_student['FDEGREE'];
				$FDESCPN          = $reg_student['FDESCPN'];
				$FEXAMNO          = $reg_student['FEXAMNO'];
				$FEXAMDATE        = $reg_student['FRESEXAMDATE'];
				$FEXAMNAME        = $reg_student['FEXAMNAME'];
				$FCOLLCODE        = $reg_student['FCOLLCODE'];
				$FCOLLCODE        = $reg_student['FCOLLCODE'];
				$FCOLLNAME        = $reg_student['FCOLLNAME'];
				$FREGNO           = $reg_student['FREGNO'];
				$FNAME            = $reg_student['FNAME'];
				$FFATNAME         = $reg_student['FFATNAME'];
				$MOTNAME          = $reg_student['MOTNAME'];
				$FAYEAR           = $reg_student['FAYEAR'];
				$FELIGREM01       = $reg_student['FELIGREM01'];
				$FELIGREM02       = $reg_student['FELIGREM02'];
				
				$remarks          = $reg_student['FRESULT_REMARKS'];	
				$univcode         = $reg_student['FUNIVCODE'];
				$FREGROLL         = $reg_student['FREGROLL'];
				
				$tr1=" {$FEXAMNAME} {$FDESCPN} ";
				$tr4=" {$FEXAMDATE} Examinations";		
				$tr2=" {$FREGROLL} : {$FREGNO}";			
				$tr3=" Name of the Student : {$FNAME}";
				
				$pdf->Cell(180,4,$tr1,"0",1,"C");
				$pdf->Cell(180,4,$tr4,"0",1,"C");
				$pdf->Cell(180,4,$tr2,"0",1,"C");
				$pdf->Cell(180,4,$tr3,"0",1,"C");
				
				
				
				if($fscheme == 'CR')
				{
					$title1 = array('Sl. No.','Subject Name','Th. Pr.',
					'Sem. End Exam','Viva','I.A.','Total','Credit Hrs','Grade Points','Credit Points','Result');
					
					$w      = array('5','50','5','8','8','8','8','8','8','8','10');
					
				}else
				{		
					$title1 = array('Sl. <br> No.','Subject Name','Th. <br> Pr.',
					'Univ <br> Exam','Viva','I.A.','Total','Remarks');
					
					$title2 = array('No.','','Pr.','Exam','','','','');
					$w      = array('20','300','25','50','25','30','30','40');
				}
				
				$html = '<table cellspacing="0" cellpadding="1" border="1">
				<tr style="">';
				for($i = 0;$i<count($w);$i++)
				{
					$html .= '<td width="'.$w[$i].'px"  align = "center">'.$title1[$i].'</td>';
				}
				$html .= "</tr></table>";
				$length = (count($w) -1);
			
				$pdf->writeHTML($html, $ln=false, $fill=true, $reseth=false, $cell=true, $align='L');
			}
				//$html
				$main_src=substr($_SERVER['SCRIPT_FILENAME'],0,strlen($_SERVER['SCRIPT_FILENAME'])-7);
				$FSUBNAME   = $reg_v['FSUBNAME'];
				$FSMAXMARKS = $reg_v['FSMAXMARKS']; 
				$FLTP       = $reg_v['FLTP'];
				$FTHUE      = $reg_v['FTHUE'];
				$FPRUE      = $reg_v['FPRUE'];
				$FTHVV      = $reg_v['FTHVV'];
				$FPRVV      = $reg_v['FPRVV'];
				$FTHIA      = $reg_v['FTHIA'];
				$FPRIA      = $reg_v['FPRIA'];
				$FTHTOT     = $reg_v['FTHTOT'];
				$FPRTOT     = $reg_v['FPRTOT'];
				$FGRADE     = $reg_v['FGRADE']; 
				$FTHPASSMTH = trim($reg_v['FTHPASSMTH']);
				$FPRPASSMTH = trim($reg_v['FPRPASSMTH']);
				$FMAXMARKS = $reg_v[FMAXMARKS];
				$FTOTMARKS = $reg_v[FTOTMARKS];
				$FPREVMAX  = $reg_v[FPREVMAX];
				$FPREVTOT  = $reg_v[FPREVTOT];
				$FPERCENT  = $reg_v[FPERCENT];
				$FCLASS    = $reg_v[FCLASS];
				$FMCNUMBER = $reg_v[FMCNUMBER];
				$FYEAR     = $reg_v[FYEAR];
				$FEXAMTYPE = $reg_v[FEXAMTYPE];	
				$FSCHEME   = $reg_v[FSCHEME];	
				$FEXAMNO       = $reg_v['FEXAMNO'];
				$FEXAMNAME     = $reg_v['FEXAMNAME'];
				$FRESULTDATE   = $reg_v['FRESULTDATE'];
				$FRESULTSCHEME = $reg_v['FRESULTSCHEME'];
				$FCREDITS      = $reg_v['FCREDITS'];
				$FGP           = $reg_v['FGP'];
				$FCP           = $reg_v['FCP'];
				$FSGPA         = $reg_v['FSGPA'];
				$FCGPA         = $reg_v['FCGPA'];
				
				
			if($FTHUE != "-" && $FPRUE != "-")
			{
				$mthprue  = "Th. Pr.";
				$uni_exam = "{$FTHUE} {$FPRUE}";
				$mthprue  = "Th.<br>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($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); 
				}
			
			$title1 = array("{$mthprue}","{$uni_exam}","{$viva_exam}","{$ia_exam}","{$total}");
			//$w      = array('5','50','8','8','8','8','8','8');
			$html = '<table cellspacing="0" cellpadding="1" border="1" >
			<tr style="">';

			$html .= '<td width="'.$w[0].'px"  align = "center">'.$z.'</td>';
			$html .= '<td width="'.$w[1].'px"  align = "left">'.$FSUBNAME.'</td>';
			$x = 0;
			for($i = 2;$i<count($w);$i++)
			{
				$html .= '<td width="'.$w[$i].'px"  align = "center">'.$title1[$x].'</td>';
				$x++;
			}
			$html .= "</tr></table>";
			$z++;	
		
			//$pdf->writeHTML($html, $ln=true, $fill=true, $reseth=false, $cell=true, $align='L');
			$pdf->writeHTML($html, false, false, false, false, '');	
			//var_dump($FREGNO);
			if($outregnonew != $outregnoold || $outexamnew != $outexamold)
			{	
				$outregnoold = $reg_v['fregno'];
				$outexamold = $reg_v['fexamno'];
				//var_dump($reg_v['fregno'].'----'.$reg_v['fexamno']);
				//$pdf->Output($main_src."results/results_".$reg_v['fregno']."_".$reg_v['fexamno'].".pdf","F");
			}	
			$z++; */	
		//	$pdf->AddPage();
		} 
		
}

function GetTdData($div1,$div2)
{
	$html="";
	if(empty($div2))
		$html="{$div1}";
	else
		$html="{$div1}<br>{$div2}";
	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;
	
}

?>