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


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

<?php
    $main_src=substr($_SERVER['SCRIPT_FILENAME'],0,strlen($_SERVER['SCRIPT_FILENAME'])-7);
    $pdf_writer_class =$main_src."/tcpdf/tcpdf.php";
    require_once($pdf_writer_class);
    include_once("stringspliter.php");
    require_once("/var/www/html/aws/aws-autoloader.php");
    require_once 'headerNfooter.php';

    use Aws\S3\S3Client;
    use Aws\S3\Exception\S3Exception;

    ini_set('max_execution_time', 300);
    ini_set("memory_limit","500M");
	
    class ra_invigilators_dairy  extends TCPDF{
	    function DefaultConstructor($aobj_context){
            session_start();
            $this->aobj_context=$aobj_context;
            $this->pdf=  new TCPDF(); 
            $this->pdf=$this;
            
            $this->db=trim($this->aobj_context->mobj_data["db"]);

            $this->degree=trim($this->aobj_context->mobj_data["degree"]);
            $this->degexam=trim($this->aobj_context->mobj_data["degexam"]);
            $this->yearmode=trim($this->aobj_context->mobj_data["yearmode"]);
            $this->section=trim($this->aobj_context->mobj_data["section"]);

            $this->collcode=$_SESSION['collcode'];
            $this->funivcode=$_SESSION['FUNIVCODE'];
            $this->ip=$_SERVER["REMOTE_ADDR"];

            $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}'";
           
        
            $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;
           
            $this->headeractive = true;
            $this->startPageGroup();
	    }
 
        function Header(){
            $pageOrientation = $this->CurOrientation;
            $reporttype="srag";
            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);

            // $deg = "select distinct fdescpn from degree where fdegree='{$this->degree}'";
            // $resDeg =  $this->aobj_context->mobj_db->GetRow($deg);
            // // if($FUNIVCODE == '055'){
            // // }
           
            // if($this->funivcode == '055'){
            //     generateHeader($this->db, $this->pdf, $pageOrientation);
            // }
            // elseif($FUNIVCODE == '031'){
            //     if(!empty($this->pdf_logo_path))
            //     {
            //         $img_logo_path=$this->aobj_context->main_src. '/'.$this->aobj_context->mobj_data["db"]."/img/report_uni_logo.jpg";
            //         $this->pdf->Image($img_logo_path,60,4,80);
            //         $this->pdf->Ln(10);
            //     }	
            // }
            // else{	
            //     if(!empty($this->pdf_logo_path))
            //     {
            //         if($this->funivcode=="051"){
            //             $img_logo_path=$this->aobj_context->main_src.'/'.$this->aobj_context->mobj_data["db"].'/'.$this->pdf_logo_path;
            //             $this->pdf->Image($img_logo_path,10,2,35);
            //         }else{
            //             $img_logo_path=$this->aobj_context->main_src.'/'.$this->aobj_context->mobj_data["db"].'/'.$this->pdf_logo_path;
            //             $this->pdf->Image($img_logo_path,10,10,35);
            //         }
                    
            //     }
		    //     $this->SetY(8);

            //     $this->pdf->SetFont('Times','B',8);
            //     $this->Cell(0, 6,'Page ' .$this->PageNo().'', 0, 1, 'R');
		    //     $this->SetY(0);

            //     $this->pdf->SetFont('Times','B',15);
            //     $this->pdf->ln(5);
            //     if($this->funivcode=="052"){
            //         $this->pdf->SetFont('Times','B',8);
            //         $this->pdf->cell(0,7,""."JSS MAHAVIDYAPEETHA","0",1,"C");
            //     }
            //     $this->pdf->SetFont('Times','B',10);
            //     $this->pdf->cell(0,3,$this->FUNIVNAME."","0",1,"C");
            //     $this->pdf->SetFont('Times','B',8);
            //     $this->pdf->cell(0,6, $this->s_state,"0",1,"C");
            
            
            // $this->pdf->SetFont('Times','B',12);
            // $this->pdf->cell(0,6, "College : $this->college_details ","0",1,"C");
            // }
            // if($this->funivcode == '055'){
		    // $this->SetY(35);
            // }
            // $this->pdf->cell(0,7,"SUBJECTWISE RESULT ANALYSIS(GRADEWISE) - ".$this->fresexamdate." EXAMINATION", "0",1,"C");
            // $this->pdf->SetFont('Times','B',10);
            // $this->pdf->cell(0,7,$this->fexamname." - ". ($resDeg['fdescpn']),"0",1,"C");
            // $this->pdf->SetFont('Times','B',12);
            $this->pdf->Cell(0,5,$this->date.$this->classid,"0",0,"L");       
        }	
	
        function Footer(){
        $sign = $this->aobj_context->main_src.$this->aobj_context->mobj_data["db"]."/img/controler_sign.jpg";
		$this->SetY(-20);
		$y = -10;
		$x = 210;
		$size = 40;
		$img_x=($this->pdf->getX()+$x);;
		$img_y=$this->pdf->getY()+$y;
		$this->pdf->SetFont('Times','B',10);
		if($this->funivcode=="052"){
			if(file_exists($sign)) 
			$this->pdf->Image($sign,$img_x,$img_y,$size);
		}
        $this->pdf->Cell(250,4,"Controller of Examinations","",0,"R");
            $this->SetY(-15);
            $this->pdf->SetFont('Times','B',8);
            //$this->Cell(140,6,'Entered  : IP Address : '.$this->ip_address." Date ".$this->created_date,'0',0,'L');
            $this->Cell(140,6,'Printed   : IP Address : '.$this->ip." Date ".$this->current_date,'0',0,'L');
            // $this->Cell(50,6,'Page '.$this->PageNo().' of {nb}',0,1,'R');
           
        }
	
        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->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'];
            $this->funivcode=$lobj_get_coll_name['FUNIVCODE'];
            $get_data="SELECT c.FCOLLCODE,
                    CONCAT(c.FCOLLCODE, ' - ', c.FCOLLNAME,', ',c.FTOWN) AS FCOLLNAME FROM college c
                    where c.FCOLLCODE='{$this->collcode}'";					
            $obj_student=$this->aobj_context->mobj_db->GetRow($get_data); 
            
            $this->college_details = $obj_student['FCOLLNAME'];
            $this->degree_details  = " College : {$this->FCOLLNAME}";

            $this->pdf->Ln();	
        }
	 
        function writepdf($data){
        
            $split = explode("*", $this->yearmode);
            $year = $split[0];
            $examtype = $split[1];
            if($this->section === "All"){
                $secCond = "";
            }else{
                 $secCond = "and ifnull(fsection, '') = '{$this->section}'";
            }


            $deg = "select distinct fdescpn from degree where fdegree='{$this->degree}'";
            $resDeg =  $this->aobj_context->mobj_db->GetRow($deg);
           
            if($this->funivcode !=="051"){
                $qrySection = "select distinct fsection from student where ifnull(fsection, '') <> '' {$secCond} order by fsection";
                $resSection =  $this->aobj_context->mobj_db->GetAll($qrySection);
            }else{
                $qrySection = "select distinct fdescpn from degree where fdegree='{$this->degree}'";
                $resSection =  $this->aobj_context->mobj_db->GetAll($qrySection);
            }

            foreach($resSection as $value){

            if($this->funivcode=="051"){
                $query ="SELECT count(*)AS count, r.fdegree, (SELECT DISTINCT fsubshort FROM subject WHERE fsubcode = r.fsubcode 
                    AND fdegree='{$this->degree}' AND fexamno='{$this->degexam}')AS fsubcode, 
                    (select distinct fcredits from subject where fsubcode = r.fsubcode 
                    and fdegree='{$this->degree}' AND fexamno='{$this->degexam}')as fcredits,
                    SUM(CASE WHEN IFNULL(fgrade, '') = 'NE' THEN 1 ELSE 0 END)AS fne, 
                    SUM(CASE WHEN IFNULL(fgrade, '') = 'F' THEN 1 ELSE 0 END)AS ff, SUM(CASE WHEN IFNULL(fgrade, '') = 'AB' THEN 1 ELSE 0 END)AS fab, 
                    SUM(CASE WHEN IFNULL(fgrade, '') = 'MP' OR IFNULL(fgrade, '') = 'I' OR IFNULL(fgrade, '') = 'TL' OR IFNULL(fgrade, '') = 'DR' OR 
                    IFNULL(fgrade, '') = 'W' THEN 1 ELSE 0 END)AS fmp, SUM(CASE WHEN IFNULL(fgrade, '') = 'S' THEN 1 ELSE 0 END)AS fs,
                    SUM(CASE WHEN IFNULL(fgrade, '') = 'A' THEN 1 ELSE 0 END)AS fa, SUM(CASE WHEN IFNULL(fgrade, '') = 'B' THEN 1 ELSE 0 END)AS fb, 
                    SUM(CASE WHEN IFNULL(fgrade, '') = 'C' THEN 1 ELSE 0 END)AS fc, SUM(CASE WHEN IFNULL(fgrade, '') = 'D' THEN 1 ELSE 0 END)AS fd, 
                    SUM(CASE WHEN IFNULL(fgrade, '') = 'E' THEN 1 ELSE 0 END)AS fe, SUM(CASE WHEN IFNULL(fclass, '') = 'pass' THEN 1 ELSE 0 END)AS 
                    fpass, SUM(CASE WHEN IFNULL(fclass, '') = 'fail' THEN 1 ELSE 0 END)AS ffail FROM resmarks r 
                    INNER JOIN student s ON s.fdegree = r.fdegree AND s.fregno = r.fregno WHERE r.fdegree='{$this->degree}'
                    AND r.fexamno='{$this->degexam}' AND r.fyear='{$year}' AND r.fexamtype='{$examtype}' GROUP BY r.fsubcode, r.fdegree
                    ORDER BY r.fsubcode";
                    
            }
            else
            {
                $query = "select count(*)as count, r.fdegree,
                    (select distinct fsubshort from subject where fsubcode = r.fsubcode 
                    and fdegree='{$this->degree}' and fexamno='{$this->degexam}')as fsubcode,
                    (select distinct fcredits from subject where fsubcode = r.fsubcode 
                    and fdegree='{$this->degree}' and fexamno='{$this->degexam}')as fcredits,
                    sum(case when ifnull(fgrade, '') = 'NE' then 1 else 0 end)as fne,
                    sum(case when ifnull(fgrade, '') = 'F' then 1 else 0 end)as ff,
                    sum(case when ifnull(fgrade, '') = 'AB' then 1 else 0 end)as fab,
                    sum(case when ifnull(fgrade, '') = 'MP' or 
                    ifnull(fgrade, '') = 'I' or  
                    ifnull(fgrade, '') = 'TL' or 
                    ifnull(fgrade, '') = 'DR' or 
                    ifnull(fgrade, '') = 'W'
                    then 1 else 0 end)as fmp,
                    sum(case when ifnull(fgrade, '') = 'S' then 1 else 0 end)as fs,
                    sum(case when ifnull(fgrade, '') = 'A' then 1 else 0 end)as fa,
                    sum(case when ifnull(fgrade, '') = 'B' then 1 else 0 end)as fb,
                    sum(case when ifnull(fgrade, '') = 'C' then 1 else 0 end)as fc,
                    sum(case when ifnull(fgrade, '') = 'D' then 1 else 0 end)as fd,
                    sum(case when ifnull(fgrade, '') = 'E' then 1 else 0 end)as fe,
                    sum(case when ifnull(fgrade, '') = 'pass' then 1 else 0 end)as fpass,
                    sum(case when ifnull(fgrade, '') = 'fail' then 1 else 0 end)as ffail
                    from resmarks r inner join student s on s.fdegree = r.fdegree and 
                    s.fregno = r.fregno 
                    where r.fdegree='{$this->degree}' and s.fsection='{$value['fsection']}' 
                    and r.fexamno='{$this->degexam}'
                    and r.fyear='{$year}' and r.fexamtype='{$examtype}' 
                    group by r.fsubcode, r.fdegree order by r.fsubcode";
            }
            
            $res =  $this->aobj_context->mobj_db->GetAll($query);
                
                 $pdf=$this->pdf;
                    $pdf->SetMargins(20,35,25,10);
                    $pdf->startPageGroup();
                    $pdf->SetFont('Times','B',10);
                   
                        if(count($res) > 0){

                            $pdf->AddPage("L");
                            if($this->funivcode =="055"){
                                $this->SetY(45);
                            }
                            else{ 
                                $this->SetY(40);
                            }
                            if($this->funivcode !=="051"){
    
                            $this->pdf->cell(0,7, "Section: ".$value['fsection'],"",1,"L");
                            }
                            $pdf->SetFont('Times','B',10);
                        
                            $this->pdf->cell(15,6, "","LRT",0,"C");
                            $this->pdf->cell(25,6, "Subject","LRT",0,"C");
                            $this->pdf->cell(26,6, "No. of Students","LRT",0,"C");
                            $this->pdf->cell(105,6, "No. of Students with","LRTB",0,"C");
                            $this->pdf->cell(90,6, "No. of Students Awarded (Counts/Percentage)","LRTB",1,"C");
    
                            $this->pdf->cell(15,6, "Sl. No.","LR",0,"C");
                            $this->pdf->cell(25,6, "Codes","LR",0,"C");
                            $this->pdf->cell(26,6, "Registered","LR",0,"C");
                            $this->pdf->cell(15,6, "NE","LR",0,"C");
                            $this->pdf->cell(15,6, "F","LR",0,"C");
                            $this->pdf->cell(15,6, "AB","LR",0,"C");
                            $this->pdf->cell(15,6, "PP","LR",0,"C");
                            $this->pdf->cell(15,6, "NP","LR",0,"C");
                            $pdf->SetFont('Times','B',9);
    
                            $this->pdf->cell(30,6, "OTHERS","LR",0,"C");
                            $pdf->SetFont('Times','B',10);
    
                            $this->pdf->cell(15,6, "S","LR",0,"C");
                            $this->pdf->cell(15,6, "A","LR",0,"C");
                            $this->pdf->cell(15,6, "B","LR",0,"C");
                            $this->pdf->cell(15,6, "C","LR",0,"C");
                            $this->pdf->cell(15,6, "D","LR",0,"C");
                            $this->pdf->cell(15,6, "E","LR",1,"C");
    
                            $this->pdf->cell(15,3, "","LRB",0,"C");
                            $this->pdf->cell(25,3, "","LRB",0,"C");
                            $this->pdf->cell(26,3, "","LRB",0,"C");
                            $this->pdf->cell(15,3, "","LRB",0,"C");
                            $this->pdf->cell(15,3, "","LRB",0,"C");
                            $this->pdf->cell(15,3, "","LRB",0,"C");
                            $this->pdf->cell(15,3, "","LRB",0,"C");
                            $this->pdf->cell(15,3, "","LRB",0,"C");
                            $pdf->SetFont('Times','B',10);
                            $this->pdf->cell(30,3, "(MP, I, TL, DR, W)","LRB",0,"C");
                            $pdf->SetFont('Times','B',10);
    
                            $this->pdf->cell(15,3, "","LRB",0,"C");
                            $this->pdf->cell(15,3, "","LRB",0,"C");
                            $this->pdf->cell(15,3, "","LRB",0,"C");
                            $this->pdf->cell(15,3, "","LRB",0,"C");
                            $this->pdf->cell(15,3, "","LRB",0,"C");
                            $this->pdf->cell(15,3, "","LRB",1,"C");
                            $pdf->SetFont('Times','B',10);
    
                            $c = 1;
                    foreach($res as $val){
                        
                            $y = $this->pdf->getY();
                            $pdf->SetFont('Times','',10);
                        
                            $this->pdf->cell(15,5, $c,"LR",0,"C");
                            $this->pdf->cell(25,5, $val['fsubcode'],"LR",0,"C");						
                            $this->pdf->cell(26,5, $val['count'],"LR",0,"C");
                            $this->pdf->cell(15,5, $val['fne'],"LR",0,"C");
                            $this->pdf->cell(15,5, $val['ff'],"LR",0,"C");
                            $this->pdf->cell(15,5, $val['fab'],"LR",0,"C");
                            $this->pdf->cell(15,5, $val['fpass'],"LR",0,"C");
                            $this->pdf->cell(15,5, $val['ffail'],"LR",0,"C");
                            $this->pdf->cell(30,5, $val['fmp'],"LR",0,"C");
                            
                            
    
                            if($val['fcredits'] != 0 ){
                                $this->pdf->cell(15,5, $val['fs'],"LR",0,"C");
                                $this->pdf->cell(15,5, $val['fa'],"LR",0,"C");
                                $this->pdf->cell(15,5, $val['fb'],"LR",0,"C");
                                $this->pdf->cell(15,5, $val['fc'],"LR",0,"C");
                                $this->pdf->cell(15,5, $val['fd'],"LR",0,"C");
                                $this->pdf->cell(15,5, $val['fe'],"LR",1,"C");
                            }else{
                                $this->pdf->cell(15,5, "-","LR",0,"C");
                                $this->pdf->cell(15,5, "-","LR",0,"C");
                                $this->pdf->cell(15,5, "-","LR",0,"C");
                                $this->pdf->cell(15,5, "-","LR",0,"C");
                                $this->pdf->cell(15,5, "-","LR",0,"C");
                                $this->pdf->cell(15,5, "-","LR",1,"C");
                            }
                            
    
                            $this->pdf->cell(15,5,"","LRB",0,"C");
                            $this->pdf->cell(25,5,"","LRB",0,"C");						
                            $this->pdf->cell(26,5,"" ,"LRB",0,"C");
                            $this->pdf->cell(15,5, "","LRB",0,"C");
                            $this->pdf->cell(15,5, "","LRB",0,"C");
                            $this->pdf->cell(15,5, "","LRB",0,"C");
                            $this->pdf->cell(15,5, "","LRB",0,"C");
                            $this->pdf->cell(15,5, "","LRB",0,"C");
        
                            $this->pdf->cell(30,5, "","LRB",0,"C");
                            if($val['fcredits'] != 0){
                                $this->pdf->cell(15,5, round($val['fs'] / $val['count'] * 100,2),"LRB",0,"C");
                                $this->pdf->cell(15,5, round($val['fa'] / $val['count'] * 100,2),"LRB",0,"C");
                                $this->pdf->cell(15,5, round($val['fb'] / $val['count'] * 100,2),"LRB",0,"C");
                                $this->pdf->cell(15,5, round($val['fc'] / $val['count'] * 100,2),"LRB",0,"C");
                                $this->pdf->cell(15,5, round($val['fd'] / $val['count'] * 100,2),"LRB",0,"C");
                                $this->pdf->cell(15,5, round($val['fe'] / $val['count'] * 100,2),"LRB",1,"C");
                            }else{
                                $this->pdf->cell(15,5, "-","LRB",0,"C");
                                $this->pdf->cell(15,5, "-","LRB",0,"C");
                                $this->pdf->cell(15,5, "-","LRB",0,"C");
                                $this->pdf->cell(15,5, "-","LRB",0,"C");
                                $this->pdf->cell(15,5, "-","LRB",0,"C");
                                $this->pdf->cell(15,5, "-","LRB",1,"C");
                            }
                            
                        
                        
                            $c++;
                    }
                  }
               
             }
        }
	 
        function SendOutput(){
            $this->pdf->Output("gradewisesubjectanalysis.pdf","I");
        }
    }

    function gradewisesubjectanalysis($aobj_context){
        $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
        $class_obj=new ra_invigilators_dairy();
        $class_obj->DefaultConstructor($aobj_context);
        $class_obj->formcolldata();
        $class_obj->writepdf();
        $class_obj->SetTitle('Grade Wise Subject Analysis');
        $class_obj->SendOutput();
    }
?>