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


Current Path : /var/www/html/reva/src/
Upload File :
Current File : /var/www/html/reva/src/PracticalIndent.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);
    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(true);

    // 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 PRACTICALQPINDENT($aobj_context)
{

    $objPHPExcel = new PHPExcel();
    $univcode = $aobj_context->mobj_data["univcode"];
    $fileName = 'PRACTICAL QPINDENT SRN WISE Report';
    $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', 'School Code')
        ->setCellValue('B1', 'School Name')
        ->setCellValue('C1', 'Program Code')
        ->setCellValue('D1', 'Program Name')
        ->setCellValue('E1', 'Exam No')
        ->setCellValue('F1', 'Subject Code')
        ->setCellValue('G1', 'Course Name')
        ->setCellValue('H1', 'Course Code')
        ->setCellValue('I1', 'Subject Type')
        ->setCellValue('J1', 'SRN');

    $j = 3;
    $slNo = 1;
    $sum = array();



    $fdeggrp = $aobj_context->mobj_data["fdeggrp"];
    //$fdatefrom = $aobj_context->mobj_data["fdatefrom"];
    //$fdateto = $aobj_context->mobj_data["fdateto"];
    $fyear = $aobj_context->mobj_data["fyear"];
    $fexamtype = $aobj_context->mobj_data["fexamtype"];
    // $fdeggrp = $aobj_context->mobj_data["fdeggrp"];


    $query = "select c.fcollcode as college ,cl.fcollname as name,c.fdegree as degree,g.fdescpn as descp,c.fexamno as exam, 
            s.fcsubcode as subcode,concat(s.fmarkdesc1,s.fmarkdesc2) as fsubname,s.fsubshort as short,s.fssubname as subtype,c.fregno as SRN
            from subject s,canddet c,candsum d,degree g, college cl
            where s.fdegree=c.fdegree and s.fsubcode=c.fsubcode and s.ftheory='f' and s.fintass='f' 
            and ifnull(c.fpassmth,'')='' and ifnull(c.fpresent,'')='P'
            and c.fregno=d.fregno and ifnull(d.frecptdate,'')<>''
            and c.fdegree like '{$fdeggrp}' and c.fyear='{$fyear}' and c.fexamtype='{$fexamtype}' 
            and c.fdegree=g.fdegree and c.fexamno=g.fexamno and c.fcollcode = cl.fcollcode and d.fcollcode =cl.fcollcode
            group by c.fcollcode,cl.fcollname,c.fdegree,g.fdescpn,c.fexamno,s.fcsubcode,s.FQPCODE,
            concat(s.fmarkdesc1,s.fmarkdesc2),s.fsubshort,s.fssubname,c.fregno
            order by c.fcollcode,cl.fcollname,c.fdegree,c.fexamno,s.fcsubcode,s.fqpcode";
   
    $result = $aobj_context->pobj_db->GetAll($query);

    $i = 2;
	$totamt=0;
    foreach ($result as $key => $value) {
        
        $objPHPExcel->getActiveSheet()
            ->setCellValue('A' . $i, $value["college"]);
        $objPHPExcel->getActiveSheet()
            ->setCellValue('B' . $i, $value["name"]);
        $objPHPExcel->getActiveSheet()
            ->setCellValue('C' . $i, $value["degree"]);
        $objPHPExcel->getActiveSheet()
            ->setCellValue('D' . $i, $value["descp"]);
        $objPHPExcel->getActiveSheet()
            ->setCellValue('E' . $i, $value['examno']);
        $objPHPExcel->getActiveSheet()
            ->setCellValue('F' . $i, $value["subcode"]);
        $objPHPExcel->getActiveSheet()
            ->setCellValue('G' . $i, $value["fsubname"]);
        $objPHPExcel->getActiveSheet()
            ->setCellValue('H' . $i, $value["short"]);
        $objPHPExcel->getActiveSheet()
            ->setCellValue('I' . $i, $value["subtype"]);
        $objPHPExcel->getActiveSheet()
            ->setCellValue('J' . $i, $value["SRN"]);
        $i++;
    }

    getheaders($objPHPExcel, $fileName);
}