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


Current Path : /var/www/oasis/Report_details/
Upload File :
Current File : /var/www/oasis/Report_details/categorywisereportpdf.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($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,13,8,180);
				$this->SetY(40);

			}
		}
		elseif(!empty($this->pdf_logo_path) && file_exists($img_path)) 
		{			
			$this->pdf->Image($img_path,10,10,35);
		}
		// $this->pdf->ln(-10);
		if($this->funivcode!=="055"){
		if($this->funivcode=="052"){
			$this->pdf->SetFont('Times','B',9);
			$this->pdf->cell(0,7,""."JSS MAHAVIDYAPEETHA","0",1,"C");
		}
		if($this->funivcode=="051"){
			$this->pdf->Ln(8);}
		
		$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");
		}
		if($this->funivcode=="055"){
			$this->SetY(30);
		}
			$this->pdf->SetFont('Times','B',10);

		$this->pdf->cell(0,7,"CATEGORY WISE 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',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'];
	}

	function tableHeader()
	{
		
		// $this->pdf->SetMargins(40,15,10,true);
      $this->pdf->SetFont('Times', 'B', 13);
      $this->pdf->Cell(15, 7, "Sl. No.", "1", 0, "C");
      $this->pdf->Cell(40, 7, "Category", "1", 0, "C");
      $this->pdf->Cell(40, 7, "Appeared ", "1", 0, "C");
      $this->pdf->Cell(40, 7, "Pass", "1", 0, "C");
      $this->pdf->Cell(40, 7, "Fail", "1", 1, "C");
       
	}

	function formdata()
	{

		$lobj_fee_data = "select distinct concat(r.fdegree, ' - '  ,d.fdescpn ) as degree, 
		concat(d.fdeggrp,' - ',d.fexamname, ' - ' ,d. fresexamdate) as examname, 
		concat(c.fcollcode,' - ',c.fcollname) as college, s.fcaste
		,count(r.fregno) as Totalcount, sum(if(instr(fclass,'fail') > 0,1,0)) as fail_cnt, 
		sum(if(instr(fclass,'fail') <= 0,1,0)) as pass_cnt 
		from (select distinct fregno,fdegree,fclass,fexamno from resmarks 
		where fexamno = '{$this->degexam}' and fdegree = '{$this->degree}'
		and fyear = '{$this->year}'
        and fexamtype = '{$this->examtye}') as r
		 inner join student s on r.fregno = s.fregno and r.fdegree = s.fdegree 
		 inner join degree d on d.fdegree =r.fdegree and d.fexamno = r.fexamno
		  inner join college c on s.fcollcode = c.fcollcode 
		where c.fcollcode = '{$this->collcode}' 
		group by r.fdegree,r.fexamno,fcaste";
		$lobj_get_fee_data = $this->aobj_context->mobj_db->GetAll($lobj_fee_data);

		
			
		$pdf = $this->pdf;
		$pdf->ln(2);
		$pdf->SetMargins(17,10,10,true);
		// $pdf->startPageGroup();
		$pdf->AddPage("P");
	
		$pdf->SetFont('Times', '', 10);
		
		$oldCode = "";
		$newCode = "";
		$sl_no = 1;
		$a = 0;
		$b = 0;
		$c = 0;
		
		// var_dump($exattendancelist);
		
		foreach ($lobj_get_fee_data as $key => $value) {
		  
			$newCode = $value['degree'];
		   
			if($newCode !== $oldCode){
			$sl_no =1;
			if($h!=0){
				$pdf->SetFont('Times', 'B', 12);
				$pdf->Cell(55, 6, "Grand Total", "LRB", 0, "C");
				$pdf->Cell(40, 6, ($a), "LRB", 0, "C");
				$pdf->Cell(40, 6, ($b), "LRB", 0, "C");
				$pdf->Cell(40, 6, ($c), "LRB", 0, "C");
			}
			$h++;
			//  $pdf->AddPage("P");
			$pdf->ln(6);
			$a = 0;
			$b = 0;
			$c = 0;
			//   $pdf->ln(10);
		   $pdf->SetFont('Times', 'B', 12);
			$pdf->cell(175, 8,' '. $value['degree'], 1, 1, "C");
			$pdf->SetFont('Times', '', 10);
			 $this->tableHeader($pdf);
			}
			if ($pdf->getY() > 270) {
				$pdf->AddPage("p");
				$pdf->ln(10);
				$pdf->SetFont('Times', 'B', 10);
				$pdf->cell(175, 8, '' . $value['degree'], 1, 1, "C");
				$pdf->SetFont('Times', '', 10);
				$this->tableHeader($pdf);
	  
				
			}
			$pdf->SetFont('Times', '', 12   );
			$pdf->Cell(15, 6, $sl_no, "1", 0, "C");
			$pdf->Cell(40, 6, $value['fcaste'], "1", 0, "C");
			$pdf->Cell(40, 6, $value['Totalcount'], "1", 0, "C");
			$pdf->Cell(40, 6, $value['pass_cnt'], "1", 0, "C");
			$pdf->Cell(40, 6, $value['fail_cnt'], "1", 1, "C");
			$a += $value['Totalcount'];
			$b += $value['pass_cnt'];
			$c += $value['fail_cnt'];
			$oldCode = $newCode;
			$sl_no++;
		   
		}   
		$pdf->SetFont('Times', 'B', 12);
		$pdf->Cell(55, 6, "Grand Total", "LRB", 0, "C");
		$pdf->Cell(40, 6, ($a), "LRB", 0, "C");
		$pdf->Cell(40, 6, ($b), "LRB", 0, "C");
		$pdf->Cell(40, 6, ($c), "LRB", 1, "C"); 

	}

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

function categorywiseresultsheet($aobj_context)
{

	// var_dump('hii');
	// die();
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$class_obj=new GenerateFeeSummaryReport();
	$class_obj->AliasNbPages();
	$class_obj->DefaultConstructor($aobj_context);

	$class_obj->Header();
    // var_dump('hii');
	// die();
	
	$class_obj->formcolldata();
	$class_obj->formdata();
	$class_obj->SendOutput();
}
?>