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.226.28.97
<?php
$main_src=substr($_SERVER['SCRIPT_FILENAME'],0,strlen($_SERVER['SCRIPT_FILENAME'])-7);
//$pdf_writer_class =$main_src."/tarka_pdf/fpdf.php";
$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;
$this->Deggrp = $this->aobj_context->mobj_data["dgp"];
$this->crtType = $this->aobj_context->mobj_data["ct"];
$this->reportType = $this->aobj_context->mobj_data["rt"];
$this->examrng = $this->aobj_context->mobj_data["exmrng"];
$this->degfrom = $this->aobj_context->mobj_data["degfrom"];
$this->degto = $this->aobj_context->mobj_data["degto"];
$this->univcode = $this->aobj_context->mobj_data["univcode"];
}
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->SetMargins(6,30,5,true);
$this->SetFillColor(248, 248 ,255);
$img_path = $this->aobj_context->main_src."/img/{$this->univcode}_logo.jpg";
if(file_exists($img_path))
$this->Image($img_path,30,8,20,20);
$this->SetFont('Times','B',13);
$this->SetY(5);
$this->Cell(0,4,$this->aobj_context->FUNIVNAME,0,1,'C');
$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,'RVRT - '.$this->reportType.' Report ','0',1,'C');
$this->SetFont('Times','',12);
$this->Cell(0,6," Degree Group: ".$this->Deggrp,"0",1,"C");
$this->Cell(0,6," Degree Range: ".$this->degfrom." - ".$this->degto ,"0",1,"C");
$this->Cell(0,6," Exam Range: ".$this->examrng,"0",1,"C");
$this->Cell(0,6," Correction Type: ".$this->crtType,"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()
{
if($this->reportType=="Detailed"){
$this->SetY(-15);
$this->SetFont('helvetica', 'I', 8);
$this->Cell(60, 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(90, 10,'Page ' .$this->getPageNumGroupAlias().'/'.$this->getPageGroupAlias(), 0, 1, 'R');
}
else if($this->reportType=="Summary")
{
$this->SetMargins(20,45);
$this->SetY(-15);
$this->SetFont('helvetica', 'I', 8);
$this->Cell(40, 10,'IP : '.$_SERVER["REMOTE_ADDR"], 0, 0, 'L');
$this->Cell(80, 10,'Date : '.date("d-m-Y H:i:s"), 0, 0, 'C');
$this->Cell(70, 10,'Page ' .$this->getPageNumGroupAlias().'/'.$this->getPageGroupAlias(), 0, 1, 'R');
}
}
}
class RVRTReport {
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->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('L');
$this->pdf->setData($aobj_context);
}
function tableHeader($pdf){
$pdf->SetFont('Times','B',10);
$pdf->Cell(8,6,"Sl.","LRT",0);
$pdf->Cell(20,6,"Reg.","LRT",0,"C");
$pdf->Cell(45,6,"Student Name","LRT",0,"C");
$pdf->Cell(20,6,"QP","LRT",0,"C");
$pdf->Cell(90,6,"Subject Name","LRT",0,"C");
$pdf->Cell(20,6,"Amount","LRT",0,"C");
$pdf->Cell(25,6,"Payment","LRT",1,"C");
$pdf->Cell(8,6,"No.","LRB",0,"C");
$pdf->Cell(20,6,"No.","LRB",0,"C"); //w h txt brd pos align
$pdf->Cell(45,6,"","LBR",0,"C");
$pdf->Cell(20,6,"Code","LBR",0,"C");
$pdf->Cell(90,6,"","LBR",0,"C");
$pdf->Cell(20,6,"Paid","LBR",0,"C");
$pdf->Cell(25,6,"Type","LBR",1,"C");
$pdf->SetFont('Times','',10);
}
function writeReport($detailed){
$pdf=$this->pdf;
$pdf->SetMargins(31,47);
$pdf->startPageGroup();
$pdf->AddPage("L");
$orientation = 'L';
$pdf->SetFont('Times','',10);
$this->tableHeader($pdf);
$sl_no = 0;
foreach ($detailed as $key => $value) {
$fname = strtolower($value['fname']);
$sub1 = substr($value['fsubname'],0,42);
$sub2 = substr($value['fsubname'],42);
$sl_no++;
if($sub2){
$pdf->Cell(8,6,$sl_no,"LRT",0);
$pdf->Cell(20,6,$value['fregno'],"LRT",0,"C");
$pdf->Cell(45,6,ucwords($fname),"LRT",0,"L");
$pdf->Cell(20,6,$value['fqpcode'],"LRT",0,"C");
$pdf->Cell(90,6,$sub1,"LRT",0,"L");
$pdf->Cell(20,6,moneyFormatIndia((int)$value['famount']),"LRT",0,"R");
$pdf->Cell(25,6,$value['fpaymentype'],"LRT",1,"L");
if($pdf->getY() > 185){
$this->tableHeader($pdf);
}
$pdf->Cell(8,6,"","LRB",0,"C");
$pdf->Cell(20,6,"","LRB",0,"L");
$pdf->Cell(45,6,"","LBR",0,"C");
$pdf->Cell(20,6,"","LBR",0,"C");
$pdf->Cell(90,6,$sub2,"LBR",0,"L");
$pdf->Cell(20,6,"","LBR",0,"R");
$pdf->Cell(25,6,"","LBR",1,"L");
if($pdf->getY() > 185){
$this->tableHeader($pdf);
}
}else{
$pdf->Cell(8,6,$sl_no,"1",0);
$pdf->Cell(20,6,$value['fregno'],"1",0,"C");
$pdf->Cell(45,6,ucwords($fname),"1",0,"L");
$pdf->Cell(20,6,$value['fqpcode'],"1",0,"C");
$pdf->Cell(90,6,$sub1,"1",0,"L");
$pdf->Cell(20,6,moneyFormatIndia((int)$value['famount']),"1",0,"R");
$pdf->Cell(25,6,$value['fpaymentype'],"1",1,"L");
}
if($pdf->getY() > 185){
$this->tableHeader($pdf);
}
}
}
function summaryHeader($pdf){
$pdf->SetFont('Times','B',10);
$pdf->Cell(8,6,"Sl.","LRT",0);
$pdf->Cell(10,6,"QP","LRT",0);
$pdf->Cell(20,6,"Subject","LRT",0,"C");
$pdf->Cell(90,6,"Subject Name","LRT",0,"C");
$pdf->Cell(20,6,"Subject","LRT",1,"C");
$pdf->Cell(8,6,"No.","LRB",0,"C");
$pdf->Cell(10,6,"Code","LBR",0);
$pdf->Cell(20,6,"Code","LBR",0,"C");
$pdf->Cell(90,6,"","LBR",0,"C");
$pdf->Cell(20,6,"Count","LBR",1,"C");
$pdf->SetFont('Times','',10);
}
function summaryReport($summRpt){
$pdf=$this->pdf;
$pdf->SetMargins(20,47);
$pdf->startPageGroup();
$pdf->AddPage("P");
$orientation = 'L';
$pdf->SetFont('Times','',10);
$this->summaryHeader($pdf);
$sl_no = 0;
foreach ($summRpt as $key => $value) {
$sub1 = substr($value['fsubname'],0,42);
$sub2 = substr($value['fsubname'],42);
$sl_no++;
if($sub2){
$pdf->Cell(8,6,$sl_no,"LRT",0,"C");
$pdf->Cell(10,6,$value['fqpcode'],"LRT",0,"C");
$pdf->Cell(20,6,$value['fsubcode'],"LRT",0,"C");
$pdf->Cell(90,6,$sub1,"LRT",0,"L");
$pdf->Cell(20,6,$value['subcount'],"LRT",1,"R");
if($pdf->getY() > 270){
$this->summaryHeader($pdf);
}
$pdf->Cell(8,6,"","LRB",0,"C");
$pdf->Cell(10,6,"","LBR",0,"C");
$pdf->Cell(20,6,"","LBR",0,"C");
$pdf->Cell(90,6,$sub2,"LBR",0,"L");
$pdf->Cell(20,6,"","LBR",1,"R");
if($pdf->getY() > 270){
$this->summaryHeader($pdf);
}
}else{
$pdf->Cell(8,6,$sl_no,"1",0,"C");
$pdf->Cell(10,6,$value['fqpcode'],"1",0,"C");
$pdf->Cell(20,6,$value['fsubcode'],"1",0,"C");
$pdf->Cell(90,6,$sub1,"1",0,"L");
$pdf->Cell(20,6,$value['subcount'],"1",1,"R");
}
if($pdf->getY() > 270){
$this->summaryHeader($pdf);
}
}
}
function SendOutput()
{
ob_end_clean();
$this->pdf->Output("RVRT_{$this->reportType}Report_{$this->univcode}.pdf","D");
}
}
function getrvrtReport($aobj_context){
$univcode = $aobj_context->mobj_data["univcode"];
$deggrp = $aobj_context->mobj_data["dgp"];
$reportType = $aobj_context->mobj_data["rt"];
$crtType = $aobj_context->mobj_data["ct"];
$degfrom = $aobj_context->mobj_data['degfrom'];
$degto = $aobj_context->mobj_data['degto'];
$exmrng = $aobj_context->mobj_data['exmrng'];
if($crtType == 'Revaluation'){
$ct = "RV";
}else if($crtType == 'Retotalling') $ct = "RT";
else if($crtType == 'PhotoCopy') $ct = "XR";
else $ct = "CV";
$exmrng1 = str_split($exmrng);
$res = "'" . implode ( "', '", $exmrng1 ) . "'";
$class_obj = new RVRTReport();
$class_obj->univcode = $univcode;
$class_obj->reportType = $reportType;
$class_obj->DefaultConstructor($aobj_context);
if($reportType == 'Detailed'){
$query ="SELECT st.fregno,st.fname,fqpcode,s.fsubname,r.famount,r.fpaymentype FROM res_stud r
INNER JOIN `subject` s ON s.fcsubcode = r.fsubcode AND s.fdegree= r.fdegree AND s.fexamno = r.fexamno
INNER JOIN student st ON st.fregno = r.fregno AND st.fcollcode=r.fcollcode AND st.fdegree = r.fdegree AND st.fexamno = r.fexamno
INNER JOIN degree d ON d.fdegree=r.fdegree AND d.fexamno = r.fexamno
WHERE r.fpaymentstatus = 'success' AND r.fexamno IN (${res}) AND d.fdeggrp='${deggrp}' AND d.fdegree BETWEEN '${degfrom}' AND '${degto}'
AND r.fcorrtype= '${ct}'
ORDER BY st.fregno,fqpcode";
$result = $aobj_context->pobj_db->GetAll($query);
if(count($result) > 0)
$class_obj->writeReport($result);
}
if($reportType == 'Summary'){
$query ="SELECT fqpcode,fsubname,COUNT(r.fsubcode) AS subcount,r.fsubcode FROM res_stud r
INNER JOIN `subject` s ON s.fcsubcode = r.fsubcode AND s.fdegree= r.fdegree AND s.fexamno = r.fexamno
INNER JOIN degree d ON d.fdegree=r.fdegree AND d.fexamno = r.fexamno
WHERE r.fpaymentstatus = 'success' AND r.fexamno IN (${res}) AND d.fdeggrp='${deggrp}'
AND d.fdegree BETWEEN '${degfrom}' AND '${degto}' AND r.fcorrtype='${ct}'
GROUP BY r.fsubcode";
// var_dump($query);
$result = $aobj_context->pobj_db->GetAll($query);
// var_dump($result);
if(count($result) > 0)
$class_obj->summaryReport($result);
}
$class_obj->SendOutput();
}
function moneyFormatIndia($num) {
$explrestunits = "" ;
if(strlen($num)>3) {
$lastthree = substr($num, strlen($num)-3, strlen($num));
$restunits = substr($num, 0, strlen($num)-3); // extracts the last three digits
$restunits = (strlen($restunits)%2 == 1)?"0".$restunits:$restunits; // explodes the remaining digits in 2's formats, adds a zero in the beginning to maintain the 2's grouping.
$expunit = str_split($restunits, 2);
for($i=0; $i<sizeof($expunit); $i++) {
// creates each of the 2's group and adds a comma to the end
if($i==0) {
$explrestunits .= (int)$expunit[$i].","; // if is first value , convert into integer
} else {
$explrestunits .= $expunit[$i].",";
}
}
$thecash = $explrestunits.$lastthree;
} else {
$thecash = $num;
}
return $thecash; // writes the final format where $currency is the currency symbol.
}
?>
|