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.223.159.237
<?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');
ini_set('max_execution_time', 300);
ini_set('memory_limit', '2G');
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
ini_set('max_execution_time', '300');
$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);
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 getpendingstudentList($aobj_context)
{
$collcode=$_SESSION['collcode'];
$funivcode=$_SESSION['univcode'];
$dates=$aobj_context->mobj_data['date'];
$yearmode=$aobj_context->mobj_data['exam'];
$deggrp1=$aobj_context->mobj_data['deggrp'];
$session=$aobj_context->mobj_data['session'];
$deg=explode('-',$deggrp1);
$deggrp=$deg[0];
$yearAndmode=explode('*',$yearmode);
$year=$yearAndmode[0];
$examtype=$yearAndmode[1];
// $query=" SELECT DISTINCT cd.FREGNO AS reg_cnt, CONCAT(dg.fdeggrp, ' - ',dg.fdescpn)AS fdeggrp,t.fsession,r.FDESCPN,
// IF(IFNULL(cd.fhallno,'') = '',0,1) AS fhallno,d.fdegree,st.fname,cd.fexamno,s.fsubname,cs.ftotalfee,c.fcollname
// FROM canddet cd INNER JOIN subject s ON s.fdegree = cd.fdegree
// AND s.fexamno = cd.fexamno AND s.FSUBCODE = cd.FSUBCODE
// INNER JOIN degree d ON cd.fdegree = d.fdegree AND cd.fexamno = d.fexamno
// INNER JOIN deggrp dg ON dg.fdeggrp = d.fdeggrp INNER JOIN candsum cs ON cd.fcollcode = cs.fcollcode AND cs.FREGNO = cd.FREGNO
// INNER JOIN timetable t ON s.fqpcode = t.fqpcode AND t.fyear = cd.fyear AND cd.fexamtype = t.fexamtype AND t.fdeggrp = d.fdeggrp
// INNER JOIN reason r ON t.FSESSION = r.FREASONCD
// INNER JOIN student st ON st.fdegree=cd.fdegree AND st.fregno=cd.fregno
// INNER JOIN college c ON c.fcollcode=cd.fcollcode
// WHERE cs.fcntrcode='{$collcode}' AND cd.fyear='{$year}' AND cd.fexamtype='{$examtype}'
// AND cd.FPRESENT = 'P' AND IFNULL(cd.fpassmth,'') = '' AND t.fdate='{$dates}' AND dg.fdeggrp='{$deggrp}' AND t.fsession='{$session}'";
$query="SELECT DISTINCT cd.FREGNO AS reg_cnt, CONCAT(dg.fdeggrp, ' - ',dg.fdescpn)AS fdeggrp,t.fsession,r.FDESCPN,
IF(IFNULL(cd.fhallno,'') = '',0,1) AS fhallno,d.fdegree,st.fname,s.fsubcode,cd.fpassmth,a.fremarks,s.fsubname,cs.ftotalfee FROM canddet cd
INNER JOIN subject s ON s.fdegree = cd.fdegree AND s.fexamno = cd.fexamno AND s.FSUBCODE = cd.FSUBCODE
INNER JOIN degree d ON cd.fdegree = d.fdegree AND cd.fexamno = d.fexamno INNER JOIN deggrp dg ON dg.fdeggrp = d.fdeggrp
INNER JOIN candsum cs ON cd.fcollcode = cs.fcollcode AND cs.FREGNO = cd.FREGNO
INNER JOIN timetable t ON s.fqpcode = t.fqpcode AND t.fyear = cd.fyear AND cd.fexamtype = t.fexamtype AND t.fdeggrp = d.fdeggrp
INNER JOIN reason r ON t.FSESSION = r.FREASONCD
INNER JOIN student st ON st.fdegree=cd.fdegree AND st.fregno=cd.fregno #and st.fcollcode=cs.fcntrcode
INNER JOIN college c ON c.fcollcode=cd.fcollcode
LEFT JOIN attshort a ON a.fdegree=cd.fdegree AND a.fexamno=cd.fexamno AND cd.fsubcode=a.fsubcode AND a.fregno=cd.fregno
WHERE cs.fcntrcode='{$collcode}' AND cd.fyear='{$year}' AND cd.fexamtype='{$examtype}'
AND cd.FPRESENT = 'P'AND t.fdate='{$dates}' AND dg.fdeggrp='{$deggrp}' AND t.fsession='{$session}'";
$lobj_get_data = $aobj_context->mobj_db->GetAll($query);
$main_src_obj=(explode("/",$_SERVER["REQUEST_URI"]));
$main_src=$main_src_obj[1];
$pdf_writer_class=$aobj_context->main_src."/maya-pdf/fpdf.php";
$root_pdf_file_download=$aobj_context->main_src."/Report_details/output/report_me_student_list.pdf";
include($pdf_writer_class);
$objPHPExcel = new PHPExcel();
$fileName ="Candidates Applied List.xls";
$objPHPExcel->getProperties()->setCreator("Uniclare")
->setLastModifiedBy("Me")->setTitle("My Excel Sheet")
->setSubject("My Excel Sheet")->setDescription("Excel Sheet")
->setKeywords("Excel Sheet")->setCategory("Me");
$objPHPExcel->setActiveSheetIndex(0);
$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', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AW', 'AX', 'AY', 'AZ',
'BA', 'BB', 'BC', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BK', 'BL', 'BM', 'BN', 'BO', 'BP', 'BQ', 'BR', 'BS', 'BT', 'BU', 'BV', 'BW', 'BX', 'BY', 'BZ',
'CA', 'CB', 'CC', 'CD', 'CE', 'CF', 'CG', 'CH', 'CI', 'CJ', 'CK', 'CL', 'CM', 'CN', 'CO', 'CP', 'CQ', 'CR', 'CS', 'CT', 'CU', 'CV', 'CW', 'CX', 'CY', 'CZ'];
$objPHPExcel->getActiveSheet()->setCellValue('A1', 'slno');
$objPHPExcel->getActiveSheet()->setCellValue('B1', 'Reg. No.');
$objPHPExcel->getActiveSheet()->setCellValue('C1', 'Student Name');
$objPHPExcel->getActiveSheet()->setCellValue('D1', 'Degree');
$objPHPExcel->getActiveSheet()->setCellValue('E1', 'Subject');
$objPHPExcel->getActiveSheet()->setCellValue('F1', 'Remarks');
$objPHPExcel->getActiveSheet()->setCellValue('G1', 'IA/Attenace Shortage');
// Style for headers
$headerStyle = [
'font' => [
'bold' => true,
'size' => 12,
],
'alignment' => [
'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER,
],
];
// Apply header style
$objPHPExcel->getActiveSheet()->getStyle('A1:G1')->applyFromArray($headerStyle);
$rowIndex = 2; // Start from row 2
$slNo = 1; // Initialize serial number
foreach ($lobj_get_data as $key => $value) {
if ($value['fhallno'] == 0) {
$objPHPExcel->getActiveSheet()->setCellValue("A$rowIndex", $slNo);
$objPHPExcel->getActiveSheet()->setCellValue("B$rowIndex", $value['reg_cnt']);
$objPHPExcel->getActiveSheet()->setCellValue("C$rowIndex", $value['fname']);
$objPHPExcel->getActiveSheet()->setCellValue("D$rowIndex", $value['fdegree']);
$objPHPExcel->getActiveSheet()->setCellValue("E$rowIndex", $value['fsubname']);
if($value['ftotalfee']!=''){
$objPHPExcel->getActiveSheet()->setCellValue("F$rowIndex", 'Fees Paid');
}
// if($value['fpassmth']=='short'){
$objPHPExcel->getActiveSheet()->setCellValue("G$rowIndex", $value['fremarks']);
// }
$slNo++;
}
$rowIndex++;
}
$objPHPExcel->getActiveSheet()->getStyle('A2')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
getheaders($objPHPExcel, $fileName);
}
?>
|