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.147.67.237
<?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);
class MYPDF extends TCPDF
{
public $aobj_context;
public function setData($aobj_context)
{
$this->aobj_context = $aobj_context;
// var_dump($this->aobj_context->pdf_logo_path);
$this->frmdeg = $this->aobj_context->mobj_data["frmdeg"];
$this->todeg = $this->aobj_context->mobj_data["todeg"];
$this->frmappno = $this->aobj_context->mobj_data["fomappno"];
$this->toappno = $this->aobj_context->mobj_data["toappno"];
}
public function Header()
{
$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->SetMargins(6,30,5,true);
$this->SetFillColor(248, 248, 255);
$img_path = $this->aobj_context->main_src . $this->aobj_context->pdf_logo_path;
// var_dump($this->aobj_context->pdf_logo_path);
// var_dump($img_path);
if (file_exists($img_path))
$this->Image($img_path, 30, 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->SetFont('Times', '', 12);
$this->Cell(0, 5, 'Candidate Report', '0', 1, 'C');
$this->Cell(0,5,'Degree Range: '.$this->frmdeg.' - '.$this->todeg,'0',1,"C");
$this->Cell(0,5,'Application Range: '.$this->frmappno.' - '.$this->toappno,'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->SetMargins(20, 40);
$this->SetY(-15);
$this->SetFont('helvetica', 'I', 8);
$this->Cell(40, 10, 'IP : ' . $_SERVER["REMOTE_ADDR"], 0, 0, 'L');
$this->Cell(90, 10, 'Date : ' . date("d-m-Y H:i:s"), 0, 0, 'C');
$this->Cell(115, 10, 'Page ' . $this->getPageNumGroupAlias() . '/' . $this->getPageGroupAlias(), 0, 1, 'R');
}
}
class ApprCandidList {
function DefaultConstructor($aobj_context){
$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->mobj_db->GetRow($get_coll_name);
$aobj_context->FUNIVNAME = $lobj_get_coll_name['FUNIVNAME'];
// $aobj_context->fexamdate = $fexamdate;
$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('L');
$this->pdf->setData($aobj_context);
}
function tableHeader(){
$pdf = $this->pdf;
$pdf->SetFont('Times', 'B', 10);
$pdf->Cell(8, 6, "Sl.", "LRT", 0, "C");
$pdf->Cell(20, 6, "Reg.", "LRT", 0, "C");
$pdf->Cell(40, 6, "Name", "LRT", 0, "C");
$pdf->Cell(20, 6, "Exam Cntr.", "LRT", 0, "C");
$pdf->Cell(15, 6, "Course/", "LRT", 0, "C");
$pdf->Cell(20, 6, "Year", "LRT", 0, "C");
$pdf->Cell(60, 6, "Subjects", "LRT", 0, "C");
$pdf->Cell(15, 6, "Status", "LRT", 1, "C");
$pdf->Cell(8, 6, "No.", "LRB", 0, "C");
$pdf->Cell(20, 6, "No.", "LBR", 0, "C");
$pdf->Cell(40, 6, "", "LBR", 0, "C");
$pdf->Cell(20, 6, "Code", "LBR", 0, "C");
$pdf->Cell(15, 6, "Degree", "LBR", 0, "C");
$pdf->Cell(20, 6, "", "LBR", 0, "C");
$pdf->Cell(60, 6, "", "LBR", 0, "C");
$pdf->Cell(15, 6, "", "LBR",1, "C");
$pdf->SetFont('Times', '', 10);
}
function writeReport($details){
$pdf = $this->pdf;
$pdf->SetMargins(30,35);
$pdf->startPageGroup();
$pdf->AddPage("L");
$orientation = 'L';
$pdf->SetFont('Times', '', 10);
$this->tableHeader($pdf);
$sl_no = 0;
foreach($details as $value){
if ($pdf->getY() > 180) {
$pdf->AddPage("L");
}
$pdf->SetFont('Times', '', 10);
$sl_no++;
$pdf->Cell(8, 6, $sl_no, 1, 0, "C");
$pdf->cell(20, 6, $value['fregno'], 1, 0, "L");
$pdf->cell(40, 6, ucwords($value['fname']), 1, 0, "L");
$pdf->cell(20,6,$value['fcntrcode'],1,0,'C');
$pdf->cell(15, 6, $value['fdegree'], 1, 0, "C");
$pdf->cell(20, 6, $value['fexamname'], 1, 0, "C");
$pdf->cell(60, 6, $value['subshort'], 1, 0, "L");
$pdf->cell(15, 6, $value['status'], 1, 1, "L");
if ($pdf->getY() > 180) {
$pdf->AddPage("L");
$pdf->SetFont('Times', 'B', 12);
$this->tableHeader($pdf);
}
}
// $pdf->cell(123,6,"Total ",1,0,"R");
// $pdf->cell(20,6,$details[0]['famtttl'],1,0,"R");
// $pdf->cell(20,6,$details[0]['ffinettl'],1,0,"R");
// $pdf->cell(20,6,$details[0]['final'],1,0,"R");
// $pdf->cell(15,6,"",1,0,"R");
}
function SendOutput(){
// ob_end_clean();
$this->pdf->Output("Approved_Candidate_Report.pdf", "D");
}
}
function generateApprCandidRprt($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$degfrom = $aobj_context->mobj_data['frmdeg'];
$degto = $aobj_context->mobj_data['todeg'];
$appnofrom = $aobj_context->mobj_data['frmappno'];
$appnoto = $aobj_context->mobj_data['toappno'];
$query = "select distinct lcase(st.fname) as fname,a.fregno,a.fdegree,a.fcntrcode,d.fexamname,group_concat(distinct sb.fsubshort) as subshort,
if(ifnull(a.fackdate,'') = '','pending','approved') as status
from appchallandet c
inner join appcandsum a on a.appno = c.fappno and a.fcollcode = c.fcollcode and a.fdegree = c.fdegree and a.fexamno = c.fexamno
and a.fregno=c.fregno and a.fchallanno=c.fchallanno
inner join appcanddet ad on a.fregno = ad.fregno and a.fdegree = ad.fdegree and a.fcollcode = ad.fcollcode
inner join subject sb on sb.fexamno=a.fexamno and sb.fdegree=a.fdegree and ad.fsubcode = sb.fsubcode
inner join degree d on d.fdegree=a.fdegree and d.fexamno=a.fexamno
inner join student st on a.fregno=st.fregno and a.fdegree=st.fdegree and c.fcollcode=st.fcollcode
where c.fdegree between '{$degfrom}' and '{$degto}'
and ifnull(a.fchallanno,'') <> ''
and c.fappno between '{$appnofrom}' and '{$appnoto}'
group by c.fappno";
$result = $aobj_context->mobj_db->GetAll($query);
// var_dump($result);
// die();
$class_obj=new ApprCandidList();
$class_obj->DefaultConstructor($aobj_context);
$class_obj->writeReport($result);
$class_obj->SendOutput();
}
?>
|