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.58.77.244
<?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,6,2,20);
$this->pdf->Ln(6);
}
}
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);
if ($this->funivcode == '055'){
$this->pdf->cell(0,6, "$this->college_details","0",1,"C");
}else{
$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 Below 75% and CIE less than 20 ".$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;
if($this->funivcode == '055'){
$pdf->SetMargins(5,30,25,10);
}else{
$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(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(22,7, "Attendace(%)","1",0,"L");
$this->pdf->cell(22,7, "CIE Marks","1",1,"C");
$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(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(22,7, "Attendace(%)","1",0,"C");
$this->pdf->cell(22,7, "CIE Marks","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(22,7, $value['fattshort'],"1",0,"C");
$this->pdf->cell(22,7, $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($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, ROUND(sum(if(a.fpresent = 'A','0',a.fnoclass))/sum(a.fnoclass)*100) as attper,now()
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}'
and a.fdegree like 'BT%'
group by a.fregno,a.fsubcode
having sum(if(a.fpresent = 'A','0',a.fnoclass)) / sum(a.fnoclass) * 100 between '0' and '74'
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`, `fthmarks`, `fprmarks`,`fcisshort`, `fdate`)
// select m.fdegree,m.fcollcode,m.fexamno,s1.fsubcode,s1.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 marksint m inner join subdet s on concat(s.fcsubcode,s.fsubcode) = 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 ( 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 ifnull(st.fdeleted,'') <> 'T'
// and m.fexamno in('A','C')
// and a1.fcollcode = '{$collcode}'
// group by m.fregno,left(a1.fsubcode,4),s1.fsubcode
// having if(prmarks >0 and thmarks >0,(((prmarks/20)*100) < '50' or ((thmarks/30)*100) < '50'),((CEILING(totmarks)/50)*100) < '50')
// order by left(m.fsubcode,4)";
$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,s1.fsubcode,s1.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,
(sum(if(s.ftheory = 'T',if(fmarks = '-1',0,if(fmarks = '-2',0,fmarks)),0))*.6) as thmarks,
if(ifnull(s.fthonly,'A') ='T', (sum(if(s.ftheory = 'F',if(fmarks = '-1',0,if(fmarks = '-2',0,fmarks)),0))),(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) + if(ifnull(s.fthonly,'A') ='T' ,sum(if(s.ftheory = 'F',if(fmarks = '-1',0,if(fmarks = '-2',0,fmarks)),0)),(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 marksint m inner join subdet s on concat(s.fcsubcode,s.fsubcode) = 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' $cnd $cnd1
and ifnull(st.fdeleted,'') <> 'T' and m.fcollcode = '{$collcode}'
group by m.fregno,s1.fcsubcode
having if(CEIL(ifnull(prmarks, '0')) >0 and thmarks >0,(((CEIL(ifnull(prmarks, '0'))/20)*100) < '40' or ((CEIL(ifnull(thmarks, '0'))/30)*100) < '40'),((CEIL(ifnull(totmarks, '0'))/50)*100) < '40') order by left(m.fsubcode,4)";
// var_dump($query);
// die();
$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)
select fdegree,fcollcode,fexamno,fsubcode,fsubshort,fregno,fname,fsection,fcisshort,fdate from attcisshort2 where fcollcode = '{$collcode}'";
$res1 = $aobj_context->mobj_db->GetAll($query);
$query = "update attcisshort a1, attcisshort1 a2 set a1.fattshort = a2.fattshort
where a.fregno = a2.fregno
and a.fdegree = a2.fdegree
and a.fcollcode = a2.fcollcode
and a.fsubcode = a2.fsubcode
and a.fsubshort = a2.fsubshort
where a1.fcollcode = '{$collcode}'";
$resdeg = $aobj_context->mobj_db->Execute($qry);
$query = "update attcisshort a1, attcisshort2 a2 set a1.fcisshort = a2.fcisshort
where a.fregno = a2.fregno
and a.fdegree = a2.fdegree
and a.fcollcode = a2.fcollcode
and a.fsubcode = a2.fsubcode
and a.fsubshort = a2.fsubshort
where a1.fcollcode = '{$collcode}'";
$resdeg = $aobj_context->mobj_db->Execute($qry);
$qry = "select fdegree, fcollcode, fexamno, fsubcode, fsubshort, fregno, fname,
fsection, round(fattshort) as fattshort, round(fcisshort) as fcisshort, fdate 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();
}
?>
|