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


Current Path : /var/www/oasis/Report_details/
Upload File :
Current File : /var/www/oasis/Report_details/invig_report.php

<?php
$main_src=substr($_SERVER['SCRIPT_FILENAME'],0,strlen($_SERVER['SCRIPT_FILENAME'])-7);
$pdf_writer_class =$main_src."/tcpdf/tcpdf.php";
require_once($pdf_writer_class);
include_once("stringspliter.php");
require_once("/var/www/html/aws/aws-autoloader.php");
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;

ini_set('max_execution_time', 300);
ini_set("memory_limit","500M");

// $pdf_writer_class =$main_src."/maya-pdf/fpdf.php";
// require_once($pdf_writer_class);
	
class ra_invigilators_dairy  extends TCPDF
{
	function DefaultConstructor($aobj_context)
	{
		session_start();
		$this->aobj_context=$aobj_context;
		$this->pdf=  new TCPDF();
		$this->pdf=$this;
		$this->fromdate=trim($this->aobj_context->mobj_data["fromdate"]);
		//var_dump($this->fromdate);die();
		$this->fromqpcode=trim($this->aobj_context->mobj_data["fqpcode"]);
		$this->toqpcode=trim($this->aobj_context->mobj_data["tqpcode"]);
		$this->session=trim($this->aobj_context->mobj_data["session"]);
		$this->room_range_from=trim($this->aobj_context->mobj_data["room_range_from"]);
		$this->room_range_to=trim($this->aobj_context->mobj_data["room_range_to"]);
		$this->rtype=trim($this->aobj_context->mobj_data["rtype"]);
		$this->room_range_from=str_pad($this->room_range_from, 3, "0", STR_PAD_LEFT);  
		$this->room_range_to=str_pad($this->room_range_to, 3, "0", STR_PAD_LEFT);  
		$this->ip=$_SERVER["REMOTE_ADDR"];
		$get_date="select now() as now_date";
		$obj=$this->aobj_context->mobj_db->GetRow($get_date);
		$this->current_date=$obj['now_date'];	
		$this->collcode=$_SESSION['collcode'];	
		$this->funivcode=$_SESSION['FUNIVCODE'];	
		$this->headeractive = true;
		$this->startPageGroup();
	}
 
	function Header()
	{
		if($FUNIVCODE == '031')
		{
			if(!empty($this->pdf_logo_path))
			{
				$img_logo_path=$this->aobj_context->main_src. '/'.$this->aobj_context->mobj_data["db"]."/img/report_uni_logo.jpg";
				$this->pdf->Image($img_logo_path,60,4,80);
				$this->pdf->Ln(10);
			}	
		}
		else
		{
			// $img_path=$this->aobj_context->main_src. '/'.$this->aobj_context->mobj_data["db"].'/'.$this->photo_path;
			// if(!empty($this->photo_path) && file_exists($img_path)) 
			// {			
			// 	$this->pdf->Image($img_path,166,50,50);
			// }	
			if(!empty($this->pdf_logo_path))
			{
				$img_logo_path=$this->aobj_context->main_src.'/'.$this->aobj_context->mobj_data["db"].'/'.$this->pdf_logo_path;
				$this->pdf->Image($img_logo_path,10,10,20);
			}
			$this->pdf->SetFont('Times','B',15);
			$this->pdf->ln(3);
			$this->pdf->cell(180,3,$this->FUNIVNAME."","0",1,"C");
			$this->pdf->SetFont('Times','B',8);
			$this->pdf->cell(180,6, $this->s_state,"0",1,"C");
		}
		$this->pdf->SetFont('Times','B',12);
		$this->pdf->cell(200,6, "Centre : $this->college_details ","0",1,"C");
		$this->pdf->SetFont('Times','B',12);
		if($FUNIVCODE == '005')
			$this->pdf->Cell(180,6,"ATTENDANCE SHEET","0",1,"C");
		else
			$this->pdf->Cell(180,6,"INVIGILATOR'S DIARY - {$this->FEXAMDATE} EXAMINATION","0",1,"C");	
		
	}	
	
