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


Current Path : /proc/thread-self/root/var/www/html/univadmin_bkp/univadmin/Reports/
Upload File :
Current File : //proc/thread-self/root/var/www/html/univadmin_bkp/univadmin/Reports/multiplePaymetReport.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;
// ini_set('memory_limit','900M');
// ini_set('max_execution_time',0);


class MYPDF extends TCPDF
{
    public $aobj_context;

    public function setData($aobj_context)
    {
        $this->aobj_context = $aobj_context;
    }
    public function Header()
    {
        
        //$univcode = $aobj_context->mobj_data["univcode"];
               $this->Degree = $this->aobj_context->mobj_data["Degree"];

                   $this->cntr_from = substr("0000000000" . $this->aobj_context->mobj_data["cntr_from"], -4);
                   $this->cntr_to = substr("ZZZZZZZZZZ" . $this->aobj_context->mobj_data["cntr_end"], -4);
                   
                   $this->degree_from = substr("0000000000" . $this->aobj_context->mobj_data["degree_from"], -5);
                   $this->degree_to = substr("ZZZZZZZZZZ" . $this->aobj_context->mobj_data["degree_to"], -5);
              
                   $examno_from = $aobj_context->mobj_data["examno_from"];
                   $examnoStr = strtoupper($examno_from);
                   $splitexamno = str_split($examnoStr);
                   $examno = implode(",", $splitexamno);
        
        // 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("Multiple Payment Report");
        
        // set bacground image
        $this->SetFillColor(248, 248, 255);
        $img_path = $this->aobj_context->main_src . "/img/logo.jpg";

        if (file_exists($img_path)) {
            $this->Image($img_path, 6, 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', 12);
        $this->Ln(1);
        $this->Cell(0, 5, ' MULTIPLE PAYMENT REPORT ' . $this->reportType, '0', 1, 'C');

        $this->SetFont('Times', 'B', 12);
        $this->cell(0, 5, "Degree Group:" . " " . $this->Degree, "0", 1, "C");

        $this->cell(0, 5, "College Code Range :" . " " . $this->cntr_from . " " . "to" . " " . $this->cntr_to, "0", 1, "C");
        $this->cell(0, 5, "Degree Range :" . " " . $this->degree_from . " " . "to" . " " . $this->degree_to, "0", 1, "C");
        

        $this->SetAutoPageBreak($auto_page_break, $bMargin);
        // set the starting point for the page content
    }

    public function Footer()
    {
        $this->SetY(-15);
        $this->SetFont('helvetica', 'I', 8);
        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)
    {
        include_once $aobj_context->main_src . "/src/format.php";
        $this->aobj_context = $aobj_context;
        $this->ip = $_SERVER["REMOTE_ADDR"];
        
        $univcode = $aobj_context->mobj_data["univcode"];
        $deggrp = $aobj_context->mobj_data["Degree"];

            $this->cntr_from = substr("0000000000" . $this->aobj_context->mobj_data["cntr_from"], -4);
            $this->cntr_to = substr("ZZZZZZZZZZ" . $this->aobj_context->mobj_data["cntr_end"], -4);
            
            $this->degree_from = substr("0000000000" . $this->aobj_context->mobj_data["degree_from"], -5);
            $this->degree_to = substr("ZZZZZZZZZZ" . $this->aobj_context->mobj_data["degree_to"], -5);
       
            $examno_from = $aobj_context->mobj_data["examno_from"];
            $examnoStr = strtoupper($examno_from);
            $splitexamno = str_split($examnoStr);
            $examno = implode(",", $splitexamno);
        
        $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->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'];
        // $this->pdf = new MYPDF('P',PDF_UNIT, PDF_PAGE_FORMAT, true, 'ISO-8859-1', false);
        $this->pdf = new MYPDF('L');
        $this->pdf->setData($aobj_context);


    }

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

        // pdf->SetMarginsWidth(0.2);
        
        $pdf->SetMargins(15, 35);
        $pdf->startPageGroup();
        $pdf->AddPage("P");

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

        $oldCode = "";
        $newCode = "";

        $sl_no = 1;

        foreach($data as $key => $value){

            // $this->Header($pdf);

            $newCode = $value['fname'];

            if($newCode != $oldCode){

                $pdf->SetMargins(15, 40);

                $pdf->Multicell(0,1, " ");

                $pdf1->SetFont('Times', 'B', 10);
                $pdf->Cell(8, 13.9, $sl_no, "1", 0, "C");

               $pdf->SetMargins(23, 45);
                $pdf1->SetFont('Times', 'B', 10);
                $pdf->Cell(35, 2, "NAME", 1, "L");
                $pdf1->SetFont('Times', '', 10);
                $pdf1->Cell(140, 0, $value['fname'], 1, 1, "L");

                $pdf1->SetFont('Times', 'B', 10);
                $pdf->Cell(35, 0, "COLLEGE", 1, "L");
                $pdf1->SetFont('Times', '', 10);
                $pdf1->Cell(140, 0, $value['college'], 1, 1, "L");

                $pdf1->SetFont('Times', 'B', 10);
                $pdf->Cell(35, 0, "DEGREE", 1, "L");
                $pdf1->SetFont('Times', '', 10);
               $pdf->SetMargins(15, 45);

                $pdf1->Cell(140, 0, $value['fdegree'], 1, 1, "L");

                $pdf1->SetFont('Times', 'B', 10);
                $pdf->Cell(25, 0, "App .No", 1, "C");
                $pdf->Cell(24, 0, "App. Date", 1, "C");
                $pdf->Cell(32, 0, "Payment Type", 1, "C");
                $pdf->Cell(22, 0, "Paid Date", 1, "C");
                $pdf->Cell(15, 0, "Amount", 1, "C");
                $pdf->Cell(65, 0, "Transaction ID", 1, 1, "L");

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

                if($value['paymentType'] === "POSTOFFICE"){
                    $pdf1->Cell(25, 9, $value['appno'], 1, "C");
                    $pdf1->Cell(24, 9, $value['fackdate'], 1, "C");
                    $pdf1->Cell(32, 9, $value['paymentType'], 1, "C");
                    $pdf1->Cell(22, 9, $value['fackdate'], 1, "C");
                    $pdf1->Cell(15, 9, $value['ftotalfee'], 1, "C");
                    $pdf1->MultiCell(65, 2, $value['fpaymentremarks'], 1);
                }else{
                    $pdf1->Cell(25, 0, $value['appno'], 1, "C");
                    $pdf1->Cell(24, 0, $value['fackdate'], 1, "C");
                    $pdf1->Cell(32, 0, $value['paymentType'], 1, "C");
                    $pdf1->Cell(22, 0, $value['fackdate'], 1, "C");
                    $pdf1->Cell(15, 0, $value['ftotalfee'], 1, "C");
                    $pdf1->MultiCell(65, 2, $value['fpaymentremarks'], 1);
                }

                $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

                $sl_no++;
            }
            else{
                if($value['paymentType'] === "POSTOFFICE"){
                    $pdf1->Cell(25, 9, $value['appno'], 1, "C");
                    $pdf1->Cell(24, 9, $value['fackdate'], 1, "C");
                    $pdf1->Cell(32, 9, $value['paymentType'], 1, "C");
                    $pdf1->Cell(22, 9, $value['fackdate'], 1, "C");
                    $pdf1->Cell(15, 9, $value['ftotalfee'], 1, "C");
                    $pdf1->MultiCell(65, 2, $value['fpaymentremarks'], 1);
                }else{
                    $pdf1->Cell(25, 0, $value['appno'], 1, "C");
                    $pdf1->Cell(24, 0, $value['fackdate'], 1, "C");
                    $pdf1->Cell(32, 0, $value['paymentType'], 1, "C");
                    $pdf1->Cell(22, 0, $value['fackdate'], 1, "C");
                    $pdf1->Cell(15, 0, $value['ftotalfee'], 1, "C");
                    $pdf1->MultiCell(65, 2, $value['fpaymentremarks'], 1);
                }

            }

            $oldCode = $newCode;

        }
    }

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

function multiplePaymetReport($aobj_context)
{
    $univcode = $aobj_context->mobj_data["univcode"];
    $deggrp = $aobj_context->mobj_data["Degree"];

        $cntr_from = substr("0000000000" . $aobj_context->mobj_data["cntr_from"], -4);
        $cntr_to = substr("ZZZZZZZZZZ" . $aobj_context->mobj_data["cntr_end"], -4);
        
        $degree_from = substr("0000000000" . $aobj_context->mobj_data["degree_from"], -5);
        $degree_to = substr("ZZZZZZZZZZ" . $aobj_context->mobj_data["degree_to"], -5);

        $examno_from = $aobj_context->mobj_data["examno_from"];
        $examnoStr = strtoupper($examno_from);
        $splitexamno = str_split($examnoStr);
        $examno = implode(",", $splitexamno);

    // $query = "select a.fcollcode, concat(c.fcollcode,'-', c.fcollname, ', ', c.ftown) as college, a.fdegree, d.fdescpn, a.fregno, s.fname, a.appno,date_format(a.fackdate, '%d/%m/%Y') as fackdate,
    // if(a.fpaymentype= 'Other Banks',a.fpaygateway,a.fpaymentype) as paymentType, a.fpaymentremarks,a.ftotalfee from appcandsum a
    // inner join degree d on a.fdegree=d.fdegree and a.fexamno=d.fexamno inner join student s on a.fregno = s.fregno and a.fdegree = s.fdegree
    // inner join college c on a.fcollcode = c.fcollcode
    // where a.fpaymentstatus='success' and
    // a.fregno in (select fregno from appcandsum where fpaymentstatus='success' group by fregno having count(fregno) > 1)
    // and a.fpaymentype != 'college bank'
    // order by a.fcollcode, a.fdegree, a.fregno
    // limit 100";

    $query = "select a.fcollcode, a.fdegree, a.fregno, s.fname, a.appno,date_format(a.fackdate, '%d/%m/%Y') as fackdate,
    concat(c.fcollcode,'-', c.fcollname, ', ', c.ftown) as college,
    if(a.fpaymentype= 'Other Banks',a.fpaygateway,a.fpaymentype) as paymentType, 
    a.fpaymentremarks,a.ftotalfee from appcandsum a
inner join degree d on a.fdegree=d.fdegree and a.fexamno=d.fexamno 
inner join student s on a.fregno = s.fregno and a.fdegree = s.fdegree
inner join college c on a.fcollcode = c.fcollcode
    where a.fpaymentstatus='success' and
    a.fregno in (select b.fregno
    from appcandsum a, appcanddet b
    where a.appno = b.appno and a.fdegree = b.fdegree and a.fregno = b.fregno and a.fpaymentstatus = 'success'
                 and b.fpresent = 'P'
                 group by b.fdegree, b.fexamno,b.fregno, b.fsubcode,a.ftotalfee
    having count(b.appno) > 1)
    and a.fpaymentype != 'college bank'
    and a.fdegree between '{$degree_from}' and '{$degree_to}' and a.fdegree in (select distinct fdegree from degree where
    fdeggrp = '{$deggrp}')
    and a.fcollcode between '{$cntr_from}' and '{$cntr_to}' and a.ffreshexam IN ('A','B','C','D','E','F')
    order by a.fcollcode, a.fdegree, a.fregno";

    

    $result = $aobj_context->pobj_db->GetAll($query);

    $class_obj = new ReprtObject();
    $class_obj->univcode = $univcode;
    $class_obj->DefaultConstructor($aobj_context);

    // If No data found Generate Blank Report
    if (count($result) > 0) {
        $class_obj->Report($result);
    }

    $class_obj->SendOutput();

}