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


Current Path : /var/www/html/phdadm/pgetadm/
Upload File :
Current File : /var/www/html/phdadm/pgetadm/printhostelfeereport.php

<?php
ob_start();
$main_src=substr($_SERVER['SCRIPT_FILENAME'],0,strlen($_SERVER['SCRIPT_FILENAME'])-7);
//$pdf_writer_class =$main_src."/tarka_pdf/fpdf.php";
$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() {
        // 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);
        // set bacground image

        $this->SetMargins(10,34,20,true);	
		$this->SetFillColor(248, 248 ,255);		
		$img_path = $this->aobj_context->main_src."/img/rur_logo.jpg";
		// var_dump($img_path);
		if(file_exists($img_path)) 
			$this->Image($img_path,55,6,110,15);

		$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, 178, 3, 20, 20);
        }
		
		$this->SetFont('Times','B',13);
		//$this->SetY(10);
		$this->Ln(22);
		
		//state
		$this->SetFont('Times','B',11);
		$this->Cell(0,4,$this->aobj_context->s_state,0,1,'C');
				 
		$this->SetFont('Times','B',12);
		$this->Ln(1);
		
		$cur_year = date("Y");
		$next_year = $cur_year + 1;
		$this->Cell(180,5,'Application for Admission to P.G. Hostel For the academic year 2021-22','0',1,'C');
		$this->Cell(0,4,$this->degree,0,1,'C'); 
		// var_dump($this->degree);
		// var_dump($this->degree);
		$style = array(
			'position' => 'right',
			'align' => 'C',
			'stretch' => false,
			'fitwidth' => true,
			'cellfitalign' => '',
			'border' => false,
			'hpadding' => 'auto',
			'vpadding' => 'auto',
			'fgcolor' => array(0,0,0),
			'bgcolor' => false, //array(255,255,255),
			'text' => true,
			'font' => 'helvetica',
			'fontsize' => 8,
			'stretchtext' => 4
		);
		// var_dump($this->aobj_context->FAPPNO);
		$this->write1DBarcode($this->aobj_context->appno, 'C39', '140', '20','130', 16, 0.3, $style, 'R');
        // 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);
        $this->Cell(50, 10,'IP : '.$_SERVER["REMOTE_ADDR"], 0, 0, 'L');
        $this->Cell(100, 10,'Date : ' .$this->aobj_context->current_date, 0, 0, 'C');

        $this->Cell(50, 10,'Page ' .$this->getPageNumGroupAlias().'/'.$this->getPageGroupAlias(), 0, 1, 'R');
    }
}

class AddmissionApplication
{	
	function DefaultConstructor($aobj_context)
	{
		$this->aobj_context=$aobj_context;
		//$this->pdf=  new FPDF();
		$this->collcode=$_SESSION['collcode'];
		$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);

		$get_coll_name="select FUNIVNAME as 'FUNIVNAME',FUNIVCODE,
		FUNIVADD1 as 'state', concat(FUNIVCODE,'_',pdf_logo_path) as 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($this->degree);
		$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->FEXAMAPPREQ=$lobj_get_coll_name['FEXAMAPPREQ'];
		$aobj_context->FUNIVCODE=$lobj_get_coll_name['FUNIVCODE']; 

		
		$app_no = trim($aobj_context->mobj_data["appno"]);

		$aobj_context->appno = $app_no;
		$aobj_context->current_date = $obj['now_date'];
		$this->current_date = $obj['now_date'];