	function Footer()
	{

		
			$this->SetY(-15);
			$this->pdf->SetFont('Times','B',8);
			//$this->Cell(140,6,'Entered  : IP Address : '.$this->ip_address." Date ".$this->created_date,'0',0,'L');
			$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');
			$this->Cell(50, 6,'Page ' .$this->PageNo().'', 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->f_year=$lobj_get_coll_name['f_year'];
		$this->pdf_logo_path=$lobj_get_coll_name['pdf_logo_path'];
		$this->funivcode=$lobj_get_coll_name['FUNIVCODE'];

	 	
		$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_details = $obj_student['FCOLLNAME'];
		$this->degree_details  = " College : {$this->FCOLLNAME}";		

	 }
	 
	function writepdf($data){

		$pdf=$this->pdf;
        $pdf->SetMargins(10,35,25,10);
        $pdf->startPageGroup();
        $pdf->AddPage("P");
    
        // $pdf->SetMargins(10,12,10);		
        
        $empty_cell_width=12;
        $pdf->SetFont('Times','B',10);

		// var_dump($data,'fdgdg');
		$this->pdf->cell(15,7, "Sl. No.","1",0,"C");
		$this->pdf->cell(22,7, "Reg. No.","1",0,"C");
		$this->pdf->cell(70,7, "Name","1",0,"C");
		$this->pdf->cell(20,7, "Qp Code","1",0,"C");
		$this->pdf->cell(32,7, "Ans. Book No.","1",0,"C");
		$this->pdf->cell(22,7, "Signature","1",1,"C");
		$pdf->SetFont('Times','',12);
        $z=0;
		$c = 1;
		foreach($data as $key=>$value){
			if($z == 33){
				$pdf->AddPage("P");
				$pdf->SetFont('Times','B',10);
				$this->pdf->cell(15,7, "Sl. No.","1",0,"C");
				$this->pdf->cell(22,7, "Reg. No.","1",0,"C");
				$this->pdf->cell(70,7, "Name","1",0,"C");
				$this->pdf->cell(20,7, "Qp Code","1",0,"C");
				$this->pdf->cell(32,7, "Ans. Book No.","1",0,"C");
				$this->pdf->cell(22,7, "Signature","1",1,"C");
				$pdf->SetFont('Times','',12);
				$z=0;
			}
			$this->pdf->cell(15,7, $c,"1",0,"C");
			$this->pdf->cell(22,7, $value['FREGNO'],"1",0,"C");						
			$this->pdf->cell(70,7, $value['FNAME'],"1",0,"L");
			$this->pdf->cell(20,7, $value['fqpcode'],"1",0,"C");
			$this->pdf->cell(32,7, $value['fansbookno'],"1",0,"C");
			$this->pdf->cell(22,7, "","1",1,"C");
			$z++;
			$c++;
		}
	}
	 
	function SendOutput()
	{
		$this->pdf->Output("Invigilators Dairy.pdf","I");
	}

}

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

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


	if($session == 'both')
		{
			$sectionvalue = "";
		}
		else 
		{
			$sectionvalue = "and s.fsession like '{$session}%'";
		}
			
		if($_SESSION['fexamseparate'] == 'T')
		{
			$candsum = "examcandsum"; 
			$canddet = "examcanddet"; 

		}else
		{
			$candsum = "candsum"; 
			$canddet = "canddet"; 
		}	

		$degreetmp = "degree";
		$subjecttmp = "subject";
		$edate=$aobj_context->mobj_data["fromdate"];

