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.142.55.138
<?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["from_deg"];
$this->todeg = $this->aobj_context->mobj_data["to_deg"];
$this->challanNo = $this->aobj_context->mobj_data["challanNo"];
$this->toappno = $this->aobj_context->mobj_data["to_appno"];
}
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->mobj_data["db"]."/". $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,'College Code: '.$_SESSION['collcode'],'0',1,'C');
$this->Cell(0,5,'Degree : '.$this->frmdeg,'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 ChallanReport{
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(20, 6, "Reg.", "LRT", 0, "C");
$pdf->Cell(60, 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, "Lang2", "LRT", 0, "C");
// $pdf->Cell(15, 6, "sub1", "LRT", 0, "C");
// $pdf->Cell(15, 6, "sub2. Pr.", "LRT", 0, "C");
// $pdf->Cell(20, 6, "sub3", "LRT", 0, "C");
// $pdf->Cell(20, 6, "sub4", "LRT", 0, "C");
$pdf->Cell(20, 6, "Fee", "LRT", 0, "C");
$pdf->Cell(20, 6, "Fine", "LRT", 0, "C");
$pdf->Cell(20, 6, "Total", "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(60, 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", 0, "C");
// $pdf->Cell(15, 6, "", "LBR", 0, "C");
// $pdf->Cell(15, 6, "", "LBR", 0, "C");
// $pdf->Cell(20, 6, "", "LBR", 0, "C");
// $pdf->Cell(20, 6, "", "LBR", 0, "C");
$pdf->Cell(20, 6, "", "LBR", 0, "C");
$pdf->Cell(20, 6, "", "LBR", 0, "C");
$pdf->Cell(20, 6, "", "LBR", 0, "C");
$pdf->Cell(15, 6, "", "LBR",1, "C");
$pdf->SetFont('Times', '', 10);
}
function writeReport($details){
$pdf = $this->pdf;
$pdf->SetMargins(20,40);
$pdf->startPageGroup();
$pdf->AddPage("L");
$orientation = 'L';
$pdf->SetFont('Times', '', 10);
$this->tableHeader($pdf);
$famtttl=0;$ffinettl =0; $final = 0;
foreach ($details as $key => $value) {
if ($pdf->getY() > 180) {
// $this->pdf->Cell(192, 1, " ", "T", 1, "C");
$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(60, 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(20, 6, $value['famount'], 1, 0, "R");
$pdf->cell(20, 6, $value['fadmfine'], 1, 0, "R");
$pdf->cell(20, 6, $value['total'], 1, 0, "R");
$pdf->cell(15, 6, $value['status'], 1, 1, "L");
if ($pdf->getY() > 180) {
$pdf->AddPage("L");
$pdf->SetFont('Times', 'B', 12);
// $pdf->Cell(192, 12, $value['fdegree'] . ' - ' .$value['fdescpn'].', '. $value['fexamname'], 1, 1, "C");
$this->tableHeader($pdf);
}
$famtttl += $value['famount'];
$ffinettl += $value['fadmfine'];
$final += $value['famount'] + $value['fadmfine'];
}
$pdf->cell(183,6,"Total ",1,0,"R");
$pdf->cell(20,6,$famtttl,1,0,"R");
$pdf->cell(20,6,$ffinettl,1,0,"R");
$pdf->cell(20,6,$final,1,0,"R");
$pdf->cell(15,6,"",1,0,"R");
}
function SendOutput()
{
// ob_end_clean();
$this->pdf->Output("Candidate_Report_{$this->univcode}.pdf", "D");
}
}
function GenerateExamChallanReport($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$degfrom = $aobj_context->mobj_data['from_deg'];
$examno = $aobj_context->mobj_data['examno'];
$challanNo = $aobj_context->mobj_data['challanNo'];
// $appnoto = $aobj_context->mobj_data['to_appno'];
// and c.fappno between '{$appnofrom}' and '{$appnoto}'
$college_code = $_SESSION['collcode'];
$funivcode = $_SESSION['FUNIVCODE'];
$query = "select distinct lcase(st.fname) as fname,a.fregno,a.fdegree,a.fcntrcode,d.fexamname,group_concat(distinct sb.fsubshort) as subshort,
ifnull(c.famount,0) as famount,ifnull(d.fadmfine,0) as fadmfine,
(ifnull(c.famount,0)+ifnull(fadmfine,0)) as total,if(ifnull(a.fackdate,'') = '','pending','approved') as status,
sum(c.famount) as famtttl, ifnull(sum(fadmfine),'0') as ffinettl, sum((ifnull(c.famount,0)+ifnull(fadmfine,0))) as final
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 = '{$degfrom}' and a.fcollcode='{$college_code}'
and ifnull(a.fchallanno,'') <> '' and c.fchallanno='{$challanNo}' and a.fexamno='{$examno}'
group by c.fchallanno,c.fappno";
// var_dump($query);
$result = $aobj_context->mobj_db->GetAll($query);
// var_dump($result);
$class_obj=new ChallanReport();
$class_obj->DefaultConstructor($aobj_context);
$class_obj->writeReport($result);
// die();
$class_obj->SendOutput();
}
?>
|