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


Current Path : /var/www/oasis/Report_details/
Upload File :
Current File : /var/www/oasis/Report_details/reportAttCount.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->dateto);die();
		$this->degree = trim($aobj_context->mobj_data["degree"]);
		$this->sem = trim($aobj_context->mobj_data["sem"]);	
		$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($date)
	{
    
		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
		{
			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,30);
			}

			$this->pdf->SetFont('Times','B',17);
			$this->pdf->ln(3);
			$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',13);
		$this->pdf->cell(0,7,$this->college_details."","0",1,"C");
		$this->pdf->cell(0,7,$this->degree_details."","0",1,"C");
		//$this->pdf->ln(3);
		$this->pdf->SetFont('Times','B',12);
            
	}	
	
	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()
	{
		$collcode = $_SESSION['collcode'];

		$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 = $obj_student['FCOLLNAME'];

		$get_data="SELECT fdegree, fdescpn,fexamname FROM degree c
				where c.fdegree='{$this->degree}'
				and fexamno = '{$this->sem}'";					
		$obj_student=$this->aobj_context->mobj_db->GetRow($get_data); 
		$fdescpn = $obj_student['fdescpn'];
		$fexamname = $obj_student['fexamname'];
		$this->college_details  = " College : {$this->college}";
		$this->degree_details  = " Degree : {$this->fdegree} - $fdescpn, $fexamname";
       // $this->date  = " Date : {$date}";

	 }
	 
	function writepdf($data,$aobj_context)
	{
    
		//var_dump($data);
		$pdf=$this->pdf;
        $pdf->SetMargins(1,30,5,10);
        $pdf->startPageGroup();
        $pdf->AddPage("L");
		
		$pdf->SetFont('Times','B',12);
		$pdf->Cell(0,7,"MIS REPORT","0",1,"C");
		$pdf->ln(2);
		$pdf->SetFont('Times','',10);

		$table1 = '<style>
			td {
			    border: 0.5px solid black;
			}
			.lable {
				font-weight: bold;
			}
			th {
			    border: 0.5px solid black;
				text-align: center;
			}
		 </style>
		<table cellpadding="3" cellspacing="0">
			<tr nobr="true">
				<th width="150" >Subject Name</th>
				<th width="150" >Class Name</th>
				<th width="40" >Class<br>Cond.</th>
				<th width="60" >Last Date of Entry</th>
				<th width="100" >Staff Name</th>
				<th width="40" >MSE-1</th>
				<th width="40" >MSE-2</th>
				<th width="40" >TASK-1</th>
				<th width="40" >TASK-2</th>
				<th width="40" >TASK-3</th>
				<th width="30" >MSE</th>
				<th width="35" >Record</th>
				<th width="38" >COND. / LAB / ACTI. </th>
			</tr>';

	$i = 0;
	$slno= 1;
	$count = 1;

	foreach($data as $key => $val)
	{
	
		
		$table1 .='<tr nobr="true">
			<td  style="text-align: left;">'.$val['fsubname'].'</td>
			<td style="text-align: left;">'.$val['fclassname'].'</td>
			<td style="text-align: center;">'.$val['fconducted'].'</td>
			<td style="text-align: center;">'.$val['flastentry'].'</td>
			<td >'.strtoupper($val['fteachname']).'</td>
			<td >'.$val['fmsc1'].'</td>
			<td  style="text-align: center;">'.$val['fmsc2'].'</td>
			<td  style="text-align: center;">'.$val['ftask1'].'</td>
			<td  style="text-align: center;">'.$val['ftask2'].'</td>
			<td  style="text-align: center;">'.$val['ftask3'].'</td>
			<td  style="text-align: center;">'.$val['fmsc'].'</td>
			<td  style="text-align: center;">'.$val['frecord'].'</td>
			<td  style="text-align: center;">'.$val['fpractical'].'</td>
			</tr>';
		$i++;
		$slno++;
	}

		$table1 .= '</table>';
		$pdf->SetX(11);
		$pdf->writeHTML($table1, false, true, false, false, 'L');

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

}

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

	$date = trim($aobj_context->mobj_data["strDate"]);
	$degree = trim($aobj_context->mobj_data["degree"]);
	$sem = trim($aobj_context->mobj_data["sem"]);
	$collcode = $_SESSION['collcode'];


	$query = "delete from misreport where fdegree = '{$degree}'
	and fexamno = '{$sem}'
	and fcollcode = '{$collcode}'";
	$res1 = $aobj_context->mobj_db->Execute($query);

	$query = "delete from misattreport where fdegree = '{$degree}'
	and fexamno = '{$sem}'
	and fcollcode = '{$collcode}'";
	$res1 = $aobj_context->mobj_db->Execute($query);
	
	$query = "insert ignore into misreport(fcollcode,fdegree,fexamno,fsubcode,fsubname,fclassid,fclassname,fteachname)
	select distinct a.fcollcode,s.fdegree,s.fexamno,s.fsubcode,
	concat(s.fsubname,' - ',s.fsubshort) as fsubname,
	a.fclassid,c.fclassname,m.fteachname 
	from subject s left join 
	attendsum a on s.fdegree = a.fdegree and s.fexamno = a.fexamno 
	and a.fsubcode = s.fcsubcode 
	left join attclass c on a.fclassid = c.fclassid
	left join masteach m on c.fteachcode = m.fteachcode
	where s.fdegree = '{$degree}' and s.fexamno = '{$sem}'
	and ifnull(a.fclassid,'') <> ''
	and a.fcollcode = '{$collcode}'
	group by s.fdegree,s.fexamno,s.fsubcode,a.fclassid";
	//var_dump($query);
	//die();
	$res2 = $aobj_context->mobj_db->Execute($query);

	$query = "insert ignore into misattreport(fclassname, fteachname, fsection, fdate, fperiod, fexamno, fcollcode, fdegree, fsubcode, fclassid, conducted)
	select c.fclassname as classname,m.fteachname,
	group_concat(distinct s.fsection) as fsection, a.fdate,fperiod,a.fexamno,a.fcollcode,a.fdegree,a.fsubcode,
	a.fclassid,a.fnoclass as conducted
	from attend_det a inner join attendsum s on a.fregno = s.fregno
	and a.fdegree = s.fdegree and a.fexamno = s.fexamno 
	and a.fsubcode = s.fsubcode
	inner join attclass c on a.fclassid = c.fclassid
	inner join masteach m on c.fteachcode = m.fteachcode
	where a.fdegree = '{$degree}' and a.fexamno = '{$sem}'
	and a.fcollcode = '{$collcode}'
	group by fdegree,fsubcode,fclassid,fdate,FPERIOD";
	//var_dump($query);
	$res2 = $aobj_context->mobj_db->Execute($query);

	$query = "update misreport m, (
		select fsection,sum(conducted) as fconducted, max(fdate) as fldate,
		fteachname,fclassname,fclassid,fdegree,fsubcode
		From misattreport s
		where s.fcollcode = '{$collcode}'
		and s.fdegree = '{$degree}'
		and s.fexamno = '{$sem}'
		group by fdegree,fsubcode,fclassid
	) a set m.fsection = a.fsection,
	m.fconducted = a.fconducted,
	m.flastentry = a.fldate
	where m.fdegree = a.fdegree
	and m.fsubcode = left(a.fsubcode,4)
	and m.fclassid = a.fclassid
	and m.fcollcode = '{$collcode}'
	and m.fdegree = '{$degree}'
	and m.fexamno = '{$sem}'";
	$res4 = $aobj_context->mobj_db->Execute($query);
	
	$query = "select * from misreport where fcollcode = '{$collcode}'
	and fdegree = '{$degree}' and fexamno = '{$sem}'";
	$res5 = $aobj_context->mobj_db->GetAll($query);
	
	foreach($res5 as $val)
	{
		$subcode = $val['fsubcode'];
		$fclassid = $val['fclassid'];

		$query = "select distinct concat(fcsubcode,fsubcode) as fcsubcode, fsubname as fssubname from subdet 
		where fdegree = '{$degree}'
		and fexamno = '{$sem}'
		and left(fcsubcode,4) = '{$subcode}'";
		
		$res6 = $aobj_context->mobj_db->GetAll($query);

		foreach($res6 as $value)
		{
			$fcsubcode = $value['fcsubcode'];
			$fssubname = $value['fssubname'];

			$query = "select * from attendsum a inner join marksint m on a.fregno = m.fregno
			and a.fdegree = m.fdegree and a.fexamno = m.fexamno
			and left(a.fsubcode,4) =  left(m.fsubcode,4)
			where m.fdegree = '{$degree}'
			and m.fexamno = '{$sem}'
			and m.fcollcode = '{$collcode}'
			and a.fclassid = '{$fclassid}'
			and m.fsubcode = '{$fcsubcode}'
			and fmarks <> '-1'";
			$res7 = $aobj_context->mobj_db->GetRow($query);

			if($res7)
			{
				if($fssubname == 'MSE-1' || $fssubname == 'MSE-1(IPCC)')
				{
					$upd = "update misreport set fmsc1 = 'Yes'
					where fdegree = '{$degree}'
					and fexamno = '{$sem}'
					and fsubcode = '{$subcode}'
					and fclassid = '{$fclassid}'";
					$res10 = $aobj_context->mobj_db->Execute($upd);


				}else if($fssubname == 'MSE-2')
				{
					$upd = "update misreport set fmsc2 = 'Yes'
					where fdegree = '{$degree}'
					and fexamno = '{$sem}'
					and fsubcode = '{$subcode}'
					and fclassid = '{$fclassid}'";
					$res10 = $aobj_context->mobj_db->Execute($upd);

				}else if($fssubname == 'TASK-1' || $fssubname == 'TASK 1')
				{
					$upd = "update misreport set ftask1 = 'Yes'
					where fdegree = '{$degree}'
					and fexamno = '{$sem}'
					and fsubcode = '{$subcode}'
					and fclassid = '{$fclassid}'";
					$res10 = $aobj_context->mobj_db->Execute($upd);
				}
				else if($fssubname == 'TASK-2' || $fssubname == 'TASK 2')
				{
					$upd = "update misreport set ftask2 = 'Yes'
					where fdegree = '{$degree}'
					and fexamno = '{$sem}'
					and fsubcode = '{$subcode}'
					and fclassid = '{$fclassid}'";
					$res10 = $aobj_context->mobj_db->Execute($upd);
				}
				else if($fssubname == 'TASK-3' || $fssubname == 'TASK 3')
				{
					$upd = "update misreport set ftask3 = 'Yes'
					where fdegree = '{$degree}'
					and fexamno = '{$sem}'
					and fsubcode = '{$subcode}'
					and fclassid = '{$fclassid}'";
					$res10 = $aobj_context->mobj_db->Execute($upd);
				}else if($fssubname == 'MSE')
				{
					$upd = "update misreport set fmsc = 'Yes'
					where fdegree = '{$degree}'
					and fexamno = '{$sem}'
					and fsubcode = '{$subcode}'
					and fclassid = '{$fclassid}'";
					$res10 = $aobj_context->mobj_db->Execute($upd);
				}else if($fssubname == 'RECORD')
				{
					$upd = "update misreport set frecord = 'Yes'
					where fdegree = '{$degree}'
					and fexamno = '{$sem}'
					and fsubcode = '{$subcode}'
					and fclassid = '{$fclassid}'";
					$res10 = $aobj_context->mobj_db->Execute($upd);
				}else if($fssubname == 'CONDUCTION' || $fssubname == 'MSE(LAB)' || $fssubname == 'ACTIVITY')
				{
					$upd = "update misreport set fpractical = 'Yes'
					where fdegree = '{$degree}'
					and fexamno = '{$sem}'
					and fsubcode = '{$subcode}'
					and fclassid = '{$fclassid}'";
					$res10 = $aobj_context->mobj_db->Execute($upd);
				}
			}	
		}
	}

	$query = "select fsubname,ifnull(fclassname,'') as fclassname, 
	ifnull(fteachname,'') as fteachname,
	ifnull(fsection,'') as fsection,
	ifnull(fconducted,'') as fconducted,
	date_format(flastentry,'%d/%m/%Y') as flastentry,
	ifnull(fmsc1,'No') as fmsc1,
	ifnull(fmsc2,'No') as fmsc2,
	ifnull(ftask1,'No') as ftask1,
	ifnull(ftask2,'No') as ftask2,
	ifnull(ftask3,'No') as ftask3,
	ifnull(fmsc,'No') as fmsc,
	ifnull(frecord,'No') as frecord,
	ifnull(fpractical,'No') as fpractical
	from misreport where fdegree = '{$degree}'
	and fexamno = '{$sem}'
	and fcollcode = '{$collcode}'";
	$res = $aobj_context->mobj_db->GetAll($query);
	//var_dump($query);
	$class_obj=new ra_invigilators_dairy();
    $class_obj->DefaultConstructor($aobj_context);

	$class_obj->formcolldata();    

	$class_obj->Header();

	$class_obj->writepdf($res,$aobj_context);
	
	$class_obj->SendOutput();
}



?>