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


Current Path : /var/www/oasis/Report_details/
Upload File :
Current File : /var/www/oasis/Report_details/studentHisResult.php

<?php
$main_src=substr($_SERVER['SCRIPT_FILENAME'],0,strlen($_SERVER['SCRIPT_FILENAME'])-7);
$pdf_writer_class =$main_src."/tarka_pdf_latest/fpdf.php";
require_once($pdf_writer_class);
ini_set('max_execution_time', 0); 
class GenerateFeeSummaryReport  extends FPDF
{
	function DefaultConstructor($aobj_context)
	{
		include_once($aobj_context->main_src."/src/format.php");
		$this->aobj_context=$aobj_context;
		$this->pdf=  new FPDF();
		$this->pdf=$this;
		session_start();
		$this->collcode = $_SESSION['collcode'];
		$this->ip=$_SERVER["REMOTE_ADDR"];
		$this->degree = $aobj_context->mobj_data["degree"]; 
		$this->regfrom = $aobj_context->mobj_data["regfrom"];
		$this->regto = $aobj_context->mobj_data["regto"];
		
		$this->first    = true;
	}
	 
	function Header()
	{	
		$img_path=$this->aobj_context->main_src."/".$this->aobj_context->mobj_data["db"]."/".$this->pdf_logo_path;
		// var_dump($img_path);
		// die();
		if($this->funivcode=="055"){
			$logopath=	$this->aobj_context->main_src."/".$this->aobj_context->mobj_data["db"]."/img/log.jpg";

			if(file_exists($logopath)) 
			{			
				$this->pdf->Image($logopath,28,4,250);
				$this->SetY(40);
			}
		}
		elseif(!empty($this->pdf_logo_path) && file_exists($img_path))
		{	
			if($this->funivcode !=="051"){		
			$this->pdf->Image($img_path,10,10,35);}else{
				$this->pdf->Image($img_path,10,5,35);
			}
		}
		if($this->funivcode!=="055"){
		if($this->funivcode=="052"){
			$this->pdf->SetFont('Times','B',9);
			$this->pdf->cell(0,7,""."JSS MAHAVIDYAPEETHA","0",1,"C");
		}
		$this->pdf->SetFont('Times','B',14);
		$this->pdf->cell(0,7,"".$this->FUNIVNAME,"0",1,"C");
		$this->pdf->SetFont('Times','',8);
		$this->pdf->cell(0,4, $this->s_state,"0",0,"C");
		$this->pdf->SetFont('Times','',10);	
		$this->pdf->Cell(-20,4,"",0,1,'C');
		$this->pdf->SetFont('Times','B',10);
		//$this->pdf->cell(0,7,"College: ".$this->college_name,"0",1,"C");	
	}	

	if($this->funivcode=="055")
	{
		$this->SetY(37);

	}

	$this->pdf->SetFont('Times','B',10);
	$this->pdf->cell(0,7,"CONSOLIDATED RESULT SHEET","0",1,"C");
	
		
}
	
	
	function Footer()
	{
	
		$this->pdf->Ln(2);
		$this->pdf->SetFont('Times','BU',12);

		$this->pdf->Cell(0,7,"Subject Details","0",1,"C");
		$this->pdf->Ln(2);
		$this->pdf->SetFont('Times','',10);

		$explode = explode("*", $this->str);
		
		$haf = ceil(count($explode)/2);

		$x = $this->getX();
		$y = $this->getY();
		$y1 = 0;
		$a = 1;

		foreach($explode as $val)
		{
			if($a > $haf)
			{
				$this->setXY($x+150,$y+$y1);
				$this->pdf->Cell(10,5,$val,"0",1,"L");
				$y1 = $y1+5;
			}else
			{
				$this->pdf->Cell(10,5,$val,"0",1,"L");
			}
			$a++;
		}

	}
	
	function formcolldata()
	{
	
		$get_coll_name="select FUNIVNAME as 'FUNIVNAME',funivcode,
		FUNIVADD1 as 'state', pdf_logo_path From control";
	
		$lobj_get_coll_name=$this->aobj_context->mobj_db->GetRow($get_coll_name);		

		$this->FUNIVNAME=$lobj_get_coll_name['FUNIVNAME'];
		$this->funivcode=$lobj_get_coll_name['funivcode'];
		
		$this->s_state=$lobj_get_coll_name['state'];
		$this->f_year=$lobj_get_coll_name['f_year'];
		$this->pdf_logo_path=$lobj_get_coll_name['pdf_logo_path'];

		$get_coll_name="select fcollname From college where fcollcode = '{$this->collcode}'";
	
		$res=$this->aobj_context->mobj_db->GetRow($get_coll_name);
		$this->college_name=$res['fcollname'];
	
	}

