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


Current Path : /var/www/html/univadmin/
Upload File :
Current File : /var/www/html/univadmin/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($this->aobj_context->degree." - Rank List");

        // 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, 30, 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, 250, 6, 20, 20);
        }

        $this->SetFont('Times', 'B', 16);
        $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', 15);
        $this->Cell(0, 7, 'Provisional Rank List of Candidates Attended for Document Verification', '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->SetY(-25);
            $this->SetFont('helvetica', 'IB', 10);
            $this->MultiCell(0, 10, 'Note :- HK: Hyderabad Karnataka; PH: Differently Abled; SP: Sports Quota; RR: Rovers and Rangers; GH: Gadinadu/Horanadu; DE: Defence; PP: Project Displaced Person; NE: Not Eligible',0, 'L');
            $this->SetY(-15);
            $this->SetFont('helvetica', 'I', 8);
            $this->Cell(80, 10, 'IP : ' . $_SERVER["REMOTE_ADDR"], 0, 0, 'L');
            $this->Cell(80, 10, 'Date : ' . date("d-m-Y h:i:s A"), 0, 0, 'C');
            $this->Cell(80, 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->pobj_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->pobj_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)
    {
        
        $aobj_context->descpn = $descpn;
        $pdf->SetFont('Times', 'B', 14);
        $pdf->Cell(0, 7, $descpn, '0', 1, 'C');
        $pdf->ln(1);
        $pdf->SetFont('Times', 'B', 12);
        $pdf->Cell(10, 4, "Sl.", "LTR", 0, "C");
        $pdf->Cell(25, 4, "Application", "LTR", 0, "C");
        $pdf->Cell(80, 4, "Candidate Name", "LTR", 0, "C");
        $pdf->Cell(12, 4, "Cat.", "LRT", 0, "C");
        $pdf->Cell(60, 4, "Reservation", "LRT", 0, "C");
        // $pdf->Cell(30, 4, "1st Year", "LRT", 0, "C");
        // $pdf->Cell(17, 4, "%", "LRT", 0, "C");
        // $pdf->Cell(30, 4, "2nd Year", "LRT", 0, "C");
        // $pdf->Cell(17, 4, "%", "LRT", 0, "C");
        // $pdf->Cell(30, 4, "3rd Year", "LRT", 0, "C");
        // $pdf->Cell(17, 4, "%", "LRT", 0, "C");
        $pdf->Cell(30, 4, "Overall", "LRT", 0, "C");
        $pdf->Cell(17, 4, "%", "LRT", 0, "C");
        $pdf->Cell(12, 4, "Rank", "LRT", 1, "C");
        //$pdf->Cell(55, 4, "Remark", "LRT", 1, "C");

        $pdf->Cell(10, 4, "No.", "LBR", 0, "C");
        $pdf->Cell(25, 4, "Number", "LBR", 0, "C");
        $pdf->Cell(80, 4, "", "LBR", 0, "C");
        $pdf->Cell(12, 4, "", "LRB", 0, "C");
        $pdf->Cell(60, 4, "Claimed", "LRB", 0, "C");
        //$pdf->Cell(17, 4, "Degree", "LRB", 0, "C");
        //$pdf->Cell(18, 4, "Sub. Name", "LRB", 0, "C");
        // $pdf->Cell(30, 4, "Marks", "LRB", 0, "C");
        // $pdf->Cell(17, 4, "1st Year", "LRB", 0, "C");
        // $pdf->Cell(30, 4, "Marks", "LRB", 0, "C");
        // $pdf->Cell(17, 4, "2nd Year", "LRB", 0, "C");
        // $pdf->Cell(30, 4, "Marks", "LRB", 0, "C");
        // $pdf->Cell(17, 4, "3rd Year", "LRB", 0, "C");
        $pdf->Cell(30, 4, "Marks", "LRB", 0, "C");
        $pdf->Cell(17, 4, "Overall", "LRB", 0, "C");
        $pdf->Cell(12, 4, "", "LRB", 1, "C");
        //$pdf->Cell(55, 4, "", "LRB", 1, "C");
       
    }

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

        $pdf->SetMargins(25, 29);
        $pdf->startPageGroup();
        
        $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("L");
                $this->Header($pdf,$degname);
                $sl_no = 1;
            }

            if ($pdf->getY() > 170) {
                $pdf->AddPage("L");
                $this->Header($pdf,$degname);
                $pdf->SetFont('Times', '', 12);
            }

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

            $y1 = $pdf->getY();
            $x = $pdf->getX();    
            $pdf->setXY($x+35,$y1);    
            $pdf->MultiCell(80,7, $value['fname'], "1","L");
            $y2 = $pdf->getY();
            $h = ($y2-$y1);

            if($value['frank'] == 'xNE')
            {
                $quta = $value['fstatus'];
            }
            else
            {
                $quta = rtrim($value['quta'],', ');
            }

            $pdf->setXY($x,$y1);
            $pdf->Cell(10, $h, $sl_no, "1", 0, "C");
            $pdf->Cell(25, $h, $value['fappno'], "1", 0, "C");
            $pdf->setXY($x+115,$y1);
            $pdf->Cell(12, $h, $value['fcategory'], "1", 0, "C");
            $pdf->Cell(60, $h, $quta, "1", 0, "L");
            //$pdf->Cell(18, $h, $value['fnewsub'], "1", 0, "C");
            // $pdf->Cell(30, $h, $value['f1mark'], "1", 0, "C");
            // $pdf->Cell(17, $h, $value['f1per'], "1", 0, "C");
            // $pdf->Cell(30, $h, $value['f2mark'], "1", 0, "C");
            // $pdf->Cell(17, $h, $value['f2per'], "1", 0, "C");
            // $pdf->Cell(30, $h, $value['f3mark'], "1", 0, "C");
            // $pdf->Cell(17, $h, $value['f3per'], "1", 0, "C");
            $pdf->Cell(30, $h, $value['mark'], "1", 0, "C");
            $pdf->Cell(17, $h, $value['fper'], "1", 0, "C");
            $pdf->Cell(12, $h, $value['frank'], "1", 1, "C");
           // $pdf->Cell(55, $h, $value['fstatus'], "1", 1, "L");


            $sl_no++;
            $oldCode = $value['fdegree'];
        }
       
    }       
    function SendOutput($fdegree)
    {
        //ob_end_clean();
        $target_path = dirname(dirname($_SERVER['SCRIPT_FILENAME']));

        $target_folder = $target_path.'/pgadm/meritlist/vskub_2/';

       // $this->pdf->Output("EXAM_TIME_TABLE{$this->reportType}Report_{$this->univcode}_{$fdegree}.pdf", "F");
        $this->pdf->Output($target_folder."$fdegree.pdf", "F");
    }
}

