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.149.254.229
<?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;
// ini_set('memory_limit','900M');
// 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);
// 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, 15, 6, 20, 20);
}
$this->SetFont('Times', 'B', 13);
$this->SetY(5);
$this->Cell(0, 7, $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->SetTitle("Dispatch Markscard to College (Detailed)");
$this->Cell(0, 7, ' Dispatch Markscard to College (Detailed)', '0', 1, 'C');
$this->SetFont('Times', 'B', 10);
$this->Ln(1);
// $this->Cell(0, 5, $this->aobj_context->fcollname, '0', 1, 'C');
// var_dump($this->$aobj_context->fcollname);
// $this->Ln(4);
// 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();
$this->SetX(15);
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 ReportObj
{
public function DefaultConstructor($aobj_context,$res)
{
$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);
$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);
// var_dump($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'];
$deggrp = $this->aobj_context->mobj_data["fdeggrp"];
$reportType = $this->aobj_context->mobj_data["reportType"];
$aobj_context->dateFrom = $aobj_context->mobj_data['dateFrom'];
$aobj_context->dateTo = $aobj_context->mobj_data['dateTo'];
$aobj_context->qpcodeFrom = $aobj_context->mobj_data['qpcodeFrom'];
$aobj_context->qpcodeTo = $aobj_context->mobj_data['qpcodeTo'];
$aobj_context->regnoFrom = $aobj_context->mobj_data['regnoFrom'];
$aobj_context->regnoTo = $aobj_context->mobj_data['regnoTo'];
$aobj_context->correctionType = $aobj_context->mobj_data['correctionType'];
$aobj_context->fcollname = $res[0]['fcollcode'].'-'.$res[0]['fcollname'];
$aobj_context->degfrom = $aobj_context->mobj_data["degfrom"];
$aobj_context->degto = $aobj_context->mobj_data["degto"];
$aobj_context->dispno = $aobj_context->mobj_data["dispno"];
$get_coll_name = "select fdeggrp,fdescpn,fexamdate as fexamdate
from deggrp where fdeggrp = '{$deggrp}'";
$lobj_get_degree = $this->aobj_context->pobj_db->GetRow($get_coll_name);
$aobj_context->deggrp = $lobj_get_degree['fdeggrp'];
$aobj_context->fexamdate = $lobj_get_degree['fexamdate'];
$aobj_context->fdescpn = $lobj_get_degree['fdescpn'];
// var_dump($res);
$this->pdf = new MYPDF('L');
$this->pdf->aobj_context = $aobj_context;
}
public function Header($pdf)
{
$pdf->SetFont('Times', 'B', 10);
$pdf->Cell(15, 5, "Sl.", "LRT", 0, "C");
$pdf->Cell(30, 5, "Register", "LRT", 0, "C");
$pdf->Cell(30, 5, "MC Number", "LRT", 1, "C");
$pdf->Cell(15, 5, "No.", "LRB", 0, "C");
$pdf->Cell(30, 5, " number", "LRB", 0, "C");
$pdf->Cell(30, 5, "", "LRB", 1, "C");
}
public function Report($data, $result_mcdisp)
{
$pdf = $this->pdf;
$pdf->SetMargins(10, 35);
$pdf->startPageGroup();
$pdf->AddPage("P");
$oldCode = "";
$newCode = "";
$sl_no = 1;
$first = true;
$j = 0;
$pdf->SetFont('Times', '', 10);
$pdf->Cell(22, 6, 'Dispatch No:-', "", 0, "L");
$pdf->SetFont('Times', 'B', 10);
$pdf->Cell(15, 6, $result_mcdisp['fdispno'], "", 0, "L");
$pdf->SetFont('Times', '', 10);
$pdf->Cell(22, 6, 'Dispatch date:-', "", 0, "L");
$pdf->SetFont('Times', 'B', 10);
$pdf->Cell(20, 6, $result_mcdisp['fdispdate'], "", 0, "L");
$pdf->SetFont('Times', '', 10);
$pdf->Cell(15, 6, 'Issue To:-', "", 0, "L");
$pdf->SetFont('Times', 'B', 10);
$pdf->Cell(20, 6, $result_mcdisp['fissueto'], "", 1, "L");
$this->Header($pdf);
$pdf->SetFont('Times', '', 10);
$slno = 1;
$tot = 0;
// var_dump($data);
$first_deg = $data[0]['fdegree'];
foreach ($data as $key => $value) {
// $first_deg = $value['fdegree'];
if($first_deg == $value['fdegree']){
}
if($value['fcollsent'] == 'T'){
$status = 'Received';
}else{
$status = '';
}
$pdf->SetFont('Times', '', 10);
$x = $pdf->GetX();
$y = $pdf->GetY();
$h = 6;
$pdf->Cell(15, $h, $slno, "LRTB", 0, "C");
$pdf->Cell(30, $h, $value['fregno'], "LRTB", 0, "C");
$pdf->Cell(30, $h, $value['first'], "LRTB", 1, "C");
$tot += $value['count'];
$slno ++;
// var_dump($pdf->getX(),$pdf->getY());
if($pdf->getX() > 120 ){
$pdf->AddPage();
// $pdf->ln(1);
// var_dump($pdf->getX(),$pdf->getY());
// $pdf->SetY(35);
$pdf->SetMargins(10, 35);
$pdf->SetY(35);
// var_dump($pdf->getX(),$pdf->getY());
$pdf->SetFont('Times', '', 10);
$pdf->Cell(22, 6, 'Dispatch No:-', "", 0, "L");
$pdf->SetFont('Times', 'B', 10);
$pdf->Cell(15, 6, $result_mcdisp['fdispno'], "", 0, "L");
$pdf->SetFont('Times', '', 10);
$pdf->Cell(22, 6, 'Dispatch date:-', "", 0, "L");
$pdf->SetFont('Times', 'B', 10);
$pdf->Cell(20, 6, $result_mcdisp['fdispdate'], "", 0, "L");
$pdf->SetFont('Times', '', 10);
$pdf->Cell(15, 6, 'Issue To:-', "", 0, "L");
$pdf->SetFont('Times', 'B', 10);
$pdf->Cell(20, 6, $result_mcdisp['fissueto'], "", 1, "L");
$this->Header($pdf);
}
if($pdf->getY() > 250){
$pdf->SetXY($x + 100, 41);
$pdf->SetMargins($x + 100, 41);
$this->Header($pdf);
// $pdf->AddPage();
}
}
$table1 .= '</table>';
$pdf->SetX(11);
// $pdf->SetY(42);
$pdf->writeHTML($table1, false, true, false, false, 'L');
}
public function SendOutput()
{
// ob_end_clean();
$this->pdf->Output("DispMarkscardClg.pdf", "I");
}
}
function DispMarksReportDetailedCLG($aobj_context)
{
$univcode = $aobj_context->mobj_data["univcode"];
$deggrp = $aobj_context->mobj_data["deggrp"];
$fcollcode = $aobj_context->mobj_data['fcollcode'];
$degfrom = $aobj_context->mobj_data['degfrom'];
$degto = $aobj_context->mobj_data['degto'];
$examno = $aobj_context->mobj_data['examno'];
$clgfrom = $aobj_context->mobj_data['clgfrom'];
$clgto = $aobj_context->mobj_data['clgto'];
$dispno = $aobj_context->mobj_data['dispno'];
$exam = str_split($examno);
$examrange = implode("','", $exam);
$query = "SELECT mc.fregno,mc.fmcnumber,mc.fcollcode,c.fcollname,mc.fdegree,d.fdescpn,mc.fexamno
FROM mcdisp mc
INNER JOIN college c ON c.fcollcode = mc.fcollcode
INNER JOIN degree d ON d.fdegree = mc.fdegree AND d.fexamno = mc.fexamno
WHERE fcolldispno = '{$dispno}'
ORDER BY mc.fmcnumber,mc.fdegree,mc.fexamno,mc.fcollcode";
// var_dump($query);
$result = $aobj_context->pobj_db->GetAll($query);
$query = "SELECT fdispno,DATE_FORMAT(fdispdate,'%d/%m/%Y') AS fdispdate,fissueto,fmccount,fdispuser
FROM mcdispsum WHERE fdispno = '{$dispno}'";
$result_mcdisp = $aobj_context->pobj_db->GetROW($query);
$res = [];
foreach($result as $v){
$mcnum_arr = explode(',', $v['fmcnumber']);
$prevnum = (int)substr($mcnum_arr[0],-6);
$count = 0;
$v['fmcnumber'] = "";
$push_arr = $v;
$first = $mcnum_arr[0];
// $arr = [30, 31,32, 33, 35, 36];
$prevmc = "";
// var_dump("MC arr =", $mcnum_arr);
foreach($mcnum_arr as $mc){
$num = (int)substr($mc,-6);
// var_dump($num);
if(($prevnum +1) != $num && $count != 0){
$push_arr['first'] = $first;
$push_arr['end'] = $prevmc;
$push_arr['count'] = $count;
array_push($res, $push_arr);
$first = $mc;
$count = 0;
}
$prevnum = $num;
$prevmc = $mc;
$count++;
}
$push_arr['first'] = $first;
$push_arr['end'] = $mc;
$push_arr['count'] = $count;
array_push($res, $push_arr);
}
// var_dump($res);
// var_dump($aobj_context->fcollname);
$class_obj = new ReportObj();
$class_obj->univcode = $univcode;
$class_obj->DefaultConstructor($aobj_context,$res);
// If No data found Generate Blank Report
if (count($res) > 0) {
$class_obj->Report($res,$result_mcdisp);
}
$class_obj->SendOutput();
}
?>
|