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.14.254.103
<?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;
// set_time_limit(0);
// ini_set('memory_limit', '-1');
// ini_set('max_execution_time', '0');
set_time_limit(0);
ini_set('mysql.connect_timeout','0');
ini_set('max_execution_time', '0');
class MYPDF extends TCPDF
{
public function Header()
{
// get the current page break margin
$bMargin = $this->getBreakMargin();
// get current auto-page-break mode
$auto_page_break = $this->AutoPageBreak;
// disable auto-page-break
$this->SetAutoPageBreak(false, 0);
$this->SetTitle(" College Wise Student List Report");
// set bacground image
$this->SetFillColor(248, 248, 255);
$img_path = $this->aobj_context->main_src . "/img/".$this->aobj_context->FUNIVCODE."_logo.jpg";
if (file_exists($img_path)) {
$this->Image($img_path, 40, 6, 20, 20);
}
$this->SetFont('Times', 'B', 13);
$this->SetY(5);
$this->Cell(0, 4, $this->aobj_context->FUNIVNAME, 0, 1, 'C');
//state
$this->SetFont('Times', '', 11);
$this->Cell(0, 4, $this->aobj_context->s_state, 0, 1, 'C');
$this->SetFont('Times', 'BU', 12);
$this->Ln(1);
$cur_year = date("Y");
$this->Cell(0, 5, ' College Wise Student List', '0', 1, 'C');
$this->SetFont('Times', 'B', 10);
// $this->Cell(0, 5, 'Degree Group : ' . $this->aobj_context->deggrp, '0', 1, 'C');
$this->Cell(0, 5, " Degree Group Range: " . $this->aobj_context->mobj_data["fdeggrpfrom"] . ' - ' . $this->aobj_context->mobj_data["fdeggrpto"], "0", 1, "C");
$this->Cell(0, 5, " Degree Range: " . $this->aobj_context->mobj_data["fdegfrom"] . ' - ' . $this->aobj_context->mobj_data["fdegto"].
" College Range: " . $this->aobj_context->mobj_data["fcollfrom"] . ' - ' . $this->aobj_context->mobj_data["fcollto"], "0", 0, "C");
// $this->Cell(0, 5, " College Range: " . $this->aobj_context->mobj_data["fcollfrom"] . ' - ' . $this->aobj_context->mobj_data["fcollto"], "0", 1, "C");
// restore auto-page-break status
// $this->SetAutoPageBreak($auto_page_break, $bMargin);
// set the starting point for the page content
}
public function Footer()
{
$this->SetY(-15);
$this->SetFont('helvetica', 'I', 8);
// var_dump();
if($this->CurOrientation == 'P')
{
$this->Cell(60, 10, 'IP : ' . $_SERVER["REMOTE_ADDR"], 0, 0, 'L');
$this->Cell(60, 10, 'Date : ' . date("d-m-Y h:i:s A"), 0, 0, 'C');
$this->Cell(60, 10, 'Page ' . $this->getPageNumGroupAlias() . '/' . $this->getPageGroupAlias(), 0, 1, 'R');
}
else {
$this->Cell(90, 10, 'IP : ' . $_SERVER["REMOTE_ADDR"], 0, 0, 'L');
$this->Cell(90, 10, 'Date : ' . date("d-m-Y h:i:s A"), 0, 0, 'C');
$this->Cell(90, 10, 'Page ' . $this->getPageNumGroupAlias() . '/' . $this->getPageGroupAlias(), 0, 1, 'R');
}
}
}
class Report{
public function DefaultConstructor($aobj_context)
{
$this->count ="";
$this->aobj_context = $aobj_context;
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$this->ip = $_SERVER["REMOTE_ADDR"];
$get_date = "select DATE_FORMAT(now(), '%d/%m/%Y') as now_date";
$obj = $this->aobj_context->mobj_db->GetRow($get_date);
$get_coll_name = "select FUNIVNAME as 'FUNIVNAME',FUNIVCODE,
FUNIVADD1 as 'state', pdf_logo_path,
ifnull(FEXAMAPPREQ,'F') as FEXAMAPPREQ From control";
$lobj_get_coll_name = $this->aobj_context->pobj_db->GetRow($get_coll_name);
$collQry ="select concat(FCOLLCODE,' ',FCOLLNAME,', ',FTOWN) as college_name
from college where FCOLLCODE='{$this->fcollcode}'";
$collRes = $this->aobj_context->pobj_db->GetRow($collQry);
$aobj_context->FUNIVNAME = $lobj_get_coll_name['FUNIVNAME'];
$aobj_context->s_state = $lobj_get_coll_name['state'];
$aobj_context->pdf_logo_path = $lobj_get_coll_name['pdf_logo_path'];
$aobj_context->FUNIVCODE = $lobj_get_coll_name['FUNIVCODE'];
$aobj_context->FCOLLNAME = $collRes['college_name'];
$this->current_date = $obj['now_date'];
$deggrp = $this->aobj_context->mobj_data["deggrp"];
$getDeggrp = "select concat(fdeggrp, ' - ', fdescpn) as fdeggrp
from deggrp where fdeggrp = '{$deggrp}'";
$lobj_get_degree = $this->aobj_context->pobj_db->GetRow($getDeggrp);
$aobj_context->deggrp = $lobj_get_degree['fdeggrp'];
$this->pdf = new MYPDF('L');
$this->pdf->aobj_context = $aobj_context;
}
public function TblHeader($pdf)
{
$pdf->SetFont('Times', 'B', 10);
$pdf->Cell(10, 6, "Sl. No.", "LRT", 0, "C");
$pdf->Cell(20, 6, "Reg. No.", "LRT", 0, "C");
$pdf->Cell(60, 6, "Student Name", "LRT", 0, "C");
$pdf->Cell(15, 6, "Gender", "LRT", 0, "C");
$pdf->Cell(25, 6, "DOB", "LRT", 0, "C");
$pdf->Cell(15, 6, "Category", "LRT", 0, "C");
$pdf->Cell(60, 6, "Father Name", "LRT", 0, "C");
$pdf->Cell(60, 6, "Mother Name", "LRT", 1, "C");
$pdf->SetFont('Times', '', 10);
}
function writeReport($det){
$pdf = $this->pdf;
// var_dump($det);
$pdf->SetMargins(15, 32);
$pdf->startPageGroup();
$pdf->AddPage("L");
$sl_no = 1;
$pdf->SetFont('Times', '', 10);
$w=array(10,35,155);
$oldDeg = $det[0]["FDEGREE"];
$pdf->SetFont('Times','B',12);
$pdf->Cell(250,9,$det[0]['fcollcode'].' - '.$det[0]['fcollname'].
' - ['.$det[0]['FDEGREE'].' '.$det[0]['fdescpn'].']','0',1,"L");
$this->TblHeader($pdf);
foreach($det as $k => $v)
{
if($pdf->GetY()>= 195)
{
$pdf->AddPage();
$pdf->SetFont('Times','B',12);
$pdf->Cell(250,9,$v['fcollcode'].' - '.$v['fcollname'].' - ['.$v['FDEGREE'].' '.$v['fdescpn'].']','0',1,"L");
$this->TblHeader($pdf);
}
if($oldDeg != $v["FDEGREE"])
{
$oldDeg = $v["FDEGREE"];
$sl_no = 1;//
$pdf->AddPage(); //
$pdf->SetFont('Times','B',12);
$pdf->Cell(250,9,$v['fcollcode'].' - '.$v['fcollname'].' - ['.$v['FDEGREE'].' '.$v['fdescpn'].']','0',1,"L");
$this->TblHeader($pdf);
}
$pdf->Cell(10, 6, $sl_no, "1", 0, "C");
$pdf->Cell(20, 6, $v['FREGNO'], "1", 0, "C");
$pdf->Cell(60, 6, ucwords($v['FNAME']), "1", 0, "L");
$pdf->Cell(15, 6, $v['FGENDER'], "1", 0, "L");
$pdf->Cell(25, 6, $v['FDOB'], "1", 0, "C");
$pdf->Cell(15, 6, $v['FCASTE'], "1", 0, "C");
$pdf->Cell(60, 6, ucwords($v['FFATNAME']), "1", 0, "L");
$pdf->Cell(60, 6, ucwords($v['FMOTNAME']), "1", 1, "L");
$sl_no++;
}
}
public function SendOutput()
{
// ob_end_clean();
$this->pdf->Output("collegewise Student List.pdf", "I");
}
}
function studentwiseCollList($aobj_context){
//http://localhost/univadmin/app.php?a=studentwiseCollList&univcode=041&fcollcode=1001&fdeggrp=UG
$univcode = $aobj_context->mobj_data["univcode"];
$fcollfrom = $aobj_context->mobj_data["fcollfrom"];
$fcollto = $aobj_context->mobj_data["fcollto"];
$fdegfrom = $aobj_context->mobj_data["fdegfrom"];
$fdegto = $aobj_context->mobj_data["fdegto"];
$fdeggrpfrom = $aobj_context->mobj_data["fdeggrpfrom"];
$fdeggrpto = $aobj_context->mobj_data["fdeggrpto"];
$rftype = $aobj_context->mobj_data["format"];
if($rftype == 'Excel'){
include 'studwiseCollListExl.php';
studentwiseCollListExl($aobj_context);
}
$query = "select c.fcollcode,CONCAT(c.fcollname,',',c.ftown) AS fcollname,d.fdescpn, d.FEXAMNAME, s.FSLNO,
lcase(FNAME) as FNAME,if(s.fgender='M','Male','Female') as FGENDER,
lcase(FFATNAME) as FFATNAME,lcase(FMOTNAME) as FMOTNAME,
if(date_format(s.FDOB,'%d/%m/%Y')='00/00/00','',date_format(s.FDOB,'%d/%m/%Y')) as FDOB,
ifnull(s.FSEX,'') as FSEX, s.FCASTE,s.FDEGREE, cs.FEXAMNO,cs.FCOLLCODE, cs.FREGNO
from student s inner join candsum cs on cs.FDEGREE = s.FDEGREE and cs.FCOLLCODE=s.FCOLLCODE and cs.FREGNO=s.FREGNO
inner join degree d on cs.fdegree = d.fdegree and cs.fexamno = d.fexamno
INNER JOIN college c ON c.fcollcode = cs.fcollcode
WHERE cs.FCOLLCODE between '{$fcollfrom}' and '{$fcollto}'
and d.fdegree between '{$fdegfrom}' and '{$fdegto}'
and d.fdeggrp IN ('{$fdeggrpfrom}','{$fdeggrpto}')
GROUP BY cs.FDEGREE,cs.FEXAMNO, cs.FCOLLCODE,cs.FREGNO
ORDER BY cs.fcollcode, cs.FDEGREE, cs.FREGNO";
// var_dump($query);
// die();
$result = $aobj_context->pobj_db->GetAll($query);
// var_dump($result);
// die();
$class_obj = new Report();
$class_obj->univcode=$univcode;
$class_obj->fcollcode = $fcollcode;
$class_obj->DefaultConstructor($aobj_context);
if(count($result)>0)
$class_obj->writeReport($result);
$class_obj->SendOutput();
}
?>
|