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


Current Path : /proc/thread-self/root/var/www/oasis/src_old/
Upload File :
Current File : //proc/thread-self/root/var/www/oasis/src_old/admissionapplist.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"]);
		$this->fromcoll = trim($aobj_context->mobj_data["college"]);
		$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() {
        // 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,46,20,true);	
		$this->SetFillColor(248, 248 ,255);		
		$this->SetFont('Times','',10);

		$img_path = $this->aobj_context->main_src."vskub/img/logo.jpg";
		//var_dump($img_path);
		if(file_exists($img_path)) 
			$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);
		$this->Cell(250,4,'VIJAYANAGARA SRI KRISHNADEVARAYA UNIVERSITY, BALLARI',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);

		

		$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(250,4,'Approval Type - '.$approve_type,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);
		$table_head = '<table cellpadding="2" cellspacing="0" border="1">
			<tr nobr="true"><th width="20" align="center"><b>Sl. No.</b></th>
				<th width="60" align="center"><b>Appl. No.</b></th>
				<th width="30" align="center"><b>Deg. <br>Code</b></th>
				<th width="150" 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="180" align="center"><b>Borad Name</b></th>
				<th width="40" align="center"><b>Fees to <br>be Paid</b></th>
				<th width="50" align="center"><b>Fees Paid</b></th>
				<th width="55" align="center"><b>Status</b></th>
				<th width="60" align="center"><b>Approver</b></th>
				<th width="60" align="center"><b>Approved Date</b></th>
			</tr>
		</table>';

		$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 DATE_FORMAT(now(), '%d/%m/%Y') as now_date";
		$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->pdf= new MYPDF('L');
		$this->pdf->setData($aobj_context);
		
		$this->fromdeg = trim($aobj_context->mobj_data["degree"]);
		$this->fromcoll = trim($aobj_context->mobj_data["college"]);
		$this->strAprtype = trim($aobj_context->mobj_data["appstatus"]);

	}
 
	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()
	{
		if($this->strAprtype == 'Approved')
			$aprCondition = "and sa.fapprstatus = 'Approved'";
		else 
			$aprCondition = "";
		

		if($_SESSION['USERTYPE'] == 'usr')
		{
			$usr_condition = "and sa.fapprusername = '{$_SESSION['USER']}'";
		}
		else
		{
			$usr_condition = "";
		}

		$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,
		m.ffeetobepaid,
		sa.funivname
		from studadm sa 
		inner join degree dg 
		on sa.fdegree = dg.fdegree 
		and sa.fexamno = dg.fexamno
		inner join masboard m on m.fboardname = sa.funivname
		where sa.fdegree = '{$this->fromdeg}' 
		and sa.fcollcode = '{$this->fromcoll}'
		and sa.fexamno = 'A' {$aprCondition} 
		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'];
	}
	
		
	function writeApproveList()
	{
		//$this->printHeaders();

		//var_dump($this->results);
		$pdf=$this->pdf;

		$pdf->SetMargins(10,46,20,false);
		$pdf->AddPage("L");

		$pdf->SetFont('courier','',9);

		
		$i = 1;
		$head = '<table cellpadding="2" cellspacing="0" border="1">';
		$table_body = '';
		$first = 1;
		$amtpaid = 0;
		$amttobepaid = 0;
		$j = 0;
		foreach ($this->results as $key => $value) 
		{
			$table_body .= '<tr nobr="true">
				<td width="20" align="center">'.$i.'</td>
				<td width="60">'.$value['fappno'].'</td>
				<td width="30">'.$value['degree'].'</td>
				<td width="150" align="left">'.$value['fname'].'</td>
				<td width="60">'.$value['dob'].'</td>
				<td width="35" align="left">'.$value['FCATBIRTH'].'</td>
				<td width="180" align="left">'.$value['funivname'].'</td>
				<td width="40" align="right">'.$value['ffeetobepaid'].'</td>
				<td width="50" align="right">'.$value['fadmfee'].'</td>
				<td width="55">'.$value['status'].'</td>
				<td width="60" align="left">'.$value['appuser'].'</td>
				<td width="60">'.$value['ack_date'].'</td>
			</tr>';

			$i++;
			if($i % 20 == 0)
			{
				$table_body .= '</table>';
				$pdf->writeHTML($head.$table_body, false, true, false, false, 'C');
				$table_body = '';
			}

			if($value['status'] == 'Approved')
			{
				$j +=1;
				$amttobepaid += $value['ffeetobepaid'];
				$amtpaid += $value['fadmfee'];
			}	
			
			//var_dump($amttobepaid);
		}
		
		$table_body .= '</table>';
		//var_dump($i);
		if($i % 20 != 0)
			$pdf->writeHTML($head.$table_body, true, true, false, false, 'C');

			$difamt = $amttobepaid - $amtpaid;
			if($difamt < 0)
				$difamt	 = 0;
				//var_dump($this->fintake);
				$pdf->SetFont('courier','B',10);
	
			$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,'No of Student approved : '.$j, 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');

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

function GenerateAdmissionAppList($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();
	
	$class_obj->SendOutput();
}
?>