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


Current Path : /proc/thread-self/root/var/www/oasis/src/
Upload File :
Current File : //proc/thread-self/root/var/www/oasis/src/admlist.php

<?php
$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 $fintake;
	
	public function setData($aobj_context)
	{
    	$this->aobj_context = $aobj_context;
    	$this->fromdeg = trim($aobj_context->mobj_data["degree_code"]);
		$this->db = trim($aobj_context->mobj_data["db"]);
		$this->fromcoll = $_SESSION['collcode']; 
		//$this->strAprtype = trim($aobj_context->mobj_data["appstatus"]);

		$query = "select fintake from colldeg where FDEGREE = '{$this->fromdeg}' and fcollcode = '{$this->fromcoll}'";
		$res = $this->aobj_context->mobj_db->GetRow($query);
		
		$this->fintake = $res['fintake'];
		$fintake = $res['fintake'];		

	}
	
    public function Header($head) {
        // 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
		if($this->aobj_context->first !='strue')
			$this->SetMargins(10,46,20,true);	
		else
			$this->SetMargins(10,30,20,true);	

		$this->SetFillColor(248, 248 ,255);		
		$this->SetFont('Times','',10);
		
		
		//var_dump($img_path);
		

		$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);
		
	
		$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']; 
		
		$img_path = $this->aobj_context->main_src.'oasis/'.$this->db."/".$this->pdf_logo_path;
		//var_dump($img_path);
		//die();
		if(file_exists($img_path)) 
		{	
			if($this->db == 'ru')
			{
				$img_path = $this->aobj_context->main_src.'oasis/'.$this->db."/img/rur_log_report.jpg";

				//$this->Image($img_path,90,6,120,25);
				$this->Image($img_path,90,4,110);
				$this->Ln(15);
			}
			else
				$this->Image($img_path,10,6,20,20);	
		}
		$img_path = $this->aobj_context->main_src."/img/logo2.jpg";
		if(file_exists($img_path)) 
			$this->Image($img_path,210,6,20,20);
		$this->SetFont('helvetica','B',17);
		$this->Ln(2);
		if($this->db != 'ru')
			$this->Cell(250,4,$this->FUNIVNAME,0,1,'C');

		$query   = "select concat(fdegree,' - ',fdescpn) as deg from degree where 
				   fdegree = '{$this->fromdeg}' and fexamno = 'A'";
		$results1 = $this->aobj_context->mobj_db->GetRow($query);

		$query   = "select concat(fcollcode,' - ',fcollname) as coll from college where 
				   fcollcode = '{$this->fromcoll}'";
		$results2 = $this->aobj_context->mobj_db->GetRow($query);

		
		if($this->db == 'ru')
		{
			$this->SetFont('Times','B',14);
			$this->Ln(8);
			$this->Cell(0,4,'Degree  - '.$results1['deg'],0,1,'C');
			$this->Cell(0,4,'College - '.$results2['coll'],0,1,'C');
			$approve_type = $this->strAprtype == All? 'All': $this->strAprtype;

			$this->Cell(0,4,'Admission Register',0,1,'C');
			//$this->Ln(5);
		}else
		{
			$this->SetFont('Times','B',11);
			$this->Cell(250,4,'Degree  - '.$results1['deg'],0,1,'C');
			$this->Cell(250,4,'College - '.$results2['coll'],0,1,'C');
			$approve_type = $this->strAprtype == All? 'All': $this->strAprtype;
			$this->Cell(0,4,'Admission Register',0,1,'C');
		}
		$this->Ln(2);
		$this->SetFont('Times','B',13);
		//$this->Cell(0,6,'Approved Intake : '.$this->fintake,"0","1",L);
		//$this->Ln(2);
		
		$this->SetFont('Times','B',10);
		// if($this->aobj_context->first !='strue')
		// {
		// 	$table_head = '<table cellpadding="2" cellspacing="0" border="0.5">
		// 	<tr nobr="true"><th width="30" align="center"><b>Sl. No.</b></th>
		// 		<th width="60" align="center"><b>Appl. No.</b></th>
		// 		<th width="40" align="center"><b>Deg. <br>Code</b></th>
		// 		<th width="140" align="center"><b>Student Name</b></th>
		// 		<th width="60" align="center"><b>DOB</b></th>
		// 		<th width="35" align="center"><b>Caste</b></th>
		// 		<th width="80" align="center"><b>Father Name</b></th>
		// 		<th width="80" align="center"><b>Mother Name</b></th>
		// 		<th width="180" align="center"><b>Name of The Board</b></th>
		// 		<th width="50" align="center"><b>Fees to <br>be Paid</b></th>
				
				
		// 	</tr>
		// 	</table>';
		// 	// <th width="50" align="center"><b>Late Fees Fine</b></th>
		// 	$this->ln(4);
		// 	$this->writeHTML($table_head, false, true, false, false, '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);
        $this->Cell(50, 10,'IP : '.$_SERVER["REMOTE_ADDR"], 0, 0, 'L');
        $this->Cell(50, 10,'Date : ' .$this->aobj_context->current_date, 0, 0, 'L');

        $this->Cell(170, 10,'Page ' .$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, 1, 'R');
    }
}

