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 : 52.15.109.209


Current Path : /proc/thread-self/root/var/www/oasis/Report_details/
Upload File :
Current File : //proc/thread-self/root/var/www/oasis/Report_details/gerderwiseresultsheet.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"];
		$this->section = $aobj_context->mobj_data["section"];	

		$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,
		// d.fresexamdate,d.fdescpn,d.fexamname from college c, degree d 
		// where fcollcode = '{$this->collcode}' and d.fdegree = '{$this->degree}' 
		// and d.fexamno = '{$this->degexam}'";

        $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()
	{
		$pageOrientation = $this->CurOrientation;
		$reporttype="gwrs";
		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);
	// 	$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,28,4,250);
	// 			$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");
	// 	}
	// 	$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(37);
	// 	}
	// 	$this->pdf->SetFont('Times','B',10);
	// 	$this->pdf->cell(0,7,"GENDER WISE RESULT SHEET","0",1,"C");
	// 	$this->pdf->cell(0,7,$this->fdescpn." EXAMINATION - ".$this->fresexamdate." / [".$this->fexamname."] ","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(13);
		}

		$this->pdf->SetFont('Times', 'B', 14);
        $this->pdf->Cell(15, 7, "Sl.", "LRT", 0, "C");
        $this->pdf->Cell(20, 7, "Degree", "LRT", 0, "C");
        $this->pdf->Cell(70, 7, "Description", "LRT", 0, "C");
        $this->pdf->Cell(54, 7, "Appeared", "1", 0, "C");
        $this->pdf->Cell(54, 7, "Pass", "1", 0, "C");
        $this->pdf->Cell(54, 7, "Fail", "1", 1, "C");

        $this->pdf->SetFont('Times', 'B', 14);
        $this->pdf->Cell(15, 7, " No.", "LRB", 0, "C");
        $this->pdf->Cell(20, 7, "", "LRB", 0, "C");
        $this->pdf->Cell(70, 7, "", "LRB", 0, "C");
        $this->pdf->Cell(18, 7, "Male", "LRB", 0, "C");
        $this->pdf->Cell(18, 7, "Female", "LRB", 0, "C");
        $this->pdf->Cell(18, 7, "Total", "LRB", 0, "C");
        $this->pdf->Cell(18, 7, "Male", "LRB", 0, "C");
        $this->pdf->Cell(18, 7, "Female", "LRB", 0, "C");
        $this->pdf->Cell(18, 7, "Total", "LRB", 0, "C");
        $this->pdf->Cell(18, 7, "Male", "LRB", 0, "C");
        $this->pdf->Cell(18, 7, "Female", "LRB", 0, "C");
        $this->pdf->Cell(18, 7, "Total", "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' OR fgender = 'Male' THEN 1 ELSE 0 END) AS Male1,
    	SUM(CASE WHEN fgender = 'F' OR fgender = 'Female' THEN 1 ELSE 0 END) AS Female1,
		count(s.fregno) as Totalcount, 
		SUM(CASE WHEN LOCATE('fail',fclass) >0 AND (fgender = 'M' OR fgender = 'Male') THEN 1 ELSE 0 END) AS Male2,
		SUM(CASE WHEN LOCATE('fail',fclass) >0 AND (fgender = 'F' OR fgender = 'Female') THEN 1 ELSE 0 END) AS Female2,
		SUM(CASE WHEN LOCATE('fail',fclass) >0 AND (fgender = 'M' OR fgender = 'Male') THEN 1 ELSE 0 END) + 
		SUM(CASE WHEN LOCATE('fail',fclass) >0 AND (fgender = 'F' OR fgender = 'Female') THEN 1 ELSE 0 END) AS 'pass_cnt',
		SUM(CASE WHEN LOCATE('fail',fclass) <=0 AND (fgender = 'M' OR fgender = 'Male') THEN 1 ELSE 0 END) AS Male3,
		SUM(CASE WHEN LOCATE('fail',fclass) <=0 AND (fgender = 'F' OR fgender = 'Female') THEN 1 ELSE 0 END) AS Female3,
		SUM(CASE WHEN LOCATE('fail',fclass) <=0 AND (fgender = 'M' OR fgender = 'Male') THEN 1 ELSE 0 END) + 
		SUM(CASE WHEN LOCATE('fail',fclass) <=0 AND (fgender = 'F' OR fgender = 'Female') 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() > 220) {
                      $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("Gender_wise_Result_Sheet.pdf","I");
	}
}

function genwiseressheet($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();
	$class_obj->formcolldata();
	$class_obj->formdata();
	$class_obj->SetTitle("Gender_wise_Result_Sheet");
	$class_obj->SendOutput();
}
?>