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


Current Path : /var/www/oasis/Report_details/
Upload File :
Current File : /var/www/oasis/Report_details/reportAttCount_old_08112022.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->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($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',15);
			$this->pdf->ln(3);
			$this->pdf->cell(300,3,$this->FUNIVNAME."","0",1,"C");
			$this->pdf->SetFont('Times','B',8);
			$this->pdf->cell(300,6, $this->s_state,"0",1,"C");
		}
		$this->pdf->SetFont('Times','B',12);
		$this->pdf->Cell(300,7,$this->date,"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($date)
	{
		$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_details = $obj_student['FCOLLNAME'];
		
		$this->degree_details  = " College : {$this->FCOLLNAME}";
        $this->date  = " Date : {$date}";

	 }
	 
	function writepdf($res1,$date,$aobj_context,$fdegree,$resall){
        
		

		$pdf=$this->pdf;
        $pdf->SetMargins(10,25,25,10);
        $pdf->startPageGroup();
        $pdf->AddPage("L");

		
		$pdf->SetFont('Times','B',12);
		$pdf->Cell(300,7,"Class Time Table 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="22" class="lable">Sl.No.</th>
				<th width="60" class="lable">Teacher Code</th>
				<th width="180" class="lable">Teacher Name</th>
				<th width="60" class="lable">Degree</th>
				<th width="150" class="lable">Degree Name</th>
				<th width="180" class="lable">Subject</th>
				<th width="40" class="lable">Period</th>
				<th width="40" class="lable">No. of Class</th>
				<th width="60" class="lable">Remarks</th>
		</tr>';

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

	foreach($res1 as $key => $val){
		$qry2 = "select ifnull(ac.fteachcode,'') as ftechcode,ifnull(m.fteachname,'') as fteachname,
        ifnull(a.FCOLLCODE,'') as fcollcode,ifnull(a.FDEGREE,'') as fdegree,ifnull(d.fdescpn,'') as fdescpn,
        ifnull(a.FSUBCODE,'') as fsubcode,
        ifnull(a.FPERIOD,'') as fperiod,
        ifnull(a.FNOCLASS,'') as fnoclass,
        ifnull(s.fsubname,'') as fsubname,
		date_format(ifnull(a.fdate,''),'%d/%m/%Y') as fdate
        from attend_det a
        inner join attclass ac on ac.fclassid = a.fclassid
        inner join degree d on d.fdegree = a.fdegree
        inner join masteach m on ac.fteachcode = m.fteachcode
        inner join subject s on s.fcsubcode = a.fsubcode and a.fdegree = s.fdegree
        where ac.fteachcode = '{$val['fteachcode']}' and s.fsubcode = '{$val['fsubcode']}'
		and a.fdate = '{$date}' $fdegree
        group by a.fsubcode
		order by a.fdegree,a.FPERIOD";

		// var_dump($qry2);
		// die();
		
		$res2 = $aobj_context->mobj_db->GetRow($qry2);


		

		if($res2)
		{
		$table1 .='<tr nobr="true">
				<td width="22" style="text-align: center;">'.$slno.'</td>
				<td width="60" style="text-align: center;">'.$res2['ftechcode'].'</td>
				<td width="180">'.$res2['fteachname'].'</td>
				<td width="60" style="text-align: center;">'.$res2['fdegree'].'</td>
				<td width="150">'.$res2['fdescpn'].'</td>
				<td width="180">'.$res2['fsubname'].'</td>
				<td width="40" style="text-align: center;">'.$res2['fperiod'].'</td>
				<td width="40" style="text-align: center;">'.$res2['fnoclass'].'</td>
				<td width="60" style="text-align: center;">Entered</td>
				</tr>';
		}else
		{
			$table1 .='<tr nobr="true">
				<td width="22" style="text-align: center;">'.$slno.'</td>
				<td width="60" style="text-align: center;">'.$val['fteachcode'].'</td>
				<td width="180">'.$val['fteachname'].'</td>
				<td width="60" style="text-align: center;">'.$val['fdegree'].'</td>
				<td width="150">'.$val['fdescpn'].'</td>
				<td width="180">'.$val['fsubname'].'</td>
				<td width="40" style="text-align: center;">'.$val['fperiod'].'</td>
				<td width="40" style="text-align: center;">'.$val['fnoclass'].'</td>
				<td width="60" style="text-align: center;">Not Entered</td>
				</tr>';

		}

		$i++;
		$slno++;
	}

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

		$pdf->ln(3);
		if($resall){
			$pdf=$this->pdf;
        $pdf->SetMargins(10,25,25,10);
        $pdf->startPageGroup();
        $pdf->AddPage("L");
		$pdf->SetFont('Times','B',12);
			$pdf->Cell(300,7,"Attendance Date Wise","0",1,"C");
			$pdf->ln(2);
			$pdf->SetFont('Times','',10);
			$table2 = '<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="22" class="lable">Sl.No.</th>
					<th width="60" class="lable">Teacher Code</th>
					<th width="210" class="lable">Teacher Name</th>
					<th width="60" class="lable">Degree</th>
					<th width="180" class="lable">Degree Name</th>
					<th width="180" class="lable">Subject</th>
					<th width="40" class="lable">Period</th>
					<th width="40" class="lable">No. of Class</th>
			</tr>';
	
		
			$i = 0;
			$slno= 1;
	
	
	
			foreach($resall as $key => $value){
	
				$table2 .='<tr nobr="true">
						<td width="22" style="text-align: center;">'.$slno.'</td>
						<td width="60" style="text-align: center;">'.$value['ftechcode'].'</td>
						<td width="210">'.$value['fteachname'].'</td>
						<td width="60" style="text-align: center;">'.$value['fdegree'].'</td>
						<td width="180">'.$value['fdescpn'].'</td>
						<td width="180">'.$value['fsubname'].'</td>
						<td width="40" style="text-align: center;">'.$value['fperiod'].'</td>
						<td width="40" style="text-align: center;">'.$value['fnoclass'].'</td>
						</tr>';
				$i++;
				$slno++;
				
			}
	
			$table2 .= '</table>';
			$pdf->SetX(11);
			$pdf->writeHTML($table2, 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"]);

	$fdegree = "";

	if($degree == "all"){
		$fdegree = "";
	}else{
		$fdegree = "and a.fdegree = '{$degree}'";
	}


    $timestamp = strtotime($date);

$day = date('l', $timestamp);

	$class_obj=new ra_invigilators_dairy();
    $class_obj->DefaultConstructor($aobj_context);
	// $class_obj->formcolldata($classId, $datefrom);
    
    $query = "select c.*,ifnull(fsubname,'') as fsubname, ifnull(fteachname,'') as fteachname,
	ifnull(d.fdescpn,'') as fdescpn
	 from calsstimetable c 
inner join subject s on c.fsubcode = s.fsubcode and c.fdegree = s.fdegree
inner join masteach m on m.fteachcode = c.fteachcode 
inner join degree d on d.fdegree = c.fdegree
where c.fday = '{$day}'
group by c.fteachcode
order by c.fdegree,c.FPERIOD";

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


	$datehead ="select date_format(ifnull(fdate,''),'%d/%m/%Y') as fdate from attend_det
	where fdate = '{$date}'";
	$resdate = $aobj_context->mobj_db->GetRow($datehead);


	$qryall = "select ifnull(ac.fteachcode,'') as ftechcode,ifnull(m.fteachname,'') as fteachname, 
	ifnull(a.FCOLLCODE,'') as fcollcode,ifnull(a.FDEGREE,'') as fdegree,
	ifnull(d.fdescpn,'') as fdescpn, ifnull(a.FSUBCODE,'') as fsubcode, 
	ifnull(a.FPERIOD,'') as fperiod, ifnull(a.FNOCLASS,'') as fnoclass, 
	ifnull(s.fsubname,'') as fsubname, date_format(ifnull(a.fdate,''),'%d/%m/%Y') as fdate from attend_det a 
	inner join attclass ac on ac.fclassid = a.fclassid 
	inner join degree d on d.fdegree = a.fdegree 
	inner join masteach m on ac.fteachcode = m.fteachcode 
	inner join subject s on s.fcsubcode = a.fsubcode and a.fdegree = s.fdegree 
	where  a.fdate = '{$date}' 
	group by a.fsubcode
	order by a.fdegree,a.FPERIOD";
	$resall = $aobj_context->mobj_db->GetAll($qryall);


	$class_obj->formcolldata($resdate['fdate']);    

	$class_obj->Header($resdate['fdate']);

	$class_obj->writepdf($res1,$date,$aobj_context,$fdegree,$resall);
	
	$class_obj->SendOutput();
}



?>