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.227.140.100
<?php
function getdeggrp($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$query = 'SELECT fdbname FROM dbname WHERE funivcode = "'.$_SESSION['FUNIVCODE'].'"';
$result = $aobj_context->mobj_db->GetRow($query);
$db = $result['fdbname'];
$query = "SELECT DISTINCT ffaculty FROM {$db}.degree WHERE IFNULL(ffaculty,'') LIKE '%U_' OR IFNULL(ffaculty,'') LIKE '%P_'";
$result = $aobj_context->mobj_db->GetAll($query);
// var_dump($query);
// var_dump($result);
echo $aobj_context->mobj_output->ToJSONEnvelope($result);
}
function getReports($aobj_context)
{
$univcode = $aobj_context->mobj_data["univcode"];
$Degree = $aobj_context->mobj_data["deggrp"];
// var_dump($Degree);
$query = "SELECT fdbname FROM dbname WHERE funivcode = $univcode";
$result = $aobj_context->mobj_db->GetRow($query);
$db = $result['fdbname'];
$main_src=substr($_SERVER['SCRIPT_FILENAME'],0,strlen($_SERVER['SCRIPT_FILENAME'])-7);
$pdf_writer_class=$aobj_context->main_src."tcpdf/tcpdf.php";
require_once($pdf_writer_class);
$pdf= new TCPDF();
if($Degree == 'All'){
$query = "SELECT fcollcode, fcollname, ftown AS town, LCASE(fcolladd1) as fcolladd1 ,LCASE(fcolladd2) as fcolladd2,fprincipalname, fphone AS landline, fmobile, femail,faltmobile
FROM {$db}.college";
// var_dump($query);
$result = $aobj_context->mobj_db->GetAll($query);
// var_dump($result);
}else{
$query = "SELECT fcollcode, fcollname, ftown AS town, LCASE(fcolladd1) as fcolladd1 ,LCASE(fcolladd2) as fcolladd2,fprincipalname, fphone AS landline, fmobile, femail,faltmobile
FROM {$db}.college WHERE ffaculty like '%{$Degree}%'";
// var_dump($query);
$result = $aobj_context->mobj_db->GetAll($query);
// var_dump($result);
}
head($pdf,$aobj_context);
tableHeader($pdf);
formdata($pdf,$result,$aobj_context);
$pdf->Output("college_report.pdf","D");
}
function getCenterList($aobj_context){
$univcode = $aobj_context->mobj_data["univcode"];
$Degree = $aobj_context->mobj_data["deggrp"];
$query = "SELECT fdbname FROM dbname WHERE funivcode = $univcode";
$result = $aobj_context->mobj_db->GetRow($query);
$db = $result['fdbname'];
$query = "SELECT a.fthcntr AS fcollcode, b.fcollname, b.ftown AS town, b.fmobile,b.fprincipalname,b.femail,b.faltmobile,b.fphone AS landline FROM (SELECT DISTINCT fthcntr FROM {$db}.college WHERE IFNULL(fthcntr,'')<> '') a
INNER JOIN {$db}.college b ON a.fthcntr = b.fcollcode";
$result = $aobj_context->mobj_db->GetAll($query);
// var_dump($query);
// var_dump($result);
$main_src=substr($_SERVER['SCRIPT_FILENAME'],0,strlen($_SERVER['SCRIPT_FILENAME'])-7);
$pdf_writer_class=$aobj_context->main_src."tcpdf/tcpdf.php";
require_once($pdf_writer_class);
$pdf= new TCPDF();
head($pdf,$aobj_context);
tableHeader($pdf);
formdata($pdf,$result,$aobj_context);
$pdf->Output("college_Center_report.pdf","D");
}
function getCntWiseColgList($aobj_context){
$univcode = $aobj_context->mobj_data["univcode"];
$Degree = $aobj_context->mobj_data["deggrp"];
$query = "SELECT fdbname FROM dbname WHERE funivcode = $univcode";
$result = $aobj_context->mobj_db->GetRow($query);
$db = $result['fdbname'];
$query = "SELECT c2.fcollcode as cnt_code, c2.fcollname as center_name, c1.fcollcode as tagged_code, c1.fcollname as tagged_colg_name,c2.fmobile AS cnt_contact,c1.fmobile AS tagged_contact
FROM {$db}.college c1 INNER JOIN {$db}.college c2 ON c1.fthcntr = c2.fcollcode
ORDER BY c2.fcollcode, c1.fcollcode";
$result = $aobj_context->mobj_db->GetAll($query);
// var_dump($query);
// var_dump($result);
$main_src=substr($_SERVER['SCRIPT_FILENAME'],0,strlen($_SERVER['SCRIPT_FILENAME'])-7);
$pdf_writer_class=$aobj_context->main_src."tcpdf/tcpdf.php";
require_once($pdf_writer_class);
$pdf= new TCPDF();
head($pdf,$aobj_context);
tableHeaderForTaggedColg($pdf);
taggeddata($pdf,$result,$aobj_context);
footer($pdf);
$pdf->Output("college_Center_report.pdf","D");
}
function footer($pdf){
$ip=$_SERVER["REMOTE_ADDR"];
date_default_timezone_set('Asia/Kolkata');
$current_date= date("d-m-Y H:i:s");
// var_dump($ip,$current_date );
$pdf->SetY(-15);
$pdf->SetFont('helvetica', 'I', 8);
$pdf->Cell(0,6,"Printed : IP Address : ".$ip." Date ".$current_date,0,0,'L');
}
function head($pdf,$aobj_context)
{
$pdf->SetMargins(6, 3);//$left,$top,$right = -1,$keepmargins = false
// $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
// $pdf->SetFooterMargin(6);
$pdf->setPrintFooter(false);
$pdf->AddPage('L');
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data["univcode"];
$Degree = $aobj_context->mobj_data["deggrp"];
$reportType = $aobj_context->mobj_data["val"];
// var_dump( $Degree);
$query = "SELECT fdbname FROM dbname WHERE funivcode = $univcode";
$result = $aobj_context->mobj_db->GetRow($query);
$db = $result['fdbname'];
// var_dump($query);
$query = "SELECT pdf_logo_path,funivadd1,ftown,funivname,funivcode
FROM {$db}.control";
$result = $aobj_context->mobj_db->GetRow($query);
$FUNIVNAME = $result['funivname'];
$FTOWN = $result['ftown'];
$FUNIVADD1 = $result['funivadd1'];
// $date = $result['DATE'];
$pdf_logo_path=$result['pdf_logo_path'];
// var_dump($FUNIVNAME,$FTOWN,$FUNIVADD1,$date,$pdf_logo_path);
$img_path=$aobj_context->main_src.$pdf_logo_path;
if(!empty($pdf_logo_path) && file_exists($img_path))
{
// var_dump($img_path);
$pdf->Image($pdf_logo_path,70,20,20);//file x y w h
}
$pdf->SetFont('Times','B',16);
$pdf->setFontStretching(105);
$pdf->setFontSpacing(0.254);
$pdf->cell(0,7,$result['funivname'],"0",1,"C");
// reset font stretching
$pdf->setFontStretching(100);
// reset font spacing
$pdf->setFontSpacing(0);
$pdf->SetFont('Times','',12);
$pdf->Cell(0,7,"".$FUNIVADD1,"0",1,"C");
$pdf->setFontSpacing(0.254);
$pdf->SetFont('Times','BU',14);
$pdf->Cell(0,6," ".$reportType." ","0",1,"C");
$pdf->setFontSpacing(0);
$pdf->SetFont('Times','',14);
$pdf->setCellHeightRatio(1);
$pdf->Cell(0,6,"Degree Group: ".$Degree,"0",1,"C");
$pdf->setCellHeightRatio(0);
}
function tableHeader($pdf){
$pdf->SetFont('Times','B',10);
$pdf->Cell(7,6,"Sl.","LRT",0);
$pdf->Cell(9,6,"Colg","LRT",0,"C");
$pdf->Cell(77,6,"College","LRT",0,"C");
$pdf->Cell(31,6,"Town","LRT",0,"C");
$pdf->Cell(45,6,"Principal","LRT",0,"C");
$pdf->Cell(22,6,"Landline","LRT",0,"C");
$pdf->Cell(20,6,"Mobile","LRT",0,"C");
$pdf->Cell(55,6,"Email","LRT",0,"C");
$pdf->Cell(20,6,"Alt","LRT",1,"C");
$pdf->Cell(7,6,"No","LRB",0,"C");
$pdf->Cell(9,6,"Code","LRB",0,"C"); //w h txt brd pos align
$pdf->Cell(77,6,"Name","LBR",0,"C");
$pdf->Cell(31,6,"","LBR",0,"C");
$pdf->Cell(45,6,"Name","LBR",0,"C");
$pdf->Cell(22,6,"No.","LBR",0,"C");
$pdf->Cell(20,6,"No.","LBR",0,"C");
$pdf->Cell(55,6,"","LBR",0,"C");
$pdf->Cell(20,6,"Contact","LBR",1,"C");
}
function tableHeaderForTaggedColg($pdf){
$pdf->SetFont('Times','B',10);
$pdf->Cell(10,8,"Sl.","LRT",0);
$pdf->Cell(112,8,"Center","1",0,"C");
$pdf->Cell(112,8,"Tagged College","1",1,"C");
$pdf->Cell(10,6,"No","LRB",0,"C");
$pdf->Cell(12,6,"Code","LRB",0,"C"); //w h txt brd pos align
$pdf->Cell(78,6,"Name","LBR",0,"C");
$pdf->Cell(22,6,"Contact","LBR",0,"C");
$pdf->Cell(12,6,"Code","LRB",0,"C");
$pdf->Cell(78,6,"Name","LBR",0,"C");
$pdf->Cell(22,6,"Contact","LBR",1,"C");
}
function taggeddata($pdf,$result,$aobj_context){
$sl_no=0;
foreach ($result as $key => $value) {
$sl_no++;
$colname1 = substr($value['center_name'],0,41);
$colname2 = substr($value['center_name'],41);
$colname3 = substr($value['tagged_colg_name'],0,41);
$colname4 = substr($value['tagged_colg_name'],41);
$pdf->SetFont('Times','',10);
$pdf->Cell(10,6,$sl_no,"LRT",0);
$pdf->cell(12,6,$value['cnt_code'],"LRT",0,"C");
$pdf->cell(78,6,$colname1,"LRT",0,"L");
$pdf->cell(22,6,$value['cnt_contact'],"LRT",0,"C");
$pdf->cell(12,6,$value['tagged_code'],"LRT",0,"C");
$pdf->cell(78,6,$colname3,"LRT",0,"L");
$pdf->cell(22,6,$value['tagged_contact'],"LRT",1,"C");
if($colname2 || $colname4){
if($colname4){
$pdf->Cell(10,6,"","LBR",0);
$pdf->cell(12,6,"","LBR",0,"C");
$pdf->cell(78,6,$colname2,"LBR",0,"L");
$pdf->cell(22,6,"","LBR",0,"C");
$pdf->cell(12,6,"","LBR",0,"C");
$pdf->cell(78,6,$colname4,"LBR",0,"L");
$pdf->cell(22,6,"","LBR",1,"C");
}else{
$pdf->Cell(10,6,"","LBR",0);
$pdf->cell(12,6,"","LBR",0,"C");
$pdf->cell(78,6,$colname2,"LBR",0,"L");
$pdf->cell(22,6,"","LBR",0,"C");
$pdf->cell(12,6,"","LBR",0,"C");
$pdf->cell(78,6,"","LBR",0,"L");
$pdf->cell(22,6,"","LBR",1,"C");
}
}
if($pdf->getY() > 182){
$pdf->cell(234,"","","B",1);
head($pdf,$aobj_context);
tableHeaderForTaggedColg($pdf);
}
}
}
function formdata($pdf, $result, $aobj_context){
$sl_no=0;
foreach ($result as $key => $value) {
$sl_no++;
$landline = 0;
$colname1 = substr($value['fcollname'],0,40);
$colname2 = substr($value['fcollname'],40);
$town1 = substr($value['town'],0,17);
$town2 = substr($value['town'],17);
$landline = substr($value['landline'],0,12);
$pdf->SetFont('Times','',10);
$pdf->Cell(7,6,$sl_no,"LRT",0);
$pdf->cell(9,6,$value['fcollcode'],"LRT",0,"C");
$pdf->cell(77,6,$colname1,"LRT",0,"L");
$pdf->cell(31,6,$town1,"LRT",0,"L");
$pdf->cell(45,6,$value['fprincipalname'],"LRT",0,"L");
$pdf->cell(22,6,$landline,"LRT",0,"C");
$pdf->cell(20,6,$value['fmobile'],"LRT",0,"C");
$pdf->cell(55,6,$value['femail'],"LRT",0,"L");
$pdf->cell(20,6,$value['faltmobile'],"LRT",1,"R");
if($colname2){
$pdf->Cell(7,6,"","LBR",0);
$pdf->cell(9,6,"","LBR",0,"C");
$pdf->cell(77,6,$colname2,"LBR",0,"L");
$pdf->cell(31,6,"","LBR",0,"L");
$pdf->cell(45,6,"","LBR",0,"C");
$pdf->cell(22,6,"","LBR",0,"C");
$pdf->cell(20,6,"","LBR",0,"C");
$pdf->cell(55,6,"","LBR",0,"L");
$pdf->cell(20,6,"","LBR",1,"R");
}
if($town2){
$pdf->Cell(7,6,"","LBR",0);
$pdf->cell(9,6,"","LBR",0,"C");
$pdf->cell(77,6,"","LBR",0,"L");
$pdf->cell(31,6,$town2,"LBR",0,"L");
$pdf->cell(45,6,"","LBR",0,"C");
$pdf->cell(22,6,"","LBR",0,"C");
$pdf->cell(20,6,"","LBR",0,"C");
$pdf->cell(55,6,"","LBR",0,"L");
$pdf->cell(20,6,"","LBR",1,"R");
}
if($pdf->getY() > 182){
$pdf->cell(286,"","","T",1);
head($pdf,$aobj_context);
tableHeader($pdf);
}
}
}
?>
|