class AddmissionApproveList
{	
	function DefaultConstructor($aobj_context)
	{
		$this->aobj_context=$aobj_context;
		//$this->pdf=  new FPDF();
		$this->ip=$_SERVER["REMOTE_ADDR"];
		$get_date="select now() as now_date,funivname,pdf_logo_path from control";
		$obj=$this->aobj_context->mobj_db->GetRow($get_date);
		$this->aobj_context->main_src = realpath(__DIR__ . '/../..');
		$this->aobj_context->main_src = $this->aobj_context->main_src.'/';
		$this->aobj_context->current_date =  $obj['now_date'];
		$this->current_date = $obj['now_date'];
		$this->univ = $obj['funivname'];
		$this->pdf_logo_path = $obj['pdf_logo_path'];
		$this->pdf= new MYPDF('L');
		$this->pdf->setData($aobj_context);
		
		$this->fromdeg = trim($aobj_context->mobj_data["degree_code"]);
		

	}
 
	function formcolldata()
	{
		$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);
		
		$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 appData()
	{
		
		$this->fromcoll = $_SESSION['collcode']; 

		$get_app_query = "select fappno, ifnull( DATE_FORMAT(flogdate, '%d/%m/%Y'),'02/03/2018') 
		as applied_date, fname, DATE_FORMAT(fdob,'%d/%m/%Y') as dob, FCATBIRTH,
  		fcollcode, dg.fdegree as degree, REPLACE(dg.fexamname, 'SEMESTER', 'SEM') as fexamname,
  		sa.TOTAL_FEE  as fadmfee, ifnull(sa.fapprstatus, 'PENDING') as status,
		ifnull(sa.FLOGNAME, '') as user, 
		ifnull(DATE_FORMAT(FAPPRDATE, '%d/%m/%Y'),'') as ack_date,
		ifnull(fapprusername,'') as appuser,
		sa.FLATADMFEE as ffeetobepaid,
		sa.funivname,sa.FFATNAME,sa.FMOTNAME
		from studadm sa 
		inner join degree dg 
		on sa.fdegree = dg.fdegree 
		and sa.fexamno = dg.fexamno
		left join masboard m on m.fboardname = sa.funivname
		where sa.fdegree = '{$this->fromdeg}' 
		and sa.fcollcode = '{$this->fromcoll}'
		and sa.fexamno = 'A' 
		and ifnull(sa.fdeleted,'') <> 'T'
		order by sa.fdegree desc, fcollcode desc,flogdate";

		//var_dump($get_app_query);
		$this->results =$this->aobj_context->mobj_db->GetAll($get_app_query);

		$query = "select fintake from colldeg where FDEGREE = '{$this->fromdeg}' and fcollcode = '{$this->fromcoll}'";
		$res = $this->aobj_context->mobj_db->GetRow($query);
		
		$this->fintake = $res['fintake'];



		$query = "select FCATBIRTH,sum(if(fgender = 'Male',1,0))  as male,
				sum(if(fgender = 'Female',1,0))  as female, 
				sum(TOTAL_FEE)  as fee
				from studadm where 
				fdegree = '{$this->fromdeg}' and fcollcode = '{$this->fromcoll}'
				and ifnull(fdeleted,'') <> 'T'
				group by fdegree,fcollcode,FCATBIRTH
				order by fdegree,fcollcode,FCATBIRTH";
		$this->ressum =$this->aobj_context->mobj_db->GetAll($query);

	}
	
		
	function writeApproveList($aobj_context)
	{
		//$this->printHeaders();
		$this->db = trim($aobj_context->mobj_data["db"]);
		//var_dump($this->results);
		$pdf=$this->pdf;

		$pdf->SetMargins(10,25,20,false);
		$pdf->AddPage("L");
		$pdf->SetMargins(10,25,20,false);
		$this->head	= true;
		$pdf->SetFont('courier','',9);
		//var_dump($this->db);
		//if($this->db == 'ru')
			//$pdf->Ln();
		
		$i = 1;
		$table_body = '<table cellpadding="2" cellspacing="0" border="0.5">
				<thead>		
				<tr nobr="true"><th width="30" align="center"><b>Sl. No.</b></th>
				<th width="60" align="center"><b>Appl. No.</b></th>
				<th width="40" align="center"><b>Deg. <br>Code</b></th>
				<th width="140" align="center"><b>Student Name</b></th>
				<th width="60" align="center"><b>DOB</b></th>
				<th width="35" align="center"><b>Caste</b></th>
				<th width="80" align="center"><b>Father Name</b></th>
				<th width="80" align="center"><b>Mother Name</b></th>
				<th width="180" align="center"><b>Name of The Board</b></th>
				<th width="50" align="center"><b>Fees to <br>be Paid</b></th>
				
				
			</tr>
			</thead>
			';
		//$table_body = '';
		$first = 1;
		$amtpaid = 0;
		$amttobepaid = 0;
		$j = 0;
		foreach ($this->results as $key => $value) 
		{
			$table_body .= '<tr nobr="true">
				<td width="30" align="center">'.$i.'</td>
				<td width="60">'.$value['fappno'].'</td>
				<td width="40">'.$value['degree'].'</td>
				<td width="140" align="left">'.$value['fname'].'</td>
				<td width="60">'.$value['dob'].'</td>
				<td width="35" align="left">'.$value['FCATBIRTH'].'</td>
				<td width="80" align="left">'.$value['FFATNAME'].'</td>
				<td width="80" align="left">'.$value['FMOTNAME'].'</td>
				<td width="180" align="left">'.$value['funivname'].'</td>
				<td width="50" align="right">'.$value['fadmfee'].'</td>
				
			</tr>';
			// <td width="50" align="right">'.$value['ffeetobepaid'].'</td>
			$i++;
			// if($i % 20 == 0)
			// {
			// 	// var_dump($i );
			// 	$table_body .= '</table>';
			// 	$pdf->writeHTML($head.$table_body, false, true, false, false, 'C');
			// 	$table_body = '';
			// }

			$j +=1;
			$amttobepaid += $value['ffeetobepaid'];
			$amtpaid += $value['fadmfee'];
			
			//var_dump($amttobepaid);
		}
		$table_body .= '<tr nobr="true">
				<td width="30" align="center"></td>
				<td width="60"></td>
				<td width="40"></td>
				<td width="140" align="left"></td>
				<td width="60"></td>
				<td width="35" align="left"></td>
				<td width="80" align="left"></td>
				<td width="80" align="left"></td>
				<td width="180" align="right"><b>Total</b></td>
				<td width="50" align="right">'.$amtpaid.'</td>
				
			</tr>';
			// <td width="50" align="right"></td>
		$table_body .= '</table>';
		//var_dump($i);
		//if($i % 20 != 0)
			$pdf->writeHTML($table_body, true, true, false, false, 'C');

			$difamt = $amttobepaid - $amtpaid;
			if($difamt < 0)
				$difamt	 = 0;
				//var_dump($this->fintake);
				$pdf->SetFont('courier','B',10);
				$this->first = "strue";
				$aobj_context->first = 'strue';
			$pdf->SetMargins(10,20,20,false);
			$pdf->AddPage("L");
			// var_dump('hii');
			
			
			$pdf->SetMargins(10,20,20,false);
			//$pdf->cell(0,6,"Admission Summary",0,1,"C");
			$pdf->ln(2);	
			
			if($this->db == 'ru')
				$pdf->Ln(20);

			$pdf->cell(30,6,"Sl. No.",1,0,"C");
			$pdf->cell(50,6,"Category",1,0,"C");
			$pdf->cell(50,6,"Male Cnt",1,0,"C");
			$pdf->cell(50,6,"Female Cnt",1,0,"C");
			$pdf->cell(30,6,"Tot. Cnt",1,0,"C");
			$pdf->cell(30,6,"Fee Paid",1,1,"C");
			//$pdf->cell(40,6,"Late Fee Fine",1,1,"C");
			$x = 1;
			$male = 0;
			$female = 0;
			$tot = 0;
			$totfee = 0;
			foreach($this->ressum as $value)
			{
				
				$pdf->cell(30,6,$x,1,0,"C");
				$pdf->cell(50,6,$value['FCATBIRTH'],1,0,"C");
				$pdf->cell(50,6,$value['male'],1,0,"C");
				$pdf->cell(50,6,$value['female'],1,0,"C");
				$pdf->cell(30,6,$value['female']+$value['male'],1,0,"C");
				$pdf->cell(30,6,$value['fee'],1,1,"C");
				//$pdf->cell(40,6,"",1,1,"C");
				$x++;
				$male += $value['male'];
				$female += $value['female'];
				$tot += $value['female']+$value['male'];
				$totfee += $value['fee'];
			}	
			$pdf->cell(30,6,"","LTB",0,"C");
			$pdf->cell(50,6,"Total",1,0,"C");
			$pdf->cell(50,6,$male,1,0,"C");
			$pdf->cell(50,6,$female,1,0,"C");
			$pdf->cell(30,6,$tot,1,0,"C");
			$pdf->cell(30,6,$totfee,1,1,"C");
			//$pdf->cell(40,6,"",1,1,"C");
			

			$pdf->ln(5);	
			$pdf->SetFont('Times','B',12);
			$pdf->Cell(50, 6,'Approved Intake  : '.$this->fintake, 0, 1, 'L');
			$pdf->Cell(50, 6,'No of Student admitted : '.($i-1), 0, 1, 'L');
		//	$pdf->Cell(50, 6,'Total amount to be Paid : '.$amttobepaid, 0, 1, 'L');
			$pdf->Cell(50, 6,'Total amount Paid : '.$amtpaid, 0, 1, 'L');
		//	$pdf->Cell(50, 6,'Difference : '.$difamt, 0, 1, 'L');

			$pdf->ln(5);
			$pdf->MultiCell(0,5,"I here by declare that all the information furnished with regard to the students are true & correct to the best of my knowledge and belief, copy of the recognition order and affiliation order is enclosed.",0,"L");
			$pdf->SetFont('Times','B',12);
			$pdf->ln(14);
			$pdf->Cell(20,4,"Date :",'0',0,'C');
			$pdf->Cell(250,4,"Principal signature (with seal)",'0',1,'R');


			$pdf->ln(12);
			$pdf->Cell(0, 6,'Signature of verifier', 0, 0, 'L');

			$pdf->Cell(0, 6,'Signature of Approver', 0, 1, 'R');

	}
		
	function SendOutput()
	{
		$this->pdf->Output("approve_list_{$this->current_date}.pdf","I");
	}	 
}

function admlist($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$class_obj = new AddmissionApproveList();
	$class_obj->DefaultConstructor($aobj_context);
	$class_obj->formcolldata();
	$class_obj->appData();
	$class_obj->writeApproveList($aobj_context);
	
	$class_obj->SendOutput();
}
?>