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.222.184.184
<?php
// ini_set('max_execution_time', 300);
ini_set('max_execution_time', 600);
ini_set('memory_limit', '1G');
error_reporting(E_ALL); ini_set('display_errors', 1);
$main_src = substr($_SERVER['SCRIPT_FILENAME'], 0, strlen($_SERVER['SCRIPT_FILENAME']) - 7);
require_once(__DIR__ . "/../../aws/aws-autoloader.php");
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
date_default_timezone_set('GMT+5:30');
// PHPExcel_Shared_Font::setAutoSizeMethod(PHPExcel_Shared_Font::AUTOSIZE_METHOD_EXACT);
if (PHP_SAPI == 'cli')
die('This example should only be run from a Web Browser');
/** Include PHPExcel */
$pdf_writer_class = $main_src . '/PHPExcel/Classes/PHPExcel.php';
require_once($pdf_writer_class);
function getheaders($objPHPExcel, $fileName)
{
//To Fit To Page while printing
$objPHPExcel->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1);
$objPHPExcel->getActiveSheet()->getPageSetup()->setFitToWidth(1);
$objPHPExcel->getActiveSheet()->getPageSetup()->setFitToHeight(0);
$objPHPExcel->getActiveSheet()->getPageSetup()->setHorizontalCentered(true);
$objPHPExcel->getActiveSheet()->getPageSetup()->setVerticalCentered(false);
ob_end_clean();
// ob_start();
// Redirect output to a client’s web browser (Excel5)
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="' . $fileName . '.xls"');
header('Cache-Control: max-age=0');
// If you're serving to IE 9, then the following may be needed
header('Cache-Control: max-age=1');
// If you're serving to IE over SSL, then the following may be needed
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
header('Pragma: public'); // HTTP/1.0
ob_end_clean();
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
}
function reportAdmList($result, $aobj_context)
{
$objPHPExcel = new PHPExcel();
$fileName = 'AdmissionFeeSummary';
$objPHPExcel->getProperties()->setCreator("Me")
->setLastModifiedBy("Me")->setTitle("My Excel Sheet")
->setSubject("My Excel Sheet")->setDescription("Excel Sheet")
->setKeywords("Excel Sheet")->setCategory("Me");
// $objPHPExcel->setOutputEncoding('UTF-8');
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->setTitle($fileName);
$objPHPExcel->getActiveSheet()->getPageSetup()
->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
$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 = $aobj_context->mobj_db->GetRow($get_coll_name);
$objPHPExcel->getActiveSheet()->getHeaderFooter()
->setOddHeader('&C&H&"-,Bold"&16' . $aobj_context->FUNIVNAME);
$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&RPage &P of &N');
// Add column headers and make them bold
$styleArray = array(
'borders' => array(
'allborders' => array(
'style' => PHPExcel_Style_Border::BORDER_THIN,
'color' => array('argb' => '000000'),
),
),
);
$alpha = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'AA', 'AB', 'AC',
'AD', 'AF', 'AE', 'AF', 'AG', 'AH'
];
$objPHPExcel->getActiveSheet()->getStyle('1:1')->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('1:1')->getFont()->setSize(12);
$objPHPExcel->getActiveSheet()->freezePane('A2');
$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Sl. No.');
$objPHPExcel->getActiveSheet()->setCellValue('B1', 'Degree Code');
$objPHPExcel->getActiveSheet()->setCellValue('C1', 'Degree Name');
$objPHPExcel->getActiveSheet()->setCellValue('D1', 'College Code');
$objPHPExcel->getActiveSheet()->setCellValue('E1', 'College Name');
$objPHPExcel->getActiveSheet()->setCellValue('F1', 'Application Number');
$objPHPExcel->getActiveSheet()->setCellValue('G1', 'Student Name');
$objPHPExcel->getActiveSheet()->setCellValue('H1', 'Father Name');
$objPHPExcel->getActiveSheet()->setCellValue('I1', 'Mother Name');
$objPHPExcel->getActiveSheet()->setCellValue('J1', 'Gender');
$objPHPExcel->getActiveSheet()->setCellValue('K1', 'Category');
$objPHPExcel->getActiveSheet()->setCellValue('L1', 'Aadhar No.');
$objPHPExcel->getActiveSheet()->setCellValue('M1', 'HK / NHK');
$objPHPExcel->getActiveSheet()->setCellValue('N1', 'Mobile No.');
$objPHPExcel->getActiveSheet()->setCellValue('O1', 'Email Id');
$objPHPExcel->getActiveSheet()->setCellValue('P1', 'State');
$objPHPExcel->getActiveSheet()->setCellValue('Q1', 'Address');
$objPHPExcel->getActiveSheet()->setCellValue('R1', 'Adm. Fee');
$objPHPExcel->getActiveSheet()->setCellValue('S1', 'Photo');
$objPHPExcel->getActiveSheet()->getStyle('A1:S1')->applyFromArray($styleArray);
// $objPHPExcel->getActiveSheet()->getColumnDimension('G1')->setAutoSize(true);
$objPHPExcel->getActiveSheet()->getRowDimension('1')->setRowHeight(40);
$objPHPExcel->getActiveSheet()->getStyle('A1:S1')->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->getStyle('A1:S1')->getAlignment()
->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A1:S1')->getAlignment()
->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$j = 2;
$slNo = 1;
$sum = array();
$totamt=0;
$totapp=0;
// setlocale(LC_ALL, 'hi_IN');
foreach ($result as $key => $value) {
$keyname = $value['fkey'];
if($keyname != ''){
$s3 = S3Client::factory(
array(
'credentials' => array(
'key' => IAM_KEY,
'secret' => IAM_SECRET
),
'version' => "latest",
'region' => 'ap-south-1'
)
);
$ext = pathinfo($keyname, PATHINFO_EXTENSION);
$filePath = tempnam(sys_get_temp_dir(), rand(10,15));
rename($filePath, $filePath .= ".".$ext);
// $filePath = $filePath.".".$ext;
try{
$result = $s3->getObject([
'Bucket' => "admission-certificates",
'Key' => $keyname,
'SaveAs' => $filePath
]);
}
catch(S3Exception $e){
}
// var_dump($filePath);
$full_photo_path = $filePath;
}
$objPHPExcel->getActiveSheet()->getStyle($j)->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->setCellValue('A' . $j, $slNo)->getColumnDimension('A')->setwidth(5);
$objPHPExcel->getActiveSheet()->setCellValue('B' . $j, $value['fdegree'])->getColumnDimension('B')->setwidth(10.43);
$objPHPExcel->getActiveSheet()->setCellValue('C' . $j, $value['fdescpn'])->getColumnDimension('C')->setwidth(40);
$objPHPExcel->getActiveSheet()->setCellValue('D' . $j, $value['fcollcode'])->getColumnDimension('D')->setwidth(12);
$objPHPExcel->getActiveSheet()->setCellValue('E' . $j, $value['fcollname'])->getColumnDimension('E')->setwidth(40);
$objPHPExcel->getActiveSheet()->setCellValue('F' . $j, $value['fappno'])->getColumnDimension('F')->setwidth(15);
$objPHPExcel->getActiveSheet()->setCellValue('G' . $j, $value['fname'])->getColumnDimension('G')->setwidth(30);
$objPHPExcel->getActiveSheet()->setCellValue('H' . $j, $value['ffatname'])->getColumnDimension('H')->setwidth(30);
$objPHPExcel->getActiveSheet()->setCellValue('I' . $j, $value['fmotname'])->getColumnDimension('I')->setwidth(30);
$objPHPExcel->getActiveSheet()->setCellValue('J' . $j, $value['fgender'])->getColumnDimension('J')->setwidth(10);
$objPHPExcel->getActiveSheet()->setCellValue('K' . $j, $value['fcategory_ver'])->getColumnDimension('K')->setwidth(10);
$objPHPExcel->getActiveSheet()->setCellValue('L' . $j, $value['faadharno'].' ' )->getColumnDimension('L')->setwidth(20);
$objPHPExcel->getActiveSheet()->setCellValue('M' . $j, $value['fhk_ver'])->getColumnDimension('M')->setwidth(10);
$objPHPExcel->getActiveSheet()->setCellValue('N' . $j, $value['fmobileno'])->getColumnDimension('N')->setwidth(18);
$objPHPExcel->getActiveSheet()->setCellValue('O' . $j, $value['femail'])->getColumnDimension('O')->setwidth(30);
$objPHPExcel->getActiveSheet()->setCellValue('P' . $j, $value['fpermstate'])->getColumnDimension('P')->setwidth(20);
$objPHPExcel->getActiveSheet()->setCellValue('Q' . $j, $value['fpermadd1'].", ".$value['fpermadd2']."\n".
$value['fpermadd3'].", ".$value['fpermdist'].'-'.$value['fpermpin'] )->getColumnDimension('Q')->setwidth(50);
$objPHPExcel->getActiveSheet()->setCellValue('R' . $j, moneyFormatIndia($value['fadmfee']) )->getColumnDimension('R')->setwidth(10);
$objPHPExcel->getActiveSheet()->getColumnDimension('S')->setwidth(20);
$objPHPExcel->getActiveSheet()->getRowDimension($j)->setRowHeight(80);
// $n = 'O'.$i;
// $coll[1] = "/home/logisys32/public_html/oasis/gcg/adm/".$coll[1];
if($keyname != ''){
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName('test_img');
$objDrawing->setDescription('test_img');
$objDrawing->setPath($full_photo_path);
$objDrawing->setCoordinates('S' . $j);
$objDrawing->setHeight(110);
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
}
// $objPHPExcel->getActiveSheet()->setCellValue('S' . $j, $value['fphotopath'])->getColumnDimension('S')->setwidth(30);
$j++;$slNo++;
}
// var_dump($totamt);die();
$objPHPExcel->getActiveSheet()->getStyle('A2' . ':S' . $j)->applyFromArray($styleArray);
$objPHPExcel->getActiveSheet()->getStyle('A2'.':S' . $j)->getAlignment()
->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A2'.':S' . $j)->getAlignment()
->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('C2'.':C' . $j)->getAlignment()
->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
$objPHPExcel->getActiveSheet()->getStyle('E2'.':E' . $j)->getAlignment()
->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
$objPHPExcel->getActiveSheet()->getStyle('G2'.':I' . $j)->getAlignment()
->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
$objPHPExcel->getActiveSheet()->getStyle('O2'.':Q' . $j)->getAlignment()
->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
// $objPHPExcel->getActiveSheet()->getStyle('A1:G1')->getAlignment()
// ->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$objPHPExcel->getActiveSheet()->getRowDimension($j)->setRowHeight(30);
$objPHPExcel->getActiveSheet()->getStyle('A3' . ':S' . $j)->getAlignment()
->setWrapText(true);
// $objPHPExcel->getActiveSheet()->getStyle('G2:G'.$j)->getNumberFormat()->setFormatCode("#,##0");
// $objPHPExcel->getActiveSheet()->getStyle('F'.$j)->getNumberFormat()->setFormatCode("#,##0");
getheaders($objPHPExcel, $fileName);
}
function getreportAdmList($aobj_context) {
$fdept = $aobj_context->mobj_data["fdept"];
$dtfrom = $aobj_context->mobj_data["dtfrom"];
$dtto = $aobj_context->mobj_data["dtto"];
$query = "select se.fdegree, dg.fdescpn, se.fcollcode, cl.fcollname,
sa.fappno, sa.fname, sa.ffatname, sa.fmotname,
if(ifnull(fgender,'') = 'F', 'Female', if(ifnull(fgender,'') = 'M', 'Male',
if(ifnull(fgender,'') = 'T', 'Transgender',''))) as fgender, fcategory_ver, faadharno,
if(fhk_ver = 'Yes', 'HK', 'NHK') as fhk_ver, fmobileno,
femail, fpermstate, fpermadd1, fpermadd2,
fpermadd3, fpermdist, fpermpin, se.fadmfee, ifnull(fphotopath,'') as fkey
from entstudadm_all_rounds sa inner join entseatallot se on sa.fappno = se.fappno
inner join entcoll cl on se.fcollcode = cl.fcollcode inner join entdeg dg on se.fdegree = dg.fdegree
where ifnull(fpaymentstatus,'') = 'success' and ifnull(fcancel,'') <> 'T'
and se.fdegree = '{$fdept}'
order by dg.forder, se.fcollcode, sa.fname";
$result = $aobj_context->mobj_db->GetAll($query);
reportAdmList($result, $aobj_context);
}
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.
}
|