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


Current Path : /var/www/oasis/Report_details/
Upload File :
Current File : /var/www/oasis/Report_details/xl_AckAppReport.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);
date_default_timezone_set('GMT+5:30');
ini_set('max_execution_time', 300);
ini_set('memory_limit', '2G');
// 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
    ini_set('max_execution_time', '300');
    $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);
    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 getAcknowledgeAppReport($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $collcode = $_SESSION['collcode'];
    $degree = $aobj_context->mobj_data['degree'];
    $appFrom = $aobj_context->mobj_data['appFrom'];
    $appTo = $aobj_context->mobj_data['appTo'];
    $rtype = $aobj_context->mobj_data['type'];

    if($degree === "All"){
        $degCond = "";
    }else{
        $degCond="and a.fdegree='{$degree}'";
    }

    if($rtype === "All"){
        $cond="";
        $fileName = 'ExamAppList.xls';
    }else if($rtype === "acknowledge"){
        $cond="and ifnull(a.fackdate, '') <> ''";
         $fileName = 'ExamAppAckList.xls';
    }else if($rtype === "not-ack"){
        $cond="and ifnull(a.fackdate, '') = ''";
        $fileName = 'ExamAppNotAckList.xls';
    }

    $query="select distinct 
            ifnull(a.appno, '')as appno, 
            ifnull(a.fdegree, '')as fdegree, 
            ifnull(d.fdescpn, '')as fdescpn, 
            ifnull(a.fexamno, '')as fexamno,
            ifnull(a.fregno, '')as fregno,
            ifnull(s.fname, '')as fname,
            ifnull(date_format(a.fackdate, '%d/%m/%Y'), '')as fackdate,
            ifnull(a.ftotalfee, '')as ftotalfee, 
            group_concat(distinct substring(f.ffeecode, 3), '->', f.famount separator '*') as ffees,
            ifnull(s.fcombcode, '')as fcombcode,
            ifnull(s.fsection, '')as fsection
            from appcandsum a
            inner join student s on s.fregno = a.fregno
            inner join degree d on d.fdegree = a.fdegree
            inner join appstudfee f on f.appno = a.appno
            where a.fcollcode='{$collcode}' 
            and lpad(a.appno, 10, '0')>='{$appFrom}'
            and lpad(a.appno, 10, '0')<='{$appTo}' 
            {$cond}
            group by a.fdegree, a.fregno, a.appno
            order by a.fdegree, a.fregno, a.appno;";
   
          
            // var_dump($query);
            // die();
    $result = $aobj_context->mobj_db->GetAll($query);

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

    
  $objPHPExcel->getActiveSheet()->getStyle('1:2')->getFont()->setBold(true);
  $objPHPExcel->getActiveSheet()->getStyle('1:2')->getFont()->setSize(12);
  $objPHPExcel->getActiveSheet()->getColumnDimension('A1')->setwidth(30);
  $objPHPExcel->getActiveSheet()->freezePane('A3');

  
  $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Sl. No.')
  ->setCellValue('B1', 'Degree')
  ->setCellValue('C1', 'Degree Description')
  ->setCellValue('D1', 'Semester')
  ->setCellValue('E1', 'Reg. No.')
  ->setCellValue('F1', 'Student Name')
  ->setCellValue('G1', 'App. No.')
  ->setCellValue('H1', 'Ack. Date')
  ->setCellValue('I1', 'Fees Details')
  ->setCellValue('I2', 'Exam')
  ->setCellValue('J2', 'Marks Card')
  ->setCellValue('K2', 'Convocation')
  ->setCellValue('L2', 'Transcription and Graduation')
  ->setCellValue('M2', 'Fine')
  ->setCellValue('N2', 'Total')
  ->setCellValue('O1', 'Combination')
  ->setCellValue('P1', 'Section');

  $objPHPExcel->getActiveSheet()->getStyle('A1:P2')->applyFromArray($styleArray);
  $objPHPExcel->getActiveSheet()->mergeCells('I1:N1')
  ->mergeCells('A1:A2')
  ->mergeCells('B1:B2')
  ->mergeCells('C1:C2')
  ->mergeCells('D1:D2')
  ->mergeCells('E1:E2')
  ->mergeCells('F1:F2')
  ->mergeCells('G1:G2')
  ->mergeCells('H1:H2');
      
  $objPHPExcel->getActiveSheet()->getColumnDimension('1')->setAutoSize(true);
  $objPHPExcel->getActiveSheet()->getRowDimension('1')->setRowHeight(25);
  $objPHPExcel->getActiveSheet()->getRowDimension('2')->setRowHeight(20);
  $objPHPExcel->getActiveSheet()->getStyle('A1:P2')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  $objPHPExcel->getActiveSheet()->getStyle('A1:P2')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
  
  $i=1;
  foreach ($result as $key => $value) {     
    $slNo = $key + 3;
    $split = explode('*',$value['ffees']);
    $exam = "";
    $markscard = "";
    $convo = "";
    $tranGrad = "";
    $fine = "";
    foreach($split as $val){
        $splitMarks = explode('->',$val);
        if(trim(strtolower($splitMarks[0]))==="exam fee"){
            $exam=$splitMarks[1];
        }else if(trim(strtolower($splitMarks[0]))==="marks card fee"){
            $markscard = $splitMarks[1];
        }else if(trim(strtolower($splitMarks[0]))==="fine"){
            $fine = $splitMarks[1];
        }else if(trim(strtolower($splitMarks[0]))==="convocation fee"){
            $convo = $splitMarks[1];
        }else if(trim(strtolower($splitMarks[0]))==="transcript and graduation fee"){
            $tranGrad = $splitMarks[1];
        }
    }

    $objPHPExcel->getActiveSheet()->getRowDimension($slNo)->setRowHeight(25);
    $objPHPExcel->getActiveSheet()->setCellValue('A' . $slNo, $i)->getColumnDimension('A')->setwidth(8);
    $objPHPExcel->getActiveSheet()->setCellValue('B' . $slNo, $value['fdegree'])->getColumnDimension('B')->setwidth(12);
    $objPHPExcel->getActiveSheet()->setCellValue('C' . $slNo, $value['fdescpn'])->getColumnDimension('C')->setwidth(40);
    $objPHPExcel->getActiveSheet()->setCellValue('D' . $slNo, $value['fexamno'])->getColumnDimension('D')->setwidth(12); 
    $objPHPExcel->getActiveSheet()->setCellValue('E' . $slNo, $value['fregno'] )->getColumnDimension('E')->setwidth(18);
    $objPHPExcel->getActiveSheet()->setCellValue('F' . $slNo, $value['fname'] )->getColumnDimension('F')->setwidth(45);
    $objPHPExcel->getActiveSheet()->setCellValue('G' . $slNo, $value['appno'])->getColumnDimension('G')->setwidth(13);
    $objPHPExcel->getActiveSheet()->setCellValue('H' . $slNo, $value['fackdate'])->getColumnDimension('H')->setwidth(15);
    $objPHPExcel->getActiveSheet()->setCellValue('I' . $slNo, $exam)->getColumnDimension('I')->setwidth(15);
    $objPHPExcel->getActiveSheet()->setCellValue('J' . $slNo, $markscard)->getColumnDimension('J')->setwidth(15);
    $objPHPExcel->getActiveSheet()->setCellValue('K' . $slNo, $convo)->getColumnDimension('K')->setwidth(15);
    $objPHPExcel->getActiveSheet()->setCellValue('L' . $slNo, $tranGrad)->getColumnDimension('L')->setwidth(15);
    $objPHPExcel->getActiveSheet()->setCellValue('M' . $slNo, $fine)->getColumnDimension('M')->setwidth(15);
    $objPHPExcel->getActiveSheet()->setCellValue('N' . $slNo, $value['ftotalfee'])->getColumnDimension('N')->setwidth(15);
    $objPHPExcel->getActiveSheet()->setCellValue('O' . $slNo, $value['fcombcode'])->getColumnDimension('O')->setwidth(15);
    $objPHPExcel->getActiveSheet()->setCellValue('P' . $slNo, $value['fsection'])->getColumnDimension('P')->setwidth(15);
    
   
    $objPHPExcel->getActiveSheet()->getStyle('A'.$slNo.':'.'B'.$slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    $objPHPExcel->getActiveSheet()->getStyle('A'.$slNo.':'.'B'.$slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::VERTICAL_CENTER); 

    $objPHPExcel->getActiveSheet()->getStyle('D'.$slNo.':'.'E'.$slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    $objPHPExcel->getActiveSheet()->getStyle('D'.$slNo.':'.'E'.$slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::VERTICAL_CENTER); 

    $objPHPExcel->getActiveSheet()->getStyle('G'.$slNo.':'.'P'.$slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    $objPHPExcel->getActiveSheet()->getStyle('G'.$slNo.':'.'P'.$slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::VERTICAL_CENTER);

    $objPHPExcel->getActiveSheet()->getStyle('A'.$slNo.':'.'P'.$slNo)->applyFromArray($styleArray);
    $i++;
    }
    getheaders($objPHPExcel, $fileName);
   }
?>