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


Current Path : /var/www/oasis/Report_details/
Upload File :
Current File : /var/www/oasis/Report_details/attiacombinednew_1.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->collcode=$_SESSION['collcode'];
		$this->funivcode=$_SESSION['FUNIVCODE'];
		$this->degcode=trim($this->aobj_context->mobj_data["degcode"]);
		$this->sem=trim($this->aobj_context->mobj_data["sem"]);
		$this->section=trim($this->aobj_context->mobj_data["section"]);
		$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->type=trim($this->aobj_context->mobj_data["type"]);
	
		$this->headeractive = true;
		$this->startPageGroup();
	}
 
	function Header()
	{
		$img_logo_path=$this->aobj_context->main_src.'/'.$this->aobj_context->mobj_data["db"].'/'.$this->pdf_logo_path;
		$this->pdf->Image($img_logo_path,25,5,37,15);

		$this->pdf->SetFont('Times','B',9);
		$this->pdf->Cell(0,8,"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);
		$this->pdf->cell(0,6, "College : $this->FCOLLCODE ","0",1,"C");
		$this->pdf->SetFont('Times','B',12);

		$this->pdf->Cell(0,7,"Attendance and CIE Marks Eligiblity","0",1,"C");
		$this->pdf->Cell(0,5,$this->degree_name,"0",1,"C");
		$this->pdf->Cell(0,5,"Section: ".$this->section,"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(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->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->FCOLLCODE = $obj_student['FCOLLCODE'];
		$this->degree_details  = " College : {$this->FCOLLNAME}";

		$get_data="SELECT d.fdegree,d.fdescpn,d.fexamname,d.fexamdate
				from degree d
				where d.fdegree='{$this->degcode}'
				and d.fexamno = '{$this->sem}'";					
		$degdata=$this->aobj_context->mobj_db->GetRow($get_data); 
		$this->degree_name = $degdata['fdegree'].' - '.$degdata['fdescpn'].' '.$degdata['fexamname'].' '.$degdata['fexamdate'];
       		

	 }
	 
	function writepdf($aobj_context){

        
		$pdf=$this->pdf;

		$query = "select distinct fsubshort from subject s 
		inner join marks_15022024 m on s.fdegree= m.fdegree
		and s.fexamno = m.fexamno 
		and s.fcsubcode = m.fsubcode
		inner join student st on m.fregno = st.fregno
		and m.fdegree = st.fdegree
		where m.fdegree = '{$this->degcode}'
		and st.fsection ='{$this->section}'
		and m.fexamno = '{$this->sem}'
		and m.fcollcode = '{$this->collcode}'
		order by fsubcode";
		// var_dump($query);
		// die();
		$subhead = $aobj_context->mobj_db->GetAll($query);

		$query = "select m.fregno,st.fname,
		ifnull(s.fattent,'') as fattent,
		group_concat(s.fvalmax, '|',ifnull(a.fper,'-'),'|',ifnull(m.fmarks,'-'),'|',s.fsubshort,'|',ifnull(s.fattent,'') order by s.fsubcode SEPARATOR '*' ) as subdet 
		from marks_15022024 m inner join attend_15022024 a on m.fcollcode = a.fcollcode
		and m.fdegree = a.fdegree and m.fexamno = a.fexamno and m.fregno = a.fregno
		and left(m.fsubcode,4) = left(a.fsubcode,4)
		inner join student st on m.fregno = st.fregno and m.fcollcode = st.fcollcode
		and m.fdegree = st.fdegree
		inner join subject s on m.fdegree = s.fdegree and m.fexamno = s.fexamno 
		and m.fsubcode = s.fcsubcode
		where m.fdegree = '{$this->degcode}'
		and st.fsection ='{$this->section}'
		and m.fexamno = '{$this->sem}'
		
		and m.fcollcode = '{$this->collcode}'
		group by m.fregno";
		
		// var_dump($query);
		// die();

		$res = $aobj_context->mobj_db->GetAll($query);

		$subcount = 0;
		foreach($res as $val){
			if(count(explode('*',$val['subdet'])) > $subcount){
				$subcount = count(explode('*',$val['subdet']));
			}
		}
		
		// var_dump($subcount);die();
		// $subhead = 0;

		$explode = explode('*',$res['0']['subdet']);
		
		if(count($subhead) >9)
        	$pdf->SetMargins(5,40,5,20);
		else
			$pdf->SetMargins(30,40,5,20);

        $pdf->startPageGroup();
        $pdf->AddPage("L","A3");
		$pdf->ln(5);
		;
        // $pdf->SetMargins(10,12,10);		
        
		
        $pdf->SetFont('Times','B',9);	
		$this->pdf->cell(10,6, "Sl. No.","LRTB",0,"C");
		$this->pdf->cell(25,6, "USN","LRTB",0,"C");
		$this->pdf->cell(50,6, "Name","LRTB",0,"C");
		$subarryhead = []; 
		if($this->funivcode !== "052"){
			foreach($subhead as $val)
			{
				$sub = $val['fsubshort'];
				array_push($subarryhead,$sub);
				$this->pdf->cell(10,6,'',"TR",0,"L");	
				$this->pdf->cell(10,6, "","TR",0,"C");
				$this->pdf->cell(10,6, "","TR",0,"C");	
			}
			$this->pdf->cell(1,6,'','',1,"C");	
			$this->pdf->cell(8,6, " No.","LRB",0,"C");
			$this->pdf->cell(25,6, "","LRB",0,"C");
			$this->pdf->cell(50,6, "","LRB",0,"C");

			
			foreach($subhead as $val1)
			{
				$this->pdf->cell(10,6,'Att.',"BR",0,"L");	
				$this->pdf->cell(10,6, "CIE","BR",0,"C");
				$this->pdf->cell(10,6, "Eligi.","BR",0,"C");
			}
		}else{
			for($i=0; $i< $subcount; $i++){
				$this->pdf->cell(10,6,'Att.',"TBR",0,"L");	
				$this->pdf->cell(10,6, "CIE","TBR",0,"C");
				$this->pdf->cell(10,6, "Eligi.","TBR",0,"C");
			}
		}
		$this->pdf->cell(1,6,'',0,1,"C");
		$pdf->SetFont('Times','',9);	
		
		$k = 1;
		foreach($res as $value)
		{
			$fregno = $value['fregno'];
			$fname  = $value['fname'];
			$subdet  = $value['subdet'];
			$subarry = explode("*",$subdet);

			$pdf->SetFont('Times','',9);
			$this->pdf->cell(10,6, $k,"L",0,"C");
			$this->pdf->cell(25,6,$fregno,"L",0,"L");
			$pdf->SetFont('Times','',8);
			$this->pdf->cell(50,6,$fname,"LR",0,"L");
			// $this->pdf->cell(1,6,'',0,1,"C");
			$pdf->SetFont('Times','',9);
			

			$subcnt = count($subarry);
			
			$z = 0;
			$h = 0;
			while($subcnt >$z)
			{	
				$subl = explode("|",$subarry[$z]);
				//var_dump($subl);
				$maxmarks = $subl[0];
				$subshort = $subl[3];
				// if($subshort == $subarryhead[$h])
				// {
					
					$this->pdf->cell(2,6,"","T",0,"L");
					$this->pdf->cell(28, 6,$subshort,"TR",0,"L");	
					
					// $this->pdf->cell(10,6,ceil($subl[1]),"",0,"C");	
					
					// if($subl[2] == '-2')
					// 	$this->pdf->cell(10,6,'AB',"1",0,"C");
					// else	
					// 	$this->pdf->cell(10,6,$subl[2],"",0,"C");
					
					// $elg = 'E';
					// $ia = ceil(($subl[2]/$maxmarks)*100);
					// $att = ceil($subl[1]);
					// $pdf->SetFont('Times','',9);

					// if($ia <50 || $att <75 || $subl[2] == '-2')
					// {	
					// 	$pdf->SetFont('Times','',9);	
					// 	$elg = 'NE';
					// }

					// $this->pdf->cell(10,6,$elg,"R",0,"C");
					// $pdf->SetFont('Times','',9);
					$z++;
				// }else
				// {
				// 	$this->pdf->cell(10,6,'',"0",0,"C");
				// 	$this->pdf->cell(10,6,'',"0",0,"C");
				// 	$this->pdf->cell(10,6,"","R",0,"C");
				// }

				$h++;
			}

			// foreach($subarry as $val2)
			// {
			// 	$subl = explode("|",$val2);
				
			// 	$maxmarks = $subl[0];
			// 	$subshort = $subl[3];
				
			// 	$this->pdf->cell(10,6,ceil($subl[1]),"1",0,"C");	
				
			// 	if($subl[2] == '-2')
			// 		$this->pdf->cell(10,6,'AB',"1",0,"C");
			// 	else	
			// 		$this->pdf->cell(10,6,$subl[2],"1",0,"C");
				
			// 	$elg = 'E';
			// 	$ia = ceil(($subl[2]/$maxmarks)*100);
			// 	$att = ceil($subl[1]);
			// 	$pdf->SetFont('Times','',9);

			// 	if($ia <50 || $att <75 || $subl[2] == '-2')
			// 	{	
			// 		$pdf->SetFont('Times','B',9);	
			// 		$elg = 'NE';
			// 	}

			// 	$this->pdf->cell(10,6,$elg,"1",0,"C");
			// 	$pdf->SetFont('Times','',9);	
			// }

			$this->pdf->cell(1,6,'',0,1,"C");

			$pdf->SetFont('Times','',9);
			$this->pdf->cell(10,6, "","LB",0,"C");
			$this->pdf->cell(25,6,"","LB",0,"L");
			$pdf->SetFont('Times','',8);
			$this->pdf->cell(50,6,"","LBR",0,"L");
			// $this->pdf->cell(1,6,'',0,1,"C");
			$pdf->SetFont('Times','',9);
			

			$subcnt = count($subarry);

			// var_dump($subcnt);
			$z = 0;
			$h = 0;
			while($subcnt >$z)
			{	
				$subl = explode("|",$subarry[$z]);
				//var_dump($subl);
				$maxmarks = $subl[0];
				$subshort = $subl[3];
				$attent = $subl[4];
				// if($subshort == $subarryhead[$h])
				// {
					// $this->pdf->cell(10,6,$subshort,"B",0,"C");	
					$this->pdf->cell(10,6,ceil($subl[1]),"B",0,"C");	
					
					if($subl[2] == '-2')
						$this->pdf->cell(10,6,'AB',"1",0,"C");
					else	
						$this->pdf->cell(10,6,$subl[2],"B",0,"C");
					
					$elg = 'E';
					$ia = ceil(($subl[2]/$maxmarks)*100);
					if($attent == 'N')
						$att = 95;
					else	
						$att = ceil($subl[1]);

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

					if($ia <50 || $att <75 || $subl[2] == '-2')
					{	
						$pdf->SetFont('Times','',9);	
						$elg = 'NE';
					}
					if($elg == 'NE')
					{
						$pdf->SetFont('Times','B',9);
						$this->pdf->cell(10,6,$elg,"BR",0,"C");
						$pdf->SetFont('Times','',9);
					}else
					{
						$pdf->SetFont('Times','',9);
						$this->pdf->cell(10,6,$elg,"BR",0,"C");
						$pdf->SetFont('Times','',9);
					}
					
					$z++;
				// }else
				// {
				// 	$this->pdf->cell(10,6,'-',"B",0,"C");
				// 	$this->pdf->cell(10,6,'-',"B",0,"C");
				// 	$this->pdf->cell(10,6,"-","BR",0,"C");
				// }

				$h++;
			}

			$this->pdf->cell(1,6,'',0,1,"C");
			if($this->pdf->GetY()>250)
			{
				$pdf->startPageGroup();
				$pdf->AddPage("L","A3");
				$pdf->ln(5);

				$pdf->SetFont('Times','B',9);	
				$this->pdf->cell(10,6, "Sl.No.","LRTB",0,"C");
				$this->pdf->cell(25,6, "USN","LRTB",0,"C");
				$this->pdf->cell(50,6, "Name","LRTB",0,"C");
				if($this->funivcode !== '052'){
				foreach($subhead as $val)
				{
					$sub = $val['fsubshort'];
					// $this->pdf->cell(30,6, "{$sub}","LRT",0,"C");
					$this->pdf->cell(10,6,'',"TR",0,"L");	
					$this->pdf->cell(10,6, "","TR",0,"C");
					$this->pdf->cell(10,6, "","TR",0,"C");	
				}
				$this->pdf->cell(1,6,'','',1,"C");	

				$this->pdf->cell(8,6, " No.","LRB",0,"C");
				$this->pdf->cell(25,6, "","LRB",0,"C");
				$this->pdf->cell(50,6, "","LRB",0,"C");

				foreach($subhead as $val1)
				{
					$this->pdf->cell(10,6,'Att.',"BR",0,"L");	
					$this->pdf->cell(10,6, "CIE","BR",0,"C");
					$this->pdf->cell(10,6, "Eligi.","BR",0,"C");
				}
			}else{
				for($i=0; $i<$subcount; $i++){
					$this->pdf->cell(10,6,'Att.',"TBR",0,"L");	
					$this->pdf->cell(10,6, "CIE","TBR",0,"C");
					$this->pdf->cell(10,6, "Eligi.","TBR",0,"C");
				}
			}
				$this->pdf->cell(1,6,'',0,1,"C");
				$pdf->SetFont('Times','',9);	
			}
			$k++;
		}
		
	}
	 
	function SendOutput()
	{
		$this->pdf->Output("Attendance_CIE_Eligiblity.pdf","I");
	}

}

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

	$degcode = trim($aobj_context->mobj_data["degcode"]);
	$sem = trim($aobj_context->mobj_data["sem"]);
	$section = trim($aobj_context->mobj_data["section"]);
	$collcode = $_SESSION['collcode'];

	$class_obj=new ra_invigilators_dairy();
    $class_obj->DefaultConstructor($aobj_context);
	$class_obj->formcolldata();
	$class_obj->writepdf($aobj_context);
	$class_obj->SendOutput();
}



?>