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 : 13.58.103.70


Current Path : /proc/thread-self/root/var/www/html/admission/src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/admission/src/resultstatsrpt.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 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, 'Excel5');
    $objWriter->save('php://output');
}


function ResultStatsRpt($aobj_context)
{
    $reporttype = $aobj_context->mobj_data["reporttype"];
    $univcode = $aobj_context->mobj_data["univcode"];
    $Degree = $aobj_context->mobj_data["deggrp"];    
    $degfrom = $aobj_context->mobj_data["degfrom"];
    $degto = $aobj_context->mobj_data["degto"];
    $clgfrom = $aobj_context->mobj_data["clgfrom"];
    $clgto = $aobj_context->mobj_data["clgto"];
   
    
    


    $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 limit 1";
    

    // var_dump($query);
    // die();

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

    $objPHPExcel = new PHPExcel();
    $fileName = 'Result Statistic 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'),
            ),
        ),
    );

    $count = "";

    
    $j = 4;
    $objPHPExcel->getActiveSheet()->getStyle('1:2')->getFont()->setBold(true);
    $objPHPExcel->getActiveSheet()->getStyle('1:2')->getFont()->setSize(12);
    $objPHPExcel->getActiveSheet()->freezePane('A1');
    $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Sl No')
        ->setCellValue('B1', 'Degree')
        ->setCellValue('C1', 'Exam')
        ->setCellValue('D1', 'College')
        ->setCellValue('E1', 'Appeared')
        ->setCellValue('E2', 'Male')
        ->setCellValue('F2', 'Female')
        ->setCellValue('G2', 'Total')
        ->setCellValue('H1', 'Passed')
        ->setCellValue('H2', 'Male')
        ->setCellValue('I2', 'Female')
        ->setCellValue('J2', 'Total')
        ->setCellValue('K1', 'Passing %')
        ->setCellValue('K2', 'Male')
        ->setCellValue('L2', 'Female')
        ->setCellValue('M2', 'Total')

        ->setCellValue('N1', 'GM Appeared')
        ->setCellValue('N2', 'Male')
        ->setCellValue('O2', 'Female')
        ->setCellValue('P2', 'Total')
        ->setCellValue('Q1', 'GM Passed')
        ->setCellValue('Q2', 'Male')
        ->setCellValue('R2', 'Female')
        ->setCellValue('S2', 'Total')
        ->setCellValue('T1', 'GM Pass %')
        ->setCellValue('T2', 'Male')
        ->setCellValue('U2', 'Female')
        ->setCellValue('V2', 'Total')

        ->setCellValue('W1', 'Cat-I Appeared')
        ->setCellValue('W2', 'Male')
        ->setCellValue('X2', 'Female')
        ->setCellValue('Y2', 'Total')
        ->setCellValue('Z1', 'Cat-I Passed')
        ->setCellValue('Z2', 'Male')
        ->setCellValue('AA2', 'Female')
        ->setCellValue('AB2', 'Total')
        ->setCellValue('AC1', 'Cat-I Pass %')
        ->setCellValue('AC2', 'Male')
        ->setCellValue('AD2', 'Female')
        ->setCellValue('AE2', 'Total')

        ->setCellValue('AF1', 'IIA Appeared')
        ->setCellValue('AF2', 'Male')
        ->setCellValue('AG2', 'Female')
        ->setCellValue('AH2', 'Total')
        ->setCellValue('AI1', 'IIA Passed')
        ->setCellValue('AI2', 'Male')
        ->setCellValue('AJ2', 'Female')
        ->setCellValue('AK2', 'Total')
        ->setCellValue('AL1', 'IIA Pass %')
        ->setCellValue('AL2', 'Male')
        ->setCellValue('AM2', 'Female')
        ->setCellValue('AN2', 'Total')

        ->setCellValue('AO1', 'IIB Appeared')
        ->setCellValue('AO2', 'Male')
        ->setCellValue('AP2', 'Female')
        ->setCellValue('AQ2', 'Total')
        ->setCellValue('AR1', 'IIB Passed')
        ->setCellValue('AR2', 'Male')
        ->setCellValue('AS2', 'Female')
        ->setCellValue('AT2', 'Total')
        ->setCellValue('AU1', 'IIB Pass %')
        ->setCellValue('AU2', 'Male')
        ->setCellValue('AV2', 'Female')
        ->setCellValue('AW2', 'Total')

        ->setCellValue('AX1', 'IIIA Appeared')
        ->setCellValue('AX2', 'Male')
        ->setCellValue('AY2', 'Female')
        ->setCellValue('AZ2', 'Total')
        ->setCellValue('BA1', 'IIIA Passed')
        ->setCellValue('BA2', 'Male')
        ->setCellValue('BB2', 'Female')
        ->setCellValue('BC2', 'Total')
        ->setCellValue('BD1', 'IIIA Pass %')
        ->setCellValue('BD2', 'Male')
        ->setCellValue('BE2', 'Female')
        ->setCellValue('BF2', 'Total')

        ->setCellValue('BG1', 'IIIB Appeared')
        ->setCellValue('BG2', 'Male')
        ->setCellValue('BH2', 'Female')
        ->setCellValue('BI2', 'Total')
        ->setCellValue('BJ1', 'IIIB Passed')
        ->setCellValue('BJ2', 'Male')
        ->setCellValue('BK2', 'Female')
        ->setCellValue('BL2', 'Total')
        ->setCellValue('BM1', 'IIIB Pass %')
        ->setCellValue('NM2', 'Male')
        ->setCellValue('BN2', 'Female')
        ->setCellValue('BO2', 'Total')

        ->setCellValue('BP1', 'SC Appeared')
        ->setCellValue('BP2', 'Male')
        ->setCellValue('BQ2', 'Female')
        ->setCellValue('BR2', 'Total')
        ->setCellValue('BS1', 'SC Passed')
        ->setCellValue('BS2', 'Male')
        ->setCellValue('BT2', 'Female')
        ->setCellValue('BU2', 'Total')
        ->setCellValue('BV1', 'SC Pass %')
        ->setCellValue('BV2', 'Male')
        ->setCellValue('BW2', 'Female')
        ->setCellValue('BX2', 'Total')

        ->setCellValue('BY1', 'ST Appeared')
        ->setCellValue('BY2', 'Male')
        ->setCellValue('BZ2', 'Female')
        ->setCellValue('CA2', 'Total')
        ->setCellValue('CB1', 'ST Passed')
        ->setCellValue('CB2', 'Male')
        ->setCellValue('CC2', 'Female')
        ->setCellValue('CD2', 'Total')
        ->setCellValue('CE1', 'ST Pass %')
        ->setCellValue('CE2', 'Male')
        ->setCellValue('CF2', 'Female')
        ->setCellValue('CG2', 'Total');  


    $objPHPExcel->getActiveSheet()->getStyle('A1:M2')->applyFromArray($styleArray);
    $objPHPExcel->getActiveSheet()->mergeCells('A1:A2');
    $objPHPExcel->getActiveSheet()->mergeCells('B1:B2');
    $objPHPExcel->getActiveSheet()->mergeCells('C1:C2');
    $objPHPExcel->getActiveSheet()->mergeCells('D1:D2');
    $objPHPExcel->getActiveSheet()->mergeCells('E1:G1');

    $objPHPExcel->getActiveSheet()->mergeCells('H1:J1');
    $objPHPExcel->getActiveSheet()->mergeCells('K1:M1');

    $objPHPExcel->getActiveSheet()->mergeCells('N1:P1');
    $objPHPExcel->getActiveSheet()->mergeCells('Q1:S1');
    $objPHPExcel->getActiveSheet()->mergeCells('T1:V1');

    $objPHPExcel->getActiveSheet()->mergeCells('W1:Y1');
    $objPHPExcel->getActiveSheet()->mergeCells('Z1:AB1');
    $objPHPExcel->getActiveSheet()->mergeCells('AC1:AE1');

    $objPHPExcel->getActiveSheet()->mergeCells('AF1:AH1');
    $objPHPExcel->getActiveSheet()->mergeCells('AI1:AK1');
    $objPHPExcel->getActiveSheet()->mergeCells('AL1:AN1');

    $objPHPExcel->getActiveSheet()->mergeCells('AO1:AQ1');
    $objPHPExcel->getActiveSheet()->mergeCells('AR1:AT1');
    $objPHPExcel->getActiveSheet()->mergeCells('AU1:AW1');

    $objPHPExcel->getActiveSheet()->mergeCells('AX1:AZ1');
    $objPHPExcel->getActiveSheet()->mergeCells('BA1:BC1');
    $objPHPExcel->getActiveSheet()->mergeCells('BD1:BF1');

    $objPHPExcel->getActiveSheet()->mergeCells('BG1:BI1');
    $objPHPExcel->getActiveSheet()->mergeCells('BJ1:BL1');
    $objPHPExcel->getActiveSheet()->mergeCells('BM1:BO1');

    $objPHPExcel->getActiveSheet()->mergeCells('BP1:BR1');
    $objPHPExcel->getActiveSheet()->mergeCells('BS1:BU1');
    $objPHPExcel->getActiveSheet()->mergeCells('BV1:BX1');

    $objPHPExcel->getActiveSheet()->mergeCells('BY1:CA1');
    $objPHPExcel->getActiveSheet()->mergeCells('CB1:CD1');
    $objPHPExcel->getActiveSheet()->mergeCells('CE1:CG1');

    // $objPHPExcel->getActiveSheet()->getColumnDimension('I1')->setAutoSize(true);
    $objPHPExcel->getActiveSheet()->getRowDimension('1')->setRowHeight(29);
    $objPHPExcel->getActiveSheet()->getStyle('A1:CG2')->getAlignment()->setWrapText(true);
    $objPHPExcel->getActiveSheet()->getStyle('A1:CG2')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    $objPHPExcel->getActiveSheet()->getStyle('A1:CG2')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);

    //$count = rtrim($count, ", ");
    // var_dump($count);
    // die();
    // var_dump($result);
    // die();
    $j = 2;
    $slNo = 1;
    // foreach ($result as $key => $value) {        
       
       
    //     $objPHPExcel->getActiveSheet()->setCellValue('A' . $j, $slNo)
    //     ->getColumnDimension('A'. $j)->setwidth(5);

    //     $objPHPExcel->getActiveSheet()->setCellValue('B' . $j, $value['fcollcode'])
    //     ->getColumnDimension('B'. $j)->setwidth(10.43);

    //     $objPHPExcel->getActiveSheet()->setCellValue('C' . $j, $value['fshortname'])
    //     ->getColumnDimension('C'. $j)->setwidth(50);

    //     $objPHPExcel->getActiveSheet()->setCellValue('D' . $j, $value['fdegree'])
    //     ->getColumnDimension('D'. $j)->setwidth(50);

    //     $objPHPExcel->getActiveSheet()->setCellValue('E' . $j, $value['fdescpn'])
    //     ->getColumnDimension('E'. $j)->setwidth(50);

    //     $objPHPExcel->getActiveSheet()->setCellValue('F' . $j, $value['fcnt'])
    //     ->getColumnDimension('F'. $j)->setwidth(50);

    //     $objPHPExcel->getActiveSheet()->setCellValue('G' . $j, $value['fee'])
    //     ->getColumnDimension('G'. $j)->setwidth(50);
    //     $j++;
    //     $slNo++;
       
    // }

    foreach ($result as $key => $value) {        
       
       
        $objPHPExcel->getActiveSheet()->setCellValue('A2', $slNo)
        ->getColumnDimension('A')->setwidth(5);

        $objPHPExcel->getActiveSheet()->setCellValue('B2', $value['fcollcode'])
        ->getColumnDimension('B')->setwidth(10.43);

        $objPHPExcel->getActiveSheet()->setCellValue('C2', $value['fshortname'])
        ->getColumnDimension('C')->setwidth(50);

        $objPHPExcel->getActiveSheet()->setCellValue('D2', $value['fdegree'])
        ->getColumnDimension('D')->setwidth(50);

        $objPHPExcel->getActiveSheet()->setCellValue('E2', $value['fdescpn'])
        ->getColumnDimension('E')->setwidth(50);

        $objPHPExcel->getActiveSheet()->setCellValue('F2', $value['fcnt'])
        ->getColumnDimension('F')->setwidth(50);

        $objPHPExcel->getActiveSheet()->setCellValue('G2', $value['fee'])
        ->getColumnDimension('G')->setwidth(50);
        $j++;
        $slNo++;
       
    }

    //$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setwidth(12);




    $objPHPExcel->getActiveSheet()->setTitle($fileName);
    $objPHPExcel->getActiveSheet()->getPageSetup()
        ->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);


    // $objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&RPage &P of &N');    

    // $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);
}