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.139.86.58
<?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);
ini_set('max_execution_time', 300);
ini_set('memory_limit', '512M');
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 . '.CSV"');
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, 'CSV');
$objWriter->save('php://output');
}
function exaEeePaidCsv($aobj_context)
{
$objPHPExcel = new PHPExcel();
$univcode = $aobj_context->mobj_data["univcode"];
$fileName = 'Fee_collected_details';
$objPHPExcel->getProperties()->setCreator("Me")
->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);
$objPHPExcel->getActiveSheet()->setTitle($fileName);
$objPHPExcel->getActiveSheet()->getPageSetup()
->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
$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', 'AF', 'AE', 'AF', 'AG', 'AH'
];
$objPHPExcel->getActiveSheet()
->setCellValue('A1', 'Sl. No.')
->setCellValue('B1', 'Degree Code')
->setCellValue('C1', 'Description')
->setCellValue('D1', 'Register No')
->setCellValue('E1', 'Student Name')
->setCellValue('F1', 'Exam No')
->setCellValue('G1', 'Fee Type')
->setCellValue('H1', 'I sem Fee')
->setCellValue('I1', 'II sem Fee')
->setCellValue('J1', 'III sem Fee')
->setCellValue('K1', 'IV sem Fee')
->setCellValue('L1', 'V sem Fee')
->setCellValue('M1', 'VI sem Fee')
->setCellValue('N1', 'VII sem Fee')
->setCellValue('O1', 'VIII sem Fee')
->setCellValue('P1', 'IX sem Fee')
->setCellValue('Q1', 'X sem Fee')
->setCellValue('R1', 'Total Fees')
->setCellValue('S1', 'Application Number')
->setCellValue('T1', 'Payment Date');
$j = 3;
$slNo = 1;
$sum = array();
// $query = "select mt.fteachcode, fteachname, mt.fmobile, ifnull(fboardcode,'xxx') as fboard1
// from masteach mt left join teachsub ts on mt.fteachcode = ts.fteachcode
// left join masqp mq on ts.fqpcode = mq.fqpcode left join
// masboard mb on mq.fboard = mb.fboardcode
// where mt.fcollcode between '0000' and 'zzzz'
// and ifnull(fboardcode,'000000') between '0000' and 'zzzz'
// group by fteachcode
// order by mt.fcollcode, fboardcode, fteachcode";
$univcode = $aobj_context->mobj_data["univcode"];
$fdatefrom = $aobj_context->mobj_data["fdatefrom"];
$fdateto = $aobj_context->mobj_data["fdateto"];
$fdeggrp = $aobj_context->mobj_data["fdeggrp"];
//#and fackdate between '{$fdatefrom}' and '{$fdateto}'
$query = "select a.fdegree as degree ,d.fdescpn as fdescpn,a.fregno as regno ,s.fname as name,
a.ffreshexam as REGEXAM,
(case when a.ffeetype='Normal Fee' then 'TAB' else 'PENPAPER' end) as feetype,
a.fexamfeea as a,a.fexamfeeb as b,a.fexamfeec as c,a.fexamfeed as d,
a.fexamfeee as e,a.fexamfeef as f,a.fexamfeeg as g,a.fexamfeeh as h,
a.fexamfeei as i,a.fexamfeej as j,a.ftotalfee as total,a.appno as appno,a.fackdate as ackdate
from appcandsum a,student s,logisys3_comexam.masuser m,degree d
where ifnull(a.fackdate,'')<>'' and ifnull(a.fpaymentstatus,'')='success'
and left(fackdate,10) between date_format(str_to_date('{$fdatefrom}','%d/%m/%Y'),'%Y-%m-%d')
and date_format(str_to_date('{$fdateto}','%d/%m/%Y'),'%Y-%m-%d')
and a.fdegree=s.fdegree and a.fregno=s.fregno and m.funivcode='{$univcode}'
and a.fregno=m.fregno and d.fdeggrp ='{$fdeggrp}' and a.fdegree=d.fdegree and d.fexamno='A'
order by a.fdegree,a.fregno";
$result = $aobj_context->pobj_db->GetAll($query);
$i = 2;
foreach ($result as $key => $value) {
$slNo = $key + 2;
$objPHPExcel->getActiveSheet()
->setCellValue('A' . $slNo, $slNo - 1);
$objPHPExcel->getActiveSheet()
->setCellValue('B' . $i, $value["degree"]);
$objPHPExcel->getActiveSheet()
->setCellValue('C' . $i, $value["fdescpn"]);
$objPHPExcel->getActiveSheet()
->setCellValue('D' . $i, $value["regno"]);
$objPHPExcel->getActiveSheet()
->setCellValue('E' . $i, $value["name"]);
$objPHPExcel->getActiveSheet()
->setCellValue('F' . $i, $value["REGEXAM"]);
$objPHPExcel->getActiveSheet()
->setCellValue('G' . $i, $value["feetype"]);
$objPHPExcel->getActiveSheet()
->setCellValue('H' . $i, $value['a']);
$objPHPExcel->getActiveSheet()
->setCellValue('I' . $i, $value["b"]);
$objPHPExcel->getActiveSheet()
->setCellValue('J' . $i, $value["c"]);
$objPHPExcel->getActiveSheet()
->setCellValue('K' . $i, $value["d"]);
$objPHPExcel->getActiveSheet()
->setCellValue('L' . $i, $value["e"]);
$objPHPExcel->getActiveSheet()
->setCellValue('M' . $i, $value["f"]);
$objPHPExcel->getActiveSheet()
->setCellValue('N' . $i, $value["g"]);
$objPHPExcel->getActiveSheet()
->setCellValue('O' . $i, $value['h']);
$objPHPExcel->getActiveSheet()
->setCellValue('P' . $i, $value["i"]);
$objPHPExcel->getActiveSheet()
->setCellValue('Q' . $i, $value["j"]);
$objPHPExcel->getActiveSheet()
->setCellValue('R' . $i, $value["total"]);
$objPHPExcel->getActiveSheet()
->setCellValue('S' . $i, $value["appno"]);
$objPHPExcel->getActiveSheet()
->setCellValue('T' . $i, $value["ackdate"]);
$i++;
}
getheaders($objPHPExcel, $fileName);
}
|