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.93.242
<?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');
// 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 . '.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 exmfeedetnewexcel($aobj_context)
{
$univcode = $aobj_context->mobj_data["univcode"];
$fdeggrp = $aobj_context->mobj_data["deggrp"];
$fdegfrom = $aobj_context->mobj_data["fdegfrom"];
$fdegto = $aobj_context->mobj_data["fdegto"];
$fcollfrm = $aobj_context->mobj_data["fcollfrom"]; //'1806';//
$fcollto = $aobj_context->mobj_data["fcollto"]; // '1807';//
// $fsubfrom = $aobj_context->mobj_data["fsubfrom"];
// $fsubto = $aobj_context->mobj_data["fsubto"];
// $fexamRng = $aobj_context->mobj_data["fexamrange"];
//$fdeggrpfrom = $aobj_context->mobj_data["fdeggrpfrom"];
//$fdeggrpto = $aobj_context->mobj_data["fdeggrpto"];*/
ini_set('MAX_EXECUTION_TIME', '300');
$query = "select c.fyear, c.fexamtype, c.fdegree,d.fdescpn, c.fcollcode, concat(cl.fcollname, ', ', cl.ftown) as College_Name,
sum(case when fexamfeea>0 and ffreshexam='a' then 1 else 0 end) as reg_app_a,
sum(case when fexamfeea>0 and ffreshexam='a' then fexamfeea else 0 end) as reg_fee_a,
sum(case when fexamfeea>0 and ffreshexam<>'a' then 1 else 0 end) as rep_app_a,
sum(case when fexamfeea>0 and ffreshexam<>'a' then fexamfeea else 0 end) as rep_fee_a,
sum(case when fexamfeeb>0 and ffreshexam='b' then 1 else 0 end) as reg_app_b,
sum(case when fexamfeeb>0 and ffreshexam='b' then fexamfeeb else 0 end) as reg_fee_b,
sum(case when fexamfeeb>0 and ffreshexam<>'b' then 1 else 0 end) as rep_app_b,
sum(case when fexamfeeb>0 and ffreshexam<>'b' then fexamfeeb else 0 end) as rep_fee_b,
sum(case when fexamfeec>0 and ffreshexam='c' then 1 else 0 end) as reg_app_c,
sum(case when fexamfeec>0 and ffreshexam='c' then fexamfeec else 0 end) as reg_fee_c,
sum(case when fexamfeec>0 and ffreshexam<>'c' then 1 else 0 end) as rep_app_c,
sum(case when fexamfeec>0 and ffreshexam<>'c' then fexamfeec else 0 end) as rep_fee_c,
sum(case when fexamfeed>0 and ffreshexam='d' then 1 else 0 end) as reg_app_d,
sum(case when fexamfeed>0 and ffreshexam='d' then fexamfeed else 0 end) as reg_fee_d,
sum(case when fexamfeed>0 and ffreshexam<>'d' then 1 else 0 end) as rep_app_d,
sum(case when fexamfeed>0 and ffreshexam<>'d' then fexamfeed else 0 end) as rep_fee_d,
sum(case when fexamfeee>0 and ffreshexam='e' then 1 else 0 end) as reg_app_e,
sum(case when fexamfeee>0 and ffreshexam='e' then fexamfeee else 0 end) as reg_fee_e,
sum(case when fexamfeee>0 and ffreshexam<>'e' then 1 else 0 end) as rep_app_e,
sum(case when fexamfeee>0 and ffreshexam<>'e' then fexamfeee else 0 end) as rep_fee_e,
sum(case when fexamfeef>0 and ffreshexam='f' then 1 else 0 end) as reg_app_f,
sum(case when fexamfeef>0 and ffreshexam='f' then fexamfeef else 0 end) as reg_fee_f,
sum(case when fexamfeef>0 and ffreshexam<>'f' then 1 else 0 end) as rep_app_f,
sum(case when fexamfeef>0 and ffreshexam<>'f' then fexamfeef else 0 end) as rep_fee_f,
sum(case when fexamfeea>0 and ffreshexam='a' then 1 else 0 end) +
sum(case when fexamfeeb>0 and ffreshexam='b' then 1 else 0 end) +
sum(case when fexamfeec>0 and ffreshexam='c' then 1 else 0 end) +
sum(case when fexamfeed>0 and ffreshexam='d' then 1 else 0 end) +
sum(case when fexamfeee>0 and ffreshexam='e' then 1 else 0 end) +
sum(case when fexamfeef>0 and ffreshexam='f' then 1 else 0 end) as tot_reg_app,
sum(case when fexamfeea>0 and ffreshexam='a' then fexamfeea else 0 end) +
sum(case when fexamfeeb>0 and ffreshexam='b' then fexamfeeb else 0 end) +
sum(case when fexamfeec>0 and ffreshexam='c' then fexamfeec else 0 end) +
sum(case when fexamfeed>0 and ffreshexam='d' then fexamfeed else 0 end) +
sum(case when fexamfeee>0 and ffreshexam='e' then fexamfeee else 0 end) +
sum(case when fexamfeef>0 and ffreshexam='f' then fexamfeef else 0 end) as tot_reg_fee,
sum(case when fexamfeea>0 and ffreshexam<>'a' then 1 else 0 end) +
sum(case when fexamfeeb>0 and ffreshexam<>'b' then 1 else 0 end) +
sum(case when fexamfeec>0 and ffreshexam<>'c' then 1 else 0 end) +
sum(case when fexamfeed>0 and ffreshexam<>'d' then 1 else 0 end) +
sum(case when fexamfeee>0 and ffreshexam<>'e' then 1 else 0 end) +
sum(case when fexamfeef>0 and ffreshexam<>'f' then 1 else 0 end) as tot_rep_app,
sum(case when fexamfeea>0 and ffreshexam<>'a' then fexamfeea else 0 end) +
sum(case when fexamfeeb>0 and ffreshexam<>'b' then fexamfeeb else 0 end) +
sum(case when fexamfeec>0 and ffreshexam<>'c' then fexamfeec else 0 end) +
sum(case when fexamfeed>0 and ffreshexam<>'d' then fexamfeed else 0 end) +
sum(case when fexamfeee>0 and ffreshexam<>'e' then fexamfeee else 0 end) +
sum(case when fexamfeef>0 and ffreshexam<>'f' then fexamfeef else 0 end) as tot_rep_fee,
sum(case when fexamfeea>0 then 1 else 0 end) +
sum(case when fexamfeeb>0 then 1 else 0 end) +
sum(case when fexamfeec>0 then 1 else 0 end) +
sum(case when fexamfeed>0 then 1 else 0 end) +
sum(case when fexamfeee>0 then 1 else 0 end) +
sum(case when fexamfeef>0 then 1 else 0 end) as tot_app,
sum(case when fexamfeea>0 then fexamfeea else 0 end) +
sum(case when fexamfeeb>0 then fexamfeeb else 0 end) +
sum(case when fexamfeec>0 then fexamfeec else 0 end) +
sum(case when fexamfeed>0 then fexamfeed else 0 end) +
sum(case when fexamfeee>0 then fexamfeee else 0 end) +
sum(case when fexamfeef>0 then fexamfeef else 0 end) as tot_fee
from candsum c inner join degree d on c.fdegree = d.fdegree and c.fexamno =d.fexamno
inner join college cl on c.fcollcode = cl.fcollcode
where d.fdeggrp = '{$fdeggrp}'
and c.fdegree between '{$fdegfrom}' and '{$fdegto}'
and c.fcollcode between '{$fcollfrom}' and '{$fcollto}'
and ftotalfee>0 group by c.fyear, c.fexamtype, c.fcollcode, d.fdegree ";
$result = $aobj_context->pobj_db->GetAll($query);
// var_dump($query);
// var_dump($result);
// die();
$objPHPExcel = new PHPExcel();
$fileName = 'EXAM FEE DETAILS(NEW FORMAT)';
$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'),
),
),
);
$count = "";
$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','AI','AJ','AK'];
$j=4;
$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('D1')->setwidth(15);
$objPHPExcel->getActiveSheet()->freezePane('A2');
$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Sl. No.')
->setCellValue('B1', 'Degree')
->setCellValue('C1', 'Description')
->setCellValue('D1', 'College Code')
->setCellValue('E1', 'College Name')
->setCellValue('F1', 'Year')
->setCellValue('G1', 'Exam_Type')
->setCellValue('H1', 'Regular_App Isem')
->setCellValue('I1', 'Regular_Fee Isem')
->setCellValue('J1', 'Repeater_App Isem')
->setCellValue('K1', 'Repeater_Fee Isem')
->setCellValue('L1', 'Regular_App IIsem')
->setCellValue('M1', 'Regular_Fee IIsem')
->setCellValue('N1', 'Repeater_App IIsem')
->setCellValue('O1', 'Repeater_Fee IIsem')
->setCellValue('P1', 'Regular_App IIIsem')
->setCellValue('Q1', 'Regular_Fee IIIsem')
->setCellValue('R1', 'Repeater_App IIIsem')
->setCellValue('S1', 'Repeater_Fee IIIsem')
->setCellValue('T1', 'Regular_App IVsem')
->setCellValue('U1', 'Regular_Fee IVsem')
->setCellValue('V1', 'Repeater_App IVsem')
->setCellValue('W1', 'Repeater_Fee IVsem')
->setCellValue('X1', 'Regular_App Vsem')
->setCellValue('Y1', 'Regular_Fee Vsem')
->setCellValue('Z1', 'Repeater_App Vsem')
->setCellValue('AA1', 'Repeater_Fee Vsem')
->setCellValue('AB1', 'Regular_App VIsem')
->setCellValue('AC1', 'Regular_Fee VIsem')
->setCellValue('AD1', 'Repeater_App VIsem')
->setCellValue('AE1', 'Repeater_Fee VIsem')
->setCellValue('AF1', 'Total_Regular_App')
->setCellValue('AG1', 'Total_Regular_Fee')
->setCellValue('AH1', 'Total_Repeater_App')
->setCellValue('AI1', 'Total_Repeater_Fee')
->setCellValue('AJ1', 'Total_Application')
->setCellValue('AK1', 'Total_Fee');
$objPHPExcel->getActiveSheet()->getStyle('A1:AK1')->applyFromArray($styleArray);
$objPHPExcel->getActiveSheet()->getColumnDimension('1')->setAutoSize(true);
$objPHPExcel->getActiveSheet()->getRowDimension('1')->setRowHeight(40);
//$objPHPExcel->getActiveSheet()->getStyle('A1:AI1')->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->getStyle('A1:AK1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A1:AK1')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$count=rtrim($count,", ");
foreach ($result as $key => $value) {
$slNo = $key + 2;
$j=4;
$objPHPExcel->getActiveSheet()->setCellValue('A' . $slNo, $slNo - 1)->getColumnDimension('A')->setwidth(8);
$objPHPExcel->getActiveSheet()->setCellValue('B' . $slNo, $value['fdegree'])->getColumnDimension('B')->setwidth(8.43);
$objPHPExcel->getActiveSheet()->setCellValue('C' . $slNo, $value['fdescpn'])->getColumnDimension('C')->setwidth(40);
$objPHPExcel->getActiveSheet()->setCellValue('D' . $slNo, $value['fcollcode'])->getColumnDimension('D')->setwidth(15);
$objPHPExcel->getActiveSheet()->setCellValue('E' . $slNo, $value['College_Name'])->getColumnDimension('E')->setwidth(50);
$objPHPExcel->getActiveSheet()->setCellValue('F' . $slNo, $value['fyear'])->getColumnDimension('F')->setwidth(10);
$objPHPExcel->getActiveSheet()->setCellValue('G' . $slNo, $value['fexamtype'])->getColumnDimension('G')->setwidth(12);
$objPHPExcel->getActiveSheet()->setCellValue('H' . $slNo, $value['reg_app_a'])->getColumnDimension('H')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('I' . $slNo, $value['reg_fee_a'])->getColumnDimension('I')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('J' . $slNo, $value['rep_app_a'])->getColumnDimension('J')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('K' . $slNo, $value['rep_fee_a'])->getColumnDimension('K')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('L' . $slNo, $value['reg_app_b'])->getColumnDimension('L')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('M' . $slNo, $value['reg_fee_b'])->getColumnDimension('M')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('N' . $slNo, $value['rep_app_b'])->getColumnDimension('N')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('O' . $slNo, $value['rep_fee_b'])->getColumnDimension('O')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('P' . $slNo, $value['reg_app_c'])->getColumnDimension('P')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('Q' . $slNo, $value['reg_fee_c'])->getColumnDimension('Q')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('R' . $slNo, $value['rep_app_c'])->getColumnDimension('R')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('S' . $slNo, $value['rep_fee_c'])->getColumnDimension('S')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('T' . $slNo, $value['reg_app_d'])->getColumnDimension('T')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('U' . $slNo, $value['reg_fee_d'])->getColumnDimension('U')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('V' . $slNo, $value['rep_app_d'])->getColumnDimension('V')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('W' . $slNo, $value['rep_fee_d'])->getColumnDimension('W')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('X' . $slNo, $value['reg_app_e'])->getColumnDimension('X')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('Y' . $slNo, $value['reg_fee_e'])->getColumnDimension('Y')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('Z' . $slNo, $value['rep_app_e'])->getColumnDimension('Z')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('AA' . $slNo, $value['rep_fee_e'])->getColumnDimension('AA')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('AB' . $slNo, $value['reg_app_f'])->getColumnDimension('AB')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('AC' . $slNo, $value['reg_fee_f'])->getColumnDimension('AC')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('AD' . $slNo, $value['rep_app_f'])->getColumnDimension('AD')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('AE' . $slNo, $value['rep_fee_f'])->getColumnDimension('AE')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('AF' . $slNo, $value['tot_reg_app'])->getColumnDimension('AF')->setwidth(20);
$objPHPExcel->getActiveSheet()->setCellValue('AG' . $slNo, $value['tot_reg_fee'])->getColumnDimension('AG')->setwidth(20);
$objPHPExcel->getActiveSheet()->setCellValue('AH' . $slNo, $value['tot_rep_app'])->getColumnDimension('AH')->setwidth(25);
$objPHPExcel->getActiveSheet()->setCellValue('AI' . $slNo, $value['tot_rep_fee'])->getColumnDimension('AI')->setwidth(22);
$objPHPExcel->getActiveSheet()->setCellValue('AJ' . $slNo, $value['tot_app'])->getColumnDimension('AJ')->setwidth(19);
$objPHPExcel->getActiveSheet()->setCellValue('AK' . $slNo, $value['tot_fee'])->getColumnDimension('AK')->setwidth(15);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':AK'. $slNo)->applyFromArray($styleArray);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':B' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':B' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('F' . $slNo . ':AK' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('F' . $slNo . ':AK' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
// $objPHPExcel->getActiveSheet()->getStyle('C' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_JUSTIFY);
$objPHPExcel->getActiveSheet()->getStyle('D' )->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('D' )->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
// $objPHPExcel->getActiveSheet()->getStyle('E' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_JUSTIFY);
// $objPHPExcel->getActiveSheet()->getStyle('F' . $slNo . ':AK' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
// $objPHPExcel->getActiveSheet()->getStyle('F' . $slNo . ':AK' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
// $objPHPExcel->getActiveSheet()->getStyle('C' . $slNo)->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->getStyle('E' . $slNo)->getAlignment()->setWrapText(true);
}
/*$objPHPExcel->getActiveSheet()->setTitle($fileName);
$objPHPExcel->getActiveSheet()->getPageSetup()
->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
$get_coll_name = "select FUNIVNAME as 'FUNIVNAME',FUNIVCODE,
FUNIVADD1 as 'state', pdf_logo_path,
ifnull(FEXAMAPPREQ,'F') as FEXAMAPPREQ From control";
$lobj_get_coll_name = $aobj_context->pobj_db->GetRow($get_coll_name);
// $deggrp = $aobj_context->mobj_data["dgp"];
// $query = "select distinct concat(fexamdate,' ',' Examination') as fexamdate
// from deggrp where fdeggrp = '{$deggrp}'";
// $results = $aobj_context->pobj_db->GetRow($query);
$aobj_context->FUNIVNAME = $lobj_get_coll_name['FUNIVNAME'];
$aobj_context->s_state = $lobj_get_coll_name['state'];
$aobj_context->pdf_logo_path = $lobj_get_coll_name['pdf_logo_path'];
$aobj_context->FUNIVCODE = $lobj_get_coll_name['FUNIVCODE'];
// die();
// $objPHPExcel->getActiveSheet()->getHeaderFooter()->addImage($aobj_context->main_src.'img/'.$aobj_context->FUNIVCODE.'_logo.jpg', PHPExcel_Worksheet_HeaderFooter::IMAGE_HEADER_LEFT);
$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&C&H&"-,Bold"&16' . $aobj_context->FUNIVNAME . "\n" . '&12' . $rtype);
$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&C&H'.$deggrp);
$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&RPage &P of &N');*/
getheaders($objPHPExcel, $fileName);
}
?>
|