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


Current Path : /var/www/html/rcub/Report_details/
Upload File :
Current File : /var/www/html/rcub/Report_details/resultsheet_07072022.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);
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->degree = $aobj_context->mobj_data["degree"];
        $this->degexam = $aobj_context->mobj_data["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,
		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}'";

        $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()
    {

        $img_path = $this->aobj_context->main_src . $this->pdf_logo_path;

        if (!empty($this->pdf_logo_path) && file_exists($img_path)) {
            $this->pdf->Image($img_path, 10, 10, 20);
        }

        $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");
        $this->pdf->cell(0, 7, "RESULT SHEET", "0", 1, "C");
        $this->pdf->cell(0, 7, $this->fexamname . " " . $this->fdescpn . " EXAMINATION - " . $this->fresexamdate, "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 " . date('d/m/Y h:i:s A'), '0', 0, 'L');
    }

    function formcolldata()
    {
        $get_coll_name = "select FUNIVNAME as 'FUNIVNAME',
		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'];
    }

    function tableHeader()
    {

        $this->pdf->SetFont('Times', 'B', 10);
        $this->pdf->Cell(8, 6, "Sl.", "LRT", 0, "C");
        $this->pdf->Cell(22, 6, "Register", "LRT", 0, "C");
        $this->pdf->Cell(70, 6, "Student Name", "LRT", 0, "C");
        $this->pdf->Cell(15, 6, "Max.", "LRT", 0, "C");
        $this->pdf->Cell(15, 6, "Sec.", "LRT", 0, "C");
        if ($this->FSCHEME == 'CR')
            $this->pdf->Cell(18, 6, "S.G.P.A / ", "LRT", 0, "C");
        else
            $this->pdf->Cell(18, 6, "Percentage", "LRT", 0, "C");
        $this->pdf->Cell(42, 6, "Remarks", "LRT", 1, "C");


        $this->pdf->Cell(8, 6, "No.", "LRB", 0, "C");
        $this->pdf->Cell(22, 6, "No.", "LRB", 0, "C");
        $this->pdf->Cell(70, 6, "", "LBR", 0, "C");
        $this->pdf->Cell(15, 6, "Marks", "LRB", 0, "C");
        $this->pdf->Cell(15, 6, "Marks", "LRB", 0, "C");
        if ($this->FSCHEME == 'CR')
            $this->pdf->Cell(18, 6, "C.G.P.A", "LRB", 0, "C");
        else
            $this->pdf->Cell(18, 6, "", "LRB", 0, "C");
        $this->pdf->Cell(42, 6, "", "LRB", 1, "C");
    }

    function formdata()
    {

        $query = "delete from res_sum where fcollcode = '{$this->collcode}' and
		fdegree = '{$this->degree}' and fexamno = '{$this->degexam}'";
        $results = $this->aobj_context->mobj_db->GetAll($query);


        $query = "insert ignore into res_sum(fdegree,fexamno,fcollcode,fregno,fmaxmarks,ftotmarks,fpercent,fclass,fremarks)select distinct fdegree, fexamno,'{$this->collcode}',fregno, fmaxmarks, ftotmarks,
        if(fpercent = '',' - ',ifnull(fpercent,' - ')) as fpercent, fclass, fmcnumber
                    from resmarks where fdegree = '{$this->degree}' and fexamno = '{$this->degexam}'
        and fregno in(select distinct fregno from res_fee where fcollcode = '{$this->collcode}' and fdegree = '{$this->degree}')";
        //        var_dump($query);
        //        die();
        $results = $this->aobj_context->mobj_db->GetAll($query);

        $lobj_fee_data = "select count(res_sum.fregno) as fappeared, 
			sum(if(fclass = 'withheld' and fremarks not like '%MAL-PRACTICE%',1,0)) as fwh,
			sum(if(fclass = 'withheld' and fremarks like '%MAL-PRACTICE%',1,0)) as fmp,
			count(res_sum.fregno) - sum(if(fclass = 'withheld',1,0)) as fdeclared,
			sum(if(fclass not like '%FAIL%' and fclass not like '%withheld%',1,0)) as fpass,
			sum(if(fclass like '%FAIL%',1,0)) as ffail,
			sum(if(fclass not like '%FAIL%' and fclass not like '%withheld%',1,0)) * 100 /(count(res_sum.fregno) - sum(if(fclass = 'withheld',1,0))) as passperct
			from res_sum inner join student s on res_sum.fregno = s.fregno and res_sum.fcollcode = s.fcollcode 
			where res_sum.fdegree = '{$this->degree}' 
			and res_sum.fexamno = '{$this->degexam}' 
			and s.fcollcode = '{$this->collcode}'";
        $results = $this->aobj_context->mobj_db->GetRow($lobj_fee_data);
        //var_dump($lobj_fee_data);
        $lobj_fee_data = "select distinct r.fregno, s.fname, r.fdegree, r.ftotmarks, 
        r.fmaxmarks, if(r.fpercent = '',' - ',ifnull(r.fpercent,' - ')) as fpercent, fclass, FSCHEME  from resmarks r inner join student s 
			on r.fdegree = s.fdegree and r.fregno = s.fregno
			where s.fdegree = '{$this->degree}' and s.fcollcode = '{$this->collcode}'
			and r.fexamno = '{$this->degexam}'";
        $lobj_get_fee_data = $this->aobj_context->mobj_db->GetAll($lobj_fee_data);

        $this->pdf->AddPage();
        $this->pdf->Ln(5);
        $this->FSCHEME = $lobj_get_fee_data[0]['FSCHEME'];
        $this->pdf->SetFont('Times', 'B', 12);
        $this->pdf->Cell(0, 6, "Result Summary", 1, 1, 'C');
        $this->pdf->SetFont('Times', 'B', 10);
        $this->pdf->Cell(30, 6, "Students", "LRT", 0, 'C');
        $this->pdf->Cell(25, 6, "Result", "LRT", 0, "C");
        $this->pdf->Cell(25, 6, "MPC", "LRT", 0, "C");
        $this->pdf->Cell(25, 6, "Result", "LRT", 0, "C");
        $this->pdf->Cell(30, 6, "Students", "LRT", 0, "C");
        $this->pdf->Cell(30, 6, "Students", "LRT", 0, "C");
        $this->pdf->Cell(25, 6, "Pass", "LRT", 1, "C");

        $this->pdf->Cell(30, 6, "Appeared", "LRB", 0, "C");
        $this->pdf->Cell(25, 6, "Withheld", "LRB", 0, "C");
        $this->pdf->Cell(25, 6, "Withheld", "LBR", 0, "C");
        $this->pdf->Cell(25, 6, "Declared", "LRB", 0, "C");
        $this->pdf->Cell(30, 6, "Passed", "LRB", 0, "C");
        $this->pdf->Cell(30, 6, "Failed", "LRB", 0, "C");
        $this->pdf->Cell(25, 6, "Percentage", "LRB", 1, "C");

        $this->pdf->SetFont('Times', '', 10);
        $this->pdf->Cell(30, 6, $results['fappeared'], "1", 0, "C");
        $this->pdf->Cell(25, 6, $results['fwh'], "1", 0, "C");
        $this->pdf->Cell(25, 6, $results['fmp'], "1", 0, "C");
        $this->pdf->Cell(25, 6, $results['fdeclared'], "1", 0, "C");
        $this->pdf->Cell(30, 6, $results['fpass'], "1", 0, "C");
        $this->pdf->Cell(30, 6, $results['ffail'], "1", 0, "C");
        $this->pdf->Cell(25, 6, number_format((float)$results['passperct'], 2, '.', ''), "1", 1, "C");



        $this->pdf->Ln(5);
        $this->pdf->SetFont('Times', 'UB', 12);
        $this->pdf->Cell(5, 6, "Result List", 0, 1, 'L');
        $this->pdf->Ln(1);
        $this->pdf->SetFont('Times', '', 10);
        $this->tableHeader();

        $i = 1;
        foreach ($lobj_get_fee_data as $key => $value) {

            if ($this->pdf->getY() > 275) {
                $this->pdf->AddPage();
                $this->tableHeader();
            }

            $name1 = substr($value['fname'], 0, 30);
            $name2 = substr($value['fname'], 30);
            if (empty($name2)) {
                $this->pdf->SetFont('Times', '', 10);
                $this->pdf->Cell(8, 6, $i, "1", 0, "C");
                $this->pdf->Cell(22, 6, $value['fregno'], "1", 0, "C");
                $this->pdf->Cell(70, 6, $name1, "1", 0, "L");
                $this->pdf->Cell(15, 6, $value['fmaxmarks'], "1", 0, "C");
                $this->pdf->Cell(15, 6, $value['ftotmarks'], "1", 0, "C");
                $this->pdf->Cell(18, 6, $value['fpercent'], "1", 0, "C");
                $this->pdf->Cell(42, 6, $value['fclass'], "1", 1, "L");
            } else {
                $this->pdf->Cell(8, 6, $i, "LRT", 0, "C");
                $this->pdf->Cell(22, 6, $value['fregno'], "LRT", 0, "C");
                $this->pdf->Cell(70, 6, $name1, "LRT", 0, "L");
                $this->pdf->Cell(15, 6, $value['fmaxmarks'], "LRT", 0, "C");
                $this->pdf->Cell(15, 6, $value['ftotmarks'], "LRT", 0, "C");
                $this->pdf->Cell(18, 6, $value['fpercent'], "LRT", 0, "C");
                $this->pdf->Cell(42, 6, $value['fclass'], "LRT", 1, "L");

                $this->pdf->Cell(8, 6, "", "LRB", 0, "C");
                $this->pdf->Cell(22, 6, "", "LRB", 0, "C");
                $this->pdf->Cell(70, 6, $name2, "LRB", 0, "L");
                $this->pdf->Cell(15, 6, "", "LRB", 0, "C");
                $this->pdf->Cell(15, 6, "", "LRB", 0, "C");
                $this->pdf->Cell(18, 6, "", "LRB", 0, "C");
                $this->pdf->Cell(42, 6, "", "LRB", 1, "L");
            }

            $i++;
        }
    }

    function SendOutput()
    {
        $this->pdf->Output("Result_Sheet.pdf", "D");
    }
}

function generesultsheet($aobj_context)
{
    $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->SendOutput();
}