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.126.199
<?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);
include_once("stringspliter.php");
class report_ra_qp_wise_student_count extends TCPDF
{
function DefaultConstructor($aobj_context)
{
session_start();
$this->aobj_context=$aobj_context;
$this->pdf= new TCPDF();
$this->pdf=$this;
$this->exdate=trim($this->aobj_context->mobj_data["exdate"]);
$this->session=trim($this->aobj_context->mobj_data["session"]);
$this->ip=$_SERVER["REMOTE_ADDR"];
$get_date="select date_format(now(),'%d/%m/%Y %h:%i %p') as now_date";
// $get_date="select current_timestamp as now_date";
$obj=$this->aobj_context->mobj_db->GetRow($get_date);
$this->current_date=$obj['now_date'];
$this->collcode=$_SESSION['collcode'];
}
function Header()
{
session_start();
$FUNIVCODE = $_SESSION['FUNIVCODE'];
$this->pdf->Ln(5);
$img_path=$this->aobj_context->main_src.$this->photo_path;
if(!empty($this->photo_path) && file_exists($img_path))
{
$this->pdf->Image($img_path,166,50,50);
}
if(!empty($this->pdf_logo_path))
{
$img_logo_path=$this->aobj_context->main_src.$this->pdf_logo_path;
$this->pdf->Image($img_logo_path,10,10,23,22);
}
$img_path2 = $this->aobj_context->main_src."/img/logo2.jpg";
if(file_exists($img_path2))
{
$this->pdf->Image($img_path2,170,6,23,23);
}
$this->pdf->SetFont('Times','B',16);
$this->pdf->cell(190,3,$this->FUNIVNAME."","0",1,"C");
$this->pdf->SetFont('Times','B',10);
$this->pdf->cell(190,7, $this->s_state,"0",1,"C");
$this->pdf->SetFont('Times','B',12);
$this->pdf->cell(190,7, $this->college_details,"0",'1',"C");
$this->pdf->Cell(190,7,"Bundle Dispatch Acknowledgement ".$this->FEXAMDATE." Examination","0",1,"C");
$this->pdf->SetFont('Times','B',12);
$this->pdf->Cell(65,7,"Exam Date : ".$this->exdate,"0",0,"L");
$this->pdf->SetFont('Times','BU',12);
$this->pdf->Cell(60,7,$this->copy,"0",0,"C");
$this->pdf->SetFont('Times','B',12);
if($this->session == 'M')
{
$session = "Morning Session";
}
else
{
$session = "After Noon Session";
}
$this->pdf->Cell(65,7,"Session : ".$session,"0",1,"R");
$this->pdf->Ln(2);
$this->pdf->SetFont('Times','',13);
}
function Footer()
{
$this->SetY(-15);
$this->pdf->SetFont('Times','B',8);
$this->Cell(140,6,'Printed : IP Address : '.$this->ip." Date ".$this->current_date,'0',0,'L');
// $this->Cell(50,6,'Page '.$this->PageNo().' of {nb}',0,1,'R');
}
function formcolldata()
{
$get_coll_name="select FUNIVNAME as 'FUNIVNAME',
FUNIVADD1 as 'state', pdf_logo_path From control";
$lobj_get_coll_name=$this->aobj_context->mobj_db->GetRow($get_coll_name);
$this->FUNIVNAME=$lobj_get_coll_name['FUNIVNAME'];
$this->s_state=$lobj_get_coll_name['state'];
$this->f_year=$lobj_get_coll_name['f_year'];
$this->pdf_logo_path=$lobj_get_coll_name['pdf_logo_path'];
$get_data="SELECT c.FCOLLCODE,
CONCAT(c.FCOLLCODE, ' - ', c.FCOLLNAME,', ',c.FTOWN) AS FCOLLNAME FROM college c
where c.FCOLLCODE='{$this->collcode}'";
$obj_student=$this->aobj_context->mobj_db->GetRow($get_data);
$this->college_details=$obj_student['FCOLLNAME'];
$this->degree_details=" College : {$this->FCOLLNAME}";
}
function GetFullQry()
{
$reporttype = "";
if($this->session == 'M')
{
$sess = 'AM';
}
else
{
$sess = 'PM';
}
$get_data = "select c.FQPCODE, s.fsubname as FSSUBNAME,
group_concat(concat(c.fbuno, ' (', c.ftotscript, ')') order by c.fbuno separator ', ') as fbundle,
count(fbuno) as fbundlecnt,
sum(ftotscript) as fpresentcnt
from colldesp c inner join masqp s on c.fqpcode = s.fqpcode
where c.fdoe = date_format(str_to_date('{$this->exdate}', '%d/%m/%Y'), '%Y-%m-%d')
and fcollcode = '{$this->collcode}' and c.fsession = '{$sess}'
group by c.fqpcode order by c.fqpcode";
//var_dump($get_data);
$this->lobj_get_data = $this->aobj_context->mobj_db->GetAll($get_data);
/*
To take exam date from degree table
*/
$query = "select d.fexamdate from degree d inner join subject s on d.fdegree = s.fdegree
and s.fexamno = d.fexamno where s.fqpcode = '{$this->lobj_get_data[0]['FQPCODE']}'";
$this->degexdate = $this->aobj_context->mobj_db->GetRow($query);
$this->FEXAMDATE = $this->degexdate['fexamdate'];
}
function formData($copy)
{
$this->copy = $copy;
$this->pdf->SetMargins(7,12,10);
$this->pdf->AddPage();
$this->pdf->SetMargins(7,20,10);
//$this->pdf->SetMargins(5,12,10);
$empty_cell_width=2;
$sl_no=1;
$k2 = 1;
$first = true;
foreach($this->lobj_get_data as $dk => $dv)
{
if($this->pdf->GetY() >= 250)
{
$this->pdf->cell($empty_cell_width,7, "","",0,"C");
$this->pdf->cell(190,1, "","T",1,"C");
$this->pdf->AddPage();
$k2 = 1;
}
if($first == true || $k2 == 1)
{
$this->pdf->Ln(25);
$this->pdf->SetFont('Times','B',12);
$this->pdf->Cell(190,7,"","0",1,"C");
$this->pdf->SetFont('Times','B',11);
$this->pdf->cell($empty_cell_width,5, ""," ",0,"C");
$this->pdf->cell(12,5, "Sl.","LTR",0,"C");
$this->pdf->cell(18,5, "QP","LTR",0,"C");
$this->pdf->cell(70,5, "Paper Title","LTR",0,"C");
$this->pdf->cell(60,5, "Bundle Nos.","LTR",0,"C");
$this->pdf->cell(12,5, "No. of","LTR",0,"C");
$this->pdf->cell(18,5, "Ans Book","LTR",1,"C");
$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
$this->pdf->cell(12,5, "No.","LBR",0,"C");
$this->pdf->cell(18,5, "Code","LBR",0,"C");
$this->pdf->cell(70,5, "","LBR",0,"C");
$this->pdf->cell(60,5, "(Script Count)","LBR",0,"C");
$this->pdf->cell(12,5, "Bundl","LBR",0,"C");
$this->pdf->cell(18,5, "Count","LBR",1,"C");
$this->pdf->SetFont('Times','B',12);
$first = false;
}
$subname = trim($dv['FSSUBNAME']);
$subnamearr = str_splitf($subname,30);
//$subnamearr[1] = "English";
$nb = 0;
$nb=max($nb,NbLines(60,$dv['fbundle'],''));
//var_dump($nb);die();
// $yH =12*$nb;
//var_dump($yH);
$yH = 0;
$this->pdf->cell($empty_cell_width,$yH, ""," ",0,"C");
$x = $this->pdf->GetX();
$y = $this->pdf->GetY();
$this->pdf->SetXY($x+90, $y);
// $fill=false, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0, $valign='T', $fitcell=false
$this->pdf->Multicell(80,$yH, $dv['fbundle'],'LRT','L');
$y1 = $this->pdf->GetY();
$yH = $y1 - $y + 2;
$this->pdf->SetXY($x, $y);
$this->pdf->cell(12,$yH, $sl_no,"LRT",0,"C");
$this->pdf->cell(18,$yH, $dv['FQPCODE'],"LRT",0,"C");
$this->pdf->SetFont('Times','B',12);
$this->pdf->cell(70,$yH, $subnamearr[0],"LRT",0,"L");
$x=$this->pdf->GetX();
$y=$this->pdf->GetY();
$this->pdf->SetXY($x+60,$y);//fbundlecnt
$this->pdf->cell(12,$yH, $dv['fbundlecnt'],"LRT",0,"C");
$this->pdf->cell(18,$yH,$dv['fpresentcnt'],"LRT",1,"C");
$this->pdf->SetFont('Times','B',12);
if($k2 == 29)
{
$this->pdf->cell($empty_cell_width,7, "","",0,"C");
$this->pdf->cell(180,1, "","T",0,"C");
}
if($subnamearr[1] != '')
{
$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
$this->pdf->cell(12,4,'',"LRB",0,"C");
$this->pdf->cell(18,4,'',"LRB",0,"C");
// $this->pdf->SetFont('Times','',10);
$this->pdf->cell(70,4, $subnamearr[1],"LRB",0,"L");
// $this->pdf->SetFont('Times','',10);
$this->pdf->cell(60,4,'',"LRB",0,"C");
$this->pdf->cell(12,4,'',"LRB",0,"C");
$this->pdf->cell(18,4,'',"LRB",1,"C");
if($k2 == 30)
{
$this->pdf->cell($empty_cell_width,7, "","",0,"C");
$this->pdf->cell(200,1, "","T",0,"C");
}
}
$sl_no++;
$k2++;
}
$this->pdf->cell($empty_cell_width,7, "","",0,"C");
$this->pdf->cell(190,1, "","T",1,"C");
$this->pdf->SetFont('Times','B',12);
if(count($this->lobj_get_data) > 0)
{
$this->pdf->Ln(10);
$this->pdf->cell(95,9, "Signature Chief Superintendent",0,0,"L");
$this->pdf->cell(95,9, "Signature of Bundle Receiving Official",0,1,"R");
}
}
function SendOutput()
{
$this->pdf->Output("QPBundleAcknowledgement.pdf","D");
}
}
function GenerateBundleAck($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$class_obj=new report_ra_qp_wise_student_count();
//$class_obj->AliasNbPages();
$class_obj->DefaultConstructor($aobj_context);
$class_obj->GetFullQry();
$class_obj->formcolldata();
$class_obj->formData("University Copy");
$class_obj->formcolldata();
$class_obj->formData("College Copy");
$class_obj->SendOutput();
}
function NbLines($w,$txt,$pdf)
{
//Computes the number of lines a MultiCell of width w will take
$cw=&$pdf->CurrentFont['cw'];
if($w==0)
$w=$pdf->w-$pdf->rMargin-$pdf->x;
$wmax=($w-2*$pdf->cMargin)*1000/$pdf->FontSize;
$s=str_replace("\r",'',$txt);
$nb=strlen($s);
if($nb>0 and $s[$nb-1]=="\n")
$nb--;
$sep=-1;
$i=0;
$j=0;
$l=0;
$nl=1;
while($i<$nb){
$c=$s[$i];
if($c=="\n"){
$i++;
$sep=-1;
$j=$i;
$l=0;
$nl++;
continue;
}
if($c==' ')
$sep=$i;
$l+=$cw[$c];
if($l>$wmax)
{
if($sep==-1){
if($i==$j)
$i++;
} else
$i=$sep+1;
$sep=-1;
$j=$i;
$l=0;
$nl++;
}
else
$i++;
}
return $nl;
}
?>
|