function MeritList($aobj_context)
{

    $query = "SELECT d.fdegree, d.fdescpn, CONCAT('meritlist/',d.fdegree,'.pdf') AS link FROM entdeg d
    WHERE  ifnull(fdeleted,'') <> 'T'
    order by forder,d.fdescpn";   
    $result = $aobj_context->pobj_db->GetAll($query);
    
    foreach( $result as $valeue)
    {
        
        $fdegree = $valeue['fdegree'];

        $query = "select a.fappno, a.fname, a.fcategory_ver as fcategory,b.fdegree, d.fdescpn,
        b.fprevdeg, b.fsubcode, 
       ifnull(b.frank,'NE') as frank, b.fper, b.f1per, b.f2per, b.f3per,
       concat(FLOOR(fsecmarks),' / ',FLOOR(fmaxmarks)) as mark,
       concat(FLOOR(f1secmarks),' / ',FLOOR(f1maxmarks)) as f1mark,
       concat(FLOOR(f2secmarks),' / ',FLOOR(f2maxmarks)) as f2mark,
       concat(FLOOR(f3secmarks),' / ',FLOOR(f3maxmarks)) as f3mark,
       ifnull(fmeritstatus,'') as fstatus,
       concat(
        if(fhk_ver='Yes','HK, ',''),
        if(fhandicap_ver='Yes','PH, ',''),
        if(fsports_ver='Yes','SP, ',''),
        if(fncc_ver='Yes','NCC, ',''),
        if(fnss_ver='Yes','NSS, ',''),
        if(fdefence_ver='Yes','DF, ',''),
        if(fpdp_ver='Yes','PP, ',''),
        if(fgah_ver='Yes','GH, ',''),
        if(fcof_ver='Yes','DE, ',''),
        if(frar_ver='Yes','RR, ','')) as quta
       from entstudadm a, entoptdeg b, entdeg d 
       where a.fappno = b.fappno 
       and b.fdegree = d.fdegree
       and a.fpaystatus = 'success'
       and ifnull(a.fapprstatus,'') = 'Accepted'	
       and b.fdegree = '{$fdegree}'
       order by ifnull(fmeritstatus,''),b.frank,b.fper desc,b.fappno,b.fdegree";
        //var_dump($query);
        $result = $aobj_context->pobj_db->GetAll($query);
        $aobj_context->degree = $fdegree;
        $class_obj = new ReprtObject();
        $class_obj->univcode = $univcode;
        $class_obj->DefaultConstructor($aobj_context);

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

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

}