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 : 3.146.176.191


Current Path : /var/www/html/gach/Report_details/
Upload File :
Current File : /var/www/html/gach/Report_details/report_ra_invigilator_dairy - Copy.php

<?php
$main_src=substr($_SERVER['SCRIPT_FILENAME'],0,strlen($_SERVER['SCRIPT_FILENAME'])-7);
$pdf_writer_class =$main_src."/maya-pdf/fpdf.php";
require_once($pdf_writer_class);
	
class ra_invigilators_dairy  extends FPDF
{
	function DefaultConstructor($aobj_context)
	{
		session_start();
		$this->aobj_context=$aobj_context;
		$this->pdf=  new FPDF();
		$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 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()
	{
			
	}	
	
	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');
	}
	
	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_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 GetFullQry()
	{
		if($this->session == 'both')
		{
			$sectionvalue = "";
		}
		else 
		{
			$sectionvalue = "and s.fsession like '{$this->session}'";
		}
	
		$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 
		LEFT JOIN masroom ON masroom.froomno = FHALLNO AND masroom.FCOLLCODE = cs.FCOLLCODE
		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";
		$this->lobj_get_data = $this->aobj_context->mobj_db->GetAll($get_data);
		//var_dump($get_data);
		$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['FREGNO']]['FREGNO']=$av['FREGNO'];
			$this->final_data_arr[$av['FHALLNO']][$av['FREGNO']]['FNAME']=$av['FNAME'];
			$this->final_data_arr[$av['FHALLNO']][$av['FREGNO']]['fphotopath']=$av['fphotopath']; 
			$this->final_data_arr[$av['FHALLNO']][$av['FREGNO']]['fqpcode']=$av['fqpcode'];
			// To display room name 12/11/2016

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

