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.119.19.251
<?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');
$pdf_writer_class = $main_src . '/PHPExcel/Classes/PHPExcel.php';
require_once($pdf_writer_class);
function getheaders($objPHPExcel, $fileName)
{
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);
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename=' . $fileName);
header('Cache-Control: max-age=0');
header('Cache-Control: max-age=1');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: cache, must-revalidate');
header('Pragma: public');
ob_clean();
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
}
function subWiseFailedStudExcelSummaryReport($aobj_context)
{
session_start();
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode=$_SESSION['collcode'];
$funivcode = $_SESSION['FUNIVCODE'];
$degree = $aobj_context->mobj_data["degree"];
$degexam = $aobj_context->mobj_data["degexam"];
$yearmode = $aobj_context->mobj_data["yearmode"];
$section = $aobj_context->mobj_data["section"];
$yearmode = explode("*",$yearmode);
$year = $yearmode[0];
$examtye = $yearmode[1];
if($funivcode =="055"){
$subjDet="Course Details";
}else{
$subjDet="Subject Details";
}
$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);
$collname="SELECT fcollname FROM college WHERE fcollcode='$collcode'";
$res=$aobj_context->mobj_db->GetRow($collname);
$get_date= "select NOW() as now_date,
CONCAT('[',fcollcode,'] ', fcollname,', ',FTOWN) as college_name,
dg.fexamdate as fresexamdate, d.fdescpn, d.fexamname from college c, degree d, degexam dg
where fcollcode = '{$collcode}' and d.fdegree = '{$degree}'
and d.fdegree = dg.fdegree and d.fexamno = dg.fexamno
and d.fexamno = '{$degexam}'
and dg.fyear = '{$year}'
and dg.fexamtype = '{$examtye}'";
$obj=$aobj_context->mobj_db->GetRow($get_date);
$query = "SELECT stu.fcollcode,cl.fcollname,rs.fdegree,dg.fdescpn,rs.fexamno,
dg.fexamname,rs.fsubcode,su.fsubname,
count(distinct rs.fregno) as cnt
FROM resmarks rs
INNER JOIN subject su ON rs.fsubcode=su.fsubcode
AND rs.fexamno=su.fexamno
AND rs.fdegree=su.fdegree
INNER JOIN student stu ON stu.fregno=rs.fregno
inner join college cl on stu.fcollcode = cl.fcollcode
inner join degree dg on dg.fdegree = rs.fdegree
and dg.fexamno = rs.fexamno
WHERE rs.fdegree='{$degree}' AND rs.fexamno='{$degexam}'
AND rs.fgrade in('A','F','N')
AND rs.fyear='{$year}' AND rs.fexamtype='{$examtye}'
group by rs.fdegree,rs.fexamno,rs.fsubcode";
$results = $aobj_context->mobj_db->GetAll($query);
$objPHPExcel = new PHPExcel();
$fileName = 'subjectWiseFailedStudentCount.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'),
),
),
);
$objPHPExcel->getActiveSheet()->getStyle('1:5')->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('1:5')->getFont()->setSize(12);
$objPHPExcel->getActiveSheet()->getRowDimension(1)->setRowHeight(25);
$objPHPExcel->getActiveSheet()->getRowDimension(2)->setRowHeight(25);
$objPHPExcel->getActiveSheet()->getRowDimension(3)->setRowHeight(25);
$objPHPExcel->getActiveSheet()->getColumnDimension('A5')->setwidth(40);
$objPHPExcel->getActiveSheet()->freezePane('A6');
$objPHPExcel->getActiveSheet()->setCellValue('A5', 'Sl No.');
$objPHPExcel->getActiveSheet()->setCellValue('B5', 'Subject Name');
$objPHPExcel->getActiveSheet()->setCellValue('C5', 'Failed Count');
$objPHPExcel->getActiveSheet()->getStyle('A5')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('B5')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('C5')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('D5')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('E5')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->mergeCells('A1:C1');
$objPHPExcel->getActiveSheet()->mergeCells('A2:C2');
$objPHPExcel->getActiveSheet()->mergeCells('A3:C3');
$objPHPExcel->getActiveSheet()->mergeCells('A4:C4');
$objPHPExcel->getActiveSheet()->setCellValue('A1', $res['fcollname']);
$objPHPExcel->getActiveSheet()->setCellValue('A2', "SubjectWise Failed Students Report"." - ". $obj['fresexamdate'].' '. "EXAMINATION");
$objPHPExcel->getActiveSheet()->setCellValue('A3', $obj['fexamname']." - ". $obj['fdescpn']."[". $degree."]");
$objPHPExcel->getActiveSheet()->setCellValue('A4',"Section".":".$section);
$objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A2')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A3')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('C5')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A4')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
foreach($results as $key => $value){
$slNo = $key + 6;
$objPHPExcel->getActiveSheet()->setCellValue('A' . $slNo, $slNo - 5)->getColumnDimension('A')->setwidth(6);
$objPHPExcel->getActiveSheet()->setCellValue('B' . $slNo, $value['fsubname'])->getColumnDimension('D')->setwidth(26);
$objPHPExcel->getActiveSheet()->setCellValue('C'.$slNo, $value['cnt'])->getColumnDimension('D')->setwidth(10);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo, $slNo - 5)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('C'.$slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A'.$slNo.':C'.$slNo)->applyFromArray($styleArray);
}
getheaders($objPHPExcel, $fileName);
}
?>
|