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


Current Path : /var/www/oasis/Report_details_old/
Upload File :
Current File : /var/www/oasis/Report_details_old/htstatus.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 ra_htstatus  extends FPDF
{
	function DefaultConstructor($aobj_context)
	{
		session_start();
		$this->aobj_context=$aobj_context;
		session_start();
		$FUNIVCODE = $_SESSION['FUNIVCODE'];
		$this->pdf=  new FPDF();
		$this->pdf=$this;

		$this->regnofrom = str_pad(strtoupper(trim($this->aobj_context->mobj_data["regnofrom"])),8, "00000000", STR_PAD_LEFT);
		$this->regnoto   = str_pad(strtoupper(trim($this->aobj_context->mobj_data["regnoto"])),8,"ZZZZZZZZ",STR_PAD_LEFT);
		$this->rtype     = trim($this->aobj_context->mobj_data["rtype"]);
		$this->degcode   = trim($this->aobj_context->mobj_data["degcode"]);
		
		$this->ip=$_SERVER["REMOTE_ADDR"];
		$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];	
		$this->collcode=$_SESSION['collcode'];	
		$this->headeractive = true;
	}
 
	function Header()
	{
		session_start();
		$FUNIVCODE = $_SESSION['FUNIVCODE'];
		$img_logo_path=$this->aobj_context->main_src."/".$this->aobj_context->mobj_data["db"]."/".$this->pdf_logo_path;
		if(!empty($this->pdf_logo_path))
		{
			$this->pdf->Image($img_logo_path,10,10,23,23);
		}
		
		$img_path2 = $this->aobj_context->main_src."/".$this->aobj_context->mobj_data["db"]."/img/logo2.jpg";
		if(file_exists($img_path2))
		{
			$this->pdf->Image($img_path2,170,6,23,23);
		}
		
		$this->pdf->SetFont('Times','B',15);
		$this->pdf->cell(0,3,$this->FUNIVNAME."","0",1,"C");
		$this->pdf->SetFont('Times','B',12);
		$this->pdf->cell(180,6, $this->s_state,"0",1,"C");
		
		if(strrpos("000*017*033*035*034*036*011*011*",$FUNIVCODE.'*')== false)
			$this->pdf->cell(0,6,$this->college_details,"0",1,"C");

		
		$this->pdf->Cell(0,6,"Hall Ticket Status Report - $this->rtype","0",1,"C");
		
		//$this->pdf->SetFont('Times','',11);
		//$this->pdf->Cell(180,6," {$this->FEXAMDATE} EXAMINATION","0",1,"C");
		$this->pdf->SetFont('Times','',12);
		$this->pdf->Cell(180,6," {$this->Degree}","0",1,"C");
		$this->pdf->Cell(180,7,"Reg. No. Range : {$this->regnofrom} - {$this->regnoto}","0",1,"C");
		$this->pdf->Ln(1);
		$this->pdf->SetFont('Times','',12);
		$empty_cell_width=24;
		//$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
		$this->pdf->SetFont('Times','B',14);
		
		$this->pdf->SetFont('Times','B',12);

		if($this->headeractive == true)
		{	
			$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
			$this->pdf->cell(15,7, "Sl. No.","1",0,"C");
			$this->pdf->cell(20,7, "Reg. No.","1",0,"C");						
			$this->pdf->cell(90,7, "Name","1",0,"C");
			$this->pdf->cell(30,7, "Status","1",1,"C");
		}	
	}	
	
	function Footer()
	{
		$this->SetY(-15);
		$this->pdf->SetFont('Times','B',8);
		//$pagecount ='{nb}';
	
		$this->Cell(140,6,'Printed   : IP Address : '.$this->ip." Date ".$this->current_date,'0',0,'L');
		//$this->Cell(50,6,'Page '.$this->PageNo().' of '.$pagecount,0,1,'R');
	}
	
	function formcolldata()
	{
		
		$get_coll_name="select FUNIVNAME as 'FUNIVNAME',funivcode,
						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->funivcode = $lobj_get_coll_name['funivcode']; 
		$this->pdf_logo_path=$lobj_get_coll_name['pdf_logo_path'];
	 	
		$get_data="SELECT c.FCOLLCODE,
				CONCAT(c.FCOLLCODE, ' - ', c.FCOLLNAME,', ',c.FTOWN) AS FCOLLNAME FROM college c
				where c.FCOLLCODE='{$this->collcode}'";					
		$obj_student=$this->aobj_context->mobj_db->GetRow($get_data); 
		 
		$this->college_det = $obj_student['FCOLLNAME'];
	 
		$this->college_details=" College : {$this->college_det}";	

		$query  = "select concat(fdegree,' - ',fdescpn) AS fdegree from degree
		where fdegree = '{$this->degcode}' and fexamno = 'A'";
		
		$result = $this->aobj_context->mobj_db->GetRow($query); 

		
		
		$fdegree = $result['fdegree'];

		$this->Degree = "Degree : {$fdegree}";

	 }
	
	
	function formData()
	{
		session_start();
		$FUNIVCODE = $_SESSION['FUNIVCODE'];
		
		if($this->rtype == 'Not Downloaded')
		{	
			$cnd = "and ifnull(cs.fhtstatus,'F') = 'F'";
		}
		else if($this->rtype == 'Downloaded')
		{	
			$cnd = " and ifnull(cs.fhtstatus,'F') = 'T'";
		}	
		else
		{	
			$cnd = '';
		}	
		

		$get_data="SELECT cs.fregno, st.fname, if(ifnull(cs.fhtstatus,'') = 'T','Downloaded','Not Downloaded') as status  from candsum cs inner join student st on 
			cs.fcollcode = st.fcollcode and cs.fdegree = st.fdegree 
			and cs.fregno = st.fregno   
			where ifnull(cs.frecptdate,'') <> '' {$cnd}
			and cs.fdegree = '{$this->degcode}'  and cs.fregno between '{$this->regnofrom}' and '{$this->regnoto}' and cs.fcollcode = '{$this->collcode}'";
		//var_dump($get_data);
		$lobj_get_data = $this->aobj_context->mobj_db->GetAll($get_data);


		$this->pdf->SetMargins(3,12,10);		
		
		$empty_cell_width=24;
		$this->pdf->SetFont('Times','',10);

		$this->headeractive = true;
		$this->pdf->AddPage();
		$sl_no=1;
		foreach($lobj_get_data as $key=>$value)
		{
			
			
			if($this->pdf->GetY() > 260) //if($cnt > 30)
			{
				$this->headeractive = true;
				$this->pdf->AddPage();
				$cnt = 0;
			}

			$this->pdf->cell($empty_cell_width,6, ""," ",0,"C");
			$this->pdf->cell(15,6, $sl_no,"1",0,"C");
			$this->pdf->cell(20,6, $value['fregno'],"1",0,"C");						
			$this->pdf->cell(90,6, $value['fname'],"1",0,"L");
			$this->pdf->cell(30,6,$value['status'],"1",1,"C");
			$sl_no++;
		}

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

}

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

	$class_obj=new ra_htstatus();
	$class_obj->AliasNbPages();
	$class_obj->DefaultConstructor($aobj_context);

	$class_obj->formcolldata();
	$class_obj->formData();
	 
	$class_obj->SendOutput();
}

function checkgeneratehtstaus($aobj_context)
{

	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);

	$regnofrom = str_pad(strtoupper(trim($aobj_context->mobj_data["regnofrom"])),8, "00000000", STR_PAD_LEFT);
	$regnoto   = str_pad(strtoupper(trim($aobj_context->mobj_data["regnoto"])),8,"ZZZZZZZZ",STR_PAD_LEFT);
	$rtype     = trim($aobj_context->mobj_data["rtype"]);
	$degcode   = trim($aobj_context->mobj_data["degcode"]);

	$query = "select * From candsum where fdegree = '{$degcode}' 
		and fregno between '{$regnofrom}' and '{$regnoto}' 
		and ifnull(fhtupload,'') = 'T'";
	$result = $aobj_context->mobj_db->GetRow($query);
	
	if(count($result) >0)
	{
		$arr = '';	
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
	}else
	{
		$arr = 'Hall Ticket Not Uploaded. Please upload Hall Ticket';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
	}	

}

?>