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.119.116.125
<?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");
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->degree_code = $aobj_context->mobj_data["degree_code"];
$from_month_name = $aobj_context->mobj_data["from_month_name"];
$to_month_name = $aobj_context->mobj_data["to_month_name"];
$this->exam_code = $aobj_context->mobj_data["exam_code"];
$sublist_start = substr("0000".$aobj_context->mobj_data["subwise_start"],-5);
$sublist_end = substr("0000".$aobj_context->mobj_data["subwise_end"],-5);
$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=trim($this->aobj_context->mobj_data['collcode']);
$this->funivcode=trim($this->aobj_context->mobj_data["FUNIVCODE"]);
$page_header_university = "select FUNIVNAME,FTOWN,FUNIVADD1, date_format(now(),'%d/%m/%Y') as date from control";
$this->lobj_page_header_university = $this->aobj_context->mobj_db->GetRow($page_header_university);
$this->college= $this->lobj_page_header_university['FUNIVNAME'];
$page_header_college ="select concat(FCOLLCODE,' - ',FCOLLNAME,', ',FTOWN) as college_name
from college where FCOLLCODE='{$this->collcode}'";
$this->lobj_page_header_college = $this->aobj_context->mobj_db->GetRow($page_header_college);
$getnumword=$aobj_context->main_src."/src/getnumword.php";
include($getnumword);
$this->startPageGroup();
}
function Header($FUNIVCODE){
$this->FUNIVCODE=$FUNIVCODE;
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,40);
}
}
else
{
if(!empty($this->pdf_logo_path))
{
$img_logo_path='/var/www/html/demo/logo.jpg';
$this->pdf->Image($img_logo_path,15,10,25);
$this->pdf->ln(5);
}
$this->pdf->SetFont('Times','B',15);
}
$get_data="select FUNIVNAME,FTOWN,FUNIVADD1, date_format(now(),'%d/%m/%Y') as date from control";
$obj_student=$this->aobj_context->mobj_db->GetRow($get_data);
$this->college=$obj_student['FUNIVNAME'];
$get_data1 ="select concat(FCOLLCODE,' - ',FCOLLNAME,', ',FTOWN) as college_name
from college where FCOLLCODE='{$this->collcode}'";
$obj_student1=$this->aobj_context->mobj_db->GetRow($get_data1);
$this->college1=$obj_student1['college_name'];
$get_data2="SELECT fdegree,fdescpn,fexamname FROM degree WHERE fdegree='{$this->degree_code}' AND fexamno='{$this->exam_code}'";
$obj_student2=$this->aobj_context->mobj_db->GetRow($get_data2);
$this->examname=$obj_student2['fexamname'];
$this->pdf->SetFont('Times','B',12);
$this->pdf->cell(0,3, "$this->college","0",1,"C");
$this->pdf->SetFont('Times','',10);
$this->pdf->cell(0,3, "College :$this->college1","0",1,"C");
$this->pdf->SetFont('Times','B',12);
$this->pdf->cell(0,3, "Attendance Report","0",1,"C");
$this->pdf->SetFont('Times','',10);
$this->pdf->cell(0,3, "Degree :$this->degree_code","0",1,"C");
$this->pdf->cell(0,3, "Exam :$this->exam_code"." - "." $this->examname","0",1,"C");
// $this->pdf->cell(0,3, "Subject :","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['FUNIVCODE'];
$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['collcode'];
$teachcode =$this->aobj_context->mobj_data['usr'];
$query_teach = "select fteachname, fteachcode from masteach
where fcollcode = '{$this->collcode}' and fteachcode = '{$teachcode}'";
$res_teach = $this->aobj_context->mobj_db->GetRow($query_teach);
$this->teachname = $res_teach['fteachname'];
}
function writepdf($data,$funivcode,$loop_arr){
$subject=$data[0]['sub_name'];
$pdf=$this->pdf;
$pdf->startPageGroup();
$empty_cell_width=12;
$univcode = $aobj_context->mobj_data['FUNIVCODE'];
$pdf->SetMargins(15,30,18,7);
$pdf->ln(15);
$pdf->SetFont('Times','',12);
$pdf->subject_name= $data[0]['sub_name'];
if($univcode=='045'){
$pdf->AddPage("P");
}
elseif($univcode=='051'){
$pdf->AddPage("P");
}
else{
$pdf->AddPage("L");
$pdf->SetFont('Times','',9);
$this->pdf->cell(0,3, "Subject : $subject","0",1,"C");
}
$pdf->SetFont('Times','',9);
$prev_sub_name= $data[0]['sub_name'];
$adm_ln_counter=0;
$slno = 1;
$z=0;
$pdf->Ln(5);
$pdf->Cell(10,5,"Sl",'LRT',0,'C');
if($univcode == '051')
$pdf->Cell(35,5,"USN",'LRT',0,'C');
elseif($univcode == '052')
$pdf->Cell(35,5,"USN",'LRT',0,'C');
else
$pdf->Cell(35,5,"Reg. No.",'LRT',0,'C');
$pdf->Cell(75,5,"Student Name",'LRT',0,'C');
foreach($loop_arr as $lk)
{
$pdf->Cell(25,5,$lk,'LRT',0,'C');
}
$pdf->Cell(20,5,"Total",'LRT',0,'C');
$pdf->Cell(20,5,"Percentage",'LRT',1,'C');
$pdf->Cell(10,5,"No",'LRB',0,'C');
$pdf->Cell(35,5,"",'LRB',0,'C');
$pdf->Cell(75,5,"",'LRB',0,'C');
foreach($loop_arr as $lk)
{
$pdf->Cell(25,5,"A / C",'LRB',0,'C');
}
$pdf->Cell(20,5,"",'LRB',0,'C');
$pdf->Cell(20,5,"",'LRB',1,'C');
foreach($data as $key=>$value){
$FREGNO = $value['FREGNO'];
$Name1 = $value['Name1'];
$sub_name = $value['sub_name'];
if($prev_sub_name !=$sub_name){
$pdf->subject_name= $sub_name;
if($univcode=='045'){
$pdf->AddPage("P");
}
elseif($univcode=='051'){
$pdf->AddPage("P");
}
else{
$pdf->AddPage("L");
$this->pdf->cell(0,3, "Subject : $pdf->subject_name","0",1,"C");
$pdf->Heading($data,$univcode,$loop_arr);
}
$slno = 1;
$prev_sub_name=$sub_name;
$z=0;
}
if($univcode=='045'){
$c=33;
}
elseif($univcode=='051'){
$c=30;
}
else{
$c=18;
}
if($z===$c){
if($univcode=='045'){
$pdf->AddPage("P");
}
elseif($univcode=='051'){
$pdf->AddPage("P");
}
else{
$pdf->AddPage("L");
$this->pdf->cell(0,3, "Subject : $sub_name","0",1,"C");
$pdf->Heading($data,$univcode,$loop_arr);
}
$z=0;
}
$get_x1=$pdf->GetX();
$get_y1=$pdf->GetY();
$pdf->SetXY($get_x1+35+10,$get_y1);
$pdf->MultiCell(75,6, $Name1,'1','L');
$get_y2=$pdf->GetY();
$height=$get_y2-$get_y1;
$pdf->SetXY($get_x1,$get_y1);
$pdf->Cell(10,$height, $slno,'1',0,'C');
$get_x1=$pdf->GetX();
$pdf->SetXY($get_x1,$get_y1);
$pdf->Cell(35,$height, $FREGNO,'1',0,'C');
$pdf->SetXY($get_x1+75+35,$get_y1);
$total_cond=0;
$total_att=0;
foreach($loop_arr as $lk)
{
$cond="F{$lk}C";
$att="F{$lk}A";
$cond_v=$value[$cond];
$att_v=$value[$att];
$total_cond+=$cond_v;
$total_att+=$att_v;
$cell_val="{$att_v}/{$cond_v}";
if($cell_val=="/")
$cell_val="-";
$pdf->Cell(25,$height,"{$cell_val}",'1',0,'C');
}
$perc=round($total_att/$total_cond*100,0);
$pdf->Cell(20,$height,"{$total_att}/{$total_cond}",'1',0,'C');
$pdf->Cell(20,$height,"{$perc}%",'1',1,'C');
$get_y1=$pdf->GetY();
++$slno;
$z++;
if($get_y1>=250)
{
$pdf->Ln(2);
$pdf->Cell(0,4,"Note : * Indicates Freezing Pending, A : No. of Class Attended, C :No. of Class Conducted ",'0',1,'L');
$pdf->Cell(0,4," ",'0',1,'L');
$pdf->AddPage();
}
$adm_ln_counter++;
}
}
function Heading($data,$univcode,$loop_arr){
$subject=$data[0]['sub_name'];
$pdf=$this->pdf;
$pdf->startPageGroup();
$empty_cell_width=12;
$univcode = $aobj_context->mobj_data['FUNIVCODE'];
$pdf->SetMargins(15,30,18,7);
$pdf->ln(5);
$pdf->SetFont('Times','',12);
$pdf->subject_name= $data[0]['sub_name'];
$pdf->SetFont('Times','',9);
$prev_sub_name= $data[0]['sub_name'];
$adm_ln_counter=0;
$slno = 1;
$z=0;
$pdf->Cell(10,5,"Sl",'LRT',0,'C');
if($univcode == '051')
$pdf->Cell(35,5,"USN",'LRT',0,'C');
elseif($univcode == '052')
$pdf->Cell(35,5,"USN",'LRT',0,'C');
else
$pdf->Cell(35,5,"Reg. No.",'LRT',0,'C');
$pdf->Cell(75,5,"Student Name",'LRT',0,'C');
foreach($loop_arr as $lk)
{
$pdf->Cell(25,5,$lk,'LRT',0,'C');
}
$pdf->Cell(20,5,"Total",'LRT',0,'C');
$pdf->Cell(20,5,"Percentage",'LRT',1,'C');
$pdf->Cell(10,5,"No",'LRB',0,'C');
$pdf->Cell(35,5,"",'LRB',0,'C');
$pdf->Cell(75,5,"",'LRB',0,'C');
foreach($loop_arr as $lk)
{
$pdf->Cell(25,5,"A / C",'LRB',0,'C');
}
$pdf->Cell(20,5,"",'LRB',0,'C');
$pdf->Cell(20,5,"",'LRB',1,'C');
}
function SendOutput(){
$this->pdf->Output("shortage_of_attendance.pdf","I");
}
}
function attendanceSummaryReport($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$college_code = $aobj_context->mobj_data['collcode'];
$univcode =$aobj_context->mobj_data['FUNIVCODE'];
if($univcode=='020'){
if($aobj_context->mobj_data['usrtype'] == '17'){
echo "please contact admin";
return;
}
}
$degree_code = $aobj_context->mobj_data["degree_code"];
$from_month_name = $aobj_context->mobj_data["from_month_name"];
$to_month_name = $aobj_context->mobj_data["to_month_name"];
$exam_code = $aobj_context->mobj_data["exam_code"];
$sublist_start = $aobj_context->mobj_data["subwise_start"];
// if($sublist_start=="All"){
// $substrt='';
// }else {
// $sublist_array = explode(',', $sublist_start);
// $sublist_start = "'" . implode("','", $sublist_array) . "'";
// $substrt="s.FCSUBCODE in($sublist_start) and";
// }
if (stripos($sublist_start, "All") !== false) {
$substrt = '';
} else {
$sublist_array = explode(',', $sublist_start);
$sublist_start = "'" . implode("','", $sublist_array) . "'";
$substrt = "s.FCSUBCODE in($sublist_start) and";
}
$canddettmp = "canddet";
$candsumttmp = "candsum";
$degreetmp = "degree";
$subjecttmp = "subject";
if($univcode == 'P005' || $univcode == 'P023' || $univcode == '096' || $univcode == '097')
{
$get_subject_data = "SELECT m.FREGNO, SUBSTRING(stu.FNAME,1,36) AS Name1 ,
CONCAT(s.FSUBCODE,' - ',s.FSUBNAME,',[',FSSUBNAME,']') AS sub_name,
sum(fnoclass) as FOVERALL_SEMC,
sum(if(fpresent = 'P',fnoclass,0)) as FOVERALL_SEMA
from attend_det m inner join student stu on m.fdegree = stu.fdegree and m.FREGNO=stu.FREGNO
inner join subject s on m.FSUBCODE=s.FCSUBCODE
where {$substrt} m.FDEGREE='{$degree_code}' and m.FEXAMNO='{$exam_code}'
and m.FCOLLCODE='{$college_code}' and s.FEXAMNO=m.FEXAMNO
and m.FDEGREE=s.FDEGREE
group by FCSUBCODE,m.FREGNO order by FCSUBCODE,m.FREGNO";
}else
{
$get_subject_data = " SELECT m.FREGNO, SUBSTRING(stu.FNAME,1,36) AS Name1,
if(ifnull(ct.FFREEZED,'') = 'T',IFNULL(FJANC,'0'),concat(IFNULL(FJANC,'0'),'*')) as FJANC,
if(ifnull(ct.FFREEZED,'') = 'T',IFNULL(FFEBC,'0'),concat(IFNULL(FFEBC,'0'),'*')) as FFEBC,
if(ifnull(ct.FFREEZED,'') = 'T',IFNULL(FMARC,'0'),concat(IFNULL(FMARC,'0'),'*')) as FMARC,
if(ifnull(ct.FFREEZED,'') = 'T',IFNULL(FAPRC,'0'),concat(IFNULL(FAPRC,'0'),'*')) as FAPRC,
if(ifnull(ct.FFREEZED,'') = 'T',IFNULL(FMAYC,'0'),concat(IFNULL(FMAYC,'0'),'*')) as FMAYC,
if(ifnull(ct.FFREEZED,'') = 'T',IFNULL(FJUNC,'0'),concat(IFNULL(FJUNC,'0'),'*')) as FJUNC,
if(ifnull(ct.FFREEZED,'') = 'T',IFNULL(FJULC,'0'),concat(IFNULL(FJULC,'0'),'*')) as FJULC,
if(ifnull(ct.FFREEZED,'') = 'T',IFNULL(FAUGC,'0'),concat(IFNULL(FAUGC,'0'),'*')) as FAUGC,
if(ifnull(ct.FFREEZED,'') = 'T',IFNULL(FSEPC,'0'),concat(IFNULL(FSEPC,'0'),'*')) as FSEPC,
if(ifnull(ct.FFREEZED,'') = 'T',IFNULL(FOCTC,'0'),concat(IFNULL(FOCTC,'0'),'*')) as FOCTC,
if(ifnull(ct.FFREEZED,'') = 'T',IFNULL(FNOVC,'0'),concat(IFNULL(FNOVC,'0'),'*')) as FNOVC,
if(ifnull(ct.FFREEZED,'') = 'T',IFNULL(FDECC,'0'),concat(IFNULL(FDECC,'0'),'*')) as FDECC,
if(ifnull(ct.FFREEZED,'') = 'T',IFNULL(FOVERALL_SEMC,'0'),concat(IFNULL(FOVERALL_SEMC,'0'),'*')) as FOVERALL_SEMC,
IFNULL(FJANA,'0') as FJANA,
IFNULL(FFEBA,'0') as FFEBA ,
IFNULL(FMARA,'0') as FMARA,
IFNULL(FAPRA,'0') as FAPRA,
IFNULL(FMAYA,'0') as FMAYA,
IFNULL(FJUNA,'0') as FJUNA,
IFNULL(FJULA,'0') as FJULA,
IFNULL(FAUGA,'0') as FAUGA,
IFNULL(FSEPA,'0') as FSEPA,
IFNULL(FOCTA,'0') as FOCTA,
IFNULL(FNOVA,'0') as FNOVA,
IFNULL(FDECA,'0') as FDECA,
IFNULL(FOVERALL_SEMA,'0') as FOVERALL_SEMA,
CONCAT(s.FSUBCODE,' - ',s.FSUBNAME,',[',FSSUBNAME,']') AS sub_name
from attend m
left join collatt ct on m.fdegree = ct.fdegree and ct.fcollcode = m.fcollcode and m.fsubcode = ct.fsubcode
inner join student stu on m.fdegree = stu.fdegree and m.FREGNO=stu.FREGNO
inner join {$subjecttmp} s on m.FSUBCODE=s.FCSUBCODE
where {$substrt}
m.FDEGREE='{$degree_code}'
and m.FEXAMNO='{$exam_code}'
and m.FCOLLCODE='{$college_code}' and s.FEXAMNO=m.FEXAMNO and m.FDEGREE=s.FDEGREE
group by FCSUBCODE,m.FREGNO order by FCSUBCODE,m.FREGNO";
}
$lobj_get_subject_data = $aobj_context->mobj_db->GetAll($get_subject_data);
$month_arr=array();
$month_arr["JAN"]=array("JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC");
$month_arr["FEB"]=array("FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC","JAN");
$month_arr["MAR"]=array("MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC","JAN","FEB");
$month_arr["APR"]=array("APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC","JAN","FEB","MAR");
$month_arr["MAY"]=array("MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC","JAN","FEB","MAR","APR");
$month_arr["JUN"]=array("JUN","JUL","AUG","SEP","OCT","NOV","DEC","JAN","FEB","MAR","APR","MAY");
$month_arr["JUL"]=array("JUL","AUG","SEP","OCT","NOV","DEC","JAN","FEB","MAR","APR","MAY","JUN");
$month_arr["AUG"]=array("AUG","SEP","OCT","NOV","DEC","JAN","FEB","MAR","APR","MAY","JUN","JUL");
$month_arr["SEP"]=array("SEP","OCT","NOV","DEC","JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG");
$month_arr["OCT"]=array("OCT","NOV","DEC","JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP");
$month_arr["NOV"]=array("NOV","DEC","JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT");
$month_arr["DEC"]=array("DEC","JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV");
$month_arr["OVERALL_SEM"]=array("OVERALL_SEM","OVERALL_SEM","JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC");
$arr_last_cnt=array_search($to_month_name,$month_arr[$from_month_name])+1;
$loop_arr_arr=array_chunk($month_arr[$from_month_name],$arr_last_cnt);
$loop_arr=$loop_arr_arr[0];
$class_obj=new ra_invigilators_dairy();
$class_obj->DefaultConstructor($aobj_context);
$class_obj->formcolldata();
$class_obj->Heading($data,$univcode,$loop_arr);
$class_obj->Header($univcode);
$class_obj->writepdf($lobj_get_subject_data,$univcode,$loop_arr);
$class_obj->SendOutput();
}
?>
|