		if($fdeggrp =='BED' && ($funivcode == '027' || $funivcode == '026') )
        {
            $order = "s.FQPCODE,cd.FHALLNO,st.fname,s.FQPCODE, cd.FREGNO";
        }else if($funivcode == '046')
		{
			$order = "s.FQPCODE,st.fayear,cd.FREGNO";
		}else if($funivcode == '033')
		{
			$order = "cd.FHALLNO,s.FQPCODE,st.fayear,cd.FREGNO";
		}
        else
        {
            $order = "LPAD(ra.forder, 3, '0'), s.FQPCODE, cd.FREGNO";
        }
	
		
	if($_SESSION['FUNIVCODE'] == '033')
        {
			$get_data = "SELECT cd.FHALLNO,cd.FREGNO,st.FNAME ,masroom.froomname,ifnull(st.fphotopath,'') as fphotopath,
			s.fqpcode, LPAD(ra.forder,3, '000') AS foorder,ifnull(rt.fname,'') as rtname, IFNULL(t.fansbookno, '') AS fansbookno 
			FROM {$canddet} cd INNER JOIN {$subjecttmp} s ON s.fdegree = cd.fdegree 
			and s.fexamno = cd.fexamno and s.FSUBCODE=cd.FSUBCODE 
			inner join {$candsum} cs on cs.FREGNO=cd.FREGNO AND  cd.FCOLLCODE=cs.FCOLLCODE 
			inner join student st on st.FREGNO=cd.FREGNO AND cd.FCOLLCODE=st.FCOLLCODE 
			inner JOIN masroom ON masroom.froomno = FHALLNO AND masroom.FCOLLCODE = cs.FCNTRCODE 
			LEFT JOIN reason r ON s.FSESSION = r.FREASONCD 
            left join roominvig rt on cd.fteachcode = rt.fteachcode
			inner join room_allotment ra on cs.fcntrcode = ra.fcollcode and s.fqpcode = ra.fqpcode 
			and ra.fhallno = masroom.froomno
            INNER JOIN anstran t ON cd.fregno = t.fregno
			WHERE cs.FCNTRCODE='{$_SESSION['collcode']}' and s.ftheory = 'T' and ifnull(s.fintass,'') <> 'T' 
			and ifnull(s.fretain,'') <> 'T' 
			{$sectionvalue} and s.FQPCODE between '0' and 'zzz' 
			and ifnull(cd.FHALLNO,'') <> '' 
			and INSTR(cs.fhtenable,cd.fexamno) >0
			AND lpad(cd.FHALLNO,3,'0') between '0' and 'zzz' 
			and s.fdoe = date_format(str_to_date('{$edate}','%d/%m/%Y'),'%Y-%m-%d') 
			and FPRESENT='P' and ifnull(cd.fpassmth,'') = '' and ifnull(FRECPTDATE,'0000-00-00')<>'0000-00-00' 
			order by {$order}";
           
        }else
        {
            $get_data = "SELECT cd.FHALLNO,cd.FREGNO,st.FNAME ,masroom.froomname,ifnull(st.fphotopath,'') as fphotopath,
			s.fqpcode, LPAD(ra.forder,3, '000') AS foorder,'' as rtname, IFNULL(t.fansbookno, '') AS fansbookno 
			FROM {$canddet} cd INNER JOIN {$subjecttmp} s ON s.fdegree = cd.fdegree 
			and s.fexamno = cd.fexamno and s.FSUBCODE=cd.FSUBCODE 
			inner join {$candsum} cs on cs.FREGNO=cd.FREGNO AND  cd.FCOLLCODE=cs.FCOLLCODE 
			inner join student st on st.FREGNO=cd.FREGNO AND cd.FCOLLCODE=st.FCOLLCODE 
			inner JOIN masroom ON masroom.froomno = FHALLNO AND masroom.FCOLLCODE = cs.FCNTRCODE 
			LEFT JOIN reason r ON s.FSESSION = r.FREASONCD 
			inner join room_allotment ra on cs.fcntrcode = ra.fcollcode and s.fqpcode = ra.fqpcode 
			and ra.fhallno = masroom.froomno
            INNER JOIN anstran t ON cd.fregno = t.fregno
			WHERE cs.FCNTRCODE='{$_SESSION['collcode']}' and s.ftheory = 'T' and ifnull(s.fintass,'') <> 'T' 
			and ifnull(s.fretain,'') <> 'T' 
			{$sectionvalue} and s.FQPCODE between '0' and 'z' 
			and ifnull(cd.FHALLNO,'') <> '' 
			and INSTR(cs.fhtenable,cd.fexamno) >0
			AND lpad(cd.FHALLNO,3,'0') between '0' and 'z' 
			and s.fdoe = date_format(str_to_date('{$edate}','%d/%m/%Y'),'%Y-%m-%d') 
			and FPRESENT='P' and ifnull(cd.fpassmth,'') = '' and ifnull(FRECPTDATE,'0000-00-00')<>'0000-00-00' 
			order by {$order}";
             
        }


        
		$lobj_get_data = $aobj_context->mobj_db->GetAll($get_data);

		// var_dump($get_data);

	$class_obj=new ra_invigilators_dairy();
	// $class_obj->AliasNbPages();
	$class_obj->DefaultConstructor($aobj_context);
	$class_obj->formcolldata();
	$class_obj->writepdf($lobj_get_data);
	// $class_obj->GetFullQry();
	
	// $class_obj->formData();
	
	$class_obj->SendOutput();
}



?>