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 : /var/www/html/rcub/Report_details/
Upload File :
Current File : /var/www/html/rcub/Report_details/DownloadExamAppFormApplications.php

<?php
$main_src=substr($_SERVER['SCRIPT_FILENAME'],0,strlen($_SERVER['SCRIPT_FILENAME'])-7);
$pdf_writer_class =$main_src."/tarka_pdf/fpdf.php";
require_once($pdf_writer_class);
	
class DownloadExamAppFormApplications  extends FPDF
{
	function DefaultConstructor($aobj_context)
	{
		$this->aobj_context=$aobj_context;
		$this->pdf=  new FPDF();
		$this->pdf=$this;
		 session_start();
		$this->ip=$_SERVER["REMOTE_ADDR"];
		$this->collcode=$_SESSION['collcode'];
		
		$this->app_no_from = ($this->aobj_context->mobj_data["app_start"]);
		$this->app_no_to = ($this->aobj_context->mobj_data["app_end"]);

		$this->reg_start = ($this->aobj_context->mobj_data["reg_start"]);
		$this->reg_end = ($this->aobj_context->mobj_data["reg_end"]);

		$this->ack_type = ($this->aobj_context->mobj_data["report_type"]);
		$this->degree_code = ($this->aobj_context->mobj_data["degree_code"]);
		$this->pay_mode = ($this->aobj_context->mobj_data["payment_type"]);		
		$this->exam_code = ($this->aobj_context->mobj_data["exam_code"]);		
		
		//$this->pay_mode = "All";


		$get_date="select date_add(date_add(now(),INTERVAL 13 hour),interval 30 minute) as now_date";
		$obj=$this->aobj_context->mobj_db->GetRow($get_date);
		$this->current_date=$obj[now_date];			
	}
		 
	function Header()
	{
	}	
	function Footer()
	{
		$this->SetY(-15);
		$this->pdf->SetFont('Times','B',8);	
		$this->Cell(140,6,'Printed : IP Address : '.$this->ip." Date: ".date('d/m/Y h:i:s A'),'0',0,'L');
		$this->Cell(130,6,'Page '.$this->PageNo().' of {nb}',0,1,'R');
	}
	
	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'];

		$get_coll_name="SELECT FCOLLCODE,FCOLLNAME,FTOWN
						FROM college where FCOLLCODE='{$this->collcode}'";
		$lobj_get_coll_name=$this->aobj_context->mobj_db->GetRow($get_coll_name);
		$this->FCOLLCODE=$lobj_get_coll_name['FCOLLCODE']; 
		 
		$this->FCOLLNAME=$lobj_get_coll_name['FCOLLNAME']; 

		$this->FCOLLTOWN=$lobj_get_coll_name['FTOWN']; 
	
		$get_degree_name="SELECT FDEGREE,FDESCPN
						FROM degree where fdegree='{$this->degree_code}'";

		$lobj_get_degree_name=$this->aobj_context->mobj_db->GetRow($get_degree_name);
		
		$this->FDEGREE=$lobj_get_degree_name['FDEGREE']; 
		 
