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


Current Path : /var/www/html/phdadm/pgetadm/
Upload File :
Current File : /var/www/html/phdadm/pgetadm/reportadm_admission_ticket.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',300);


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("Admission Ticket");

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

        // if (file_exists($img_path)) {
        //     $this->Image($img_path, 25, 6, 20, 20);
        // }
        $img_path = $this->aobj_context->main_src."/img/rur_logo.jpg";
		// var_dump($img_path);
		if(file_exists($img_path)) 
			$this->Image($img_path,48,6,115,20);

        $this->SetFont('Times', 'B', 20);
        $this->SetY(25);
       // $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->ln(5);

        $this->SetFont('Times', 'BU', 14);
        
        // $this->MultiCell(0, 7, 'DAVANAGERE UNIVERSITY POST - GRADUATE PROGRAMS ADMISSION  ENTRANCE TEST 2021-22', '0', 'C');
        // $this->Cell(0, 5, '[DUPGPAET 2021-22]', '0', 1, 'C');
        $this->Cell(0, 5, 'PG ENTRANCE  EXAMINATION 2021-22', '0', 1, 'C');
        $this->Cell(0, 5, 'ADMISSION TICKET', '0', 1, 'C');
        $this->SetFont('Times', '', 12);
        $this->ln(2);
        
        // $dt = date("d-m-Y");
        // var_dump($dt);         
        
        
        // var_dump($this->doe);
       // $this->Cell(0, 6, " Degree Group: " . $this->aobj_context->mobj_data["deggrp"], "0", 1, "C");
      //  $this->Cell(0, 6, " Degree Range: " . $this->aobj_context->mobj_data["fdegfrom"] . ' - ' . $this->aobj_context->mobj_data["fdegto"], "0", 1, "C");
        // restore auto-page-break status
        $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);
        // 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"];

       $get_coll_name = "select concat(fdeggrp, ' - ', fdescpn) as fdeggrp 
        from deggrp where fdeggrp = '{$deggrp}'";
        $lobj_get_degree = $this->aobj_context->mobj_db->GetRow($get_coll_name);
        
        $aobj_context->deggrp = $lobj_get_degree['fdeggrp'];
        $this->pdf = new MYPDF('P');
        $this->pdf->aobj_context = $aobj_context;
    }

    public function Header($pdf)
    {

        $pdf->SetFont('Times', 'B', 10);
        $pdf->Cell(12, 7, "Sl.No", "LTR", 0, "C");
        $pdf->Cell(26, 7, "Degree Code", "LTR", 0, "C");
        $pdf->Cell(90, 7, "Degree Name", "LTR", 0, "C");
        $pdf->Cell(22, 7, "No. of App.", "LTR", 0, "C");
        $pdf->Cell(22, 7, "Total Fee", "LRT", 1, "C");        
          

       
        /*$pdf->Cell(12, 7, "", "LRB", 0, "C");
        $pdf->Cell(26, 7, "", "LRB", 0, "C");
        $pdf->Cell(22, 7, "", "LRB", 0, "C");
        $pdf->Cell(60, 7, "", "LRB", 0, "C");
        $pdf->Cell(22, 7, "", "LRB", 0, "C");
        $pdf->Cell(18, 7, "", "LRB", 0, "C");
        $pdf->Cell(18, 7, "", "LRB", 0, "C");
        $pdf->Cell(21, 7, "Karnataka", "LRB", 1, "C");
        $pdf->SetFont('Times', '', 12);*/
       
    }

    public function Report($data,$lobj_page_header_university,$aobj_context)
    {
        
        for($z = 0;$z < count($data);$z++){
        
            $pdf = $this->pdf;

        $pdf->SetMargins(9,35,15);
        $pdf->startPageGroup();
        $pdf->AddPage("P");

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

        $oldCode = "";
        $newCode = "";
        $sl_no = 1;
        $first = true;
        $j = 0;
        // var_dump($exattendancelist);
		$pdf->Ln(13);
		// $pdf->SetX(10);
        // var_dump($data[0]['fappno']);
        $photo_url = "https://admission-certificates.s3.ap-south-1.amazonaws.com";

        $photo = $photo_url.'/'.$data[$z]['fphotopath'];
        // var_dump($data[0]['fphotopath']);
        // var_dump($photo);
        if($data[$z]['fphotopath'] != ''){
        $image = file_get_contents($photo);
        $pdf->Image('@'.$image,168,48,30,0,0);
        }
				

		

		
		
		$pdf->SetFont('Times','B',12); 
		$pdf->Cell(35,6," Student's Name",0,0,'L'); $pdf->Cell(3,6,' :  ',0,0,'L');
		$pdf->SetFont('Times','',12); 
		$pdf->Cell(120,6,'  '.$data[$z]['fname'],0,1,'L');

		

		$pdf->SetX(10);
		$pdf->SetFont('Times','B',12); 
		$pdf->Cell(35,6,"Date of Birth",0,0,'L'); $pdf->Cell(3,6,':  ',0,0,'L');
		$pdf->SetFont('Times','',12); 
        $pdf->Cell(120,6,'  '.$data[$z]['fdob'],0,1,'L');
        
        $pdf->SetX(10);
        $pdf->SetFont('Times','B',12); 
		$pdf->Cell(35,6,"",0,0,'L'); $pdf->Cell(3,6,'  ',0,0,'L');
		$pdf->SetFont('Times','',12); 
		$pdf->Cell(120,6,'  ',0,1,'L');
        
        $pdf->SetX(78);
        $pdf->SetFont('Times','B',15); 
		$pdf->Cell(50,6,"Reg. No. :  ".$data[$z]['fregno'] ,1,0,'C');
        $pdf->Cell(0,6,'  ',0,0,'L');
		$pdf->SetFont('Times','B',15); 
		$pdf->Cell(0,6,'  ',0,1,'L');
        
   

        
		
        centers($data[$z]['fappno'],$pdf,$aobj_context);
        // $pdf->centers($data[0]['fappno']);
		
		

		$pdf->ln(8);
		

		
		//var_dump($fprefix);
		$pdf->ln(2);
		$pdf->SetFont('Times','',10);	
		$pdf->Ln(4);
		$pdf->SetFont('Times','',10);
		$date_str = "<u><b>INSTRUCTIONS TO CANDIDATES:-</b></u><br> <br>

        01. Candidates must enter the Test Centre half an hour early.<br> 
        02. Candidates have to bring any valid ID Proof like Aadhaar/Voter ID/DL/College ID etc. <br>
        03. Strictly follow the COVID - 19 SOP and wear the mask compulsorily. <br>
        04. Do not carry Mobile or any Electronic gadgets/valuables to the Entrance Test Hall and University is not responsible <br>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for any loss of the same. <br>
        05. Candidates have to Carry Black or Blue Ball Point pen to mark on the OMR Sheet. <br>
        06. Follow all the instructions given by the invigilator in the Entrance Test Hall.<br>";
		$text1 = str_replace("<br>","\n",$date_str);
		$text = str_replace("<r>","\t",$text1);
		$pdf->writeHTML($date_str, $ln=true, $fill=false, $reseth=true, $cell=true, $align='L');

        $pdf->SetFont('Times','',10);
        //$pdf->Ln(2);
        $date_str = "<br><br><u><b>Note:-</b></u><br>
        <b>The Newly added courses: 
        M.Sc - Environmental Science and Climate Change :: M.Sc - Microbiology :: M.Sc - Zoology :: M.Sc - Botany :: M.Sc - Biotechnology :: M.Sc - Mining and Geology :: M.A - Public Administration. Will run only if the applications / admissions are more than 10 (Ten) for this academic year.</b>";
$text1 = str_replace("<br>","\n",$date_str);
$text = str_replace("<r>","\t",$text1);
$pdf->writeHTML($date_str, $ln=true, $fill=false, $reseth=true, $cell=true, $align='L');

		$pdf->SetFont('Times','B',11);
					$img_x=($pdf->getX()+140);;
                    $img_y=$pdf->getY()+15;
                    // $arr = $aobj_context->main_src.split("/");
                    // var_dump($arr[15]);
					$img_path = $aobj_context->main_src."/".$aobj_context->mobj_data["db"]."/controler_sign.jpg";
                    // $img_path = $aobj_context->main_src."img/controler_sign.jpg";
                    // var_dump($img_path);
					if(file_exists($img_path)) 
						$pdf->Image($img_path,$img_x,$img_y+2,45,10);
					$pdf->Ln(25);
					$pdf->Cell(130,5,'Student Signature','0',0,'L');
					
						IF($class_obj->std_FUNIVCODE=='021' || $FUNIVCODE == '005' || $FUNIVCODE == '021' || $FUNIVCODE == '032' || $FUNIVCODE == '016' || $FUNIVCODE == '018' || $FUNIVCODE == '033' || $FUNIVCODE == '017' || $FUNIVCODE == '034' )
						$pdf->Cell(50,6,'Controller of Examinations','0',0,'R');
						ELSE
							$pdf->Cell(50,6,'Registrar (Evaluation)','0',0,'R');
                        

                       

        }						


    }       



    public function SendOutput()
    {
        // ob_end_clean();
        $this->pdf->Output("AdmissionTicket.pdf", "D");
    }
}


