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


Current Path : /proc/thread-self/root/var/www/html/pget/admin-src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/pget/admin-src/report_merit_list.php

<?php
// error_reporting(E_ALL & ~E_NOTICE);
// ob_start();
$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;


class MYPDF extends TCPDF
{
    public function Header()
    {
        // get the current page break margin
        $bMargin = $this->getBreakMargin();
        // get current auto-page-break mode
        $auto_page_break = $this->AutoPageBreak;
        // disable auto-page-break
        $this->SetAutoPageBreak(false, 0);
        $this->SetTitle("ApplicationReport");

        // set bacground image
        $this->SetFillColor(248, 248, 255);
        $img_path = $this->aobj_context->main_src . "/img/vku_logo.jpg";

        if (file_exists($img_path)) {
            $this->Image($img_path, 6, 6, 20, 20);
        }

        $img_path1 = $this->aobj_context->main_src . "img/".$this->aobj_context->FUNIVCODE."_logo_2.jpeg";
        //var_dump($img_path);
        if (file_exists($img_path1)) {
            $this->Image($img_path1, 182, 6, 20, 20);
        }

        $this->SetFont('Times', 'B', 13);
        $this->SetY(5);
        $this->Cell(0, 4, $this->aobj_context->FUNIVNAME, 0, 1, 'C');
        //state
        $this->SetFont('Times', '', 11);
        $this->Cell(0, 4, $this->aobj_context->s_state, 0, 1, 'C');

        $this->SetFont('Times', 'BU', 14);
        $this->Cell(0, 5, 'PG Admissions 2020-21', '0', 1, 'C');
        $this->SetFont('Times', 'B', 14);
        $this->Cell(0, 5, 'Merit List', '0', 1, 'C');
        $this->ln(3);
        $this->SetFont('Times', 'B', 12);
        $this->SetAutoPageBreak($auto_page_break, $bMargin);
       
    }

    public function Footer()
    {
        $this->SetY(-15);
        $this->SetFont('helvetica', 'I', 8);
        // var_dump();
        if($this->CurOrientation == 'P')
        {
            $this->Cell(60, 10, 'IP : ' . $_SERVER["REMOTE_ADDR"], 0, 0, 'L');
            $this->Cell(60, 10, 'Date : ' . date("d-m-Y h:i:s A"), 0, 0, 'C');
            $this->Cell(60, 10, 'Page ' . $this->getPageNumGroupAlias() . '/' . $this->getPageGroupAlias(), 0, 1, 'R');
        }
        else {
            $this->Cell(90, 10, 'IP : ' . $_SERVER["REMOTE_ADDR"], 0, 0, 'L');
            $this->Cell(90, 10, 'Date : ' . date("d-m-Y h:i:s A"), 0, 0, 'C');
            $this->Cell(90, 10, 'Page ' . $this->getPageNumGroupAlias() . '/' . $this->getPageGroupAlias(), 0, 1, 'R');
        }
    }
}

class ReprtObject
{

    public function DefaultConstructor($aobj_context)
    {
        $this->aobj_context = $aobj_context;
        $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);

        $this->ip = $_SERVER["REMOTE_ADDR"];
        $get_date = "select DATE_FORMAT(now(), '%d/%m/%Y') as now_date";
        $obj = $this->aobj_context->mobj_db->GetRow($get_date);
        $this->reportType = $aobj_context->mobj_data["rtype"];

        $get_coll_name = "select FUNIVNAME as 'FUNIVNAME',FUNIVCODE,
		FUNIVADD1 as 'state', pdf_logo_path,
		ifnull(FEXAMAPPREQ,'F') as FEXAMAPPREQ From control";
        $lobj_get_coll_name = $this->aobj_context->mobj_db->GetRow($get_coll_name);
// var_dump($get_coll_name);
        $aobj_context->FUNIVNAME = $lobj_get_coll_name['FUNIVNAME'];
        $aobj_context->s_state = $lobj_get_coll_name['state'];
        $aobj_context->pdf_logo_path = $lobj_get_coll_name['pdf_logo_path'];
        $aobj_context->FUNIVCODE = $lobj_get_coll_name['FUNIVCODE'];

