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.202.60
<?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 generateCorseRep($aobj_context)
{
session_start();
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode=$_SESSION['collcode'];
$degcode=trim($aobj_context->mobj_data["degcode"]);
$sem=trim($aobj_context->mobj_data["sem"]);
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$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);
$cnd = "and a.fexamno = '{$sem}'";
$cnd1 = "and d.fexamno = '{$sem}'";
// var_dump()
if($sem == 'All')
{
$cnd1 = "";
$cnd = "";
}
$get_data="SELECT d.fdegree,d.fdescpn,d.fexamname,d.fexamdate
from degree d
where d.fdegree='{$degcode}'
{$cnd1}";
$degdata=$aobj_context->mobj_db->GetRow($get_data);
if($sem == 'All')
$degree_name = $degdata['fdegree'].' - '.$degdata['fdescpn'];
else
$degree_name = $degdata['fdegree'].' - '.$degdata['fdescpn'].' '.$degdata['fexamname'];
$collcode=$_SESSION['collcode'];
$query = "select rd.fregno,st.fname,sum(rd.fcredit) as credit,sum(rd.famount) as famount,rd.fpaydate,
rd.fpaytranid,
group_concat(su.fsubshort,' (',su.fcredits,')' SEPARATOR ', ') as subcode
from attshort a inner join regfeesum r on a.fregno = r.fregno
inner join regfee rd on rd.fregno = a.fregno
and rd.fsubcode = a.fsubcode
and rd.fappno = r.fappno
and rd.fregno = r.fregno
inner join student st on st.fregno = a.fregno
inner join subject su on a.fdegree = su.fdegree and a.fexamno = su.fexamno
and a.fsubcode = su.fcsubcode
where ifnull(r.fpaystatus,'') = 'success'
and a.fdegree = '{$degcode}'
{$cnd}
group by a.fregno";
$res = $aobj_context->mobj_db->GetAll($query);
$subcount = 0;
foreach($res as $val){
if(count(explode('*',$val['subdet'])) > $subcount){
$subcount = count(explode('*',$val['subdet']));
}
}
$objPHPExcel = new PHPExcel();
$fileName = 'student_ia_marks_det.xls';
// var_dump($subdet);die();
$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'),
),
),
);
$attArr=['D', 'G', 'J', 'M', 'P', 'S', 'V', 'Y', 'AB', 'AE'];
$cieArr=['E', 'H', 'K', 'N', 'Q', 'T', 'W', 'Z', 'AC', 'AF'];
$eligArr=['F', 'I', 'L', 'O', 'R', 'U', 'X', 'AA', 'AD', 'AG'];
$objPHPExcel->getActiveSheet()->getStyle('1:2')->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('1:2')->getFont()->setSize(12);
$objPHPExcel->getActiveSheet()->getColumnDimension('A1')->setwidth(30);
$objPHPExcel->getActiveSheet()->freezePane('A3');
$objPHPExcel->getActiveSheet()->setCellValue('A1', $degree_name)->mergeCells('A1:H1');
$objPHPExcel->getActiveSheet()->getStyle('A1:H1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->setCellValue('A2', 'Sl No.');
$objPHPExcel->getActiveSheet()->setCellValue('B2', 'USN');
$objPHPExcel->getActiveSheet()->setCellValue('C2', 'Name');
$objPHPExcel->getActiveSheet()->setCellValue('D2', 'Total Credits');
$objPHPExcel->getActiveSheet()->setCellValue('E2', 'Amount');
$objPHPExcel->getActiveSheet()->setCellValue('F2', 'Payment Date');
$objPHPExcel->getActiveSheet()->setCellValue('G2', 'Payment ID');
$objPHPExcel->getActiveSheet()->setCellValue('H2', 'Registered Courses (Credit)');
$objPHPExcel->getActiveSheet()->getRowDimension(2)->setRowHeight(25);
$objPHPExcel->getActiveSheet()->getRowDimension(1)->setRowHeight(25);
$merge=3;
$sl = 1;
$objPHPExcel->getActiveSheet()->getStyle('A2:H2')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
foreach ($res as $key => $value) {
$slNo = $key + 2;
$split = explode("*", $value['subdet']);
// $objPHPExcel->getActiveSheet()->getRowDimension($slNo)->setRowHeight(25);
$objPHPExcel->getActiveSheet()->setCellValue('A' . $merge, $sl)->getColumnDimension('A')->setwidth(8);
$objPHPExcel->getActiveSheet()->setCellValue('B' . $merge, $value['fregno'])->getColumnDimension('B')->setwidth(15);
$objPHPExcel->getActiveSheet()->setCellValue('C' . $merge, $value['fname'])->getColumnDimension('C')->setwidth(40);
$objPHPExcel->getActiveSheet()->setCellValue('D' . $merge, $value['credit'])->getColumnDimension('D')->setwidth(15);
$objPHPExcel->getActiveSheet()->setCellValue('E' . $merge, $value['famount'])->getColumnDimension('E')->setwidth(15);
$objPHPExcel->getActiveSheet()->setCellValue('F' . $merge, $value['fpaydate'])->getColumnDimension('F')->setwidth(20);
$objPHPExcel->getActiveSheet()->setCellValue('G' . $merge, $value['fpaytranid'])->getColumnDimension('G')->setwidth(30);
$objPHPExcel->getActiveSheet()->setCellValue('H' . $merge, $value['subcode'])->getColumnDimension('H')->setwidth(70);
$objPHPExcel->getActiveSheet()->getRowDimension($merge)->setRowHeight(25);
$objPHPExcel->getActiveSheet()->getStyle('A'.$merge.':'.'B'.$merge)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('D'.$merge.':'.'E'.$merge)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$merge++;
$sl++;
}
getheaders($objPHPExcel, $fileName);
}
?>
|