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


Current Path : /var/www/oasis/Report_details/
Upload File :
Current File : /var/www/oasis/Report_details/AttdetPdf.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->type=trim($this->aobj_context->mobj_data["type"]);
		if($this->type == 'app'){
			$this->collcode = trim($this->aobj_context->mobj_data["collcode"]);
			$this->funivcode = trim($this->aobj_context->mobj_data["univcode"]);
		}else{
			$this->collcode=$_SESSION['collcode'];
			$this->funivcode=$_SESSION['FUNIVCODE'];
		}

		
			
		$this->headeractive = true;
		$this->startPageGroup();
	}
 
	function Header()
	{
    
		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
		{
			// $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;
				$this->pdf->Image($img_logo_path,5,2,20);
				// $this->pdf->ln(15);
			}
			$this->pdf->SetFont('Times','B',15);
			//$this->pdf->ln(5);
			$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->college_details ","0",1,"C");
		$this->pdf->SetFont('Times','B',12);
		// if($FUNIVCODE == '005')
		// 	$this->pdf->Cell(150,6,"ATTENDANCE SHEET","0",1,"C");
		// else
		// $this->pdf->ln(10);
			$this->pdf->Cell(0,7,"Date Wise Attendance","0",1,"C");
			$this->pdf->Cell(0,5,$this->date,"0",1,"L");
            $this->pdf->Cell(0,5,$this->classid,"0",1,"L");

			//$this->pdf->ln(1);
            //$this->pdf->Cell(10,5,,"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(40, 6,'Page ' .$this->PageNo().'', 0, 1, 'R');
		
		
	}
	
	function formcolldata($fclassname,$classid, $date)
	{
        
		
		$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}";
        $this->classid  = " Class Name : {$fclassname} ({$classid})";		

	 }
	 
	function writepdf($data){

        $query1 = "select ifnull(fregroll, 'Reg. No.')as fregroll from control";
		$res=$this->aobj_context->mobj_db->GetRow($query1); 

		$pdf=$this->pdf;
        $pdf->SetMargins(20,36,25,10);
        $pdf->startPageGroup();
        $pdf->AddPage("P");
		$pdf->ln(3);
        // $pdf->SetMargins(10,12,10);		
        
        $empty_cell_width=12;
        $pdf->SetFont('Times','B',12);
		$syllabusl = $data[0]['fsyllabusl'];
		// var_dump($data,'fdgdg');

		$this->pdf->Multicell(0,7, 'Syllabus Covered: '.$syllabusl,0,"L");
 		$pdf->SetFont('Times','B',10);
		$this->pdf->cell(15,7, "Sl. No.","1",0,"C");
		$this->pdf->cell(40,7, $res['fregroll'],"1",0,"C");
		$this->pdf->cell(80,7, "Name","1",0,"C");
		$this->pdf->cell(20,7, "Subcode","1",0,"C");
		$this->pdf->cell(15,7, "Period","1",0,"C");
		$this->pdf->cell(15,7, "Ab./Pr.","1",1,"C");
		$pdf->SetFont('Times','',12);
        // $z=0;
		$c = 1;
		foreach($data as $key=>$value){

				$y = $this->pdf->getY();
				if($y >260)
                {   
					$pdf->SetMargins(20,36,25,10);
                    $pdf->AddPage("P");
                    $pdf->ln(3);
                    $empty_cell_width=12;
                    $pdf->SetFont('Times','B',12);
					$this->pdf->Multicell(0,7, 'Syllabus Covered: '.$syllabusl,0,"L");
					$pdf->SetFont('Times','B',10);
                    $this->pdf->cell(15,7, "Sl. No.","1",0,"C");
                    $this->pdf->cell(40,7, $res['fregroll'],"1",0,"C");
                    $this->pdf->cell(80,7, "Name","1",0,"C");
					$this->pdf->cell(20,7, "Subcode","1",0,"C");
					$this->pdf->cell(15,7, "Period","1",0,"C");
                    $this->pdf->cell(15,7, "Ab./Pr.","1",1,"C");
                    $pdf->SetFont('Times','',12);
                }
			
			$this->pdf->cell(15,7, $c,"1",0,"C");
			$this->pdf->cell(40,7, $value['FREGNO'],"1",0,"C");						
			$this->pdf->cell(80,7, $value['fname'],"1",0,"L");
			$this->pdf->cell(20,7, $value['FSUBCODE'],"1",0,"C");
			$this->pdf->cell(15,7, $value['FPERIOD'],"1",0,"C");
			$this->pdf->cell(15,7, $value['FPRESENT'],"1",1,"C");
			$c++;
		}
	}
	 
	function SendOutput()
	{
		$this->pdf->Output("datewiseAttendance.pdf","I");
	}

}

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

	$classId = trim($aobj_context->mobj_data["classid"]);
	$datefrom = trim($aobj_context->mobj_data["datefrom"]);
	$dateto = trim($aobj_context->mobj_data["dateto"]);
	$type = trim($aobj_context->mobj_data["type"]);

	if($type == 'app'){
		$collcode = trim($aobj_context->mobj_data["collcode"]);
		$univcode = trim($aobj_context->mobj_data["univcode"]);
		$teachcode = trim($aobj_context->mobj_data["teachcode"]);
	}else{
		$collcode = $_SESSION['collcode'];
	}
	$class_obj=new ra_invigilators_dairy();
    $class_obj->DefaultConstructor($aobj_context);
	// $class_obj->formcolldata($classId, $datefrom);
    
    $query = "select distinct date_format(d.fdate,'%d/%m/%Y') as fdate, 
	a.fclassname,ifnull(fsyllabus,'') as fsyllabus 
		from attend_det d 
              inner join attclass a on a.fclassid = d.fclassid
              where d.fclassid='{$classId}' 
              and d.fdate between date_format(str_to_date('{$datefrom}','%Y-%m-%d'),'%Y-%m-%d')
              and date_format(str_to_date('{$dateto}','%Y-%m-%d'),'%Y-%m-%d')";

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

	// var_dump($res1);
	// die();

    foreach($res1 as $value)
    {
        $query = "select s.fname,ifnull(a.fsyllabus,'') as fsyllabusl, a.*  from attend_det a inner join student s
             on s.fregno = a.fregno where fdate = date_format(str_to_date('{$value['fdate']}','%d/%m/%Y'),'%Y-%m-%d')
            and a.fclassid='{$classId}' order by fdate";

       
			$class_obj->formcolldata($res1[0]['fclassname'],$classId, $value['fdate']);    
		$lobj_get_data = $aobj_context->mobj_db->GetAll($query);
		
        
	
		$class_obj->writepdf($lobj_get_data);
    }
	
	$class_obj->SendOutput();
}



?>