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


Current Path : /var/www/oasis/Report_details/
Upload File :
Current File : /var/www/oasis/Report_details/attshortlist.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($resdeg,$section,$sem)
	{

       


		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;
                // var_dump($img_logo_path);
                // die();
				$this->pdf->Image($img_logo_path,80,2,50);
                $this->pdf->ln(15);
			}

			$this->pdf->SetFont('Times','B',15);
			$this->pdf->ln(3);
		}
        $this->pdf->ln(3);
		$this->pdf->SetFont('Times','B',12);
		$this->pdf->cell(0,6, "College : $this->college_details","0",1,"C");    
        
		$this->pdf->SetFont('Times','B',10);
        
        $this->pdf->Cell(0,7,"Shortage of Attendance between 75% to 85% for the ".$this->res['FEXAMDATE'],"0",1,"C");
            
	}	
	
	function Footer()
	{
        $this->SetY(-15);
        $this->pdf->SetFont('Times','B',8);
        $this->Cell(140,6,'Printed   : IP Address : '.$this->ip." Date ".$this->current_date,'0',0,'L');
        $this->Cell(50, 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'];

      

	 }
	 
	function writepdf($data){

    
		$pdf=$this->pdf;
        $pdf->SetMargins(5,40,25,10);
        $pdf->startPageGroup();
        $pdf->AddPage("P");
        $this->pdf->SetFont('Times','B',10);
        $empty_cell_width=12;
        $pdf->SetFont('Times','B',9);
        $newusn = "";
        $oldusn = "";

		// var_dump($data,'fdgdg');
		$this->pdf->cell(10,7, "Sl. No.","1",0,"C");
        $this->pdf->cell(20,7, "Program","1",0,"C");
        $this->pdf->cell(25,7, "USN","1",0,"C");
		$this->pdf->cell(90,7, "Name","1",0,"C");
		$this->pdf->cell(12,7, "Section","1",0,"C");
        $this->pdf->cell(23,7, "Course Code","1",0,"C");
        $this->pdf->cell(22,7, "Attendace(%)","1",1,"L");

		$c = 1;
        $i = 0;

		foreach($data as $key=>$value)
        {

           
            $y = $this->pdf->getY();

            if($y>270)
            {
                $oldusn = $newusn;
                $this->pdf->cell(202,1, "","T",1,"C");
                $pdf->SetMargins(5,40,25,10);
                $pdf->startPageGroup();
                $pdf->AddPage("P");
                $pdf->SetFont('Times','B',9);
                $this->pdf->cell(10,7, "Sl. No.","1",0,"C");
                $this->pdf->cell(20,7, "Program","1",0,"C");
                $this->pdf->cell(25,7, "USN","1",0,"C");
                $this->pdf->cell(90,7, "Name","1",0,"C");
                $this->pdf->cell(12,7, "Section","1",0,"C");
                $this->pdf->cell(23,7, "Course Code","1",0,"C");
                $this->pdf->cell(22,7, "Attendace(%)","1",1,"C");
                  
            }

            $pdf->SetFont('Times','',9);
            $newusn = $value['fregno'];
            
			if($newusn != $oldusn)
            {
                $this->pdf->cell(10,7, $c,"LRT",0,"C");
                $this->pdf->cell(20,7, $value['fdegree'],"LRT",0,"C");						
                $this->pdf->cell(25,7, $value['fregno'],"LRT",0,"C");
                $this->pdf->cell(90,7, $value['fname'],"LRT",0,"L");
                $this->pdf->cell(12,7, $value['fsection'],"LRT",0,"C");
                $c++;

            }else
            {
				
                $this->pdf->cell(10,7, "","LR",0,"C");
                $this->pdf->cell(20,7, "","LR",0,"C");						
                $this->pdf->cell(25,7, "","LR",0,"C");
                $this->pdf->cell(90,7, "","LR",0,"L");
                $this->pdf->cell(12,7, "","LR",0,"C");
            }

            $oldusn = $newusn;
            $this->pdf->cell(23,7, $value['fsubshort'],"1",0,"C");
            $this->pdf->cell(22,7, $value['attper'],"1",1,"C");
           
        }
        $this->pdf->cell(202,1, "","T",1,"C");    
	}
	 
	function SendOutput()
	{
		$this->pdf->Output("shortage_of_attendance.pdf","I");
	}

}

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

	$degree = trim($aobj_context->mobj_data["degree"]);
	$sem = trim($aobj_context->mobj_data["sem"]);
    $regfrom = trim($aobj_context->mobj_data["regfrom"]);
	$regto = trim($aobj_context->mobj_data["regto"]);
	$perfrom = trim($aobj_context->mobj_data["perfrom"]);
    $collcode = $_SESSION['collcode'];

	$cnd1 = "and a.fexamno = '{$sem}'";
	if(strtoupper($sem) == 'ALL')
		$cnd1 = "";


	// $query = "delete from attcisshort2 where fcollcode = '{$collcode}'";
    // $result = $aobj_context->mobj_db->Execute($query);


	// $query = "INSERT ignore INTO `attcisshort2` (`fdegree`, `fcollcode`, `fexamno`, `fsubcode`, `fsubshort`, `fregno`, `fname`, `fsection`, `fth`, `fpr`, `fthmarks`, `fprmarks`,`fcisshort`, `fdate`)
	// select m.fdegree,m.fcollcode,m.fexamno,s.fsubcode,s.fsubshort,m.fregno,st.fname,st.fsection,
	// 							(sum(if(s.ftheory = 'T',if(fmarks = '-1',0,if(fmarks = '-2',0,fmarks)),0))) as th,
	// 							(sum(if(s.ftheory = 'F',if(fmarks = '-1',0,if(fmarks = '-2',0,fmarks)),0))) as pr,
	// 							CEILING((sum(if(s.ftheory = 'T',if(fmarks = '-1',0,if(fmarks = '-2',0,fmarks)),0))*.6)) as thmarks,
	// 							CEILING((sum(if(s.ftheory = 'F',if(fmarks = '-1',0,if(fmarks = '-2',0,fmarks)),0))*.4)) as prmarks,
	// 							if((sum(if(s.ftheory = 'F',if(fmarks = '-1',0,if(fmarks = '-2',0,fmarks)),0))*.4) >0
	// 							and (sum(if(s.ftheory = 'T',if(fmarks = '-1',0,if(fmarks = '-2',0,fmarks)),0))*.6) >0,((sum(if(s.ftheory = 'T',if(fmarks = '-1',0,if(fmarks = '-2',0,fmarks)),0))*.6)+(sum(if(s.ftheory = 'F',if(fmarks = '-1',0,if(fmarks = '-2',0,fmarks)),0))*.4)),sum(if(fmarks = '-1',0,if(fmarks = '-2',0,fmarks)))) as totmarks,
	// 							now()
	// 							from marks m inner join subject s on s.fcsubcode = m.fsubcode
	// 							and m.fdegree = s.fdegree and m.fexamno = s.fexamno  
	// 							inner join ( select at.fdegree,at.fcollcode,at.fregno,at.fsubcode, at.fexamno,sum(fnoclass) as conducted, sum(if(fpresent = 'P',fnoclass,0)) as attend From attendsum at left join attend_det a on a.fexamno = at.fexamno and a.fdegree = at.fdegree and a.fsubcode = at.fsubcode 
	// 							and a.fregno = at.fregno and a.fcollcode = at.fcollcode
	// 							and a.fclassid = at.fclassid
	// 							where at.fcollcode = '{$collcode}'
	// 							group by at.fregno,at.fsubcode) a1 on a1.fdegree = m.fdegree
	// 							and a1.fexamno = m.fexamno and a1.fregno = m.fregno  
	// 							and left(a1.fsubcode,4) = left(m.fsubcode,4)
	// 							inner join student st on st.fdegree = m.fdegree and 
	// 							st.fcollcode = m.fcollcode and m.fregno = st.fregno and 
	// 							m.fexamno = st.fexamno
	// 							where fintass = 'T' and s.fexamno='A' 
	// 							and ifnull(st.fdeleted,'') <> 'T'
	// 							and a1.fcollcode = '{$collcode}' 
	// 							group by m.fregno,left(a1.fsubcode,4),s.fsubshort
	// 							having if(prmarks >0 and thmarks >0,(((prmarks/20)*100) < '40' or ((thmarks/30)*100) < '40'),((CEILING(totmarks)/50)*100) < '40') order by left(m.fsubcode,4)";
	// $res1 = $aobj_context->mobj_db->GetAll($query);


    $query = "select st.fsection, a.fregno,st.fdegree,d.fdescpn,st.fname, a.fsubcode,s.fsubshort, s.fsubname, 
	sum(a.fnoclass) as conducted, 
    sum(if(a.fpresent = 'A','0',a.fnoclass)) as attended,
	ROUND(sum(if(a.fpresent = 'A','0',a.fnoclass))/sum(a.fnoclass)*100) as attper
    from attend_det a 
    inner join subject s on a.fexamno = s.fexamno and a.fdegree = s.fdegree 
	and a.fsubcode = s.fcsubcode
    inner join student st on a.fregno = st.fregno and a.fdegree = st. fdegree 
	and a.fcollcode = st.fcollcode
    inner join degree d on st.fdegree = d.fdegree and d.fexamno = 'A'
	
    where ifnull(st.fdeleted,'') <> 'T'
	and st.fcollcode = '{$collcode}'
	{$cnd1}
    group by a.fregno,a.fsubcode
    having sum(if(a.fpresent = 'A','0',a.fnoclass)) / sum(a.fnoclass) * 100 between '75' and '84'
    order by st.fdegree,a.fregno,a.fsubcode,st.fsection";
	$res1 = $aobj_context->mobj_db->GetAll($query);
	
    $qry = "select fdegree,fdescpn,FEXAMDATE from degree limit 1";
    $resdeg = $aobj_context->mobj_db->GetRow($qry);


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

    $class_obj->res = $resdeg;

	$class_obj->writepdf($res1);
	$class_obj->SendOutput();
}



?>