function centers($cappno,$pdf,$aobj_context) 
{

    $centers = "SELECT b.fdescpn , a.fregno,b.fqpcode, 
    if(ifnull(s.fecntrcode,'1') = '1',b.fexamcntr,b.fexamcntr1)
    as fexamcntr, 
    b.fexamdate,a.fappno,a.fdegree
	FROM entoptdeg a , entdeg b, entstudadm s  
	WHERE b.fdegree = a.fdegree 
	and a.fappno = s.fappno
	AND a.fappno = '{$cappno}'";
    		
    $centers_arr = $aobj_context->mobj_db->GetAll($centers);

    $pdf->SetFont('Times','B',12);
    //var_dump($centers);	
    
   

    $pdf->ln(15);

    $pdf->SetFont('Times','B',12); 
    $pdf->Cell(160,6," Application No.",0,0,'R'); 
    $pdf->Cell(3,6,' :  ',0,0,'L');
    $pdf->SetFont('Times','',12); 
    $pdf->Cell(120,6,'  '.$cappno,0,1,'L');

    $pdf->Cell($length,5,'PROGRAMMES APPLIED',0,1,'C');
    $pdf->ln(2);

		$table2 = '<style>
			td, th {
			    border: 0.5px solid black;
			}
		 </style>
		<table cellpadding="2" cellspacing="0">
			<tr nobr="true">
				<th width="20" align="center"><b>Sl. No.</b></th>
                <th width="30" align="center"><b>Qp Code</b></th>
				<th width="160" align="center"><b>Programme Name</b></th>
				<th width="155" align="center"><b>Centre</b></th>
				<th width="105" align="center"><b>Exam Date & Time</b></th>
				<th width="70" align="center"><b>Invi sign.</b></th>
			</tr>';
		$i = 1;
		
        $fprefix = "";
        $fprefix = $res_optopns[0]['fprefix'];
        $pdf->SetFont('Times','',10); 

		foreach($centers_arr as $value)
		{
			
			$table2 .= '<tr nobr="true">
			<td width="20" align="center">'.$i.'</td>
            <td width="30" align="center">'.$value['fqpcode'].'</td>
            <td width="160" align="left">'.$value['fdescpn'].'</td>
            <td width="155" align="left">'.$value['fexamcntr'].'</td>
            <td width="105" align="center">'.$value['fexamdate'].'</td>
            <td width="70" align="center"></td>            						
			</tr>';	
			$i++;
		}

		$table2 .='</table>';
		
		$pdf->SetX(11);		
        $pdf->writeHTML($table2, false, true, false, false, 'L');

    }

