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.219.119.163
<?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;
require_once("degreeWiseStudentlist_excel.php");
// ini_set('memory_limit','900M');
// ini_set('max_execution_time',0);
class MYPDF extends TCPDF
{
public $aobj_context;
public $degreegrp;
public function setDeggrp($degreegrp){
$this->degreegrp = $degreegrp[0];
}
public function setData($aobj_context)
{
$this->aobj_context = $aobj_context;
}
public function Header()
{
$this->Degree = $this->aobj_context->mobj_data["Degree"];
$this->deggrp = $this->aobj_context->mobj_data["deggrp"];
$this->degRngfrm = $this->aobj_context->mobj_data["degfrm"];
$this->degRngto = $this->aobj_context->mobj_data["degto"];
$this->semRng = $this->aobj_context->mobj_data["semRng"];
$fdeggrp = $this->degreegrp["fdeggrp"];
$fdescpn = $this->degreegrp["fdescpn"];
$fexamdate = $this->degreegrp["fexamdate"];
// var_dump($fdeggrp);
// 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("Degree Wise Subject Report");
// set bacground image
$this->SetFillColor(248, 248, 255);
$img_path = $this->aobj_context->main_src . "/img/logo.jpg";
if (file_exists($img_path)) {
$this->Image($img_path, 6, 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, ' Degree Wise Subject List', '0', 1, 'C');
$this->SetFont('Times', 'B', 12);
// $this->Cell(0, 5, $fdeggrp . ' - ' . $fdescpn . ' ' . $fexamdate , '0', 1, 'C');
$this->Cell(0, 6, " Degree Group Range: " . $this->aobj_context->mobj_data["deggrpfrm"] . ' - ' . $this->aobj_context->mobj_data["deggrpto"], "0", 1, "C");
$this->Cell(0, 5, ' Degree Range:' . ' ' . $this->degRngfrm . ' - ' . $this->degRngto . ' and ' . ' Semester Range: ' . str_replace("'", "", $this->semRng) , '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);
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 ReprtObject
{
public function DefaultConstructor($aobj_context)
{
$this->aobj_context = $aobj_context;
$deggrp = $aobj_context->mobj_data["deggrp"];
$fdeggrpfrm = $aobj_context->mobj_data["deggrpfrm"];
$fdeggrpto = $aobj_context->mobj_data["deggrpto"];
$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);
$this->reportType = $aobj_context->mobj_data["rtype"];
$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);
$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'];
$this->current_date = $obj['now_date'];
$this->pdf = new MYPDF('P',PDF_UNIT, PDF_PAGE_FORMAT, true, 'ISO-8859-1', false);
$this->pdf->setData($aobj_context);
$query1 = "select distinct fdeggrp, fdescpn, fexamdate from deggrp
where ifnull(fdeggrp,'') BETWEEN '{$fdeggrpfrm}' AND '{$fdeggrpto}'";
$result1 = $aobj_context->pobj_db->GetAll($query1);
$this->pdf->setDeggrp($result1);
}
public function Header($pdf)
{
$pdf->SetFont('Times', 'B', 10);
$pdf->Cell(8, 6, "Sl.", "LRT", 0, "C");
$pdf->Cell(13, 6, "Subject", "LRT", 0, "C");
$pdf->Cell(49, 6, "Subject Name", "LRT", 0, "C");
$pdf->Cell(13, 6, "Short", "LRT", 0, "C");
$pdf->Cell(25, 6, "Element", "LRT", 0, "C");
$pdf->Cell(15, 6, "Max.", "LRT", 0, "C");
$pdf->Cell(15, 6, "Mand.", "LRT", 0, "C");
$pdf->Cell(15, 6, "QP. Code", "LRT", 0, "C");
$pdf->Cell(15, 6, "Theory/", "LRT", 0, "C");
$pdf->Cell(15, 6, "INT.", "LRT", 1, "C");
$pdf->Cell(8, 6, "No", "LRB", 0, "C");
$pdf->Cell(13, 6, "Code", "LRB", 0, "C"); //w h txt brd pos align
$pdf->Cell(49, 6, "", "LBR", 0, "C");
$pdf->Cell(13, 6, "Name", "LBR", 0, "C");
$pdf->Cell(25, 6, "Name", "LBR", 0, "C");
$pdf->Cell(15, 6, "Marks", "LBR", 0, "C");
$pdf->Cell(15, 6, "Subject", "LBR", 0, "C");
$pdf->Cell(15, 6, "", "LBR", 0, "C");
$pdf->Cell(15, 6, "Pratical", "LBR", 0, "C");
$pdf->Cell(15, 6, "ASS", "LBR", 1, "C");
$pdf->SetFont('Times', '', 10);
}
public function Report($data)
{
$pdf = $this->pdf;
$pdf->SetMargins(15, 30);
$pdf->startPageGroup();
$pdf->AddPage("P");
$pdf->SetFont('Times', '', 10);
$oldCode = "";
$newCode = "";
$oldSub = "";
$newSub = "";
$sl_no = 1;
$first = true;
// var_dump($exattendancelist);
foreach ($data as $key => $value) {
$newCode = $value['fdegree'].$value['fexamno'];
$newSub = $value['fsubname'];
if ($pdf->getY() > 260) {
$oldSub = "A";
$newSub = $value['fsubname'];
$pdf->SetFont('Times', 'B', 12);
$pdf->cell(180, 1, " ", "T", 1, "C");
$pdf->AddPage("P");
$pdf->cell(0, 12, $value['fdegree'] . ' - ' . $value['fdescpn'] . ', ' . $value['fexamname'], 0, 1, "C");
$this->Header($pdf);
$pdf->SetFont('Times', '', 10);
}
if ($newCode != $oldCode) {
$sl_no = 1;
if(!$first){
$pdf->cell(180, 1, " ", "T", 1, "C");
}
if ($pdf->getY() > 220)
$pdf->AddPage("P");
$pdf->SetFont('Times', 'B', 12);
$pdf->cell(0, 12, $value['fdegree'] . ' - ' . $value['fdescpn'] . ', ' . $value['fexamname'], 0, 1, "C");
$this->Header($pdf);
$pdf->SetFont('Times', '', 10);
$first = false;
}
$x = $pdf->GetX();
$y = $pdf->GetY();
if($newSub != $oldSub) {
$pdf->SetX($x + 21);
$pdf->MultiCell(49, 6, $value['fsubname'], "LTR", "L");
}
else{
$pdf->SetX($x + 21);
$pdf->MultiCell(49, 6, ' ', "LR", "L");
}
$y1 = $pdf->GetY();
$h = $y1 - $y;
$pdf->SetXY($x, $y);
$pdf->Cell(8, $h, $sl_no, "1", 0, "C");
$pdf->cell(13, $h, $value['fcsubcode'], "1", 0, "C");
if($newSub != $oldSub) {
$pdf->SetXY($x + 70, $y);
$pdf->cell(13, $h, $value['fsubshort'], "LTR", "B", "C");
// $pdf->Cell(13, $h, 'Bottom', 1, 'B', 'B');
}else{
$pdf->SetXY($x + 70, $y);
$pdf->cell(13, $h, '', "LR", 0, "C");
}
$pdf->cell(25, $h, $value['fssubname'], "1", 0, "C");
$pdf->cell(15, $h, $value['fsmaxmarks'], "1", 0, "C");
$pdf->SetFont('dejavusans', '', 10);
$html = $value['fmandatory'] == 'True'?
'Yes': 'No';
$pdf->SetFont('Times', '', 10);
$pdf->cell(15, $h, $html, "1", 0, "C");
$pdf->cell(15, $h, $value['fqpcode'], "1", 0, "C");
$pdf->cell(15, $h, $value['fthpr'], "1", 0, "C");
$pdf->cell(15, $h, $value['fintass'], "1", 1, "C");
$oldCode = $newCode;
$oldSub = $newSub;
$sl_no++;
}
}
public function SendOutput()
{
// ob_end_clean();
$this->pdf->Output("Subject List.pdf", "I");
}
}
function degreeWiseSubjectList($aobj_context)
{
$univcode = $aobj_context->mobj_data["univcode"];
$deggrp = $aobj_context->mobj_data["deggrp"];
$degRngfrm = $aobj_context->mobj_data["degfrm"];
$degRngto = $aobj_context->mobj_data["degto"];
$semRng = $aobj_context->mobj_data["semRng"];
$fdeggrpfrm = $aobj_context->mobj_data["deggrpfrm"];
$fdeggrpto = $aobj_context->mobj_data["deggrpto"];
$query = "select s.fdegree, d.fdescpn, d.fexamno, d.fexamname, fcsubcode, fsubname,
fsubshort, fssubname, fsmaxmarks, if(fmandatory='T','True', 'False') as fmandatory,
ifnull(fqpcode,'') as fqpcode, if(ftheory ='T', 'Th.','Pr.') as fthpr,
if(fintass = 'T','Yes', 'No') as fintass
from subject s inner join degree d on s.fdegree = d.fdegree and s.fexamno = d.fexamno
where d.fdeggrp BETWEEN '{$fdeggrpfrm}' AND '{$fdeggrpto}'
and s.fdegree BETWEEN '{$degRngfrm}' AND '{$degRngto}'
and d.fexamno in ('{$semRng}') and s.fsubname <> 'DUMMY'
order by fdegree, fexamno, fcsubcode;";
// var_dump($query);
// return;
$result = $aobj_context->pobj_db->GetAll($query);
$class_obj = new ReprtObject();
$class_obj->univcode = $univcode;
$class_obj->DefaultConstructor($aobj_context);
// If No data found Generate Blank Report
if (count($result) > 0) {
$class_obj->Report($result);
}
$class_obj->SendOutput();
}
|