        $this->current_date = $obj['now_date'];
        $deggrp = $this->aobj_context->mobj_data["deggrp"];

    
        $this->pdf = new MYPDF('P');
        $this->pdf->aobj_context = $aobj_context;
    }

    public function Header($pdf,$descpn)
    {
        
        $pdf->SetFont('Times', 'B', 12);
        $pdf->Cell(0, 5, $descpn, '0', 1, 'C');
        $pdf->ln(1);
        $pdf->SetFont('Times', 'B', 10);
        $pdf->Cell(12, 7, "Sl. No.", "LTR", 0, "C");
        $pdf->Cell(26, 7, "App. Number", "LTR", 0, "C");
        $pdf->Cell(78, 7, "Name", "LTR", 0, "C");
        $pdf->Cell(22, 7, "DOB", "LTR", 0, "C");
        $pdf->Cell(22, 7, "Category", "LRT", 0, "C");
        $pdf->Cell(18, 7, "HK", "LRT", 0, "C");
        $pdf->Cell(18, 7, "Rank", "LRT", 1, "C");
       
    }

    public function Report($data)
    {
        $pdf = $this->pdf;

        $pdf->SetMargins(07, 28);
        $pdf->startPageGroup();
        //$pdf->AddPage("P");

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

        $oldCode = "";
        $newCode = "";
        $sl_no = 1;
        $first = true;
        $j = 0;
        
        foreach ($data as $key => $value) {
      
            $newCode = $value['fdegree'];
            $degname = $value['fdescpn'];
            if($oldCode != $newCode)
            {
                $pdf->AddPage("P");
                $this->Header($pdf,$degname);
                $sl_no = 1;
            }

            if ($pdf->getY() > 250) {
                $pdf->AddPage("P");
                $this->Header($pdf,$degname);
                $pdf->SetFont('Times', '', 10);
            }

            if ($pdf->getY() > 260) 
            {
                $pdf->AddPage("P");
                $this->Header($pdf,$degname);
                $pdf->SetFont('Times', '', 10);
            }
             
            $pdf->SetFont('Times', '', 10);
           
            $pdf->Cell(12, 6, $sl_no, "1", 0, "C");
            $pdf->Cell(26, 6, $value['fappno'], "1", 0, "C");
            $pdf->Cell(78, 6, $value['fname'], "1", 0, "L");
            $pdf->Cell(22, 6, $value['fdob'], "1", 0, "C");
            $pdf->Cell(22, 6, $value['fcategory'], "1", 0, "C");
            $pdf->Cell(18, 6, $value['fhk'], "1", 0, "C");
            $pdf->Cell(18, 6, $value['frank'], "1", 1, "C");
            $sl_no++;
            $oldCode = $value['fdegree'];
           // var_dump($newCode,$oldCode);
        }
       

    }       
    public function SendOutput()
    {
        // ob_end_clean();
        $this->pdf->Output("ApplicationReport", "I");
    }
}

function MeritList($aobj_context)
{

    $fdegfrom = $aobj_context->mobj_data["fdegfrom"];
    $fdegto = $aobj_context->mobj_data["fdegto"];

    $query = "select s.fappno,d.fdegree,deg.fdescpn,s.fname,DATE_FORMAT(s.fdob, '%d/%m/%Y') as fdob,  
    IF( IFNULL(fcategory,'') = '', 'GM', fcategory) as fcategory, fhk,d.frank  
    from entstudadm s inner join entoptdeg d on d.fappno = s.fappno
    inner join entdeg deg on d.fdegree = deg.fdegree
    where IFNULL(fpaystatus,'') = 'success' 
    and d.fdegree between '{$fdegfrom}' and '{$fdegto}'
    order by d.fdegree,d.frank,s.fname";
    // var_dump($query);
    $result = $aobj_context->mobj_db->GetAll($query);
    
    $class_obj = new ReprtObject();
    $class_obj->univcode = $univcode;
    $class_obj->DefaultConstructor($aobj_context);

    if (count($result) > 0) {
        $class_obj->Report($result);
    }

    $class_obj->SendOutput();
    // ob_start();
    // ob_end_flush();

}