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.145.105.199
<?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 qpindentstudlist($aobj_context)
{
$univcode = $aobj_context->mobj_data["univcode"];
$fdeggrp = $aobj_context->mobj_data["deggrp"];
$fdegfrom = $aobj_context->mobj_data["fdegfrom"];
$fdegto = $aobj_context->mobj_data["fdegto"];
$fcollfrm = $aobj_context->mobj_data["fcollfrom"]; //'1806';//
$fcollto = $aobj_context->mobj_data["fcollto"]; // '1807';//
// $fsubfrom = $aobj_context->mobj_data["fsubfrom"];
// $fsubto = $aobj_context->mobj_data["fsubto"];
// $fexamRng = $aobj_context->mobj_data["fexamrange"];
//$fdeggrpfrom = $aobj_context->mobj_data["fdeggrpfrom"];
//$fdeggrpto = $aobj_context->mobj_data["fdeggrpto"];*/
ini_set('MAX_EXECUTION_TIME', '300');
$query = "select m.fdate as date,t.fsessiont as session,cd.fcollcode as collcode,cl.fcollname as collname,cd.fdegree as degree ,d.fdescpn as descp
,s.fexamno as examno,s.fcsubcode as subcode,t.fqpcode as qpcode ,concat(s.fmarkdesc1,s.fmarkdesc2) as fsubname,s.fsubshort as coursecode
,s.fssubname as subtype,
cd.fregno as srn
from timetable t inner join masdate m on m.fdeggrp = t.fdeggrp
and m.fdatecode = t.fdatecodet
and m.fyear = t.fyear and m.fexamtype = t.fexamtype
inner join subject s on t.fqpcode = s.fqpcode
inner join canddet cd on s.fdegree = cd.fdegree
inner join degree d on d.fdegree=cd.fdegree and d.fexamno = cd.fexamno
and s.fexamno = cd.fexamno
and s.fsubcode = cd.fsubcode
inner join college cl on cd.fcollcode = cl.fcollcode
where t.fyear = '2021' and t.fexamtype ='3'
and cd.fdegree between '{$fdegfrom}' and '{$fdegto}'
and cd.fcollcode between '{$fcollfrom}' and '{$fcollto}'
and cd.fpresent = 'P'
group by m.fdate,t.fsessiont,cd.fdegree,d.fdescpn,s.fexamno,s.fcsubcode,t.fqpcode,cd.fregno;";
$result = $aobj_context->pobj_db->GetAll($query);
// var_dump($query);
// var_dump($result);
// die();
$objPHPExcel = new PHPExcel();
$fileName = 'Qpindent Student list';
$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'),
),
),
);
$count = "";
$alpha = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N'];
$j=4;
$objPHPExcel->getActiveSheet()->getStyle('1:1')->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('1:1')->getFont()->setSize(12);
$objPHPExcel->getActiveSheet()->getColumnDimension('A1')->setwidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension('D1')->setwidth(15);
$objPHPExcel->getActiveSheet()->freezePane('A2');
$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Sl. No.')
->setCellValue('B1', 'Date')
->setCellValue('C1', 'Session')
->setCellValue('D1', 'College Code')
->setCellValue('E1', 'College Name')
->setCellValue('F1', 'Degree')
->setCellValue('G1', 'Description')
->setCellValue('H1', 'Exam No')
->setCellValue('I1', 'Subject code')
->setCellValue('J1', 'Qpcode')
->setCellValue('K1', 'Subject Name')
->setCellValue('L1', 'Course Code')
->setCellValue('M1', 'Subject Type')
->setCellValue('N1', 'SRN');
$objPHPExcel->getActiveSheet()->getStyle('A1:N1')->applyFromArray($styleArray);
$objPHPExcel->getActiveSheet()->getColumnDimension('1')->setAutoSize(true);
$objPHPExcel->getActiveSheet()->getRowDimension('1')->setRowHeight(40);
//$objPHPExcel->getActiveSheet()->getStyle('A1:AI1')->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->getStyle('A1:N1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A1:N1')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$count=rtrim($count,", ");
foreach ($result as $key => $value) {
$slNo = $key + 2;
$j=4;
$objPHPExcel->getActiveSheet()->setCellValue('A' . $slNo, $slNo - 1)->getColumnDimension('A')->setwidth(8);
$objPHPExcel->getActiveSheet()->setCellValue('B' . $slNo, $value['date'])->getColumnDimension('B')->setwidth(8.43);
$objPHPExcel->getActiveSheet()->setCellValue('C' . $slNo, $value['session'])->getColumnDimension('C')->setwidth(40);
$objPHPExcel->getActiveSheet()->setCellValue('D' . $slNo, $value['collcode'])->getColumnDimension('D')->setwidth(15);
$objPHPExcel->getActiveSheet()->setCellValue('E' . $slNo, $value['collname'])->getColumnDimension('E')->setwidth(50);
$objPHPExcel->getActiveSheet()->setCellValue('F' . $slNo, $value['degree'])->getColumnDimension('F')->setwidth(10);
$objPHPExcel->getActiveSheet()->setCellValue('G' . $slNo, $value['descp'])->getColumnDimension('G')->setwidth(12);
$objPHPExcel->getActiveSheet()->setCellValue('H' . $slNo, $value['examno'])->getColumnDimension('H')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('I' . $slNo, $value['subcode'])->getColumnDimension('I')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('J' . $slNo, $value['qpcode'])->getColumnDimension('J')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('K' . $slNo, $value['fsubname'])->getColumnDimension('K')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('L' . $slNo, $value['coursecode'])->getColumnDimension('L')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('M' . $slNo, $value['subtype'])->getColumnDimension('M')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('N' . $slNo, $value['srn'])->getColumnDimension('N')->setwidth(22);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':N'. $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('F' . $slNo . ':N' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('F' . $slNo . ':N' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
// $objPHPExcel->getActiveSheet()->getStyle('C' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_JUSTIFY);
$objPHPExcel->getActiveSheet()->getStyle('D' )->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('D' )->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
// $objPHPExcel->getActiveSheet()->getStyle('E' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_JUSTIFY);
// $objPHPExcel->getActiveSheet()->getStyle('F' . $slNo . ':AK' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
// $objPHPExcel->getActiveSheet()->getStyle('F' . $slNo . ':AK' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
// $objPHPExcel->getActiveSheet()->getStyle('C' . $slNo)->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->getStyle('E' . $slNo)->getAlignment()->setWrapText(true);
}
/*$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' . $rtype);
$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&C&H'.$deggrp);
$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&RPage &P of &N');*/
getheaders($objPHPExcel, $fileName);
}
?>
|