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.129.22.34
Current Path : /var/www/oasis/Report_details/ |
| Current File : /var/www/oasis/Report_details/report_ra_qp_wise_student_count_new.php |
<?php
$main_src=substr($_SERVER['SCRIPT_FILENAME'],0,strlen($_SERVER['SCRIPT_FILENAME'])-7);
$pdf_writer_class =$main_src."/tarka_pdf/fpdf.php";
require_once($pdf_writer_class);
include_once("stringspliter.php");
class report_ra_qp_wise_student_count extends FPDF
{
function DefaultConstructor($aobj_context)
{
session_start();
$this->aobj_context=$aobj_context;
$this->pdf= new FPDF();
$this->pdf=$this;
$this->date_from=trim($this->aobj_context->mobj_data["date_from"]);
$this->date_to=trim($this->aobj_context->mobj_data["date_to"]);
$this->qp_code_from=trim($this->aobj_context->mobj_data["qp_code_from"]);
$this->qp_code_to=trim($this->aobj_context->mobj_data["qp_code_to"]);
$this->centerwise = trim($this->aobj_context->mobj_data["centerwise"]);
$this->orderby = trim($this->aobj_context->mobj_data["orderby"]);
$this->degreegrp = trim($this->aobj_context->mobj_data["deggrp"]);
$this->exmmonth = trim($this->aobj_context->mobj_data["exmmonth"]);
$yemode = explode("*",$this->exmmonth);
$this->year = $yemode[0];
$this->examtype = $yemode[1];
// var_dump($this->date_to,$this->date_from);
// die();
$this->ip=$_SERVER["REMOTE_ADDR"];
$get_date="select date_format(now(),'%d/%m/%Y %H:%i:%s') now_date";
$obj=$this->aobj_context->mobj_db->GetRow($get_date);
$this->current_date=$obj['now_date'];
$this->collcode=$_SESSION['collcode'];
$get_deggrp=" select fdeggrp,fdescpn from deggrp where fdeggrp='{$this->degreegrp}';";
$objdeggrp=$this->aobj_context->mobj_db->GetRow($get_deggrp);
$this->fdescpn=$objdeggrp['fdescpn'];
}
function Header()
{
session_start();
$FUNIVCODE = $_SESSION['FUNIVCODE'];
$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->aobj_context->mobj_data["db"].'/'.$this->pdf_logo_path;
if($FUNIVCODE == '052')
$this->pdf->Image($img_logo_path,5,5,37,15);
else
$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);
}
if($FUNIVCODE == '052')
{
$this->pdf->SetFont('Times','B',9);
$this->pdf->Cell(0,4,"JSS MAHAVIDYAPEETHA",0,1,'C');
}
$this->pdf->SetFont('Times','B',12);
$this->pdf->cell(0,3,$this->FUNIVNAME."","0",1,"C");
$this->pdf->SetFont('Times','B',7);
$this->pdf->cell(0,7, $this->s_state,"0",1,"C");
$this->pdf->SetFont('Times','B',9);
$this->pdf->cell(0,7, $this->college_details,"0",'1',"C");
$this->pdf->SetFont('Times','B',9);
$this->pdf->Cell(0,7,"Q.P. WISE STUDENT COUNT - ".$this->FEXAMDATE." EXAMINATION","0",1,"C");
if($this->degreegrp=='All'){
$this->pdf->Cell(0,7,"Degree Group - All ","0",1,"C");
}else{
$this->pdf->Cell(0,7,"Degree Group - ".$this->degreegrp." - ".$this->fdescpn,"0",1,"C");
}
$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()
{
$reporttype = "";
$FUNIVCODE = $_SESSION['FUNIVCODE'];
if($this->centerwise == 'cntr')
{
$reporttype = " and m.FCNTRCODE = '{$this->collcode}' ";
}else
{
$reporttype = " and c.FCOLLCODE = '{$this->collcode}'";
}
if($_SESSION['fexamseparate'] == 'T')
{
$candsum = "examcandsum";
$canddet = "examcanddet";
$examdate = "d.fexexamdate as FEXAMDATE";
}else
{
$candsum = "candsum";
$canddet = "canddet";
$examdate = "d.FEXAMDATE as FEXAMDATE";
}
/*$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);*/
/* $get_data =" select d.FEXAMDATE, s.FQPCODE, date_format(s.FDOE,'%d/%m/%Y') FDOE,
if(ifnull(s.FSESSION,'')<>'',if(s.FSESSION = r.FREASONCD,r.FDESCPN,s.FSESSION),s.FSESSION) as FDESCPN, concat(s.fsubname, ' ', s.FSSUBNAME) as FSSUBNAME,
COUNT(c.FSUBCODE) AS FCAPACITY from degree d
inner join subject s on d.fdegree = s.fdegree and d.fexamno = s.fexamno
inner join canddet c on s.fdegree = c.fdegree and s.fexamno = c.fexamno and s.fsubcode = c.fsubcode
inner join candsum m on c.fregno = m.fregno
left join reason r on r.FREASONCD = s.FSESSION
where ifnull(frecptdate,'0000-00-00') <> '0000-00-00'
and c.fpresent = 'P' and ifnull(c.fpassmth,'') = '' {$reporttype}
AND s.fqpcode between '{$this->qp_code_from}' and '{$this->qp_code_to}'
group by FQPCODE order by FQPCODE"; */
$user = $_SESSION['user_type'];
// if($user === "SuperUser" || $user === "LSYS"){
// $cond="";
// }else{
// $cond="";
// }
if($this->degreegrp=== 'All'){
$deggrpcond = "t.fdeggrp BETWEEN '00000' and 'zzzzzz'";
}
else {
$deggrpcond = "t.fdeggrp='{$this->degreegrp}'";
}
$grpcnd = 't.fqpcode';
if($FUNIVCODE == '055')
$grpcnd = "left(t.fqpcode,5)";
if($FUNIVCODE == '052'){
$this->orderby = "order by t.fdate, t.fsession desc";
}
$get_data =" select {$examdate}, t.FQPCODE, date_format(t.fdate,'%d/%m/%Y') FDOE,
ifnull(t.fsession,'') as FDESCPN,
if('{$FUNIVCODE}' = '055',concat(s.fsubshort,' - ',s.fsubname),concat(s.fsubname,' ', s.fssubname)) as FSSUBNAME,
COUNT(c.FSUBCODE) AS FCAPACITY from degree d
inner join subject s on d.fdegree = s.fdegree and d.fexamno = s.fexamno
inner join {$canddet} c on s.fdegree = c.fdegree and s.fexamno = c.fexamno and s.fsubcode = c.fsubcode
inner join {$candsum} m on c.fregno = m.fregno
inner join timetable t on t.fqpcode = s.fqpcode
and t.fyear = c.fyear
and t.fexamtype = c.fexamtype
and m.fyear = c.fyear
and m.fexamtype = c.fexamtype
left join reason r on r.FREASONCD = s.FSESSION
left outer join attshort a on a.fdegree = c.fdegree and c.fexamno = a.fexamno and a.fregno = c.fregno and left(a.fsubcode,4) = c.fsubcode
and a.fyear = c.fyear and a.fexamtype = c.fexamtype
where ifnull(frecptdate,'0000-00-00') <> '0000-00-00'
and ifnull(a.fregno,'') = ''
and ifnull(c.FTHPR,'') <> 'T'
and c.fpresent = 'P' and ifnull(c.fpassmth,'') = '' {$reporttype}
AND t.fqpcode between '{$this->qp_code_from}' and '{$this->qp_code_to}'
AND t.fdate BETWEEN
STR_TO_DATE('{$this->date_from}', '%d/%m/%Y') and
STR_TO_DATE('{$this->date_to}', '%d/%m/%Y')
and {$deggrpcond} and INSTR(m.fhtenable,c.fexamno) >0
group by $grpcnd {$this->orderby} ";
// var_dump($get_data);die();and c.fyear = '{$this->year}' and c.fexamtype = '{$this->examtype}'
$this->lobj_get_data = $this->aobj_context->mobj_db->GetAll($get_data);
$this->FEXAMDATE = $this->lobj_get_data[0]['FEXAMDATE'];
}
function formData()
{
$FUNIVCODE = $_SESSION['FUNIVCODE'];
$this->pdf->SetMargins(10,5,10);
$this->pdf->AddPage();
$empty_cell_width=2;
$sl_no=1;
$k2 = 1;
$first = true;
$totalCount = 0;
foreach($this->lobj_get_data as $dk => $dv)
{
if($k2 > 29)
{
$this->pdf->AddPage();
$k2 = 1;
}
if($first == true || $k2 == 1)
{
$this->pdf->SetFont('Times','B',10);
$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
$this->pdf->cell(12,7, "Sl. No.","1",0,"C");
$this->pdf->cell(18,7, "QP Code","1",0,"C");
$this->pdf->cell(20,7, "Exam Date","1",0,"C");
$this->pdf->cell(45,7, "Session","1",0,"C");
$this->pdf->cell(85,7, "Subject / Paper Title","1",0,"C");
$this->pdf->cell(10,7, "Count","1",1,"C");
$this->pdf->SetFont('Times','',9);
$first = false;
}
$subname = trim($dv['FSSUBNAME']);
$subnamearr = str_splitf($subname,50);
$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
$this->pdf->cell(12,7, $sl_no,"LRT",0,"C");
if($FUNIVCODE == '055')
$this->pdf->cell(18,7, substr($dv['FQPCODE'],0,5),"LRT",0,"C");
else
$this->pdf->cell(18,7, $dv['FQPCODE'],"LRT",0,"C");
$this->pdf->cell(20,7, $dv['FDOE'],"LRT",0,"C");
$this->pdf->cell(45,7, $dv['FDESCPN'],"LRT",0,"C");
$this->pdf->SetFont('Times','',8);
$this->pdf->cell(85,7, $subnamearr[0],"LRT",0,"L");
$this->pdf->SetFont('Times','',9);
$this->pdf->cell(10,7, $dv['FCAPACITY'],"LRT",1,"C");
$totalCount += $dv['FCAPACITY'];
if($k2 == 29)
{
$this->pdf->cell($empty_cell_width,7, "","",0,"C");
$this->pdf->cell(190,1, "","T",0,"C");
}
if($subnamearr[1] != '')
{
$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
$this->pdf->cell(12,4,'',"LRB",0,"C");
$this->pdf->cell(18,4,'',"LRB",0,"C");
$this->pdf->cell(20,4,'',"LRB",0,"C");
$this->pdf->cell(45,4,'',"LRB",0,"L");
$this->pdf->SetFont('Times','',8);
$this->pdf->cell(85,4, $subnamearr[1],"LRB",0,"L");
$this->pdf->SetFont('Times','',9);
$this->pdf->cell(10,4,'',"LRB",1,"C");
if($k2 == 30)
{
$this->pdf->cell($empty_cell_width,7, "","",0,"C");
$this->pdf->cell(190,1, "","T",0,"C");
}
}
$sl_no++;
$k2++;
}
$this->pdf->cell($empty_cell_width,7, "","",0,"C");
$this->pdf->cell(190,0, "","T",1,"C");
$this->pdf->cell($empty_cell_width,7, "","",0,"C");
$this->pdf->SetFont('Times','B',9);
$this->pdf->cell(180,7, "TOTAL COUNT","1",0,"R");
$this->pdf->cell(10,7, $totalCount,"1",1,"C");
}
function SendOutput()
{
$this->pdf->Output("QPwise Students count.pdf","I");
}
}
function GenerateRAQPwiseStudentsCountNew($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$class_obj=new report_ra_qp_wise_student_count();
$class_obj->AliasNbPages();
$class_obj->DefaultConstructor($aobj_context);
// var_dump($aobj_context);die();
$class_obj->GetFullQry();
$class_obj->formcolldata();
$class_obj->formData();
$class_obj->SendOutput();
}
?>
|