	function logoheader($FUNIVCODE)
	{
		if($FUNIVCODE == '031')
		{
			if(!empty($this->pdf_logo_path))
			{
				$img_logo_path=$this->aobj_context->main_src."/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->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->pdf_logo_path;
				$this->pdf->Image($img_logo_path,10,10,20);
			}
			$this->pdf->SetFont('Times','B',15);
			$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");
		
		$this->pdf->SetFont('Times','',12);
		$this->pdf->Cell(180,6," {$this->sub_details}","0",1,"C");
		$this->pdf->Cell(180,6," {$this->exam_date}","0",1,"C");
		$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);
		$this->pdf->SetMargins(10,12,10);		
		
		$empty_cell_width=12;
		$this->pdf->SetFont('Times','B',10);
		$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
		$cnt=0;
		
		foreach($this->final_data_arr as $hallk=>$hallv)
		{
			// To display room name 12/11/2016
			$this->hall_no = $this->hallname[$hallk];
			$this->headeractive = true;
			//$this->pdf->AddPage();
			$sl_no=1;
			
			$c=1;	$t_s=0;	
			$this->pdf->SetFont('Times','',12);
			$cnt=0;
			$newqpcode = '';
			$oldqpcode = '';
			$newhallno = '';
			$oldhallno = '';
			
			foreach($hallv as $hk=>$hv)
			{
				$cnt++;
				$newqpcode = $hv['fqpcode'];
				$this->qp_code = $hv['fqpcode'];
				if($newqpcode != $oldqpcode)
				{
					$get_qp_details = "select FEXAMDATE,CONCAT(s.FSUBNAME,' ',s.FSSUBNAME) AS FSSUBNAME from subject s 
					inner join degree d on d. FDEGREE=s.FDEGREE and d.fexamno = s.fexamno 
					where s.FQPCODE='{$newqpcode}'";
					$obj_get_qp_details=$this->aobj_context->mobj_db->GetRow($get_qp_details); 

					$FSSUBNAME=$obj_get_qp_details['FSSUBNAME'];
					$this->FEXAMDATE=$obj_get_qp_details['FEXAMDATE'];
					$this->sub_details="Subject : {$newqpcode} - {$FSSUBNAME} ";
					$get_qp_data="SELECT distinct DATE_FORMAT(s.FDOE,'%d/%m/%Y') AS FDOE,s.FSESSION, r.fdescpn
					FROM room_allotment ra inner join subject s on ra.fqpcode = s.fqpcode left outer join
					reason r on s.fsession = r.freasoncd
					WHERE ra.FCOLLCODE='{$this->collcode}'
					AND ra.FQPCODE='{$newqpcode}'";
					$obj_get_qp_data=$this->aobj_context->mobj_db->GetRow($get_qp_data);	
					$this->exam_date="Exam Date : {$obj_get_qp_data['FDOE']}, {$obj_get_qp_data['fdescpn']} ";
				
					$this->pdf->AddPage();
					
					session_start();
					$FUNIVCODE = $_SESSION['FUNIVCODE'];

					$this->logoheader($FUNIVCODE);

					$newhallno = $this->hall_no;
				if($newhallno != $oldhallno)
				{	
					$this->pdf->SetFont('Times','B',11);
					$this->pdf->cell(12,10, "","0",0,"L");				
					$this->pdf->cell(50,10, "Name of the Invigilator","1",0,"L");	
					$this->pdf->cell(131,10, "","1",1,"L");	
					$this->pdf->cell(12,10, "","0",0,"L");
					$this->pdf->cell(50,10, "Designation","1",0,"L");	
					$this->pdf->cell(131,10, "","1",1,"L");
					$this->pdf->cell(12,5, "","0",0,"L");
					$this->pdf->cell(50,5, "Serial No. of Answer","LRT",0,"L");	
					$this->pdf->cell(42,5, "From","1",0,"C");
					$this->pdf->cell(42,5, "To","1",0,"C");
					$this->pdf->cell(47,5, "Total","1",1,"C");
					$this->pdf->cell(12,7, "","0",0,"L");
					$this->pdf->cell(50,7, "Books Issued to Invigilator","LRB",0,"L");	
					$this->pdf->SetFont('Times','B',12);
					$this->pdf->cell(42,7, "","1",0,"C");
					$this->pdf->cell(42,7, "","1",0,"C");
					$this->pdf->cell(47,7, "","1",1,"C");
					//$this->pdf->cell(12,10, "","0",0,"L");
					$this->pdf->Ln(3);	
					$oldhallno = $newhallno;
				}
					if($this->headeractive == true)
					{	
						if($this->rtype == 'F')
						{	
							$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(80,7, "Name","1",0,"C");
							$this->pdf->cell(38,7, "Ans. Book 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");
							$this->pdf->cell(20,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(28,7, "Signature","1",1,"C");
						}	
					}
					$oldqpcode = $newqpcode;
					$sl_no = 1;
				} 	 
				$this->pdf->SetFont('Times','',12);
				if($this->pdf->GetY() > 260) //if($cnt > 30)
				{
					$this->hall_no=$this->hallname[$hallk];
					$this->headeractive = true;
					$this->pdf->AddPage();
					$this->logoheader($FUNIVCODE);
					
					$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");
						$this->pdf->cell(20,7, "Reg. No.","1",0,"C");
						$this->pdf->cell(80,7, "Name","1",0,"C");
						$this->pdf->cell(38,7, "Ans. Book No.","1",0,"C");
						$this->pdf->cell(28,7, "Signature","1",1,"C");
						$this->pdf->SetFont('Times','',12);
						
					}else 
					{
						$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(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(28,7, "Signature","1",1,"C");
						$this->pdf->SetFont('Times','',12);
						
					}

				}
				if($this->rtype == 'F')
				{		
					$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
					$this->pdf->cell(15,7, $sl_no,"1",0,"C");
					$this->pdf->cell(20,7, $hv['FREGNO'],"1",0,"C");						
					$this->pdf->cell(80,7, $hv['FNAME'],"1",0,"L");
					$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();
					$full_photo_path=trim($this->aobj_context->main_src."/".$hv['fphotopath']);
					if(file_exists($full_photo_path) && !empty($hv['fphotopath']))
					{
						$this->pdf->Image($full_photo_path,128,$y+1,18,18);						
					}
					else
					{
						$this->pdf->Image($this->aobj_context->main_src."/img/nophotoborder.jpg",128,$y+1,18,18);				
					}
					
					$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
					$this->pdf->cell(15,20, $sl_no,"1",0,"C");
					$this->pdf->cell(20,20, $hv['FREGNO'],"1",0,"C");						
					$this->pdf->cell(70,20, $hv['FNAME'],"1",0,"L");
					$this->pdf->cell(20,20,'',"1",0,"L");
					$this->pdf->cell(38,20, "","1",0,"C");
					$this->pdf->cell(28,20, "","1",1,"C");
				}	
				$c++;
				$sl_no++;
				$t_s+=1;
				
				
			}
			$FUNIVCODE = '017';
			if($FUNIVCODE == "035" || $FUNIVCODE == "017" || $FUNIVCODE == "003" || $FUNIVCODE == "033" || $FUNIVCODE == "012" || $FUNIVCODE == "036" || $FUNIVCODE == "034" || $FUNIVCODE == "027")
			{	
				$this->pdf->Ln(5);				
				if($this->pdf->GetY() > 120)
				{
					$this->headeractive = true;
					$this->pdf->AddPage();
					$this->logoheader($FUNIVCODE);
				}	
				
				$this->pdf->cell(12,10, "","0",0,"L");
				$this->pdf->cell(90,10, "Register No. of Candidate(s) who arrived late","1",0,"L");	
				$this->pdf->cell(91,10, "","1",1,"C");
				$this->pdf->cell(12,10, "","0",0,"L");			
				$this->pdf->cell(90,5, "Register No. of Candidate(s) who left the ","LR",0,"L");				
				$this->pdf->cell(91,5, "","LR",1,"C");
				$this->pdf->cell(12,5, "","0",0,"L");
				$this->pdf->cell(90,5, "hall temporarily ","LRB",0,"L");
				$this->pdf->cell(91,5, "","LRB",1,"C");				
				$this->pdf->cell(12,10, "","0",0,"L");
				$this->pdf->cell(90,10, "Register No. of Absentee(s)","1",0,"L");	
				$this->pdf->cell(91,10, "","1",1,"C");
				$this->pdf->cell(12,10, "","0",0,"L");
				$this->pdf->cell(90,10, "Total No. of Absentee(s)","1",0,"L");	
				$this->pdf->cell(91,10, "","1",1,"C");
				$this->pdf->cell(12,5, "","0",0,"L");
				$this->pdf->cell(90,5, "Total No. of Candidate(s) Answer Books handed","LR",0,"L");	
				$this->pdf->cell(91,5, "","LR",1,"C");
				$this->pdf->cell(12,5, "","0",0,"L");
				$this->pdf->cell(90,5, "over to Chief - Superintendent","LRB",0,"L");	
				$this->pdf->cell(91,5, "","LRB",1,"C");
				$this->pdf->cell(12,5, "","0",0,"L");
				$this->pdf->cell(90,5, "Serial No. of Blank Answer Books returned ","LRT",0,"L");	
				$this->pdf->cell(91,5, "","LR",1,"C");
				$this->pdf->cell(12,5, "","0",0,"L");
				$this->pdf->cell(90,5, "to Chief-Superintendent ","LRB",0,"L");	
				$this->pdf->cell(91,5, "","LRB",1,"C");
				$this->pdf->cell(12,5, "","0",0,"L");
				$this->pdf->cell(90,5, "Register No. of Candidate(s) Involved in ","LR",0,"L");	
				$this->pdf->cell(91,5, "","LR",1,"C");
				$this->pdf->cell(12,5, "","0",0,"L");
				$this->pdf->cell(90,5, "Malpractice","LRB",0,"L");	
				$this->pdf->cell(91,5, "","LRB",1,"C");
				$this->pdf->cell(12,10, "","0",0,"L");
				$this->pdf->cell(90,10, "Sl.No. of Ans Book of M.P. Case(s)","1",0,"L");		
				$this->pdf->cell(91,10, "","1",1,"C");
				$this->pdf->cell(12,10, "","0",0,"L");
				$this->pdf->cell(90,10, "Remarks regarding M.P.Case(s)","1",0,"L");	
				$this->pdf->cell(91,10, "","1",1,"C");
				$this->pdf->Ln(16);
				$this->pdf->cell(12,5, "","0",0,"L");
				$this->pdf->Cell(90,7,"Date  : _________ ","0",0,"L");
				$this->pdf->Cell(90,7,"Signature of the Invigilator ","0",1,"R");
			}
		}

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

}

function GenerateInvigilatorDairy($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->SendOutput();
}

?>