		$this->pdf= new MYPDF('P');
		$this->pdf->setData($aobj_context);
		
	}
 
	function formcolldata()
	{
		$get_coll_name="select FUNIVNAME as 'FUNIVNAME',FUNIVCODE,
		FUNIVADD1 as 'state', concat(FUNIVCODE,'_',pdf_logo_path) as pdf_logo_path,
		ifnull(FEXAMAPPREQ,'F') as FEXAMAPPREQ 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->pdf_logo_path=$lobj_get_coll_name['pdf_logo_path'];
		$this->FEXAMAPPREQ=$lobj_get_coll_name['FEXAMAPPREQ'];
		$this->FUNIVCODE=$lobj_get_coll_name['FUNIVCODE']; 
	}
	
		
	function writeApplication($db,$per_details, $fee_det,$res_optopns,$degree, $res_prevmarks,$res_lanmarks,$res_totmarks,$fdob,$resopt)
	{

		//var_dump($degdet[$per_details['FDEGREE1']]);
	// var_dump($db,$per_details, $fee_det,$res_optopns,$per_details['FDEGREE1'], $res_prevmarks,$res_lanmarks);


		$pdf=$this->pdf;


		$pdf->SetMargins(10,35,25,false);
		$pdf->startPageGroup();
		$pdf->AddPage("P");

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

		$this->degree = $degdet[$degree];
		//$pdf->cell(0,7,"Courses Preference : ".$degree." - ".$degdet[$degree],0,1,'C');

		
		//====================Personal Details====================================
		$pdf->SetFont('Times','',10);
		$html = '<h3 style="background-color: #918988; color: rgb(255, 255, 255);"> Personal Details</h3>';
		$x = $pdf->GetX();
		$y = $pdf->GetY();		
		$pdf->writeHTMLCell(188,0,$x,$y,$html, false,1, false, true, '', false);

		$path = realpath(__DIR__ .'/..');
		//var_dump($path.'/pget_photos'.'/'.$per_details['fphotopath']);
		//var_dump($path.'/'.$per_details['fphotopath']);
		$photo_url = "https://admission-certificates.s3.ap-south-1.amazonaws.com";
		$i= 1;
		// var_dump($photo_url);
		// var_dump($per_details);
		$table1 = '<style>
			td {
			    border: 0.5px solid black;
			}
			.lable {
				font-weight: bold;
			}
		 </style>
		<table cellpadding="3" cellspacing="0">
			<tr nobr="true">
				<td width="150" class="lable">Application No.</td>
				<td width="270" colspan="3" style = "font-size:15px;">'.$resopt['fappno'].'</td>
				<td width="100" rowspan="5"><img width="100" height="100" src="'.$photo_url.'/'.$resopt['fphotopath'].'" /></td>
		</tr>';

		$table1 .='<tr nobr="true">
				<td width="150" class="lable"> Name of the Applicant</td>
				<td width="270" colspan="3">'.$resopt['fname'].'</td></tr>';

		$table1 .='<tr nobr="true">
				<td width="150" class="lable"> Department </td>
				<td width="270" colspan="3">'.$resopt['fdegree'].'</td>
				</tr>';



		$table1 .='<tr nobr="true">								
				<td width="150" class="lable"> Date of Birth </td>
				<td width="270" colspan="3">'.$resopt['fdob'].'</td>
				</tr>';

		$table1 .='<tr nobr="true">								
				<td width="150" class="lable"> Aadhar Number</td>
				<td width="270" colspan="3">'.$resopt['faadharno'].'</td>
				</tr>';

		$table1 .='<tr nobr="true">				
				<td width="150" class="lable"> Category</td>
				<td width="370" colspan="3">'.$resopt['fcategory'].'</td>				
				</tr>';

		
	

		$table1 .='<tr nobr="true">
				<td width="150" class="lable"> Father Occupation</td>
				<td width="370">'.$resopt['ffatocc'].'</td>
				</tr>';
                $table1 .='<tr nobr="true">
        <td width="150" class="lable"> Father Income</td>
        <td width="370">'.$resopt['fincome'].'</td>
</tr>';
		$table1 .='<tr nobr="true">
        <td width="150" class="lable"> Permanent Address</td>
        <td width="370">'.$resopt['fperadd'].'</td>
</tr>';
$table1 .='<tr nobr="true">
<td width="150" class="lable"> Mobile No.</td>
<td width="370">'.$resopt['fmobileno'].'</td>
</tr>';
$table1 .='<tr nobr="true">
<td width="150" class="lable"> Email Address</td>
<td width="370">'.$resopt['femail'].'</td>
</tr>';
$table1 .= '<tr nobr="true">
				<td width="150" class="lable"> Name of Bank</td>
				<td width="370">'.$resopt['fbankname'].'</td>
		</tr>'; 
        $table1 .= '<tr nobr="true">
        <td width="150" class="lable"> Account Number</td>
        <td width="370">'.$resopt['faccno'].'</td>
</tr>'; 
                        
		
			
		
				
		$table1 .= '</table>';
		// echo $table1;

		$pdf->SetX(11);
		// $pdf->SetY(42);
		
		$pdf->writeHTML($table1, false, true, false, false, 'L');
		$pdf->ln(5);
		$html = '<h3 style="background-color: #918988; color: rgb(255, 255, 255);"> Payment Details</h3>';
		$x = $pdf->GetX();
		$y = $pdf->GetY();
		$pdf->writeHTMLCell(188,0,$x,$y,$html, false,1, false, true, '', false);
		

		$per_details['fperadd'] = $per_details['FPERMADD1'].' '.$per_details['FPERMADD2'].' '.$per_details['FPERMADD3'].' '.$per_details['FPERMDIST'].' '.$per_details['FPERMSTATE'].' - '.$per_details['FPERMPIN'];
		$per_details['fcuradd'] = $per_details['FCURRADD1'].' '.$per_details['FCURRADD2'].' '.$per_details['FCURRADD3'].' '.$per_details['FCURRDIST'].' '.$per_details['FCURRSTATE'].' - '.$per_details['FCURRPIN'];
		$table2 = '<style>
			td {
			    border: 0.5px solid black;
			}
			.lable {
				font-weight: bold;
			}
		 </style>
		<table cellpadding="3" cellspacing="0">
		<tr nobr="true">
				<td width="150" class="lable"> Amount</td>
				<td width="370">'.$resopt['famount'].'</td>
		</tr>	
		<tr nobr="true">
				<td width="150" class="lable"> Payment ID</td>
				<td width="370">'.$resopt['fpaymentid'].'</td>
		</tr>';
		$table2 .= '<tr nobr="true">
				<td width="150" class="lable"> Payment Date</td>
				<td width="370">'.$resopt['fpaymentdate'].'</td>
		</tr>'; 
		$table2 .= '<tr nobr="true">
				<td width="150" class="lable"> Payment Status</td>
				<td width="370">'.$resopt['fpaymentstatus'].'</td>
		</tr>'; 
		
		$table2 .= '</table>';
		$pdf->SetX(11);
		$pdf->writeHTML($table2, false, true, false, false, 'L');
		$pdf->ln(2);
		
	
		$pdf->ln(20);
		$pdf->SetFont('Times','B',10);
		$pdf->Cell(160,4,'Date',0,0,'L');
		$pdf->Cell(30,4,'Student Signature ',0,1,'R');


	}
		
	function SendOutput()
	{
		// ob_end_clean();
		// ob_end_flush();
		// ob_end_clean();
		$this->pdf->Output("Application_letter.pdf","I");
	}	 
}

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

    $fappno = $aobj_context->mobj_data["fappno"];
    $univcode = $aobj_context->mobj_data["univcode"];
	

	$class_obj = new AddmissionApplication();
	
	$class_obj->DefaultConstructor($aobj_context);

	
    

	// $query = "select date_format(ifnull(fdob,''), '%d/%m/%Y') as fdob from entstudadm where fappno ='{$appno}'";
	// $res = $aobj_context->mobj_db->GetAll($query);
	$fdob = "";
	// var_dump($db,$per_details, $fee_det,$res_optopns,$per_details['FDEGREE1'], $res_prevmarks,$res_lanmarks);
	// var_dump($res);
	// var_dump($fdob);
    // var_dump($per_details['funivstud']);
    // var_dump($per_details);


	$query = "select ifnull(ea.fname,'') as fname,ifnull(fphotopath,'') as fphotopath,ifnull(DATE_FORMAT(ea.fdob,'%d/%m/%Y'),'') AS fdob,ifnull(ea.ffatocc,'') as ffatocc,
    ifnull(ea.ffatocc,'') as ffatocc,ifnull(ea.fcategory,'') as fcategory,ifnull(ea.fappno,'') as fappno,
    ifnull(ea.fmobileno,'') as fmobileno,ifnull(ea.fincome,'') as fincome,ifnull(ea.faadharno,'') as faadharno,
    ifnull(ea.femail,'') as femail,ifnull(eh.fbankname,'') as fbankname,ifnull(eh.faccno,'') as faccno,ifnull(eh.fdegree,'') as fdegree,
    ifnull(eh.fhpaymentid,'') as fpaymentid,ifnull(eh.fhpaymentstatus,'') as fpaymentstatus,ifnull(DATE_FORMAT(eh.fhpaymentdate,'%d/%m/%Y'),'') AS fpaymentdate,
    CONCAT(ea.fpermadd1,',',ea.fpermadd2,',',ea.fpermadd3,',',ea.fpermadd4,',',ea.fpermdist,',',ea.fpermstate,'-',ea.fpermpin) as fperadd,
	eh.fhostelamt as famount      
    from entstudadm ea 
    inner join entstudhostel eh on ea.fappno = eh.fappno
    where (eh.fappno = '{$fappno}' or fhostalid = '{$fappno}')
	and eh.fhpaymentstatus = 'success'";



    $resopt = $aobj_context->mobj_db->GetRow($query);


    // var_dump($resopt);
    // die();

	
	$class_obj->writeApplication($db,$per_details, $fee_det,$res_optopns,$per_details['FDEGREE1'], $res_prevmarks,$res_lanmarks,$res_totmarks,$fdob,$resopt);
	

	$class_obj->SendOutput();
}