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.220.94.189
<?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");
class exam_attendance_det extends TCPDF
{
function DefaultConstructor($aobj_context)
{
session_start();
$this->aobj_context=$aobj_context;
$this->pdf= new TCPDF();
$this->pdf=$this;
$this->session = trim($this->aobj_context->mobj_data["session"]);
$this->qp_code_start = trim($this->aobj_context->mobj_data["qp_code_start"]);
$this->qp_code_end = trim($this->aobj_context->mobj_data["qp_code_end"]);
$this->Date_start = trim($this->aobj_context->mobj_data["Date_start"]);
$this->ip=$_SERVER["REMOTE_ADDR"];
$get_date="select date_format(now(),'%d/%m/%Y %h:%i %p') as now_date";
// $get_date="select current_timestamp as now_date";
$obj=$this->aobj_context->mobj_db->GetRow($get_date);
$this->current_date=$obj['now_date'];
$this->collcode = $_SESSION['collcode'];
}
function Header()
{
session_start();
$FUNIVCODE = $_SESSION['FUNIVCODE'];
$this->pdf->Ln(5);
$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);
}
$img_logo_path=$this->aobj_context->main_src."/".$this->aobj_context->mobj_data["db"]."/".$this->pdf_logo_path;
if(!empty($this->pdf_logo_path) && file_exists($img_logo_path))
{
$this->pdf->Image($img_logo_path,10,10,23,22);
}
$img_path2 = $this->aobj_context->main_src."/img/logo2.jpg";
if(file_exists($img_path2))
{
$this->pdf->Image($img_path2,170,6,23,23);
}
$this->pdf->SetFont('Times','B',16);
$this->pdf->cell(190,3,$this->FUNIVNAME."","0",1,"C");
$this->pdf->SetFont('Times','B',10);
$this->pdf->cell(190,7, $this->s_state,"0",1,"C");
$this->pdf->SetFont('Times','B',14);
$this->pdf->cell(190,7, $this->college_details,"0",'1',"C");
$this->pdf->Cell(190,7,"Exam Attendance Summary ".$this->FEXAMDATE." Examination","0",1,"C");
$this->pdf->Ln(3);
// $this->pdf->SetFont('Times','B',14);
// $this->pdf->Ln(2);
// $this->pdf->Cell(65,7,"Exam Date : ".$this->exdate,"0",0,"L");
// if($this->session == 'M')
// {
// $session = "Morning Session";
// }
// else
// {
// $session = "After Noon Session";
// }
// $this->pdf->Cell(65,7,"Session : ".$session,"0",1,"R");
// $this->pdf->Ln(2);
// $this->pdf->SetFont('Times','',13);
}
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().' 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()
{
$canddettmp = "canddet";
$candsumttmp = "candsum";
$degreetmp = "degree";
$subjecttmp = "subject";
$reporttype = "";
if($this->session == "'AM'")
{
$sess = "and an.fsession like 'M%'";
}
else if($this->session == "'PM'")
{
$sess = "and an.fsession like 'N%'";
}else
{
$sess = "";
}
$query1 = "SET SESSION group_concat_max_len=10000000";
$results = $this->aobj_context->mobj_db->Execute($query1);
$get_data = "select concat(m.fqpcode,' - ',m.fsubname) as fsubname,date_format(an.fdoe,'%d/%m/%Y') as doe,an.fsession,
an.fqpcode,ifnull(cnt_pr,'No Present') as cnt_pr,ifnull(cnt_ab,'No Absent') as cnt_ab from anscapt an
inner join masqp m on an.fqpcode = m.fqpcode
left join (select fqpcode,group_concat(fregno SEPARATOR ', ') as cnt_pr from anscapt an where
an.fcntrcode = '{$this->collcode}'
and an.fdoe = date_format(STR_TO_DATE('{$this->Date_start}', '%d/%m/%Y'),'%Y-%m-%d')
and an.fqpcode between '{$this->qp_code_start}' and '{$this->qp_code_end}'
and ifnull(an.FANSBOOKNO,'') <> ''
{$sess}
group by fqpcode
) b on b.fqpcode = an.fqpcode
left join (select fqpcode,group_concat(fregno SEPARATOR ', ') as cnt_ab from anscapt an where
an.fcntrcode = '{$this->collcode}'
and an.fdoe = date_format(STR_TO_DATE('{$this->Date_start}', '%d/%m/%Y'),'%Y-%m-%d')
and an.fqpcode between '{$this->qp_code_start}' and '{$this->qp_code_end}'
and ifnull(an.FANSBOOKNO,'') = ''
{$sess}
group by fqpcode
) c on c.fqpcode = an.fqpcode
where an.fcntrcode = '{$this->collcode}'
and an.fdoe = date_format(STR_TO_DATE('{$this->Date_start}', '%d/%m/%Y'),'%Y-%m-%d')
and an.fqpcode between '{$this->qp_code_start}' and '{$this->qp_code_end}'
{$sess}
group by an.fqpcode";
//var_dump($get_data);
$this->lobj_get_data = $this->aobj_context->mobj_db->GetAll($get_data);
//var_dump($get_data);
$query = "select d.fexamdate from {$degreetmp} d inner join {$subjecttmp} s on d.fdegree = s.fdegree
and s.fexamno = d.fexamno where s.fqpcode = '{$this->lobj_get_data[0]['fqpcode']}'";
$res = $this->aobj_context->mobj_db->GetRow($query);
$this->FEXAMDATE = $res['fexamdate'];
}
function formData()
{
$this->pdf->SetMargins(7,12,10);
$empty_cell_width=2;
$sl_no=1;
$k2 = 1;
$first = true;
$qpcodeold = "";
$qpcodenew = "";
foreach($this->lobj_get_data as $dk => $dv)
{
if($this->pdf->GetY() >= 250)
{
$this->pdf->AddPage();
$k2 = 1;
}
$qpcodenew = $dv['fqpcode'];
if($qpcodeold != $qpcodenew || $k2 == 1)
{
$this->pdf->SetMargins(7,30,10);
$this->pdf->AddPage();
$this->pdf->SetFont('Times','B',14);
$this->pdf->Ln(3);
$this->pdf->Multicell(0,6,"Subject Name : ".$dv['fsubname'],"0","C");
$this->pdf->cell(0,6,"Exam Date : ".$dv['doe'],"0",'1',"C");
$this->pdf->Ln(3);
$first = false;
$qpcodeold = $qpcodenew;
}
$z = explode(', ',$dv['cnt_ab']);
if($z[0] == 'No Absent')
$cntcount = "0";
else
$cntcount = count(explode(', ',$dv['cnt_ab']));
$z1 = explode(', ',$dv['cnt_pr']);
if($z1[0] == 'No Present')
$prcntcount = "0";
else
$prcntcount = count(explode(', ',$dv['cnt_pr']));
$this->pdf->SetFont('Times','B',11);
$this->pdf->cell(0,6,"Absent Register Number","1",'0',"L");
$this->pdf->cell(0,6,"Ab. Count : ".$cntcount,"1",'1',"R");
$this->pdf->SetFont('Times','',10);
$this->pdf->Multicell(0,6,$dv['cnt_ab'],1,"L");
$this->pdf->SetFont('Times','B',11);
$this->pdf->cell(0,6,"Present Register Number","1",'0',"L");
$this->pdf->cell(0,6,"Pr. Count : ".$prcntcount,"1",'1',"R");
$this->pdf->SetFont('Times','',10);
$this->pdf->Multicell(0,6,$dv['cnt_pr'],1,"L");
$sl_no++;
$k2++;
}
}
function SendOutput()
{
$this->pdf->Output("Exam_Attendance_Det.pdf","D");
}
}
function exam_attendance_det($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$class_obj=new exam_attendance_det();
//$class_obj->AliasNbPages();
$class_obj->DefaultConstructor($aobj_context);
$class_obj->GetFullQry();
$class_obj->formcolldata();
$class_obj->formData();
$class_obj->SendOutput();
}
function NbLines($w,$txt,$pdf)
{
//Computes the number of lines a MultiCell of width w will take
$cw=&$pdf->CurrentFont['cw'];
if($w==0)
$w=$pdf->w-$pdf->rMargin-$pdf->x;
$wmax=($w-2*$pdf->cMargin)*1000/$pdf->FontSize;
$s=str_replace("\r",'',$txt);
$nb=strlen($s);
if($nb>0 and $s[$nb-1]=="\n")
$nb--;
$sep=-1;
$i=0;
$j=0;
$l=0;
$nl=1;
while($i<$nb){
$c=$s[$i];
if($c=="\n"){
$i++;
$sep=-1;
$j=$i;
$l=0;
$nl++;
continue;
}
if($c==' ')
$sep=$i;
$l+=$cw[$c];
if($l>$wmax)
{
if($sep==-1){
if($i==$j)
$i++;
} else
$i=$sep+1;
$sep=-1;
$j=$i;
$l=0;
$nl++;
}
else
$i++;
}
return $nl;
}
?>
|