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 : 13.59.217.1
<?php
$main_src = substr($_SERVER['SCRIPT_FILENAME'], 0, strlen($_SERVER['SCRIPT_FILENAME']) - 7);
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);
// 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_clean();
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
}
function AdmissionDetailed($aobj_context)
{
$objPHPExcel = new PHPExcel();
$fileName = 'AdmissionDetailedReport';
$objPHPExcel->getProperties()->setCreator("Uniclare")
->setLastModifiedBy("Me")->setTitle("My Excel Sheet")
->setSubject("My Excel Sheet")->setDescription("Excel Sheet")
->setKeywords("Excel Sheet")->setCategory("Me");
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);
// Add column headers and make them bold
$styleArray = array(
'borders' => array(
'allborders' => array(
'style' => PHPExcel_Style_Border::BORDER_THIN,
'color' => array('argb' => '000000'),
),
),
);
$univcode = $aobj_context->mobj_data["univcode"];
$fdegfrm = $aobj_context->mobj_data["fdegfrom"];
$fdegto = $aobj_context->mobj_data["fdegto"];
$fregfrm = $aobj_context->mobj_data["fregnofrm"];
$fregto = $aobj_context->mobj_data["fregnoto"];
$fcollfrm = $aobj_context->mobj_data["fcollfrom"];
$fcollto = $aobj_context->mobj_data["fcollto"];
$fsubfrom = $aobj_context->mobj_data["fsubfrom"];
$fsubto = $aobj_context->mobj_data["fsubto"];
$fexamRng = $aobj_context->mobj_data["fexamrange"];
$deggrp = $aobj_context->mobj_data["deggrp"];
$fdeggrpfrom = $aobj_context->mobj_data["fdeggrpfrom"];
$fdeggrpto = $aobj_context->mobj_data["fdeggrpto"];
// $reportWise = $aobj_context->mobj_data["reportWise"];
// $rtype = $aobj_context->mobj_data["rtype"];
$count = "";
$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'
];
$j=4;
$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.')
->setCellValue('B1', 'College Code')
->setCellValue('C1', 'College Name')
->setCellValue('D1', 'Degree Code')
->setCellValue('E1', 'Degree Name')
->setCellValue('F1', 'Subject Code')
->setCellValue('G1', 'Subject Name')
->setCellValue('H1', 'Application No.')
->setCellValue('I1', 'Student Name');
$objPHPExcel->getActiveSheet()->getStyle('A1:I1')->applyFromArray($styleArray);
// $objPHPExcel->getActiveSheet()->getColumnDimension('G1')->setAutoSize(true);
$objPHPExcel->getActiveSheet()->getRowDimension('1')->setRowHeight(45);
$objPHPExcel->getActiveSheet()->getStyle('A1:I1')->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->getStyle('A1:I1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A1:I1')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$count=rtrim($count,", ");
$query = "select cd.fdegree,d.fdescpn,cd.fcollcode,c.fcollname,
cd.fsubcode,s.fsubname,sa.fappno,sa.fname
from options cd
inner join studadm sa on
sa.fappno = cd.fappno and
sa.fdegree = cd.fdegree and sa.fexamno = cd.fexamno and sa.fcollcode = cd.fcollcode
inner join degree d on cd.fdegree = d.fdegree and cd.fexamno = d.fexamno
inner join subject s on s.fdegree = cd.fdegree and s.fexamno = cd.fexamno and s.fsubcode = cd.fsubcode
inner join college c on cd.fcollcode = c.fcollcode
where cd.fdegree between '{$fdegfrm}' and '{$fdegto}'and
s.fsubcode between '{$fsubfrom}' and '{$fsubto}' and cd.fcollcode between '{$fcollfrm}' and '{$fcollto}'
and sa.fappstatus='verified'
and d.fdeggrp IN('{$fdeggrpfrom}','{$fdeggrpto}') and s.ftheory = 'T' and s.fintass = 'F'";//cd.fexamno in ('{$fexamRng}') and
// var_dump($query);
// die();
$result1 = $aobj_context->pobj_db->GetAll($query);
foreach ($result1 as $key => $value) {
$slNo = $key + 2;
$j=4;
$objPHPExcel->getActiveSheet()->setCellValue('A' . $slNo, $slNo - 1)->getColumnDimension('A')->setwidth(5);
$objPHPExcel->getActiveSheet()->setCellValue('B' . $slNo, $value['fcollcode'])->getColumnDimension('B')->setwidth(8.43);
$objPHPExcel->getActiveSheet()->setCellValue('C' . $slNo, $value['fcollname'])->getColumnDimension('C')->setwidth(50);
$objPHPExcel->getActiveSheet()->setCellValue('D' . $slNo, $value['fdegree'])->getColumnDimension('D')->setwidth(8.43);
$objPHPExcel->getActiveSheet()->setCellValue('E' . $slNo, $value['fdescpn'])->getColumnDimension('E')->setwidth(50);
$objPHPExcel->getActiveSheet()->setCellValue('F' . $slNo, $value['fsubcode'])->getColumnDimension('F')->setwidth(8.43);
$objPHPExcel->getActiveSheet()->setCellValue('G' . $slNo, $value['fsubname'])->getColumnDimension('G')->setwidth(50);
$objPHPExcel->getActiveSheet()->setCellValue('H' . $slNo, $value['fappno'])->getColumnDimension('H')->setwidth(15);
$objPHPExcel->getActiveSheet()->setCellValue('I' . $slNo, $value['fname'])->getColumnDimension('I')->setwidth(50);
// $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setwidth(12);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':I'. $slNo)->applyFromArray($styleArray);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':B' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':B' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('D' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('D' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
//->setWrapText(true);
$objPHPExcel->getActiveSheet()->getStyle('B' . $slNo)->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->getStyle('E' . $slNo)->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->getStyle('F' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('F' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('G' . $slNo)->getAlignment()->setWrapText(true);
// $objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':'.$alpha[$j-1] . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
// $objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':'.$alpha[$j-1] . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
// $objPHPExcel->getActiveSheet()->getStyle($alpha[$j-1]. $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
// $objPHPExcel->getActiveSheet()->getStyle($alpha[$j-1] . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
// $objPHPExcel->getActiveSheet()->getStyle($alpha[$j-2]. $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
// $objPHPExcel->getActiveSheet()->getStyle($alpha[$j-2] . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
// $objPHPExcel->getActiveSheet()->getStyle($alpha[$j-3]. $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
// $objPHPExcel->getActiveSheet()->getStyle($alpha[$j-3] . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
}
$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->pobj_db->GetRow($get_coll_name);
// $deggrp = $aobj_context->mobj_data["dgp"];
// $query = "select distinct concat(fexamdate,' ',' Examination') as fexamdate
// from deggrp where fdeggrp = '{$deggrp}'";
// $results = $aobj_context->pobj_db->GetRow($query);
$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'];
// die();
// $objPHPExcel->getActiveSheet()->getHeaderFooter()->addImage($aobj_context->main_src.'img/'.$aobj_context->FUNIVCODE.'_logo.jpg', PHPExcel_Worksheet_HeaderFooter::IMAGE_HEADER_LEFT);
$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&C&H&"-,Bold"&16' . $aobj_context->FUNIVNAME . "\n" . '&12' . 'AdmissionReportDetailed');
$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&C&H'.$deggrp);
$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&RPage &P of &N');
getheaders($objPHPExcel, $fileName);
}
// 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.
// }
?>
|