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


Current Path : /var/www/oasis/src_old/
Upload File :
Current File : /var/www/oasis/src_old/downloadFeeStatement.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 DownloadFeeStatement  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'];
		$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 ".$this->current_date,'0',0,'L');
		$this->Cell(50,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
		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']; 	
	}
	 
		 
	function formData()
	{
		$this->pdf->SetMargins(10,12,10);		
		$this->pdf->AddPage();
		$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,10,10,20);
		}
		$this->pdf->SetFont('Times','B',15);
		$this->pdf->cell(180,3,"".$this->FUNIVNAME,"0",1,"C");
		$this->pdf->SetFont('Times','',8);
		$this->pdf->cell(180,4, $this->s_state,"0",1,"C");
		$this->pdf->SetFont('Times','B',10);
		$this->pdf->cell(180,6, $this->FCOLLCODE." - ".$this->FCOLLNAME,"0",1,"C");
		$this->pdf->SetFont('Times','B',10);
		$this->pdf->Cell(180,3,"Exam Application Forms List / Fees Statement","0",1,"C");
		$this->pdf->SetFont('Times','B',15);	
		$this->pdf->Ln(4); 
	}
	
	function GetFullQry()
	{
		
		$app_no_from =$this->aobj_context->mobj_data['app_no_from'];
		$app_no_to =$this->aobj_context->mobj_data['app_no_to'];
		$roll_no_from =$this->aobj_context->mobj_data['roll_no_from'];
		$roll_no_to =$this->aobj_context->mobj_data['roll_no_to'];
		$degree_from =$this->aobj_context->mobj_data['degree_from'];
		$degree_to =$this->aobj_context->mobj_data['degree_to'];
		
		$get_data="SELECT DISTINCT DATE_FORMAT(r.FRECPTDATE,'%d/%m/%Y') AS FRECPTDATE,r.FREGNO,s.FNAME,r.FDEGREE,r.FTOTALFEE
		FROM candsum r INNER JOIN student s ON s.FREGNO=r.FREGNO and s.fdegree = r.fdegree
		WHERE r.FCOLLCODE='{$this->collcode}' and  DATE_FORMAT(ifnull(FRECPTDATE,''),'%d/%m/%Y') <>'00/00/0000'  
		and ifnull(FTOTALFEE,0) > 0
		and r.FDEGREE between '{$degree_from}' and '{$degree_to}'
		and r.FREGNO between '{$roll_no_from}' and '{$roll_no_to}'		
		order by r.FREGNO";			 
		$this->lobj_get_get_data= $this->aobj_context->mobj_db->GetAll($get_data);
		
		$lquery="SELECT DISTINCT sum(FTOTALFEE) as amount
		FROM candsum r INNER JOIN student s ON s.FREGNO=r.FREGNO and s.fdegree = r.fdegree
		WHERE r.FCOLLCODE='{$this->collcode}' and  DATE_FORMAT(ifnull(FRECPTDATE,''),'%d/%m/%Y') <>'00/00/0000'  
		and ifnull(FTOTALFEE,0) > 0
		and r.FDEGREE between '{$degree_from}' and '{$degree_to}'
		and r.FREGNO between '{$roll_no_from}' and '{$roll_no_to}'		
		order by r.FREGNO";			 
		$this->results= $this->aobj_context->mobj_db->GetRow($lquery);
		
	}
	
	function GetQry()
	{
		$i=0;
		$this->SetFillColor(219,217,217);
		//$this->SetDrawColor(255,2,195);
		$this->pdf->SetFont('Times','B',9);
	 
		$this->pdf->cell(15,7, "Sl. No.","1",0,"C",true);
		$this->pdf->cell(16,7, "Degree","1",0,"C",true);
		$this->pdf->cell(20,7, "Roll. No","1",0,"C",true);
		$this->pdf->cell(100,7, "Student Name","1",0,"C",true);			 
		$this->pdf->cell(16,7, "Fee Paid","1",0,"C",true);
		$this->pdf->cell(16,7, "Date","1",1,"C",true);
		$height=5;
		$sl_no=1;
		$this->pdf->SetFont('Times','',9);

		foreach($this->lobj_get_get_data as $ak=>$av)
		{ 
			$sub_code=$ak;
			$this->pdf->cell(15,$height, $sl_no,"1",0,"C");
			$this->pdf->cell(16,$height, $av['FDEGREE'],"1",0,"C");
			$this->pdf->cell(20,$height, $av['FREGNO'],"1",0,"C");
			$this->pdf->cell(100,$height, $av['FNAME'],"1",0,"Ls");
			$this->pdf->cell(16,$height, $av['FTOTALFEE'],"1",0,"C");
			$this->pdf->cell(16,$height, $av['FRECPTDATE'],"1",1,"C");
			$sl_no++;
		 }	
		$this->pdf->cell(151,$height,'Total Amount',"1",0,"C");
		$this->pdf->cell(32,$height, $this->results['amount'],"1",1,"C");		 
	}
	
	function SendOutput()
	{
		$this->pdf->Output("application_letter_{$this->app_no}.pdf","D");
	}	 
}

function DownloadFeeStatement($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$class_obj=new DownloadFeeStatement();
	$class_obj->AliasNbPages();
	$class_obj->DefaultConstructor($aobj_context);
	$class_obj->formcolldata();
	$class_obj->GetFullQry();	 
	$class_obj->formData();
	$class_obj->GetQry();
	$class_obj->SendOutput();
}

?>