/*function moneyFormatIndia($num)
{
    $explrestunits = "";
    if (strlen($num) > 3) {
        $lastthree = substr($num, strlen($num) - 3, strlen($num));
        $restunits = substr($num, 0, strlen($num) - 3); // extracts the last three digits
        $restunits = (strlen($restunits) % 2 == 1) ? "0" . $restunits : $restunits; // explodes the remaining digits in 2's formats, adds a zero in the beginning to maintain the 2's grouping.
        $expunit = str_split($restunits, 2);
        for ($i = 0; $i < sizeof($expunit); $i++) {
            // creates each of the 2's group and adds a comma to the end
            if ($i == 0) {
                $explrestunits .= (int) $expunit[$i] . ","; // if is first value , convert into integer
            } else {
                $explrestunits .= $expunit[$i] . ",";
            }
        }
        $thecash = $explrestunits . $lastthree;
    } else {
        $thecash = $num;
    }
    return $thecash; // writes the final format where $currency is the currency symbol.
}
*/
function reportadm_admission_ticket($aobj_context)
{
    $fdept = trim($aobj_context->mobj_data["fdept"]);  

    $afrom = trim($aobj_context->mobj_data["afrom"]);
    
   $ato = trim($aobj_context->mobj_data["ato"]);

   if($fdept == 'All')
   {
     $cnd = "";
   }else
   {
     $cnd = "and a.fdegree = '{$fdept}'";
   }

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

    $query = "SELECT a.fappno,b.fname,b.fregno,
    b.fcategory,DATE_FORMAT(IFNULL(b.fdob,''), '%d/%m/%Y') AS fdob,c.fdescpn,
    a.fexamdate,a.fexamcenter,IFNULL( b.fphotopath,'') AS fphotopath 
	FROM entoptdeg a INNER JOIN entstudadm b 
	ON a.fappno = b.fappno INNER JOIN entdeg c 
	ON a.fdegree = c.fdegree 
	WHERE b.fpaystatus = 'success' 
    AND a.fappno BETWEEN '{$afrom}' AND '{$ato}'
    {$cnd}
	GROUP BY a.fappno
    ORDER BY b.fname";
//    var_dump($query);
	$result = $aobj_context->mobj_db->GetAll($query);
    //$result = [];
	$page_header_university = "select FUNIVNAME,FTOWN,FHTTEXT,FUNIVADD1  from control";		
	$lobj_page_header_university = $aobj_context->mobj_db->GetRow($page_header_university);		
	$std_FUNIVNAME = $lobj_page_header_university['FUNIVNAME'];
	$std_FTOWN = $lobj_page_header_university['FTOWN'];
	$std_FHTTEXT = $lobj_page_header_university['FHTTEXT'];
	$std_FUNIVADD1 = $lobj_page_header_university['FUNIVADD1'];
    
    $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,$lobj_page_header_university,$aobj_context);
    }

    $class_obj->SendOutput();

}