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.223.195.30
<?php
$main_src=substr($_SERVER['SCRIPT_FILENAME'],0,strlen($_SERVER['SCRIPT_FILENAME'])-7);
$pdf_writer_class =$main_src."/maya-pdf/fpdf.php";
require_once($pdf_writer_class);
class ra_invigilators_dairy extends FPDF
{
function DefaultConstructor($aobj_context)
{
session_start();
$this->aobj_context=$aobj_context;
$this->pdf= new FPDF();
$this->pdf=$this;
$this->fromdate=trim($this->aobj_context->mobj_data["fromdate"]);
$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 date_add(date_add(now(),INTERVAL 13 hour),interval 30 minute) as now_date";
$obj=$this->aobj_context->mobj_db->GetRow($get_date);
$this->current_date=$obj[now_date];
$this->collcode=$_SESSION['collcode'];
$this->headeractive = true;
}
function Header()
{
}
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');
}
function formcolldata()
{
$get_coll_name="select FUNIVNAME as 'FUNIVNAME',
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'];
$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}";
}
function GetFullQry()
{
if($this->session == 'both')
{
$sectionvalue = "";
}
else
{
$sectionvalue = "and s.fsession like '{$this->session}'";
}
$canddettmp = "canddet";
$candsumttmp = "candsum";
$studenttmp = "student";
/*$query = "CREATE TEMPORARY TABLE IF NOT EXISTS {$candsumttmp} AS
select * from candsum where FCNTRCODE = '{$this->collcode}'";
$this->aobj_context->mobj_db->execute($query);
$query = "CREATE INDEX tmpcansum
ON {$candsumttmp} (fcollcode, fdergee, fregno)";
$this->aobj_context->mobj_db->execute($query);
$query = "CREATE TEMPORARY TABLE IF NOT EXISTS {$canddettmp} AS
select cd.* from canddet cd inner join {$candsumttmp} cs on cd.fcollcode = cs.fcollcode
and cd.fdegree = cs.fdegree and cd.fregno = cs.fregno where
cs.FCNTRCODE = '{$this->collcode}'";
$this->aobj_context->mobj_db->execute($query);
$query = "CREATE INDEX tmpcanddet
ON {$canddettmp} (fcollcode, fdergee, fregno, fsubcode)";
$this->aobj_context->mobj_db->execute($query);
$query = "CREATE TEMPORARY TABLE IF NOT EXISTS {$studenttmp} AS
select * from student where fcollcode = '{$this->collcode}'";
$this->aobj_context->mobj_db->execute($query);
$query = "CREATE INDEX tmpstudent
ON {$studenttmp} (fcollcode, fdergee, fregno)";
$this->aobj_context->mobj_db->execute($query);*/
/*$get_data="SELECT FHALLNO,cd.FREGNO,st.FNAME ,masroom.froomname,st.fphotopath,fqpcode,
(select count(*) from canddet s1 where s1.fdegree = cd.fdegree and s1.fexamno = cd.fexamno and s1.fsubcode = cd.fsubcode and s1.fdegree = s.fdegree
and s1.fexamno = s.fexamno and s1.fsubcode = s.fsubcode and s1.fpresent = 'P' group by s1.fdegree, s1.fexamno, s1.fsubcode) as orderby
FROM {$canddettmp} cd INNER JOIN subject s ON s.fdegree = cd.fdegree and s.fexamno = cd.fexamno
and s.FSUBCODE=cd.FSUBCODE
inner join {$candsumttmp} cs on cd.FCOLLCODE=cs.FCOLLCODE and cd.FDEGREE=cs.FDEGREE and cs.FREGNO=cd.FREGNO
inner join {$studenttmp} st on cd.FCOLLCODE=st.FCOLLCODE and st.FREGNO=cd.FREGNO
and ifnull(st.fexamappblk,'') <> 'T'
LEFT JOIN masroom ON masroom.froomno = cd.FHALLNO AND masroom.FCOLLCODE = cs.fcntrcode
LEFT JOIN reason r ON s.FSESSION = r.FREASONCD
WHERE cs.FCNTRCODE='{$this->collcode}' and s.ftheory = 'T' and ifnull(s.fintass,'') <> 'T'
and ifnull(s.fretain,'') <> 'T' {$sectionvalue}
and FQPCODE between '{$this->fromqpcode}' and '{$this->toqpcode}' and ifnull(cd.FHALLNO,'') <> ''
AND lpad(cd.FHALLNO,3,'0') between '{$this->room_range_from}' and '{$this->room_range_to}' and s.fdoe = date_format(str_to_date('{$this->fromdate}','%d/%m/%Y'),'%Y-%m-%d')
and FPRESENT='P' and ifnull(cd.fpassmth,'') = '' and ifnull(FRECPTDATE,'0000-00-00')<>'0000-00-00'
order by orderby desc,masroom.froomno,FQPCODE,cd.FREGNO";*/
$get_data = "SELECT cd.FHALLNO,cd.FREGNO,st.FNAME ,masroom.froomname,st.fphotopath,
s.fqpcode,LPAD(ra.forder,3, '000') AS foorder
FROM canddet cd INNER JOIN subject s ON s.fdegree = cd.fdegree
and s.fexamno = cd.fexamno and s.FSUBCODE=cd.FSUBCODE
inner join candsum cs on cs.FREGNO=cd.FREGNO AND cd.FDEGREE=cs.FDEGREE AND cd.FCOLLCODE=cs.FCOLLCODE
inner join student st on st.FREGNO=cd.FREGNO AND cd.FCOLLCODE=st.FCOLLCODE
inner JOIN masroom ON masroom.froomno = FHALLNO AND masroom.FCOLLCODE = cs.FCNTRCODE
LEFT JOIN reason r ON s.FSESSION = r.FREASONCD
inner join room_allotment ra on cs.fcntrcode = ra.fcollcode and s.fqpcode = ra.fqpcode
and ra.fhallno = masroom.froomno
WHERE cs.FCNTRCODE='{$this->collcode}' and s.ftheory = 'T' and ifnull(s.fintass,'') <> 'T'
and ifnull(s.fretain,'') <> 'T'
{$sectionvalue} and s.FQPCODE between '{$this->fromqpcode}' and '{$this->toqpcode}'
and ifnull(cd.FHALLNO,'') <> ''
AND lpad(cd.FHALLNO,3,'0') between '{$this->room_range_from}' and '{$this->room_range_to}'
and s.fdoe = date_format(str_to_date('{$this->fromdate}','%d/%m/%Y'),'%Y-%m-%d')
and FPRESENT='P' and ifnull(cd.fpassmth,'') = '' and ifnull(FRECPTDATE,'0000-00-00')<>'0000-00-00'
order by foorder,s.FQPCODE, cd.FREGNO";
$this->lobj_get_data = $this->aobj_context->mobj_db->GetAll($get_data);
//var_dump($get_data);
$this->final_data_arr=array();
$this->hallname= array();
$c=0;
foreach($this->lobj_get_data as $ak=>$av)
{
$this->final_data_arr[$av['FHALLNO']][$av['FREGNO']]['FREGNO']=$av['FREGNO'];
$this->final_data_arr[$av['FHALLNO']][$av['FREGNO']]['FNAME']=$av['FNAME'];
$this->final_data_arr[$av['FHALLNO']][$av['FREGNO']]['fphotopath']=$av['fphotopath'];
$this->final_data_arr[$av['FHALLNO']][$av['FREGNO']]['fqpcode']=$av['fqpcode'];
// To display room name 12/11/2016
$this->hallname[$av['FHALLNO']] = $av['froomname'];
$c++;
}
}
function WriteSlNoRow()
{
}
function logoheader($FUNIVCODE)
{
if($FUNIVCODE == '031')
{
if(!empty($this->pdf_logo_path))
{
$img_logo_path=$this->aobj_context->main_src."/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->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->pdf_logo_path;
$this->pdf->Image($img_logo_path,10,10,20);
}
$this->pdf->SetFont('Times','B',15);
$this->pdf->cell(180,3,$this->FUNIVNAME."","0",1,"C");
$this->pdf->SetFont('Times','B',8);
$this->pdf->cell(180,6, $this->s_state,"0",1,"C");
}
$this->pdf->SetFont('Times','B',12);
$this->pdf->cell(200,6, "Center : $this->college_details ","0",1,"C");
$this->pdf->SetFont('Times','B',12);
if($FUNIVCODE == '005')
$this->pdf->Cell(180,6,"ATTENDANCE SHEET","0",1,"C");
else
$this->pdf->Cell(180,6,"INVIGILATOR'S DIARY - {$this->FEXAMDATE} EXAMINATION","0",1,"C");
$this->pdf->SetFont('Times','',12);
$this->pdf->Cell(180,6," {$this->sub_details}","0",1,"C");
$this->pdf->Cell(180,6," {$this->exam_date}","0",1,"C");
$this->pdf->Ln(1);
$this->pdf->SetFont('Times','',12);
$empty_cell_width=12;
$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
$this->pdf->SetFont('Times','B',14);
$this->pdf->Cell(180,7,"Room No. : {$this->hall_no}","0",1,"L");
$this->pdf->SetFont('Times','B',12);
}
function formData()
{
session_start();
$FUNIVCODE = $_SESSION['FUNIVCODE'];
//var_dump($FUNIVCODE);
$this->pdf->SetMargins(10,12,10);
$empty_cell_width=12;
$this->pdf->SetFont('Times','B',10);
$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
$cnt=0;
foreach($this->final_data_arr as $hallk=>$hallv)
{
// To display room name 12/11/2016
$this->hall_no = $this->hallname[$hallk];
$this->headeractive = true;
//$this->pdf->AddPage();
$sl_no=1;
$c=1; $t_s=0;
$this->pdf->SetFont('Times','',12);
$cnt=0;
$newqpcode = '';
$oldqpcode = '';
$newhallno = '';
$oldhallno = '';
foreach($hallv as $hk=>$hv)
{
$cnt++;
$newqpcode = $hv['fqpcode'];
$this->qp_code = $hv['fqpcode'];
if($newqpcode != $oldqpcode)
{
$get_qp_details = "select FEXAMDATE,CONCAT(s.FSUBNAME,' ',s.FSSUBNAME) AS FSSUBNAME from subject s
inner join degree d on d. FDEGREE=s.FDEGREE and d.fexamno = s.fexamno
where s.FQPCODE='{$newqpcode}'";
$obj_get_qp_details=$this->aobj_context->mobj_db->GetRow($get_qp_details);
$FSSUBNAME=$obj_get_qp_details['FSSUBNAME'];
$this->FEXAMDATE=$obj_get_qp_details['FEXAMDATE'];
$this->sub_details="Subject : {$newqpcode} - {$FSSUBNAME} ";
$get_qp_data="SELECT distinct DATE_FORMAT(s.FDOE,'%d/%m/%Y') AS FDOE,s.FSESSION, r.fdescpn
FROM room_allotment ra inner join subject s on ra.fqpcode = s.fqpcode left outer join
reason r on s.fsession = r.freasoncd
WHERE ra.FCOLLCODE='{$this->collcode}'
AND ra.FQPCODE='{$newqpcode}'";
$obj_get_qp_data=$this->aobj_context->mobj_db->GetRow($get_qp_data);
$this->exam_date="Exam Date : {$obj_get_qp_data['FDOE']}, {$obj_get_qp_data['fdescpn']} ";
if($t_s > 0)
{
$this->pdf->Ln(2);
$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
$this->pdf->Cell(180,7,"End of Room No. {$this->hall_no}, Total Students : {$t_s}","0",1,"L");
$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
if($FUNIVCODE != '005')
$this->pdf->Cell(180,7,"Total no. of students present : _________ Total no of students absent : _________","0",1,"L");
$this->pdf->Ln(6);
$this->pdf->Cell(180,7,"Name & Signature of the Invigilator ","0",1,"R");
$t_s=0;
}
$this->pdf->AddPage();
session_start();
$FUNIVCODE = $_SESSION['FUNIVCODE'];
$this->logoheader($FUNIVCODE);
$newhallno = $this->hall_no;
if($newhallno != $oldhallno && $FUNIVCODE != '027')
{
$this->pdf->SetFont('Times','B',11);
$this->pdf->cell(12,10, "","0",0,"L");
$this->pdf->cell(50,10, "Name of the Invigilator","1",0,"L");
$this->pdf->cell(131,10, "","1",1,"L");
$this->pdf->cell(12,10, "","0",0,"L");
$this->pdf->cell(50,10, "Designation","1",0,"L");
$this->pdf->cell(131,10, "","1",1,"L");
$this->pdf->cell(12,5, "","0",0,"L");
$this->pdf->cell(50,5, "Serial No. of Answer","LRT",0,"L");
$this->pdf->cell(42,5, "From","1",0,"C");
$this->pdf->cell(42,5, "To","1",0,"C");
$this->pdf->cell(47,5, "Total","1",1,"C");
$this->pdf->cell(12,7, "","0",0,"L");
$this->pdf->cell(50,7, "Books Issued to Invigilator","LRB",0,"L");
$this->pdf->SetFont('Times','B',12);
$this->pdf->cell(42,7, "","1",0,"C");
$this->pdf->cell(42,7, "","1",0,"C");
$this->pdf->cell(47,7, "","1",1,"C");
//$this->pdf->cell(12,10, "","0",0,"L");
$this->pdf->Ln(3);
$oldhallno = $newhallno;
}
if($this->headeractive == true)
{
if($this->rtype == 'F')
{
$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
$this->pdf->cell(15,7, "Sl. No.","1",0,"C");
$this->pdf->cell(20,7, "Reg. No.","1",0,"C");
$this->pdf->cell(80,7, "Name","1",0,"C");
$this->pdf->cell(38,7, "Ans. Book No.","1",0,"C");
$this->pdf->cell(28,7, "Signature","1",1,"C");
}else
{
$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
$this->pdf->cell(15,7, "Sl. No.","1",0,"C");
$this->pdf->cell(20,7, "Reg. No.","1",0,"C");
$this->pdf->cell(70,7, "Name","1",0,"C");
$this->pdf->cell(20,7, "Photo","1",0,"C");
$this->pdf->cell(28,7, "Ans. Book No.","1",0,"C");
$this->pdf->cell(28,7, "Signature","1",1,"C");
}
}
$oldqpcode = $newqpcode;
$sl_no = 1;
}
$this->pdf->SetFont('Times','',12);
if($this->pdf->GetY() > 265) //if($cnt > 30)
{
//$this->hall_no=$this->hallname[$hallk];
$this->headeractive = true;
$this->pdf->AddPage();
$this->logoheader($FUNIVCODE);
$cnt = 0;
if($this->rtype == 'F')
{
$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
$this->pdf->cell(15,7, "Sl. No.","1",0,"C");
$this->pdf->cell(20,7, "Reg. No.","1",0,"C");
$this->pdf->cell(80,7, "Name","1",0,"C");
$this->pdf->cell(38,7, "Ans. Book No.","1",0,"C");
$this->pdf->cell(28,7, "Signature","1",1,"C");
$this->pdf->SetFont('Times','',12);
}else
{
$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
$this->pdf->cell(15,7, "Sl. No.","1",0,"C");
$this->pdf->cell(20,7, "Reg. No.","1",0,"C");
$this->pdf->cell(70,7, "Name","1",0,"C");
$this->pdf->cell(20,7, "Photo","1",0,"C");
$this->pdf->cell(28,7, "Ans. Book No.","1",0,"C");
$this->pdf->cell(28,7, "Signature","1",1,"C");
$this->pdf->SetFont('Times','',12);
}
}
if($this->rtype == 'F')
{
$this->pdf->cell($empty_cell_width,6, ""," ",0,"C");
$this->pdf->cell(15,6, $sl_no,"1",0,"C");
$this->pdf->cell(20,6, $hv['FREGNO'],"1",0,"C");
$this->pdf->cell(80,6, $hv['FNAME'],"1",0,"L");
$this->pdf->cell(38,6, "","1",0,"C");
$this->pdf->cell(28,6, "","1",1,"C");
}else
{
$x = $this->pdf->GetX();
$y = $this->pdf->GetY();
$full_photo_path=trim($this->aobj_context->main_src."/".$hv['fphotopath']);
if(file_exists($full_photo_path) && !empty($hv['fphotopath']))
{
$this->pdf->Image($full_photo_path,128,$y+1,18,18);
}
else
{
$this->pdf->Image($this->aobj_context->main_src."/img/nophotoborder.jpg",128,$y+1,18,18);
}
$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
$this->pdf->cell(15,20, $sl_no,"1",0,"C");
$this->pdf->cell(20,20, $hv['FREGNO'],"1",0,"C");
$this->pdf->cell(70,20, $hv['FNAME'],"1",0,"L");
$this->pdf->cell(20,20,'',"1",0,"L");
$this->pdf->cell(28,20, "","1",0,"C");
$this->pdf->cell(28,20, "","1",1,"C");
}
$c++;
$sl_no++;
$t_s+=1;
}
$this->pdf->Ln(2);
$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
$this->pdf->Cell(180,7,"End of Room No. {$this->hall_no}, Total Students : {$t_s}","0",1,"L");
$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
if($FUNIVCODE != '005')
$this->pdf->Cell(180,7,"Total no. of students present : _________ Total no of students absent : _________","0",1,"L");
$this->pdf->Ln(6);
$this->pdf->Cell(180,7,"Name & Signature of the Invigilator ","0",1,"R");
}
}
function SendOutput()
{
$this->pdf->Output("Invigilators Dairy.pdf","D");
}
}
function GenerateInvigilatorDairy($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$class_obj=new ra_invigilators_dairy();
$class_obj->AliasNbPages();
$class_obj->DefaultConstructor($aobj_context);
$class_obj->GetFullQry();
$class_obj->formcolldata();
$class_obj->formData();
$class_obj->SendOutput();
}
?>
|