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.116.118.214
Current Path : /var/www/oasis/src/ |
| Current File : /var/www/oasis/src/studentreport.php |
<?php
function getyears($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$univcode = $_SESSION['FUNIVCODE'];
$query="SELECT DISTINCT fadyear FROM degree";
$result=$aobj_context->mobj_db->GetAll($query);
// var_dump($result);
// die();
if($result){
echo $aobj_context->mobj_output->TOJSONEnvelope($result,0,"success");
}
else{
$arr['msg']="No Data Found.";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failed");
}
}
function GetDegreeOnYear($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$univcode = $_SESSION['FUNIVCODE'];
$year = $aobj_context->mobj_data["year"];
// var_dump($year);
// die();
if($year=="All"){
$cond= "fADYEAR BETWEEN '0' AND 'Z'";
}
else {
$cond="fADYEAR='{$year}'";
}
$query="SELECT DISTINCT fdegree,fdescpn,fADYEAR FROM degree WHERE {$cond}";
$result=$aobj_context->mobj_db->GetAll($query);
// var_dump($result);
// die();
if($result){
echo $aobj_context->mobj_output->TOJSONEnvelope($result,0,"success");
}
else{
$arr['msg']="No Data Found.";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failed");
}
}
$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');
// 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
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="Subject Listing.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 getstdreport($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$univcode = $_SESSION['FUNIVCODE'];
$year = $aobj_context->mobj_data["year"];
$degree = $aobj_context->mobj_data["degree"];
$clgFrom = $aobj_context->mobj_data["clgrangeFrom"];
$clgTo = $aobj_context->mobj_data["clgrangeTo"];
$semFrom= $aobj_context->mobj_data["semrangeFrom"];
$semTo = $aobj_context->mobj_data["semrangeTo"];
// var_dump($clgFrom,$clgTo, $semFrom,$semTo ,"hii");die();
if($year=="All")
{
$cond1=" fADYEAR BETWEEN '0' AND 'Z'";
}
else
{
$cond1="fADYEAR='{$year}'";
}
if($degree=="All")
{
$cond2=" degree.fdegree BETWEEN '0' AND 'Z'";
}
else
{
$cond2="degree.fdegree='{$degree}'";
}
if($clgFrom == 0){
$conn3="0";
}else{
$conn3="{$clgFrom }";
}
if($clgTo == "z"){
$conn4="z";
}else{
$conn4="{$clgTo}";
}
if($semFrom == 0){
$conn5="0";
}else{
$conn5="{$semFrom}";
}
if($semTo == "z"){
$conn6="z";
}else{
$conn6="{$semTo}";
}
$query="SELECT DISTINCT degree.fdegree, fregno,fname,ffatname,FMOTNAME,FCURRADD1,
FCURRADD2,FCURRADD3,FCURRADD4,fpermadd1,fpermadd2,FPERMADD3,FPERMADD4,FFATMOB,
fmotmob,FGENDER,fadyear FROM student JOIN degree ON degree.fdegree=student.FDEGREE
WHERE {$cond1} AND {$cond2} and fcollcode between '{$conn3}' and '{$conn4}'
and student.fexamno between '{$conn5}' and '{$conn6}'";
$result = $aobj_context->mobj_db->GetAll($query);
$objPHPExcel = new PHPExcel();
$fileName = 'student_report';
$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'),
),
),
);
$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('G1')->setwidth(50);
$objPHPExcel->getActiveSheet()->freezePane('A1');
$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Sl. No.')
->setCellValue('B1', 'DEGREE')
->setCellValue('C1', 'REGNO')
->setCellValue('D1', 'NAME')
->setCellValue('E1', 'FATHER NAME')
->setCellValue('F1', 'MOTHER NAME')
->setCellValue('G1', 'FATHER MOB')
->setCellValue('H1', 'MOTHER MOB')
->setCellValue('I1', 'GENDER')
->setCellValue('J1', 'YEAR OF ADDMISION')
->setCellValue('K1', 'CURRENT ADDRESS')
->setCellValue('L1', 'CURRENT ADDRESS')
->setCellValue('M1', 'CURRENT ADDRESS')
->setCellValue('N1', 'CURRENT ADDRESS')
->setCellValue('O1', 'POST')
->setCellValue('P1', 'TALUK')
->setCellValue('Q1', 'DISTRICT')
->setCellValue('R1', 'STATE')
->setCellValue('S1', 'PIN CODE')
->setCellValue('T1', 'PERMANENT ADDRESS')
->setCellValue('U1', 'PERMANENT ADDRESS')
->setCellValue('V1', 'PERMANENT ADDRESS')
->setCellValue('W1', 'PERMANENT ADDRESS')
->setCellValue('X1', 'POST')
->setCellValue('Y1', 'TALUK')
->setCellValue('Z1', 'STATE')
->setCellValue('AA1', 'PIN CODE');
// ->setCellValue('AB1', 'PIN CODE');
// fperpost fcommtaluk fpertaluk fcommdist fperstate fcommstate fcommpin fperpin
$objPHPExcel->getActiveSheet()->getStyle('A1:AB1')->applyFromArray($styleArray);
$objPHPExcel->getActiveSheet()->getColumnDimension('1')->setAutoSize(true);
$objPHPExcel->getActiveSheet()->getRowDimension('1')->setRowHeight(40);
$objPHPExcel->getActiveSheet()->getStyle('A1:AB1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A1:AB1')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
foreach ($result as $key => $value) {
$slNo = $key + 2;
$objPHPExcel->getActiveSheet()->setCellValue('A' . $slNo, $slNo-1)->getColumnDimension('A')->setwidth(16);
$objPHPExcel->getActiveSheet()->setCellValue('B' . $slNo, $value['fdegree'])->getColumnDimension('B')->setwidth(16);
$objPHPExcel->getActiveSheet()->setCellValue('C' . $slNo, $value['fregno'])->getColumnDimension('C')->setwidth(16);
$objPHPExcel->getActiveSheet()->setCellValue('D' . $slNo, $value['fname'])->getColumnDimension('D')->setwidth(60);
$objPHPExcel->getActiveSheet()->setCellValue('E' . $slNo, $value['ffatname'])->getColumnDimension('E')->setwidth(60);
$objPHPExcel->getActiveSheet()->setCellValue('F' . $slNo, $value['FMOTNAME'] )->getColumnDimension('F')->setwidth(50);
$objPHPExcel->getActiveSheet()->setCellValue('G' . $slNo, $value['FFATMOB'] )->getColumnDimension('G')->setwidth(20);
$objPHPExcel->getActiveSheet()->setCellValue('H' . $slNo, $value['fmotmob'] )->getColumnDimension('H')->setwidth(20);
$objPHPExcel->getActiveSheet()->setCellValue('I' . $slNo, $value['FGENDER'] )->getColumnDimension('I')->setwidth(18);
$objPHPExcel->getActiveSheet()->setCellValue('J' . $slNo, $value['fadyear'] )->getColumnDimension('J')->setwidth(25);
$objPHPExcel->getActiveSheet()->setCellValue('K' . $slNo, $value['FCURRADD1'] )->getColumnDimension('K')->setwidth(60);
$objPHPExcel->getActiveSheet()->setCellValue('L' . $slNo, $value['FCURRADD2'] )->getColumnDimension('L')->setwidth(60);
$objPHPExcel->getActiveSheet()->setCellValue('M' . $slNo, $value['FCURRADD3'] )->getColumnDimension('M')->setwidth(60);
$objPHPExcel->getActiveSheet()->setCellValue('N' . $slNo, $value['FCURRADD4'] )->getColumnDimension('N')->setwidth(60);
$objPHPExcel->getActiveSheet()->setCellValue('O' . $slNo, $value['fcommpost'] )->getColumnDimension('O')->setwidth(30);
$objPHPExcel->getActiveSheet()->setCellValue('P' . $slNo, $value['fcommtaluk'] )->getColumnDimension('P')->setwidth(30);
$objPHPExcel->getActiveSheet()->setCellValue('Q' . $slNo, $value['fcommdist'] )->getColumnDimension('Q')->setwidth(30);
$objPHPExcel->getActiveSheet()->setCellValue('R' . $slNo, $value['fcommstate'] )->getColumnDimension('R')->setwidth(30);
$objPHPExcel->getActiveSheet()->setCellValue('S' . $slNo, $value['fcommpin'] )->getColumnDimension('S')->setwidth(20);
$objPHPExcel->getActiveSheet()->setCellValue('T' . $slNo, $value['fpermadd1'] )->getColumnDimension('T')->setwidth(60);
$objPHPExcel->getActiveSheet()->setCellValue('U' . $slNo, $value['fpermadd2'] )->getColumnDimension('U')->setwidth(60);
$objPHPExcel->getActiveSheet()->setCellValue('V' . $slNo, $value['FPERMADD3'] )->getColumnDimension('V')->setwidth(60);
$objPHPExcel->getActiveSheet()->setCellValue('W' . $slNo, $value['FPERMADD4'] )->getColumnDimension('W')->setwidth(60);
$objPHPExcel->getActiveSheet()->setCellValue('X' . $slNo, $value['fperpost'] )->getColumnDimension('X')->setwidth(30);
$objPHPExcel->getActiveSheet()->setCellValue('Y' . $slNo, $value['fpertaluk'] )->getColumnDimension('Y')->setwidth(30);
$objPHPExcel->getActiveSheet()->setCellValue('Z' . $slNo, $value['fperstate'] )->getColumnDimension('Z')->setwidth(30);
$objPHPExcel->getActiveSheet()->setCellValue('AA' . $slNo, $value['fperpin'] )->getColumnDimension('AA')->setwidth(30);
// $objPHPExcel->getActiveSheet()->setCellValue('AB' . $slNo, $value['fperpin'] )->getColumnDimension('AB')->setwidth(30);
$objPHPExcel->getActiveSheet()->getStyle('A'.$slNo.':'.'A'.$slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('B'.$slNo.':'.'B'.$slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('C'.$slNo.':'.'C'.$slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('G'.$slNo.':'.'G'.$slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('H'.$slNo.':'.'H'.$slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('I'.$slNo.':'.'I'.$slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('J'.$slNo.':'.'J'.$slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('S'.$slNo.':'.'S'.$slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('AA'.$slNo.':'.'AA'.$slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('D'.$slNo.':'.'D'.$slNo)->getAlignment()->setIndent(3);
$objPHPExcel->getActiveSheet()->getStyle('E'.$slNo.':'.'E'.$slNo)->getAlignment()->setIndent(3);
$objPHPExcel->getActiveSheet()->getStyle('F'.$slNo.':'.'F'.$slNo)->getAlignment()->setIndent(3);
$objPHPExcel->getActiveSheet()->getStyle('K'.$slNo.':'.'K'.$slNo)->getAlignment()->setIndent(3);
$objPHPExcel->getActiveSheet()->getStyle('L'.$slNo.':'.'L'.$slNo)->getAlignment()->setIndent(3);
$objPHPExcel->getActiveSheet()->getStyle('M'.$slNo.':'.'M'.$slNo)->getAlignment()->setIndent(3);
$objPHPExcel->getActiveSheet()->getStyle('N'.$slNo.':'.'N'.$slNo)->getAlignment()->setIndent(3);
$objPHPExcel->getActiveSheet()->getStyle('O'.$slNo.':'.'O'.$slNo)->getAlignment()->setIndent(3);
$objPHPExcel->getActiveSheet()->getStyle('P'.$slNo.':'.'P'.$slNo)->getAlignment()->setIndent(3);
$objPHPExcel->getActiveSheet()->getStyle('Q'.$slNo.':'.'Q'.$slNo)->getAlignment()->setIndent(3);
$objPHPExcel->getActiveSheet()->getStyle('R'.$slNo.':'.'R'.$slNo)->getAlignment()->setIndent(3);
$objPHPExcel->getActiveSheet()->getStyle('T'.$slNo.':'.'T'.$slNo)->getAlignment()->setIndent(3);
$objPHPExcel->getActiveSheet()->getStyle('U'.$slNo.':'.'U'.$slNo)->getAlignment()->setIndent(3);
$objPHPExcel->getActiveSheet()->getStyle('V'.$slNo.':'.'V'.$slNo)->getAlignment()->setIndent(3);
$objPHPExcel->getActiveSheet()->getStyle('W'.$slNo.':'.'W'.$slNo)->getAlignment()->setIndent(3);
$objPHPExcel->getActiveSheet()->getStyle('X'.$slNo.':'.'X'.$slNo)->getAlignment()->setIndent(3);
$objPHPExcel->getActiveSheet()->getStyle('Y'.$slNo.':'.'Y'.$slNo)->getAlignment()->setIndent(3);
$objPHPExcel->getActiveSheet()->getStyle('Z'.$slNo.':'.'Z'.$slNo)->getAlignment()->setIndent(3);
// $objPHPExcel->getActiveSheet()->getStyle('AA'.$slNo.':'.'AA'.$slNo)->getAlignment()->setIndent(3);
}
getheaders($objPHPExcel, $fileName);
}
?>
|