	function tableHeader($section,$name,$degree,$regno){  
		
		$this->pdf->SetFont('Times','B',10);
		$this->pdf->Cell(0,7,"USN: ".$regno."     Name: ".$name."            Program: ".$degree,"0",1,"L");
        $this->pdf->Cell(20,7,"Exam Date","1",0,"C");
		$this->pdf->Cell(10,7,"Sem","1",0,"C");
		$this->pdf->Cell(221,7,"Course Details","1",0,"C"); 
        $this->pdf->Cell(14,7,"SGPA","1",0,"C");
		$this->pdf->Cell(14,7,"CGPA","1",1,"C");
		$this->pdf->SetFont('Times','',10);
		
		
}
	function formdata(){
		
		$cnd = "";
		$cnd1 = "";
		if($this->funivcode == '055')
		{
			$cnd = "GROUP_CONCAT(DISTINCT CONCAT(IF(r.FSCHEME = 'CR',r.fgrade,(fthtot+fprtot)),'*',s.fsubshort,'*','','*','','*',s.fsubname) order by ifnull(FPRINTORD,''),s.fsubcode SEPARATOR '|') AS subdet,";
			$cnd1 = "GROUP BY r.fregno,r.fexamno,r.fyear,r.fexamtype";
		}else
		{
			$cnd = "GROUP_CONCAT(DISTINCT CONCAT(IF(r.FSCHEME = 'CR',r.fgrade,(fthtot+fprtot)),'*',s.fsubshort,'*',if(r.fthue = '-',r.FPRUE,r.fthue),'*',if(r.fthia = '-',r.FPRIA,r.fthia),'*',s.fsubname) SEPARATOR '|') AS subdet,";
			$cnd1 = "GROUP BY r.fregno,r.fyear,r.fexamtype";
		}
		
        $query="SELECT dg.fexamdate,dg.fsexamdate,r.fdegree,r.fexamno,r.fregno,r.fyear,r.fexamtype,
		if(r.fexamno = 'X','S',(ASCII(r.fexamno)-64)) as sem,
		st.fname,
		d.fdescpn,
		sum(if(( r.fgrade ='F' or r.fgrade ='NE' or r.fgrade ='Fail' or r.fgrade ='MP' or r.fgrade ='AB'),0,r.fcredits / 2)) as credits, 
		ifnull(st.fsection,'All') as fsection, 
		{$cnd}
		r.fclass,r.fsgpa,
		r.fcgpa 
		FROM resmarks r INNER JOIN subject s ON r.fsubcode = s.fsubcode 
		AND r.fdegree = s.fdegree AND r.fexamno = s.fexamno 
		inner join student st on r.fregno = st.fregno 
		inner join degexam dg on r.fdegree = dg.fdegree and r.fexamno = dg.fexamno
		and r.fyear = dg.fyear and r.fexamtype = dg.fexamtype
		inner join degree d on d.fdegree = r.fdegree and d.fexamno = r.fexamno
		WHERE  r.fregno = '{$this->regfrom}'
		{$cnd1}
		order by st.fregno";
		// var_dump($query);
		// die();
        $results =  $this->aobj_context->mobj_db->GetAll($query);
		
		$subdet=count(explode('|',$results[1]['subdet']));

		$subcount = 0;
	
		foreach($results as $val){
			if(count(explode('|',$val['subdet'])) > $subcount){
				$subcount = count(explode(',',$val['subdet']));
			}
		}
		
		// var_dump($subcount);die();
		
       $i = 1;
	   $oldregno = "";
	   $newregno = "";
		foreach ($results as $key => $value) 
		{
			
			
			$newregno = $value['fregno'];
			$regno = $value['fregno'];
			$fname = $value['fname'];
			$fdescpn = $value['fdescpn'];
			
			if($this->pdf->getY() > 150  || ($newregno != $oldregno))
			{
				$this->pdf->AddPage("L");
				$this->str = "";
			    $oldregno = $newregno;
			   	$this->tableHeader($newregno,$fname,$fdescpn,$regno);
			}
			
			$subres1=substr($value['subdet'],0);
            $this->pdf->SetFont('Times','',9);

				$this->pdf->SetFont('Times','',9);
				$this->pdf->Cell(20,5,$value['fsexamdate'],"LRT",0,"C");
				$this->pdf->Cell(10,5,$value['sem'],"LRT",0,"C");
                $submarks=explode("|",$subres1);
				$subdetcount = count($submarks);
				
				$width = 17;
				
				$a = 0;
				
                foreach($submarks as $v){
                    $explode = explode("*", $v);
					$this->str .= $explode[1]." : ".$explode[4].'*';
					
                    $this->pdf->Cell($width ,5,$explode[1],"LRT",0,"C");
					$a++;
                }

				for($i = $a;$i<13;$i++)
				{
					$this->pdf->Cell($width ,5,'',"",0,"C");
				}

                $this->pdf->Cell(14,5,$value['fsgpa'],"LRT",0,"C");
				$this->pdf->Cell(14,5,$value['fcgpa'],"LRT",1,"C");
				
				$this->pdf->Cell(20,5,"","LRB",0,"C");
				$this->pdf->Cell(10,5,"","LRB",0,"C");
    
				$a = 0;
                foreach($submarks as $v){
					
                    $explode = explode("*", $v);
                   
					$val=$explode[0];

					if(strtoupper($val) == 'PASS')
						$val = 'PP';
					else if(strtoupper($val) == 'FAIL')	
						$val = 'NP';
					

					$thmarks=$explode[2];
					$iamarks=$explode[3];
					$this->pdf->Cell(5,5,$thmarks,"B",0,"C");
					$this->pdf->Cell(5,5,$iamarks,"B",0,"C");
                    $this->pdf->Cell(7,5,$val,"RB",0,"C");
					$a++;
                }
				
				for($i = $a;$i<13;$i++)
				{
					$this->pdf->Cell($width ,5,'',"B",0,"C");
				}

				$this->pdf->Cell(14,5,'',"LRB",0,"C");
				$this->pdf->Cell(14,5,'',"LRB",1,"C");
	        $i++;
		}	
       
	}

	function SendOutput()

	{
		$this->pdf->Output("Result_Sheet.pdf","I");
	}
}

function studentwiseHistresult($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);

	$class_obj=new GenerateFeeSummaryReport();
	$class_obj->AliasNbPages();
	$class_obj->DefaultConstructor($aobj_context);
	$class_obj->Header();
	
	$class_obj->formcolldata();
	$class_obj->formdata();
	$class_obj->SetTitle('Result_Sheet.pdf');
	$class_obj->SendOutput();    
}
?>