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


Current Path : /var/www/html/rcub/Report_details/
Upload File :
Current File : /var/www/html/rcub/Report_details/resultsheet.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->degexam = $aobj_context->mobj_data["degexam"];
		$this->yearmode = $aobj_context->mobj_data["yearmode"];
		$yearmode = explode("*",$this->yearmode);
		$this->year = $yearmode[0];
		$this->examtye = $yearmode[1];


		
		$get_date= "select DATE_ADD(DATE_ADD(NOW(),INTERVAL 13 hour),interval 30 minute)  as now_date,
		CONCAT('[',fcollcode,'] ', fcollname,', ',FTOWN) as college_name,
		dg.fexamdate as fresexamdate, d.fdescpn, d.fexamname from college c, degree d, degexam dg 
		where fcollcode = '{$this->collcode}' and d.fdegree = '{$this->degree}'
		and d.fdegree = dg.fdegree and d.fexamno = dg.fexamno 
		and d.fexamno = '{$this->degexam}'
		and dg.fyear = '{$this->year}'
		and dg.fexamtype = '{$this->examtye}'";
        
		$obj=$aobj_context->mobj_db->GetRow($get_date);

		$this->current_date = $obj['now_date'];
		$this->college_name = $obj['college_name'];
		$this->fresexamdate = $obj['fresexamdate'];
		$this->fdescpn      = $obj['fdescpn'];
		$this->fexamname    = $obj['fexamname'];
		$this->first    = true;
	}
	 
	function Header()
	{
			
		$img_path=$this->aobj_context->main_src."/".$this->aobj_context->mobj_data["db"]."/".$this->pdf_logo_path;
	 
		if(!empty($this->pdf_logo_path) && file_exists($img_path)) 
		{			
			$this->pdf->Image($img_path,10,10,20);
		}
			
		$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,"Page {$this->pdf->PageNo()}/{nb}",0,1,'C');
		$this->pdf->SetFont('Times','B',10);
		$this->pdf->cell(0,7,"College: ".$this->college_name,"0",1,"C");
		$this->pdf->cell(0,7,"RESULT SHEET","0",1,"C");
		$this->pdf->cell(0,7,$this->fexamname." ".$this->fdescpn." EXAMINATION - ".$this->fresexamdate,"0",1,"C");
	}	

	function Footer()
	{
		$this->SetY(-15);
		$this->pdf->SetFont('Times','B',8);
		$new_y=$this->pdf->GetY();
		$this->pdf->Ln(2);
		$this->Cell(140,6,'Printed: IP Address : '.$this->ip." Date ".$this->current_date,'0',0,'L');
	}
	
	function formcolldata()
	{
		$get_coll_name="select FUNIVNAME as 'FUNIVNAME',
		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->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'];
	}

	function tableHeader()
	{

		$this->pdf->SetFont('Times','B',10);
        $this->pdf->Cell(8,6,"Sl.","LRT",0,"C");
		$this->pdf->Cell(22,6,"Register","LRT",0,"C");
		$this->pdf->Cell(45,6,"Student Name","LRT",0,"C");
		$this->pdf->Cell(15,6,"Max.","LRT",0,"C");
		$this->pdf->Cell(15,6,"Sec.","LRT",0,"C");
		if($this->FSCHEME == 'CR')
			$this->pdf->Cell(18,6,"S.G.P.A / ","LRT",0,"C");
		else	
			$this->pdf->Cell(18,6,"Percentage","LRT",0,"C");
		$this->pdf->Cell(38,6,"Remarks","LRT",0,"C");
		$this->pdf->Cell(30,6,"Withheld","LRT",1,"C");

 
		$this->pdf->Cell(8,6,"No.","LRB",0,"C");
		$this->pdf->Cell(22,6,"No.","LRB",0,"C"); 
		$this->pdf->Cell(45,6,"","LBR",0,"C");
		$this->pdf->Cell(15,6,"Marks","LRB",0,"C");
		$this->pdf->Cell(15,6,"Marks","LRB",0,"C");
		if($this->FSCHEME == 'CR')
			$this->pdf->Cell(18,6,"C.G.P.A","LRB",0,"C");
		else	
			$this->pdf->Cell(18,6,"","LRB",0,"C");
        $this->pdf->Cell(38,6,"","LRB",0,"C");
		$this->pdf->Cell(30,6,"Remarks","LRB",1,"C");
       
	}

	function formdata()
	{

		$query = "delete from res_sum where fcollcode = '{$this->collcode}' and
		fdegree = '{$this->degree}' and fexamno = '{$this->degexam}' 
		and fyear = '{$this->year}' and fexamtype = '{$this->examtye}'";
		$results = $this->aobj_context->mobj_db->Execute($query);
	

		$query = "insert ignore into res_sum(fdegree,fexamno,fcollcode,fregno,fmaxmarks,ftotmarks,fpercent,fclass,fremarks,fyear,fexamtype)
		select distinct r.fdegree, r.fexamno,s.fcollcode,r.fregno, r.fmaxmarks, r.ftotmarks, 
		if(r.fpercent = '',' - ',ifnull(r.fpercent,' - ')) as fpercent, r.fclass, r.fmcnumber,
		r.fyear,r.fexamtype 
		from resmarks r inner join student s on r.fdegree = s.fdegree and r.fregno = s.fregno
		where s.fcollcode = '{$this->collcode}'
		and r.fdegree = '{$this->degree}' and r.fexamno = '{$this->degexam}'
		and r.fyear = '{$this->year}' and r.fexamtype = '{$this->examtye}'";
		
     //  var_dump($query);
      // die();
		$results = $this->aobj_context->mobj_db->Execute($query);

			$lobj_fee_data = "select count(res_sum.fregno) as fappeared, 
			sum(if(fclass = 'withheld' and res_sum.fremarks not like '%MAL-PRACTICE%',1,0)) as fwh,
			sum(if(fclass = 'withheld' and res_sum.fremarks like '%MAL-PRACTICE%',1,0)) as fmp,
			count(res_sum.fregno) - sum(if(fclass = 'withheld',1,0)) as fdeclared,
			sum(if(fclass not like '%FAIL%' and fclass not like '%withheld%',1,0)) as fpass,
			sum(if(fclass like '%FAIL%',1,0)) as ffail,
			sum(if(fclass not like '%FAIL%' and fclass not like '%withheld%',1,0)) * 100 /(count(res_sum.fregno) - sum(if(fclass = 'withheld',1,0))) as passperct
			from res_sum inner join student s on res_sum.fregno = s.fregno and res_sum.fcollcode = s.fcollcode 
			AND res_sum.fdegree = s.fdegree
			where res_sum.fdegree = '{$this->degree}' 
			and res_sum.fexamno = '{$this->degexam}' 
			and s.fcollcode = '{$this->collcode}'
			and res_sum.fyear = '{$this->year}' and res_sum.fexamtype = '{$this->examtye}'";
		$results = $this->aobj_context->mobj_db->GetRow($lobj_fee_data);
		// var_dump($lobj_fee_data);
		$lobj_fee_data = "select distinct r.fregno, s.fname, r.fdegree, r.ftotmarks, 
        r.fmaxmarks, if(r.fpercent = '',' - ',ifnull(r.fpercent,' - ')) as fpercent, fclass, FSCHEME, r.fmcnumber as remarks
		from resmarks r inner join student s 
			on r.fdegree = s.fdegree and r.fregno = s.fregno
			where s.fdegree = '{$this->degree}' and s.fcollcode = '{$this->collcode}'
			and r.fexamno = '{$this->degexam}'
			and r.fyear = '{$this->year}' and r.fexamtype = '{$this->examtye}'";
		$lobj_get_fee_data = $this->aobj_context->mobj_db->GetAll($lobj_fee_data);
		// var_dump($lobj_fee_data);

		$this->pdf->AddPage();
		$this->pdf->Ln(5);
		$this->FSCHEME = $lobj_get_fee_data[0]['FSCHEME'];
		$this->pdf->SetFont('Times','B',12);
		$this->pdf->Cell(0,6,"Result Summary",1,1,'C');
		$this->pdf->SetFont('Times','B',10);
       	$this->pdf->Cell(30,6,"Students","LRT",0,'C');
		$this->pdf->Cell(25,6,"Result","LRT",0,"C");
		$this->pdf->Cell(25,6,"MPC","LRT",0,"C");
		$this->pdf->Cell(25,6,"Result","LRT",0,"C");
		$this->pdf->Cell(30,6,"Students","LRT",0,"C");
		$this->pdf->Cell(30,6,"Students","LRT",0,"C");
		$this->pdf->Cell(25,6,"Pass","LRT",1,"C");

		$this->pdf->Cell(30,6,"Appeared","LRB",0,"C");
		$this->pdf->Cell(25,6,"Withheld","LRB",0,"C"); 
		$this->pdf->Cell(25,6,"Withheld","LBR",0,"C");
		$this->pdf->Cell(25,6,"Declared","LRB",0,"C");
		$this->pdf->Cell(30,6,"Passed","LRB",0,"C");
		$this->pdf->Cell(30,6,"Failed","LRB",0,"C");
        $this->pdf->Cell(25,6,"Percentage","LRB",1,"C");
		
		$this->pdf->SetFont('Times','',10);
		$this->pdf->Cell(30,6,$results['fappeared'],"1",0,"C");
		$this->pdf->Cell(25,6,$results['fwh'],"1",0,"C"); 
		$this->pdf->Cell(25,6,$results['fmp'],"1",0,"C"); 
		$this->pdf->Cell(25,6,$results['fdeclared'],"1",0,"C");
		$this->pdf->Cell(30,6,$results['fpass'],"1",0,"C");
		$this->pdf->Cell(30,6,$results['ffail'],"1",0,"C");
		$this->pdf->Cell(25,6,number_format((float)$results['passperct'], 2, '.', ''),"1",1,"C");

		 
			
       $this->pdf->Ln(5);
       $this->pdf->SetFont('Times','UB',12);
       $this->pdf->Cell(5,6,"Result List",0,1,'L');
       $this->pdf->Ln(1);
       //$this->pdf->SetFont('Times','',10);
       $this->tableHeader();

       $i = 1;
		foreach ($lobj_get_fee_data as $key => $value) 
		{
			
			if($this->pdf->getY() > 275)
			{
				$this->pdf->AddPage();
				$this->tableHeader();
			}	

			$name1=substr($value['fname'],0,19);
			$name2=substr($value['fname'],19);
			$this->pdf->SetFont('Times','',9);
			if(empty($name2))
			{
				//$this->pdf->SetFont('Times','',9);
				$this->pdf->Cell(8,6,$i,"1",0,"C");
				$this->pdf->Cell(22,6,$value['fregno'],"1",0,"C"); 
				$this->pdf->Cell(45,6,$name1,"1",0,"L");
				$this->pdf->Cell(15,6,$value['fmaxmarks'],"1",0,"C");
				$this->pdf->Cell(15,6,$value['ftotmarks'],"1",0,"C");
				$this->pdf->Cell(18,6,$value['fpercent'],"1",0,"C");
		        $this->pdf->Cell(38,6,$value['fclass'],"1",0,"L");
				$this->pdf->Cell(30,6,$value['remarks'],"1",1,"L");

		    }else 
		    {
		    	$this->pdf->Cell(8,6,$i,"LRT",0,"C");
				$this->pdf->Cell(22,6,$value['fregno'],"LRT",0,"C"); 
				$this->pdf->Cell(45,6,$name1,"LRT",0,"L");
				$this->pdf->Cell(15,6,$value['fmaxmarks'],"LRT",0,"C");
				$this->pdf->Cell(15,6,$value['ftotmarks'],"LRT",0,"C");
				$this->pdf->Cell(18,6,$value['fpercent'],"LRT",0,"C");
		        $this->pdf->Cell(38,6,$value['fclass'],"LRT",0,"L");
				$this->pdf->Cell(30,6,$value['remarks'],"LRT",1,"L");
		        $this->pdf->Cell(8,6,"","LRB",0,"C");
				$this->pdf->Cell(22,6,"","LRB",0,"C"); 
				$this->pdf->Cell(45,6,$name2,"LRB",0,"L");
				$this->pdf->Cell(15,6,"","LRB",0,"C");
				$this->pdf->Cell(15,6,"","LRB",0,"C");
				$this->pdf->Cell(18,6,"","LRB",0,"C");
		        $this->pdf->Cell(38,6,"","LRB",0,"L");
				$this->pdf->Cell(30,6,"","LRB",1,"L");
		    }  
	        
	        $i++;
		}	

	}

	function SendOutput()
	{
		$this->pdf->Output("Result_Sheet.pdf","D");
	}
}

function generesultsheet($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->SendOutput();
}
?>