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.15.144.162
<?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);
}
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);
$get_collName = "select fcollname From college where fcollcode = '{$_SESSION['collcode']}'";
$lobj_get_coll_name = $this->aobj_context->mobj_db->GetRow($get_collName);
$this->Cell(0, 5, 'College transfer with in the University', '0', 1, 'C');
$this->Cell(0,5,'College Code: '.$_SESSION['collcode'],'0',1,'C');
$this->Cell(0,5,'College Name : '.$lobj_get_coll_name['fcollname'],'0',1,"C");
// $this->Cell(0,5,'Challan No.: '.$this->challanNo,'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 Report{
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)
{
$pdf->SetFont('Times', 'B', 10);
$pdf->Cell(8, 6, "Sl.", "LRT", 0, "C");
$pdf->Cell(15, 6, "Degree", "LRT", 0, "C");
$pdf->Cell(20, 6, "Reg.", "LRT", 0, "C");
$pdf->Cell(60, 6, "Name", "LRT", 0, "C");
$pdf->Cell(15, 6, "Old Coll.", "LRT", 0, "C");
$pdf->Cell(70, 6, "Previous college", "LRT", 0, "C");
$pdf->Cell(15, 6, "Fee", "LRT", 0, "C");
$pdf->Cell(70, 6, "Remarks", "LRT", 1, "C");
$pdf->Cell(8, 6, "No.", "LRB", 0, "C");
$pdf->Cell(15, 6, "Code", "LBR", 0, "C");
$pdf->Cell(20, 6, "No.", "LBR", 0, "C");
$pdf->Cell(60, 6, "", "LBR", 0, "C");
$pdf->Cell(15, 6, "Code", "LBR", 0, "C");
$pdf->Cell(70, 6, "", "LBR", 0, "C");
$pdf->Cell(15, 6, "", "LBR",0, "C");
$pdf->Cell(70, 6, "", "LBR",1, "C");
$pdf->SetFont('Times', '', 10);
}
function writeReport($details){
$pdf = $this->pdf;
$pdf->SetMargins(15,40);
$pdf->startPageGroup();
$pdf->AddPage("L");
$orientation = 'L';
$pdf->SetFont('Times', '', 10);
$this->tableHeader($pdf);
foreach ($details as $key => $value) {
if ($pdf->getY() > 180) {
$pdf->AddPage("L");
}
$pdf->SetFont('Times', '', 10);
$sl_no++;
$x = $pdf->GetX();
$y = $pdf->GetY();
$pdf->SetX($x + 118);
$pdf->MultiCell(70, 6, $value['fcollname'], 1, "L");
$y1 = $pdf->GetY();
$h = $y1 - $y;
$pdf->SetXY($x, $y);
$pdf->Cell(8, $h, $sl_no, 1, 0, "C");
$pdf->cell(15, $h, $value['fdegree'], 1, 0, "C");
$pdf->cell(20, $h, $value['fregno'], 1, 0, "C");
$pdf->cell(60, $h, ucwords($value['fname']), 1, 0, "L");
$pdf->cell(15, $h, $value['foldcollcode'], 1, 0, "C");
$pdf->SetXY($x+188, $y);
$pdf->cell(15, $h, $value['ffee'], 1, 0, "L");
$pdf->cell(70, $h, $value['fremarks'], 1, 1, "L");
if ($pdf->getY() > 180) {
$pdf->AddPage("L");
$pdf->SetFont('Times', 'B', 12);
$this->tableHeader($pdf);
}
$final += $value['ffee'];
}
$pdf->cell(188,6,"Total ",1,0,"R");
$pdf->cell(15,6,$final,1,0,"L");
$pdf->cell(70,6,"",1,0,"R");
$pdf->Ln(18);
$pdf->Cell(240, 10, 'Principal Signature ' , 0, 1, 'R');
}
function SendOutput()
{
// ob_end_clean();
$this->pdf->Output("Lateral_Entry_Report.pdf", "I");
}
}
function GenerateLatEntryReport($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$college_code = $_SESSION['collcode'];
$funivcode = $_SESSION['FUNIVCODE'];
$query = "select l.foldcollcode,l.fcollcode,concat(c.fcollname,', ',c.ftown) as fcollname,
st.fregno,lcase(st.fname) as fname,l.fdegree,l.ffee,l.fremarks
from studlat l
inner join college c on l.foldcollcode = c.fcollcode
inner join student st on l.fregno=st.fregno and l.fdegree=st.fdegree and c.fcollcode=st.fcollcode
where l.fcollcode='{$college_code}'";
// var_dump($query);
$result = $aobj_context->mobj_db->GetAll($query);
// var_dump($result);
$class_obj=new Report();
$class_obj->DefaultConstructor($aobj_context);
$class_obj->writeReport($result);
// die();
$class_obj->SendOutput();
}
?>
|