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


Current Path : /var/www/oasis/Report_details/
Upload File :
Current File : /var/www/oasis/Report_details/report_ra_invigilator_dairy_sjbit.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","1080M");

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->faculty=trim($this->aobj_context->mobj_data["faculty"]);
		$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,ifnull(fregroll,'Reg. No.') as fregroll from control";
		$obj=$this->aobj_context->mobj_db->GetRow($get_date);
		
		$this->current_date=$obj['now_date'];
		$this->fregroll=$obj['fregroll'];	
		$this->collcode=$_SESSION['collcode'];	
		$this->funivcode=$_SESSION['FUNIVCODE'];
			
		// if($this->funivcode == '052')
		// 	$this->fregroll= "USN";
		// else
		// 	$this->fregroll= "Register";
		$this->headeractive = true;
		$this->startPageGroup();
	}
 
	function Header()
	{
		$bMargin = $this->getBreakMargin();
		$auto_page_break = $this->AutoPageBreak;
		$this->SetAutoPageBreak(false, 0);
		$this->SetAutoPageBreak($auto_page_break, $bMargin);	
		
	}	
	
	function Footer()
	{
		// if($this->funivcode == '052')
		// {
		// 	$this->SetY(-50);	
		// 	$this->Ln(3);		
		// 	$this->cell(0,7, "No. of Answer Booklets received","0",1,"R");
		// 	$this->Ln(10);	
		// 	$this->cell(0,7, "Signature of the Receiver","0",1,"R");
		// }else
		// {
			$this->SetY(-12);	
		//}

		$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(0,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(0, 6,'Page ' .$this->getPageNumGroupAlias().'/'.$this->getPageGroupAlias(), 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,
				if('{$this->funivcode}' = '052',CONCAT('Center Code: ',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 GetFullQry()
	{
		if($this->session == 'both')
		{
			$sectionvalue = "";
		}
		else 
		{
			$sectionvalue = "and s.fsession like '{$this->session}%'";
		}
			
		if($_SESSION['fexamseparate'] == 'T')
		{
			$candsum = "examcandsum"; 
			$canddet = "examcanddet"; 

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

		$degreetmp = "degree";
		$subjecttmp = "subject";
	
		/*$get_data="SELECT FHALLNO,cd.FREGNO,st.FNAME ,masroom.froomname,st.fphotopath,fqpcode,
		(select count(*) from canddet s1 where s1.fdegree = cd.fdegree and s1.fexamno = cd.fexamno and s1.fsubcode = cd.fsubcode and s1.fdegree = s.fdegree 
		and s1.fexamno = s.fexamno and s1.fsubcode = s.fsubcode and s1.fpresent = 'P' group by s1.fdegree, s1.fexamno, s1.fsubcode) as orderby 
		FROM canddet cd INNER JOIN subject 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.FDEGREE=cs.FDEGREE
		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

		WHERE cs.FCNTRCODE='{$this->collcode}' and s.ftheory = 'T' and ifnull(s.fintass,'') <> 'T'
		and ifnull(s.fretain,'') <> 'T' {$sectionvalue}
		and FQPCODE between '{$this->fromqpcode}' and '{$this->toqpcode}' and ifnull(cd.FHALLNO,'') <> ''
		AND lpad(cd.FHALLNO,3,'0') between '{$this->room_range_from}' and '{$this->room_range_to}' and s.fdoe = date_format(str_to_date('{$this->fromdate}','%d/%m/%Y'),'%Y-%m-%d')
		and FPRESENT='P' and ifnull(cd.fpassmth,'') = '' and ifnull(FRECPTDATE,'0000-00-00')<>'0000-00-00' 
		order by orderby desc,FHALLNO,FQPCODE,cd.FREGNO";*/

		$query = "select distinct d.fdeggrp from {$degreetmp} d inner join subject s on d.fdegree = s.fdegree
        and d.fexamno = s.fexamno
		where s.fdoe = date_format(str_to_date('{$this->fromdate}','%d/%m/%Y'),'%Y-%m-%d')
		and ifnull(d.fdeggrp,'') <> ''";
        $res = $this->aobj_context->mobj_db->GetRow($query);
        $fdeggrp = $res['fdeggrp'];

        if($fdeggrp =='BED' && ($this->funivcode == '027' || $this->funivcode == '026') )
        {
            $order = "s.FQPCODE,cd.FHALLNO,st.fname,s.FQPCODE, cd.FREGNO";
        }else if($this->funivcode == '046')
		{
			$order = "s.FQPCODE,st.fayear,cd.FREGNO";
		}else if($this->funivcode == '033')
		{
			$order = "cd.FHALLNO,s.FQPCODE,st.fayear,cd.FREGNO";
		}else if($this->funivcode == '052')
		{
			$order = "cd.FHALLNO,s.FQPCODE,cd.FREGNO";
		}else if($this->funivcode == '055' || $this->funivcode == '021')
		{
			$order = "cd.FHALLNO,s.FQPCODE,cd.FREGNO";
		}
        else
        {
            $order = "LPAD(ra.forder, 3, '0'), s.FQPCODE, cd.FREGNO";
        }

        if($this->funivcode == '033')
        {
			$get_data = "SELECT cd.FHALLNO,cd.FREGNO,left(st.FNAME,30) as FNAME ,masroom.froomname,ifnull(st.fphotopath,'') as fphotopath,s.fmcq,
			s.fqpcode, LPAD(ra.forder,3, '000') AS foorder,ifnull(rt.fname,'') as rtname
			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
			WHERE cs.FCNTRCODE='{$this->collcode}' and s.ftheory = 'T' and ifnull(s.fintass,'') <> 'T' 
			and ifnull(s.fretain,'') <> 'T' 
			{$sectionvalue} and s.FQPCODE between '{$this->fromqpcode}' and '{$this->toqpcode}' 
			and ifnull(cd.FHALLNO,'') <> '' 
			and INSTR(cs.fhtenable,cd.fexamno) >0
			and ifnull(s.fparentsub,'') <> 'T'
			AND lpad(cd.FHALLNO,3,'0') between '{$this->room_range_from}' and '{$this->room_range_to}' 
			and s.fdoe = date_format(str_to_date('{$this->fromdate}','%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,concat(cd.FREGNO,'*',s.fqpcode) as FREGNO1,left(st.FNAME,30) as FNAME ,masroom.froomname,ifnull(st.fphotopath,'') as fphotopath,
			s.fqpcode, LPAD(ra.forder,3, '000') AS foorder,'' as rtname
			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 degree d on cd.fdegree = d.fdegree and cd.fexamno = d.fexamno
			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 room_allotment ra on cs.fcntrcode = ra.fcollcode and s.fqpcode = ra.fqpcode 
			and ra.fhallno = masroom.froomno
			WHERE cs.FCNTRCODE='{$this->collcode}' and s.ftheory = 'T' and ifnull(s.fintass,'') <> 'T' 
			{$sectionvalue} and s.FQPCODE between '{$this->fromqpcode}' and '{$this->toqpcode}' 
			and ifnull(cd.FHALLNO,'') <> '' 
			and d.fdeggrp = '{$this->faculty}'
			and INSTR(cs.fhtenable,cd.fexamno) >0
			#and ifnull(s.fparentsub,'') <> 'T'
			AND lpad(cd.FHALLNO,3,'0') between '0000' and 'zzzzz' 
			and s.fdoe = date_format(str_to_date('{$this->fromdate}','%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}";
			


        }
        
	
		$this->lobj_get_data = $this->aobj_context->mobj_db->GetAll($get_data);
		// var_dump($get_data);
		// 	die();
		
		$this->final_data_arr=array();
		$this->hallname= array();
		$c=0;
		foreach($this->lobj_get_data as $ak=>$av)
		{
			$this->final_data_arr[$av['FHALLNO']][$av['FREGNO1']]['FREGNO']=$av['FREGNO'];
			$this->final_data_arr[$av['FHALLNO']][$av['FREGNO1']]['FNAME']=$av['FNAME'];
            $this->final_data_arr[$av['FHALLNO']][$av['FREGNO1']]['rtname']=$av['rtname'];
			$this->final_data_arr[$av['FHALLNO']][$av['FREGNO1']]['fphotopath']=$av['fphotopath']; 
			$this->final_data_arr[$av['FHALLNO']][$av['FREGNO1']]['fqpcode']=$av['fqpcode'];
			// To display room name 12/11/2016

			$this->hallname[$av['FHALLNO']] = $av['froomname'];
			$c++;
		} 
	}
		
	function WriteSlNoRow()
	{
		
	}

	function logoheader($FUNIVCODE,$last)
	{
		
		if($FUNIVCODE == '031' || $FUNIVCODE == '049' || $FUNIVCODE == '055')
		{
			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";
				if($FUNIVCODE == '049')
				{	
					$this->pdf->Image($img_logo_path,80,4,62);
					$this->pdf->Ln(9);
				} else if($FUNIVCODE == '055')
				{

					if($FUNIVCODE == '055')
						$this->pdf->Cell(0,1,"FORM-B","0",1,"R");

					$this->pdf->Image($img_logo_path,30,2,140,20);
					$this->pdf->Ln(10);
				}
				else
					$this->pdf->Image($img_logo_path,60,4,80);
				
				if($FUNIVCODE != '055')
					$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;
				if($FUNIVCODE == '052')
					$this->pdf->Image($img_logo_path,5,5,37,15);
				else 
					$this->pdf->Image($img_logo_path,10,10,20);
			}

			if($FUNIVCODE == '052')
			{
				$this->pdf->SetFont('Times','B',11);
				$this->pdf->Cell(0,4,"JSS MAHAVIDYAPEETHA",0,1,'C'); 
			}
			$this->pdf->SetFont('Times','B',15);
			$this->pdf->cell(0,3,$this->FUNIVNAME."","0",1,"C");
			$this->pdf->SetFont('Times','B',8);
			$this->pdf->cell(0,6, $this->s_state,"0",1,"C");
		}
		$this->pdf->SetFont('Times','B',12);
		if($FUNIVCODE == '052')
			$this->pdf->cell(0,6, "$this->college_details ","0",1,"C");
		else if($FUNIVCODE == '055')
		{
			
		}
		else
			$this->pdf->cell(0,6, "Centre : $this->college_details ","0",1,"C");

		$this->pdf->SetFont('Times','B',12);
		if($FUNIVCODE == '005')
			$this->pdf->Cell(0,6,"ATTENDANCE SHEET","0",1,"C");
		else if($FUNIVCODE == '052')
			$this->pdf->Cell(0,6,"INVIGILATOR'S DIARY (B FORM) - {$this->FEXAMDATE} EXAMINATION","0",1,"C");
		else if($FUNIVCODE == '055')
			$this->pdf->Cell(0,6,"{$this->fexamname} {$this->FEXAMDATE} EXAMINATIONS","0",1,"C");
		else
			$this->pdf->Cell(0,6,"INVIGILATOR'S DIARY - {$this->FEXAMDATE} EXAMINATION","0",1,"C");
		if($FUNIVCODE != '055')
			$this->pdf->Cell(0,6,$this->copy,"0",1,"C");
		if($last != 'last')
		{	
			$this->pdf->SetFont('Times','',12);
			$this->pdf->Cell(0,6," {$this->sub_details}","0",1,"C");
			$this->pdf->Cell(0,6," {$this->degreename}","0",1,"C");
			$this->pdf->Cell(0,6," {$this->exam_date}","0",1,"C");
			
			$style = array(
				'position' => 'right',
				'align' => 'C',
				'stretch' => false,
				'fitwidth' => true,
				'cellfitalign' => '',
				'border' => false,
				'hpadding' => 'auto',
				'vpadding' => 'auto',
				'fgcolor' => array(0,0,0),
				'bgcolor' => false, //array(255,255,255),
				'text' => true,
				'font' => 'helvetica',
				'fontsize' => 8,
				'stretchtext' => 4
			);

			
			//$this->pdf->write1DBarcode($this->newqpcode, 'C39', '170', '45','130', 14, 0.2, $style, 'R');	

			$this->pdf->Ln(1);
			$this->pdf->SetFont('Times','',12);
			$empty_cell_width=12;
			$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
			$this->pdf->SetFont('Times','B',14);
			$this->pdf->Cell(180,7,"Room No. :   {$this->hall_no}","0",1,"L");
			$this->pdf->SetFont('Times','B',12);
		}
	}
	
	function formData()
	{
		session_start();
		$FUNIVCODE = $_SESSION['FUNIVCODE'];
		//var_dump($FUNIVCODE);
		if($this->rtype == 'T')
			$this->pdf->SetMargins(1,5,10);		
		else
			$this->pdf->SetMargins(1,5,10);		
		
		if($FUNIVCODE == '049')
			$empty_cell_width=15;
		else
			$empty_cell_width=5;

		$this->pdf->SetFont('Times','B',10);
		$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
		$cnt=0;
		
        if($FUNIVCODE == '041' || $FUNIVCODE == '042' || $FUNIVCODE == '023' || $FUNIVCODE == '008')
        {
			$copies = ["University Copy", "College Copy"];
		}else
		{
			$copies = [""];
		}	
		//print_r($this->final_data_arr);
		foreach($this->final_data_arr as $hallk=>$hallv)
		{
			
			
			// $this->copy = $copy;
			foreach($copies as $hk=>$copy)
			{
				$this->copy = $copy;

				// To display room name 12/11/2016
				$this->hall_no = $this->hallname[$hallk];

				/*$qyuery = "select froomname from masroom where froomno = '{$hallk}' 
				and fcollcode = '{$this->collcode}'";
				$results = $this->aobj_context->mobj_db->GetRow($qyuery);*/
				//var_dump($qyuery);
				
				//$this->hall_no = $results['froomname'];

				$this->headeractive = true;
				//$this->pdf->AddPage();
				$sl_no=1;
				
				$c=1;	$t_s=0;	
				$this->pdf->SetFont('Times','',12);
				$cnt=0;
				$newqpcode = '';
				$oldqpcode = '';
				$soldqpcode = '';
				$newhallno = '';
				$oldhallno = '';
				foreach($hallv as $hk=>$hv)
				{
					

					$cnt++;
					$newqpcode = $hv['fqpcode'];
					$this->qp_code = $hv['fqpcode'];
					if($newqpcode != $oldqpcode)
					{
						
						if($FUNIVCODE == '055')			
							$slcndno = '250';
						else
							$slcndno = '110';

						if($cnt != 1)
						{

							$this->pdf->Ln(5);
							$this->pdf->SetFont('Times','B',11);
							$this->pdf->Cell(5,8,"","0",0,"L");	
							$this->pdf->Cell(70,8,"Total No. of students Present","1",0,"L");
							$this->pdf->Cell(115,8,"","1",1,"L");	
							$this->pdf->Cell(5,8,"","0",0,"L");			
							$this->pdf->Cell(70,8,"USNs of absentees","1",0,"L");
							$this->pdf->Cell(115,8,"","1",1,"L");	
							$this->pdf->Cell(5,8,"","0",0,"L");	
							$this->pdf->Cell(70,8,"USNs (candidates b/u Malpractice)","1",0,"L");
							$this->pdf->Cell(115,8,"","1",1,"L");	

							$this->pdf->ln(15);
							$this->pdf->Cell(5,8,"","0",0,"L");	
							$this->pdf->Cell(60,5,"Signature of the Invigilator","0",0,"L");							// $this->pdf->Cell(90,5,"Date  : _________ ","0",0,"L");
							$this->pdf->Cell(0,5,"Signature of Deputy Chief Superintendent / Chief Superintendent","0",1,"R");
							$this->pdf->Cell(5,8,"","0",0,"L");	
							$this->pdf->Cell(60,5,"Name:","0",1,"L");							// $this->pdf->Cell(90,5,"Date  : _________ ","0",0,"L");
							
							if($this->pdf->GetY() > $slcndno)
							{

								$this->headeractive = true;
								
								$this->pdf->AddPage();
								$this->logoheader($FUNIVCODE,'first');
							}
						}	

						if($_SESSION['fexamseparate'] == 'T')
						{
							$FEXAMDATE = "fexexamdate as FEXAMDATE"; 
						}else
						{
							$FEXAMDATE = "FEXAMDATE as FEXAMDATE"; 
						}	

						if($_SESSION['fexamseparate'] == 'T')
						{
							$candsum = "examcandsum"; 
							$canddet = "examcanddet"; 

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

						if($FUNIVCODE !== '021'){
							$get_qp_details = "select {$FEXAMDATE},
							if('$FUNIVCODE' = '055',s.FSUBNAME,CONCAT(s.FSUBNAME,' ',s.FSSUBNAME)) AS FSSUBNAME,
							s.fsubshort,ucase(d.fexamname) as fexamname,s.fmcq
							from subject s inner join degree d on d. FDEGREE=s.FDEGREE and d.fexamno = s.fexamno 
							inner join $canddet cd on cd.fdegree = s.fdegree 
							and cd.fexamno = s.fexamno
							and cd.fsubcode = s.fsubcode
							and cd.fyear = d.FMEYEAR
							and cd.fexamtype = d.FMEEXAMTYP
							where s.FQPCODE='{$newqpcode}'";
						}else{
							$get_qp_details = "select distinct {$FEXAMDATE}, 
							if('$FUNIVCODE' = '055',s.fsubname,concat(s.fsubname,' ',s.fssubname)) as FSSUBNAME,
							s.fsubshort,ucase(d.fexamname) as fexamname,s.fmcq
							from subject s 
							inner join degree d on d. fdegree=s.fdegree and d.fexamno = s.fexamno 
							left join $canddet cd on cd.fdegree = s.fdegree and cd.fexamno = s.fexamno and cd.fsubcode = s.fsubcode
							left join examcanddet cd1 on cd1.fdegree = s.fdegree and cd1.fexamno = s.fexamno and cd1.fsubcode = s.fsubcode
							and cd.fyear = d.fmeyear and cd.fexamtype = d.fmeexamtyp
							where s.fqpcode='{$newqpcode}';";
						}

						// var_dump($get_qp_details);die();
						
						$obj_get_qp_details=$this->aobj_context->mobj_db->GetRow($get_qp_details);

						$fmcq = $obj_get_qp_details['fmcq'];
						$add_version_column = ($fmcq == "T");
						// var_dump($add_version_column);die();
						
					

						$FSSUBNAME = $obj_get_qp_details['FSSUBNAME'];
						$fsubshort = $obj_get_qp_details['fsubshort'];
						$this->FEXAMDATE=$obj_get_qp_details['FEXAMDATE'];
						$this->fexamname=$obj_get_qp_details['fexamname'];
						if($this->funivcode == '049')
							$this->sub_details="Course : {$newqpcode} - {$FSSUBNAME} ";
						else if($this->funivcode == '052')
						$this->sub_details="QP Code : {$fsubshort} - {$FSSUBNAME} ( {$newqpcode} )";
						else if($this->funivcode == '055')
							$this->sub_details="QP Code : ".substr($newqpcode,0,5)." - {$fsubshort} - {$FSSUBNAME}";
						else
							$this->sub_details="QP Code : {$newqpcode} - {$FSSUBNAME} ";
						$this->newqpcode = $newqpcode;
						
						$subjecttmp = "subject";

						$get_qp_data="SELECT distinct DATE_FORMAT(s.FDOE,'%d/%m/%Y') AS FDOE,s.FSESSION, r.fdescpn,
						d.fdescpn as degname, d.fdegree
						FROM {$subjecttmp} s inner join degree d on s.fdegree = d.fdegree and s.fexamno = d.fexamno
						left outer join reason r on s.fsession = r.freasoncd
						WHERE s.FQPCODE='{$newqpcode}' 
						and ifnull(s.fdoe,'0000-00-00')<> '0000-00-00'
						order by s.fdoe desc";

						// var_dump($get_qp_data);die();
						
						$obj_get_qp_data=$this->aobj_context->mobj_db->GetRow($get_qp_data);	
						$this->exam_date="Exam Date : {$obj_get_qp_data['FDOE']}, Time: {$obj_get_qp_data['fdescpn']} ";
						$this->degreename="Branch / Program : {$obj_get_qp_data['fdegree']} - {$obj_get_qp_data['degname']} ";
					
						$this->pdf->AddPage();
						
						session_start();
						$FUNIVCODE = $_SESSION['FUNIVCODE'];
						//if($FUNIVCODE != '052')
						$this->logoheader($FUNIVCODE,'first');

						$newhallno = $this->hall_no;
						if($newhallno != $oldhallno)
						{	
							$this->pdf->Ln(3);	
							$oldhallno = $newhallno;
						}

						if($this->headeractive == true)
						{	
							
							if($this->rtype == 'F')
							{	
								$this->pdf->SetFont('Times','B',11);
								$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
								$this->pdf->cell(15,7, "Sl. No.","1",0,"C");
								
								if($FUNIVCODE == '049' || $FUNIVCODE == '050')
									$this->pdf->cell(28,7, "Reg. No.","1",0,"C");
								else if($FUNIVCODE == '051')
									$this->pdf->cell(38,7, "Reg. No.","1",0,"C");
								else if($FUNIVCODE == '052' || $FUNIVCODE == '055')
									$this->pdf->cell(38,7, "USN","1",0,"C");
								else
									$this->pdf->cell(22,7, "Reg. No.","1",0,"C");

								$this->pdf->cell(65,7, "Name","1",0,"C");
								if($FUNIVCODE == '049' || $FUNIVCODE == '050' || $FUNIVCODE == '051' || $FUNIVCODE == '052')
									$this->pdf->cell(32,7, "Ans. Book No.","1",0,"C");
								else if($FUNIVCODE == '040' || $FUNIVCODE == '021')
								{
									
									if ($add_version_column) {
										$this->pdf->cell(14, 7, "Version", "1", 0, "C");
									}
								
									$this->pdf->cell(25,7, "OMR No.","1",0,"C");
									$this->pdf->cell(28,7, "Ans. Book No.","1",0,"L");
								}	
								else
									$this->pdf->cell(38,7, "Answer Booklet No.","1",0,"C");
								$this->pdf->cell(28,7, "Signature","1",1,"C");
								
							}else 
							{
								$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
								$this->pdf->cell(15,7, "Sl. No.","1",0,"C");
								
								if($FUNIVCODE == '051')
									$this->pdf->cell(37,7, "Reg. No.","1",0,"C");
								else if($FUNIVCODE == '052' || $FUNIVCODE == '055')
									$this->pdf->cell(37,7, "USN","1",0,"C");
								else
									$this->pdf->cell(28,7, "Reg. No.","1",0,"C");
								$this->pdf->cell(70,7, "Name","1",0,"C");
								$this->pdf->cell(20,7, "Photo","1",0,"C");

								if($FUNIVCODE == '021'){
									$this->pdf->cell(20,7, "OMR No.","1",0,"C");
								}
								$this->pdf->cell(28,7, "Ans. Book No.","1",0,"C");
								$this->pdf->cell(21,7, "Signature","1",1,"C");
								$this->pdf->SetFont('Times','B',11);
							}	
						}

						$oldqpcode = $newqpcode;
						$sl_no = 1;
						if($FUNIVCODE == '052')
							$cnt = 1;
					} 	 
					$this->pdf->SetFont('Times','',9);
					
					if($FUNIVCODE == '052' || $FUNIVCODE == '021')
					{
						
							if($cnt > 20) //if($cnt > 30)
							{
							
									 
									$this->hall_no=$this->hallname[$hallk];
									$this->headeractive = true;
									$this->pdf->AddPage();
									$this->logoheader($FUNIVCODE,'fisrt');
								
								// $sl_no = $FUNIVCODE == '021'?21:1;
								if($FUNIVCODE != '021'){
									$sl_no = 1;
								}
								$cnt = 1;
							
							
								if($this->rtype == 'F')
								{	
									$this->pdf->SetFont('Times','B',11);
									$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
									$this->pdf->cell(15,7, "Sl. No.","1",0,"C");
									if($FUNIVCODE == '049' || $FUNIVCODE == '050')
										$this->pdf->cell(28,7, "Reg. No.","1",0,"C");
									else if($FUNIVCODE == '051')
										$this->pdf->cell(38,7, "Reg. No.","1",0,"C");
									else if($FUNIVCODE == '052' || $FUNIVCODE == '055')
										$this->pdf->cell(38,7, "USN","1",0,"C");
									else
										$this->pdf->cell(22,7, "Reg. No.","1",0,"C");

									$this->pdf->cell(65,7, "Name","1",0,"C");
									if($FUNIVCODE == '049' || $FUNIVCODE == '050' || $FUNIVCODE == '051' || $FUNIVCODE == '052')
										$this->pdf->cell(32,7, "Ans. Book No.","1",0,"C");
									else if($FUNIVCODE == '040' || $FUNIVCODE == '021')
									{
										
										if ($add_version_column) {
											$this->pdf->cell(14, 7, "Version", "1", 0, "C"); 
										}
									
										$this->pdf->cell(25,7, "OMR No.","1",0,"C");
										$this->pdf->cell(28,7, "Ans. Book No.","1",0,"L");
										
									}
									else
										$this->pdf->cell(38,7, "Answer Booklet No.","1",0,"C");

									$this->pdf->cell(28,7, "Signature","1",1,"C");
									$this->pdf->SetFont('Times','B',11);
									
								}else 
								{
									$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
									$this->pdf->cell(15,7, "Sl. No.","1",0,"C");
									if($FUNIVCODE == '051')
										$this->pdf->cell(37,7, "Reg. No.","1",0,"C");
									else if($FUNIVCODE == '052' || $FUNIVCODE == '055')
										$this->pdf->cell(37,7, "USN","1",0,"C");
									else
										$this->pdf->cell(28,7, "Reg. No.","1",0,"C");
									$this->pdf->cell(70,7, "Name","1",0,"C");
									$this->pdf->cell(20,7, "Photo","1",0,"C");
									if($FUNIVCODE == '021'){
										$this->pdf->cell(20,7, "OMR No.","1",0,"C");
									}
									$this->pdf->cell(28,7, "Ans. Book No.","1",0,"C");
									$this->pdf->cell(21,7, "Signature","1",1,"C");
									$this->pdf->SetFont('Times','B',11);
									
								}

							
						}

					}else
					{
						
							//var_dump("Arun");
							if($this->pdf->GetY() > 250) //if($cnt > 30)
							{
								$this->hall_no=$this->hallname[$hallk];
								$this->headeractive = true;
								$this->pdf->AddPage();
								$this->logoheader($FUNIVCODE,'fisrt');
								
								$cnt = 0;
								if($this->rtype == 'F')
								{	
									$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
									$this->pdf->cell(15,7, "Sl. No.","1",0,"C");
									if($FUNIVCODE == '049' || $FUNIVCODE == '050')
										$this->pdf->cell(28,7, "Reg. No.","1",0,"C");
									else if($FUNIVCODE == '051')
										$this->pdf->cell(38,7, "Reg. No.","1",0,"C");
									else if($FUNIVCODE == '052' || $FUNIVCODE == '055')
										$this->pdf->cell(38,7, "USN","1",0,"C");
									else
										$this->pdf->cell(22,7, "Reg. No.","1",0,"C");
		
									$this->pdf->cell(65,7, "Name","1",0,"C");
									if($FUNIVCODE == '049' || $FUNIVCODE == '050' || $FUNIVCODE == '051' || $FUNIVCODE == '052')
										$this->pdf->cell(32,7, "Ans. Book No.","1",0,"C");
									else if($FUNIVCODE == '040' || $FUNIVCODE == '021')
									{
										if ($add_version_column) {
											$this->pdf->cell(14, 7, "Version", "1", 0, "C"); 
										}
									
										$this->pdf->cell(25,7, "OMR No.","1",0,"C");
										$this->pdf->cell(28,7, "Ans. Book No.","1",0,"L");
										
									}
									else
										$this->pdf->cell(38,7, "Ans. Booklet No.","1",0,"C");
		
									$this->pdf->cell(28,7, "Signature","1",1,"C");
									$this->pdf->SetFont('Times','',9);
									
								}else 
								{
									$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
									$this->pdf->cell(15,7, "Sl. No.","1",0,"C");
									if($FUNIVCODE == '051')
										$this->pdf->cell(37,7, "Reg. No.","1",0,"C");
									else if($FUNIVCODE == '052' || $FUNIVCODE == '055')
										$this->pdf->cell(37,7, "USN","1",0,"C");
									else
										$this->pdf->cell(28,7, "Reg. No.","1",0,"C");
									$this->pdf->cell(70,7, "Name","1",0,"C");
									$this->pdf->cell(20,7, "Photo","1",0,"C");
									$this->pdf->cell(28,7, "Ans. Book No.","1",0,"C");
									$this->pdf->cell(23,7, "Signature","1",1,"C");
									$this->pdf->SetFont('Times','',9);
									
								}
		
							}
						
	
					}

					
					if($this->rtype == 'F')
					{		

						$this->pdf->SetFont('Times','',9);

						$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
						$this->pdf->cell(15,7, $sl_no,"1",0,"C");
						
						if($FUNIVCODE == '049' || $FUNIVCODE == '050')
							$this->pdf->cell(28,7, $hv['FREGNO'],"1",0,"C");						
						else if($FUNIVCODE == '051')
							$this->pdf->cell(38,7, $hv['FREGNO'],"1",0,"C");
						else if($FUNIVCODE == '052' || $FUNIVCODE == '055')
							$this->pdf->cell(38,7, $hv['FREGNO'],"1",0,"C");	
						else
							$this->pdf->cell(22,7, $hv['FREGNO'],"1",0,"C");

						$this->pdf->cell(65,7, $hv['FNAME'],"1",0,"L");
						if($FUNIVCODE == '049' || $FUNIVCODE == '050' || $FUNIVCODE == '051' || $FUNIVCODE == '052')
							$this->pdf->cell(32,7, "","1",0,"C");
						else if($FUNIVCODE == '040' || $FUNIVCODE == '021')
						{

							if ($add_version_column) {
								$versions = ['A', 'B', 'C', 'D'];
								$version_index = ($sl_no - 1) % count($versions); 
								$this->pdf->cell(14, 7, $versions[$version_index], "1", 0, "C");
							}
					
							$this->pdf->cell(25,7, "","1",0,"L");
							$this->pdf->cell(28,7, "","1",0,"C");
						}
						else
							$this->pdf->cell(38,7, "","1",0,"C");

						$this->pdf->cell(28,7, "","1",1,"C");
					}
					else
					{
						$x = $this->pdf->GetX();
						$y = $this->pdf->GetY();

						// $url = "https://university-student-photos.s3.ap-south-1.amazonaws.com/".$FUNIVCODE."/".urlencode($hv['fphotopath']);
						// $full_photo_path = file_get_contents($url);
						// $abcd = getimagesize($full_photo_path);

						$curl3 = curl_init();
						
						$photo_url = 'https://university-student-photos.s3.ap-south-1.amazonaws.com/'.$FUNIVCODE.'/'.urlencode($hv['fphotopath']);
						//var_dump($photo_url);
						curl_setopt($curl3, CURLOPT_URL, $photo_url);
						curl_setopt($curl3, CURLOPT_NOBODY, true);
						$response_photo = curl_exec($curl3);
						$httpCode_photo = curl_getinfo($curl3 , CURLINFO_HTTP_CODE);
						//var_dump($httpCode_photo);

						if($httpCode_photo == 200) //!file_exists($actualpath)
						{
							
							if($hv['fphotopath'] !='')
							{
								$keyname = $FUNIVCODE."/".$hv['fphotopath'];
								$s3 = S3Client::factory(
									array(
										'credentials' => array(
											'key' => IAM_KEY,
											'secret' => IAM_SECRET
										),
										'version' => "latest",
										'region'  => 'ap-south-1'
									)
								);
								
								$filePath = tempnam(sys_get_temp_dir(), rand(10,15));
								$result = $s3->getObject([
									'Bucket' => STUDENT_PHOTOS_BUCKET,
									'Key'    => $keyname,
									'SaveAs' => $filePath
								]);
						
						
								if(file_exists($filePath))
								{
									if($FUNIVCODE == '051' || $FUNIVCODE == '052')
										$this->pdf->Image($filePath,128,$y+1,18,18);		
									else
										$this->pdf->Image($filePath,119,$y+1,18,18);		

								}	
							}	
						}
						$this->pdf->SetFont('Times','',9);
						$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
						$this->pdf->cell(15,20, $sl_no,"1",0,"C");
						
						if($FUNIVCODE == '051' || $FUNIVCODE == '052')
							$this->pdf->cell(37,20, $hv['FREGNO'],"1",0,"C");						
						else
							$this->pdf->cell(28,20, $hv['FREGNO'],"1",0,"C");							

						$this->pdf->cell(70,20, $hv['FNAME'],"1",0,"L");
						$this->pdf->cell(20,20,'',"1",0,"L");
						if($FUNIVCODE == '021'){
							$this->pdf->cell(20,20, "","1",0,"C");
						}
						$this->pdf->cell(28,20, "","1",0,"C");
						$this->pdf->cell(21,20, "","1",1,"C");
					}	
					$c++;
					$sl_no++;
					$t_s+=1;	
					
				}
			
				$this->pdf->Ln(5);	
				
				if($FUNIVCODE == '055')			
					$slcndno = '250';
				else
					$slcndno = '90';
			

				if($this->pdf->GetY() > $slcndno)
				{

					$this->headeractive = true;
					if($FUNIVCODE !== '040'){
						$this->pdf->AddPage();
						$this->logoheader($FUNIVCODE,'first');
					}
				}
				
				$this->pdf->SetFont('Times','B',11);
				$this->pdf->Cell(5,8,"","0",0,"L");	
				$this->pdf->Cell(70,8,"Total No. of students Present","1",0,"L");
				$this->pdf->Cell(115,8,"","1",1,"L");	
				$this->pdf->Cell(5,8,"","0",0,"L");			
				$this->pdf->Cell(70,8,"USNs of absentees","1",0,"L");
				$this->pdf->Cell(115,8,"","1",1,"L");	
				$this->pdf->Cell(5,8,"","0",0,"L");	
				$this->pdf->Cell(70,8,"USNs (candidates b/u Malpractice)","1",0,"L");
				$this->pdf->Cell(115,8,"","1",1,"L");	

				$this->pdf->ln(15);
				$this->pdf->Cell(5,8,"","0",0,"L");	
				$this->pdf->Cell(60,5,"Signature of the Invigilator","0",0,"L");							// $this->pdf->Cell(90,5,"Date  : _________ ","0",0,"L");
				$this->pdf->Cell(0,5,"Signature of Deputy Chief Superintendent / Chief Superintendent","0",1,"R");
				$this->pdf->Cell(5,8,"","0",0,"L");	
				$this->pdf->Cell(60,5,"Name: ","0",1,"L");							// $this->pdf->Cell(90,5,"Date  : _________ ","0",0,"L");
			
			}
		}

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

}

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

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

	$class_obj->GetFullQry();
	$class_obj->formcolldata();
	$class_obj->formData();
	// $class_obj->formData("College Copy");
	$class_obj->SendOutput();
}




?>