		$this->FDESCPN=$lobj_get_degree_name['FDESCPN']; 
	}
		 
	function formData()
	{
		$this->pdf->SetMargins(15,12,10);
					
		$this->pdf->AddPage('L');
		$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,20,6,25);
		}

		$this->pdf->SetFont('Times','B',16);
		$this->pdf->cell(0,7,"".$this->FUNIVNAME,"0",1,"C");
		$this->pdf->SetFont('Times','B',13);
		$this->pdf->cell(0,7, "College: ". $this->FCOLLCODE." - ".$this->FCOLLNAME.", ".$this->FCOLLTOWN,"0",1,"C");
		$this->pdf->SetFont('Times','B',12);
		$this->pdf->Cell(0,7,"Degree: ".$this->degree_code." - ".$this->FDESCPN,"0",1,"C");
		$this->pdf->Cell(0,7,"[Report Type: ".strtoupper($this->ack_type)."]","0",1,"C");
		$this->pdf->SetFont('Times','B',15); 
	}

	function GetFullQry()
	{
		//var_dump($this->ack_type);
		if($this->ack_type == 'pending')
		{
			$ref = "AND (FACKDATE IS NULL)";
		}
		else if($this->ack_type == 'success')
		{
			$ref = "AND (ifnull(FACKDATE,'') <> '' OR date_format(FACKDATE,'%d/%m/%Y') <> '00/00/0000')";
		}
		else
		{
			$ref = "";
		}

		//$this->pay_mode = 'A';
		if($this->pay_mode=='College Bank') 
		{
			$pay = "AND FPAYMENTYPE ='College Bank'";

		}
		else if($this->pay_mode=='Post Office')
		{
			$pay = "AND FPAYMENTYPE ='POSTOFFICE'";

		}
		else if($this->pay_mode=='Other Bank')
		{
			$pay = "AND FPAYMENTYPE ='Other Banks'";
		}
		else
		{
			$pay = "";
		}

		$exam_no=implode("','",str_split($this->exam_code)); 

		$get_data = "SELECT DISTINCT r.APPNO, r.FDEGREE,d.FEXAMNO, d.FEXAMNAME, r.FREGNO,s.FNAME, DATE_FORMAT(r.FDATE,'%d/%m/%Y') AS FAPPDATE,
		r.FTOTALFEE, IF(r.FPAYMENTYPE = 'Other Banks', r.FPAYGATEWAY,r.FPAYMENTYPE) AS  FPAYMENTYPE, 
		IFNULL(DATE_FORMAT(FACKDATE,'%d/%m/%Y'),'') AS FSETDATE, 
		UCASE(IFNULL(r.FPAYMENTSTATUS, 'Pending')) AS FPAYMENTSTATUS
		FROM appcandsum r INNER JOIN  degree d ON r.fdegree = d.fdegree 
		AND d.fexamno = r.fexamno INNER JOIN
		student s ON s.FREGNO=r.FREGNO 
		WHERE r.FCOLLCODE='{$this->collcode}' and r.fdegree = '{$this->degree_code}'
		AND r.APPNO BETWEEN '{$this->app_no_from}' AND '{$this->app_no_to}'
		AND r.fregno BETWEEN '{$this->reg_start}' AND '{$this->reg_end}'
		{$ref} {$pay} AND r.fexamno in ('{$exam_no}')
		ORDER BY r.FDEGREE, r.APPNO,  r.FREGNO, d.FEXAMNAME, r.fpaymentype";
			
		//var_dump($get_data);
		$this->lobj_get_get_data= $this->aobj_context->mobj_db->GetAll($get_data); 

	}

	function GetQry()
	{
		$i=0;
		$this->SetFillColor(219,217,217);
		if($this->pdf->GetY() >280)
			$this->pdf->AddPage('L');
		//$this->SetDrawColor(255,2,195);
		$this->pdf->SetFont('Times','B',10);
	 
		$this->pdf->cell(15,7, "Sl. No.","1",0,"C",true);
		$this->pdf->cell(25,7, "Appl. No.","1",0,"C",true);
		
		$this->pdf->cell(20,7, "Reg. No.","1",0,"C",true);
		$this->pdf->cell(90,7, "Student Name","1",0,"C",true);
	 
		$this->pdf->cell(25,7, "Appl. Date","1",0,"C",true);
		$this->pdf->cell(25,7, "Pay. Type","1",0,"C",true);
		$this->pdf->cell(25,7, "Pay. Date","1",0,"C",true);
		$this->pdf->cell(20,7, "Amount","1",0,"C",true);
		$this->pdf->cell(25,7, "Pay. Status","1",1,"C",true);
		$height=5;
		$sl_no=1;
		if($this->pdf->GetY() >280)
		$totfee = 0;
		
		foreach($this->lobj_get_get_data as $ak=>$av)
		{ 
			$sub_code=$ak;
			$this->pdf->SetFont('Times','',10);
			$this->pdf->cell(15,$height, $sl_no,"1",0,"C");
			$this->pdf->cell(25,$height, $av['APPNO'],"1",0,"C");
			
			$this->pdf->cell(20,$height, $av['FREGNO'],"1",0,"C");
			$this->pdf->cell(90,$height, $av['FNAME'],"1",0,"Ls");

		 	$this->pdf->cell(25,$height, $av['FAPPDATE'],"1",0,"C");
			$this->pdf->cell(25,$height, $av['FPAYMENTYPE'],"1",0,"C");
			$this->pdf->cell(25,$height, $av['FSETDATE'],"1",0,"C");
			$this->pdf->cell(20,$height, $av['FTOTALFEE'],"1",0,"R");
			$totfee += $av['FTOTALFEE'];
			$this->pdf->cell(25,$height, $av['FPAYMENTSTATUS'],"1",1,"C");
			$sl_no++;
			if($this->pdf->GetY() >180)
			{
				$this->pdf->AddPage('L');

				// $this->formData();
				$this->pdf->SetFont('Times','B',10);
				$this->pdf->cell(15,7, "Sl. No.","1",0,"C",true);
				$this->pdf->cell(25,7, "Appl. No.","1",0,"C",true);
		
				$this->pdf->cell(20,7, "Reg. No.","1",0,"C",true);
				$this->pdf->cell(90,7, "Student Name","1",0,"C",true);
			 
				$this->pdf->cell(25,7, "Appl. Date","1",0,"C",true);
				$this->pdf->cell(25,7, "Pay. Type","1",0,"C",true);
				$this->pdf->cell(25,7, "Pay. Date","1",0,"C",true);
				$this->pdf->cell(20,7, "Amount","1",0,"C",true);
				$this->pdf->cell(25,7, "Pay. Status","1",1,"C",true);
			}
		 }
		 $totfee = moneyFormatIndia($totfee);
		 $this->pdf->SetFont('Times','B',11);
		 $this->pdf->Cell(270,7,"Total Amount: ".$totfee."/-",'1',1,'R');
	}

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

function DownloadExamAppFormApplications($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);

	$class_obj=new DownloadExamAppFormApplications();
	$class_obj->AliasNbPages();
	$class_obj->DefaultConstructor($aobj_context);
	$class_obj->formcolldata();
	$class_obj->GetFullQry();
	 
	$class_obj->formData();
	$class_obj->GetQry();
	$class_obj->SendOutput();
}

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

?>