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


Current Path : /var/www/html/college/Report_details/
Upload File :
Current File : /var/www/html/college/Report_details/attCisshortList_sjbit.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)
	{
		// var_dump($this->funivcode);die();

		if($this->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 ($this->funivcode == '055'){
			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,40,2,130,20);
				$this->pdf->Ln(15);
			}	
		}
		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,50,2,130,20);
                $this->pdf->ln(25);
			}

			$this->pdf->SetFont('Times','B',15);
			
		}
		
        $this->pdf->ln(12);
		
		$this->pdf->SetFont('Times','B',10);
        
        $this->pdf->Cell(200,7,"Not Eligible Student(NSA/NSC) List I Semester ".$this->res['FEXAMDATE'],"0",1,"C");
            
	}	
	
	function Footer()
	{
        $this->SetY(-15);
        $this->pdf->SetFont('Times','B',8);
		$this->Cell(140,6,'Note : NSC - Not Satisfactory CIE; NSA - Not Satisfactory Attendance','0',1,'L');
		$this->pdf->SetFont('Times','',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;
		if($this->funivcode == '055x'){
			$pdf->SetMargins(2,30,25,10);
		}else{
			$pdf->SetMargins(2,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(68,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(12,7, "NSA","1",0,"C");
		$this->pdf->cell(36,7, "NSC","1",1,"C");

		$c = 1;
        $i = 0;

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

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

            if($y>260)
            {
                $oldusn = $newusn;
                $this->pdf->cell(202,1, "","T",1,"C");
                $pdf->SetMargins(2,40,25,10);
                $pdf->startPageGroup();
                $pdf->AddPage("P");
				$pdf->SetMargins(2,40,25,10);
                $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(68,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(12,7, "NSA","1",0,"C");
				$this->pdf->cell(36,7, "NSC","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(68,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(68,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(12,7, $value['fattshort'],"1",0,"C");
			
			if($value['fia'] == '')
				$this->pdf->cell(36,7, $value['fcisshort'],"1",1,"C");
			else
				$this->pdf->cell(36,7, 'Th.: '.$value['fia'].' Pr.'.$value['fpr'].' NSC: '.$value['fcisshort'],"1",1,"C");
           
        }

        $this->pdf->cell(202,1, "","T",1,"C");

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

}

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

	$degree = trim($aobj_context->mobj_data["degree"]);
	$degarry = explode('- ',$degree);
	$degcode = trim($degarry[0]);
	$cnd = "and m.fdegree = '{$degcode}'";
	if(strtoupper($degcode) == 'ALL')
		$cnd = '';
	$sem = trim($aobj_context->mobj_data["sem"]);
	$semarry = explode('- ',$sem);
	$exam = trim($semarry[0]);
	$cnd1 = "and m.fexamno = '{$exam}'";
	if(strtoupper($exam) == 'ALL')
		$cnd1 = "";

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

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

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

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

    $query = "INSERT ignore into attcisshort1(fdegree,fcollcode,fexamno,fsubcode,fsubshort,fregno,fname,fsection,fattshort,fdate)
	select st.fdegree, a.fcollcode,a.fexamno,s.fsubcode,s.fsubshort,st.fregno,st.fname,
	st.fsection, a.FPER as attper,
	now()
    from attend 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}'
    group by a.fregno,a.fsubcode
    having ifnull(a.FPER,100) <75
    order by st.fdegree,a.fregno,a.fsubcode,st.fsection";
	//var_dump($query);
	$res1 = $aobj_context->mobj_db->GetAll($query);

	$query = "INSERT ignore INTO attcisshort2 (fdegree, fcollcode, fexamno, fsubcode, fsubshort, fregno, fname, fsection, fth, fpr,fcisshort, fdate,fvalmax)
	select m.fdegree,m.fcollcode,m.fexamno,s1.fsubcode,s1.fsubshort,m.fregno,st.fname, 
	st.fsection,m.fthia,m.factia,m.fmarks, 
	now(),s1.fvalmax 
	from marks m inner join subdet s on s.fcsubcode = m.fsubcode 
	and m.fdegree = s.fdegree and m.fexamno = s.fexamno
	inner join subject s1 on s.fdegree = s1.fdegree
	and s.fexamno = s1.fexamno and s1.fcsubcode = s.fcsubcode 
	inner join student st on st.fdegree = m.fdegree 
	and st.fcollcode = m.fcollcode 
	and m.fregno = st.fregno 
	where m.fregno between '0' and 'z' 
	and ifnull(st.fdeleted,'') <> 'T' 
	and m.fcollcode = '{$collcode}' 
	group by m.fregno,m.fsubcode
	having if(ifnull(m.fthia,'') ='',CEILING((m.fmarks/s1.fvalmax)*100),
	if( CEILING((m.fthia/s1.fvalmax)*100) <50,CEILING((m.fthia/s1.fvalmax)*100), 
	if(CEILING((factia/s1.fvalmax)*100) <50,CEILING((factia/s1.fvalmax)*100),
	CEILING((m.fmarks/s1.fvalmax)*100)
	))) <50";
	
	$res1 = $aobj_context->mobj_db->GetAll($query);
	

	$query = "INSERT ignore into attcisshort(fdegree,fcollcode,fexamno,fsubcode,fsubshort,fregno,fname,fsection,fattshort,fdate)
	select fdegree,fcollcode,fexamno,fsubcode,fsubshort,fregno,fname,fsection,fattshort,fdate from attcisshort1 where fcollcode = '{$collcode}'";
	$res1 = $aobj_context->mobj_db->GetAll($query);

	$query = "INSERT ignore into attcisshort(fdegree,fcollcode,fexamno,fsubcode,fsubshort,fregno,fname,fsection,fcisshort,fdate,fia,fpr)
	select fdegree,fcollcode,fexamno,fsubcode,fsubshort,fregno,fname,fsection,fcisshort,fdate,fth,fpr from attcisshort2 where fcollcode = '{$collcode}'";
	$res1 = $aobj_context->mobj_db->GetAll($query);

	$query = "update attcisshort a1, attcisshort1 a2 set a1.fattshort = a2.fattshort
	where a1.fregno = a2.fregno
	and a1.fdegree = a2.fdegree
	and a1.fcollcode = a2.fcollcode
	and a1.fsubcode = a2.fsubcode
	and a1.fsubshort = a2.fsubshort
	and a1.fcollcode = '{$collcode}'";
	$resdeg = $aobj_context->mobj_db->Execute($query);

	$query = "update attcisshort a1, attcisshort2 a2 set a1.fcisshort = a2.fcisshort,
	a1.fia = a2.fth, a1.fpr = a2.fpr
	where a1.fregno = a2.fregno
	and a1.fdegree = a2.fdegree
	and a1.fcollcode = a2.fcollcode
	and a1.fsubcode = a2.fsubcode
	and a1.fsubshort = a2.fsubshort
	and a1.fcollcode = '{$collcode}'";


	$resdeg = $aobj_context->mobj_db->Execute($query);

	$qry = "select fdegree, fcollcode, fexamno, fsubcode, fsubshort, fregno, fname, 
	fsection, round(fattshort) as fattshort, round(fcisshort) as fcisshort, fdate,
	ifnull(fia,'') as fia,
	ifnull(fpr,'') as fpr
	from attcisshort m
	where fcollcode = '{$collcode}'
	{$cnd}
	
	{$cnd1}
	order by fdegree,fregno,fsubcode,fsection";
	$res1 = $aobj_context->mobj_db->GetAll($qry);

    $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();
}



?>