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


Current Path : /var/www/oasis/Report_details/
Upload File :
Current File : /var/www/oasis/Report_details/subjwisepasspercentagePie.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");
    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();
            include_once($aobj_context->main_src."/src/format.php");
		
            $this->aobj_context=$aobj_context;
            $this->pdf=  new TCPDF();
            $this->pdf=$this;
            
            $this->univcode = $_SESSION['univcode'];
            $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"];
            $this->section = $aobj_context->mobj_data["section"];

            
            $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);
            // var_dump($obj,"vikkkk");
            // die();
            $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($section){
            $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,35);
            }
            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()}",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,"SUBJECT WISE RESULT ANALYSIS - ".$this->fresexamdate ." EXAMINATION ","0",1,"C");
            $this->pdf->cell(0,7,$this->fexamname." - ".$this->fdescpn,"0",1,"C");
        }	
	
        function Footer(){
            $sign = $this->aobj_context->main_src.$this->aobj_context->mobj_data["db"]."/img/controler_sign.jpg";
            $this->SetY(-30);
            $y = 5;
            $x = 170;
            $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(0,40,"Controller of Examinations","",0,"R");
    
            $this->SetY(-14);
            $new_y=$this->pdf->GetY();
            $this->pdf->Ln(2);
            $this->Cell(140,5,'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 writepdf($data){
            $split = explode("*", $this->yearmode);
            $year = $split[0];
            $examtype = $split[1];

            if($this->section === "All"){
                $secCond = "";
            }else{
                $secCond = "";
            }

           $qrySection = "select distinct fsection from student where ifnull(fsection, '') <> '' {$secCond} order by fsection";
		   $resSection =  $this->aobj_context->mobj_db->GetAll($qrySection);
         
            foreach($resSection as $value){

                $query="SELECT r.fdegree,r.fsubcode,fsubshort,fsubname,COUNT(r.fregno) AS cnt,
                SUM(IF(FTHPASSMTH = 'Pass',1,0)) AS  passcnt,
                SUM(IF(FTHPASSMTH <> 'Pass',1,0)) AS  failcnt
                FROM resmarks r 
                INNER JOIN `subject` s ON r.fsubcode = s.fsubcode
                AND r.fdegree = s.fdegree AND r.fexamno = s.fexamno 
                inner join student st on r.fdegree = st.fdegree and r.fregno = st.fregno
                WHERE r.fdegree='{$this->degree}' AND r.fexamno='{$this->degexam}' 
                AND r.fyear='{$this->year}' AND r.fexamtype = '{$this->examtye}'
                AND IFNULL(s.fintass,'') = 'F'
                AND IFNULL(s.fretain,'') = 'F'
                and fsection='{$value['fsection']}' and s.fssubcode ='0'
                GROUP BY r.fdegree,r.fexamno,r.fsubcode
                order by st.fsection, fsubcode";
    
                $results =  $this->aobj_context->mobj_db->GetAll($query);
                
                $count = count($results);
                $passcnt = 0;
                $failcnt = 0;
                
                if($count > 0){
                    
                    if(count($results) > 0){
                        
                        foreach($results as $val){
                            $pdf=$this->pdf;

                            $pdf->SetMargins(45,50,40,25);
                            $pdf->startPageGroup();
                            $pdf->SetFont('Times','B',10);
                            
                            $pdf->AddPage("L");
                            $this->SetY(40);
                            $c = 1;
                            $xc = 140;
                            $yc = 100;
                            $r = 50;

                            $total=substr($val['cnt'],0);
                            $passed=substr($val['passcnt'],0);

                            $percentage = ($passed / $total)*100;
                            $explode = explode(".", $percentage);
                            list($whole, $decimal) = explode('.',$percentage);
                            $totalperc= round($percentage, 2);

                            $passcnt = (round($val['passcnt'] / $val['cnt'] * 360,2));
                            $failcnt = (round($val['failcnt'] / $val['cnt'] * 360,2));
                            
                            $this->pdf->SetFillColor(0, 132, 0);
                            $this->pdf->PieSector($xc, $yc, $r, 0, $passcnt);
                            
                            $this->pdf->SetFillColor(218, 0, 0);
                            $this->pdf->PieSector($xc, $yc, $r, $passcnt, $passcnt+$failcnt);

                            $this->pdf->SetTextColor(0,0,0);
                            $this->pdf->cell(0,120, "Section: ".$value['fsection'],"",1,"L");
                    
                            $this->pdf->SetFont('Times','B',9);
                            
                            $this->pdf->Cell(22,5,"Subject","LRT",0,"C");
                            $this->pdf->SetFont('Times','B',11	);
                            $this->pdf->Cell(75,10,"Subject Name","LRT",0,"C"); 

                            $this->pdf->SetFont('Times','B',9);
                            $this->pdf->Cell(23,10,"Appeared","LRTB",0,"C");
                            $this->pdf->SetTextColor(0, 132, 0);
                            $this->pdf->Cell(23,10,"Passed","LRTB",0,"C");
                            $this->pdf->SetTextColor(218, 0, 0);
                            $this->pdf->Cell(23,10,"Failed","LRTB",0,"C");
                            $this->pdf->SetTextColor(0, 0, 0);
                            $this->pdf->Cell(17,5,"Pass","LRT",1,"C");

                            $this->pdf->SetFont('Times','B',9);
                            
                            $this->pdf->Cell(22,5,"Code","LRB",0,"C"); 
                            
                            $this->pdf->Cell(75,0,"","",0,"C"); 

                            $this->pdf->Cell(23,0,"","",0,"C");
                            $this->pdf->Cell(23,0,"","",0,"C");
                            $this->pdf->Cell(23,0,"","",0,"C");
                            $this->pdf->Cell(17,5,"Percentage","LRB",1,"C");

                            $this->pdf->Cell(22,9,$val['fsubshort'],"LRB",0,"C");

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

                            $this->pdf->Cell(75,9,$val['fsubname'],"LRBT ",0,"L");
                            $this->pdf->SetFont('Times','',9);
                            
                            $this->pdf->Cell(23,9,$val['cnt'],"LRB",0,"C");
                            $this->pdf->SetTextColor(0, 132, 0);
                            $this->pdf->Cell(23,9,$val['passcnt'],"LRB",0,"C");
                            $this->pdf->SetTextColor(218, 0, 0);
                            $this->pdf->Cell(23,9,$val['failcnt'],"LRB",0,"C");
                            $this->pdf->SetTextColor(0, 0, 0);
                            $this->pdf->Cell(17,9,$totalperc,"LRB",1,"C");
                        }
                    }
                }
            
            }
        }
        function SendOutput()
        {
            
            $this->pdf->Output("subjwisepasspercentagePie.pdf","I");
        }
    }
    function subjwisepasspercentagePie($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->SendOutput();
    }
?>