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.143.7.53


Current Path : /var/www/oasis/Report_details/
Upload File :
Current File : /var/www/oasis/Report_details/iaMarksQnWiseReportExcel.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');

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 getIaMarksQnWiseReportExcel($aobj_context)
{
    session_start();
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
   
    $collcode=$_SESSION['collcode'];
    $teachcode = $aobj_context->mobj_data["teachcode"];
    $classid = $aobj_context->mobj_data["classid"];
    $subelement = $aobj_context->mobj_data["subelement"];
    $txtmarks = $aobj_context->mobj_data["txtmarks"];
    $txtunits = $aobj_context->mobj_data["txtunits"];
    $testName = $aobj_context->mobj_data["testName"];
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);

 $split = explode("*", $subelement);
    $subelement = $split[0];
    $subdet = $split[1];
	

	$main_src_obj=(explode("/",$_SERVER["REQUEST_URI"]));
	$main_src=$main_src_obj[1];
	$pdf_writer_class=$aobj_context->main_src."/maya-pdf/fpdf.php";
	$root_pdf_file_download=$aobj_context->main_src."/Report_details/output/report_me_student_list.pdf";
	
	include($pdf_writer_class);		



	$page_header_university = "select concat(FUNIVNAME,', ',FTOWN) as FUNIVNAME, '' as FTOWN, date_format(now(),'%d/%m/%Y') as date from control";
	$lobj_page_header_university = $aobj_context->mobj_db->GetRow($page_header_university);
	
	$page_header_college ="select concat('[ ',FCOLLCODE,' ]  ',FCOLLNAME,', ',FTOWN) as college_name
							from college where FCOLLCODE='{$college_code}'";
	$lobj_page_header_college = $aobj_context->mobj_db->GetRow($page_header_college); 

	$page_header_degree = "select concat('[ ',FDEGREE,' ] - ', FDESCPN) as Degree_name, 
							concat('( ', FEXAMNAME ,' Examination ',FEXAMDATE,')') as Exam ,FADYEAR
							from degree where FDEGREE = '{$degree_code}' and FEXAMNO='{$exam_code}' ";
	$lobj_page_header_degree = $aobj_context->mobj_db->GetRow($page_header_degree);
	
	$page_header_REGROLL = "select FREGROLL from control";
		$lobj_page_header_REGROLL = $aobj_context->mobj_db->GetRow($page_header_REGROLL);

    $headerQry = "select a.fclassname, s.fsubname, m.fdegree, m.ftest from marksint m 
                inner join subject s on left(s.fcsubcode, 4) = left(m.fsubcode, 4) 
                and m.fdegree = s.fdegree and m.fexamno = s.fexamno
                inner join attendsum sum on sum.fdegree = m.fdegree and 
                left(sum.fsubcode, 4) = left(m.fsubcode, 4)
                inner join attclass a on a.fclassid = sum.fclassid 
                where sum.fclassid='{$classid}'
                and m.fcollcode = '{$collcode}' 
                and m.fsubcode='{$subelement}' 
                and m.ftest='{$testName}' group by m.fsubcode, a.fclassid";

    $lobj_page_header = $aobj_context->mobj_db->GetRow($headerQry);
	
   		
	$get_student_data = ""; 
		  
	$lobj_get_student_data = $aobj_context->mobj_db->GetAll($get_student_data);	
	$page_header_FEEZEDorNOT = "select if(FCMESTATUS is null,'NOT CONFIRMED',concat('CONFIRMED(',FCMESTATUS,')')) as MESTATUS								
								from colldeg where fcollcode='{$college_code}'
								and fdegree='{$degree_code}'";
	$lobj_page_header_FEEZEDorNOT = $aobj_context->mobj_db->GetRow($page_header_FEEZEDorNOT);
	$pdf->REPORT_STATUS=$lobj_page_header_FEEZEDorNOT['MESTATUS'];
	
	// $pdf->AddPage('L');
	// $pdf->SetFont('Courier','',9);
    $query = "select distinct fcollcode,fdegree,fexamno from attendsum where fclassid = '{$classid}'";
    $res=$aobj_context->mobj_db->GetRow($query);
	$collcode = $res['fcollcode'];
	$degree = $res['fdegree'];
	$exam = $res['fexamno'];

	$query = "select * from subdet 
	where fcollcode = '{$collcode}' 
	and DATE_FORMAT(NOW(),'%Y-%m-%d') between DATE_FORMAT(fiafrom,'%Y-%m-%d') 
	AND DATE_FORMAT(fiato,'%Y-%m-%d')
	and concat(fcsubcode,fsubcode) = '{$subelement}'";
	$res3=$aobj_context->mobj_db->GetAll($query);
	

	$query = "select * from control";
	$res9=$aobj_context->mobj_db->GetRow($query);
	$FREGROLL = $res9['FREGROLL'];

    if(strtolower($subdet) == "cie"){
        $colcond = "ifnull(mak.fmarks11, '-1')as fmarks11, ifnull(mak.fmarks12, '-1')as fmarks12, ifnull(mak.fmarks13, '-1')as fmarks13, ifnull(mak.fmarks14, '-1')as fmarks14,
                    ifnull(mak.fmarks21, '-1')as fmarks21, ifnull(mak.fmarks22, '-1')as fmarks22, ifnull(mak.fmarks23, '-1')as fmarks23, ifnull(mak.fmarks24, '-1')as fmarks24,
                    ifnull(mak.fmarks31, '-1')as fmarks31, ifnull(mak.fmarks32, '-1')as fmarks32, ifnull(mak.fmarks33, '-1')as fmarks33, ifnull(mak.fmarks34, '-1')as fmarks34,
                    ifnull(mak.fmarks41, '-1')as fmarks41, ifnull(mak.fmarks42, '-1')as fmarks42, ifnull(mak.fmarks43, '-1')as fmarks43, ifnull(mak.fmarks44, '-1')as fmarks44";
    }else if(strtolower($subdet) == "cie-activity_1" || strtolower($subdet) == "cie-activity_2"){
        $colcond = "ifnull(mak.fmarks11, '-1')as fmarks11, ifnull(mak.fmarks12, '-1')as fmarks12, ifnull(mak.fmarks13, '-1')as fmarks13, 
                    ifnull(mak.fmarks14, '-1')as fmarks14, ifnull(mak.fmarks15, '-1')as fmarks15, ifnull(mak.fmarks16, '-1')as fmarks16";
    }
   

   $query="select stu.FREGNO, stu.FNAME, sd.fexamno, sd.fdegree, stu.fcollcode,
   {$colcond}, mak.FTOTAL,  mak.FACTTOTAL,
   mak.fsubcode, mak.fdegree, mak.fexamno, 
   fnotest as FTEST, fu1max, fu2max, fqnno 
   FROM attendsum a inner join student stu on stu.FREGNO=a.FREGNO and stu.fdegree = a.fdegree
   inner join degree d on d.FDEGREE =a.FDEGREE and d.Fexamno=a.Fexamno
   inner join subdet sd on a.fdegree = sd.fdegree and a.fexamno = sd.fexamno 
   and left(a.fsubcode,4) = left(sd.fcsubcode,4)
   left join marksint mak ON a.fdegree = mak.fdegree and a.FREGNO=mak.FREGNO 
   and mak.ftest = '{$testName}' and mak.fsubcode='{$subelement}' 
   where  a.fteachcode = '{$teachcode}' and a.fclassid = '{$classid}' 
   and a.FCOLLCODE='{$collcode}'
   and left(a.fsubcode,4) = left('{$subelement}',4) 
   group by fregno order by FREGNO";

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

    $getCo = "select ifnull(FCO, '')as FCO from maxmarksint where 
              fclassid='{$classid}' and ftestname='{$testName}' and fsubcode='{$subelement}'";
    $resCo=$aobj_context->mobj_db->GetAll($getCo);
    $count = count($resCo);
    // Example: 
    $objPHPExcel = new PHPExcel();
    
    $fileName = 'student_ia_marks_det.xls';
    // var_dump($subdet);die();
     
    $objPHPExcel->getProperties()->setCreator("Uniclare")
    ->setLastModifiedBy("Me")->setTitle("My Excel Sheet")
    ->setSubject("My Excel Sheet")->setDescription("Excel Sheet")
    ->setKeywords("Excel Sheet")->setCategory("Me");
    
    $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'];
  $j=4;
  if($subdet == "CIE"){
  $objPHPExcel->getActiveSheet()->getStyle('1:1')->getFont()->setBold(true);
  $objPHPExcel->getActiveSheet()->getStyle('1:1')->getFont()->setSize(12);
  $objPHPExcel->getActiveSheet()->getRowDimension(1)->setRowHeight(25);
  $objPHPExcel->getActiveSheet()->getRowDimension(2)->setRowHeight(25);
  $objPHPExcel->getActiveSheet()->getRowDimension(3)->setRowHeight(25);
  $objPHPExcel->getActiveSheet()->getColumnDimension('A1')->setwidth(30);
  $objPHPExcel->getActiveSheet()->freezePane('A4');
//   $objPHPExcel->getActiveSheet()->freezePane('D1');


  $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Sl No.');
  $objPHPExcel->getActiveSheet()->setCellValue('B1', 'USN');
  $objPHPExcel->getActiveSheet()->setCellValue('C1', 'Student Name ');
  $objPHPExcel->getActiveSheet()->setCellValue('D1', '1. Max. Marks(25)');
  $objPHPExcel->getActiveSheet()->setCellValue('D2', 'CO');
  $objPHPExcel->getActiveSheet()->setCellValue('D3', 'Total');
  $objPHPExcel->getActiveSheet()->setCellValue('E3', 'A');
  $objPHPExcel->getActiveSheet()->setCellValue('F3', 'B');
  $objPHPExcel->getActiveSheet()->setCellValue('G3', 'C');
  $objPHPExcel->getActiveSheet()->setCellValue('H3', 'D');
  $objPHPExcel->getActiveSheet()->setCellValue('I3', 'Tot');
  $objPHPExcel->getActiveSheet()->setCellValue('J1', '2. Max. Marks(25)');
  $objPHPExcel->getActiveSheet()->setCellValue('J2', '');
  $objPHPExcel->getActiveSheet()->setCellValue('J3', 'A');
  $objPHPExcel->getActiveSheet()->setCellValue('K3', 'B');
  $objPHPExcel->getActiveSheet()->setCellValue('L3', 'C');
  $objPHPExcel->getActiveSheet()->setCellValue('M3', 'D');
  $objPHPExcel->getActiveSheet()->setCellValue('N3', 'Tot');
  $objPHPExcel->getActiveSheet()->setCellValue('O1', '3. Max. Marks(25)');
  $objPHPExcel->getActiveSheet()->setCellValue('O2', '');
  $objPHPExcel->getActiveSheet()->setCellValue('O3', 'A');
  $objPHPExcel->getActiveSheet()->setCellValue('P3', 'B');
  $objPHPExcel->getActiveSheet()->setCellValue('Q3', 'C');
  $objPHPExcel->getActiveSheet()->setCellValue('R3', 'D');
  $objPHPExcel->getActiveSheet()->setCellValue('S3', 'Tot');
  $objPHPExcel->getActiveSheet()->setCellValue('T1', '4. Max. Marks(25)');
  $objPHPExcel->getActiveSheet()->setCellValue('T2', '');
  $objPHPExcel->getActiveSheet()->setCellValue('T3', 'A');
  $objPHPExcel->getActiveSheet()->setCellValue('U3', 'B');
  $objPHPExcel->getActiveSheet()->setCellValue('V3', 'C');
  $objPHPExcel->getActiveSheet()->setCellValue('W3', 'D');
  $objPHPExcel->getActiveSheet()->setCellValue('X3', 'Tot');

  $arr = ['E', 'F', 'G', 'H'];
  for($i=0; $i<4; $i++){
    $objPHPExcel->getActiveSheet()->setCellValue($arr[$i].'2', $resCo[$i]['FCO']);
  } 
  
  $arr = ['J', 'K', 'L', 'M'];
  $z=0;
  for($i=4; $i<8; $i++){
    $objPHPExcel->getActiveSheet()->setCellValue($arr[$z].'2', $resCo[$i]['FCO']);
    $z++;
  }

  $arr = ['O', 'P', 'Q', 'R'];
  $index=0;
  for($i=8; $i<12; $i++){
    $objPHPExcel->getActiveSheet()->setCellValue($arr[$index].'2', $resCo[$i]['FCO']);
    $index++;
  } 

  $arr = ['T', 'U', 'V', 'W'];
  $j=0;
  for($i=12; $i<16; $i++){
    $objPHPExcel->getActiveSheet()->setCellValue($arr[$j].'2', $resCo[$i]['FCO']);
    $j++;
  } 

  $objPHPExcel->getActiveSheet()->getStyle('A1:X3')->applyFromArray($styleArray);
$objPHPExcel->getActiveSheet()->mergeCells('A1:A3');
$objPHPExcel->getActiveSheet()->mergeCells('B1:B3');
$objPHPExcel->getActiveSheet()->mergeCells('C1:C3');


$objPHPExcel->getActiveSheet()->mergeCells('D1:I1');
$objPHPExcel->getActiveSheet()->mergeCells('J1:N1');
$objPHPExcel->getActiveSheet()->mergeCells('O1:S1');
$objPHPExcel->getActiveSheet()->mergeCells('T1:X1');  
$objPHPExcel->getActiveSheet()->getColumnDimension('1')->setAutoSize(true);

  $objPHPExcel->getActiveSheet()->getStyle('A1:X3')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  $objPHPExcel->getActiveSheet()->getStyle('A1:X3')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
  
  $count=rtrim($count,", ");
  
  foreach ($result as $key => $value) {     
    $slNo = $key + 4;

    $marks11 = $value['fmarks11'] == '-1.00' ? "" : $value['fmarks11'];
    $marks12 = $value['fmarks12'] == '-1.00' ? "" : $value['fmarks12'];
    $marks13 = $value['fmarks13'] == '-1.00' ? "" : $value['fmarks13'];
    $marks14 = $value['fmarks14'] == '-1.00' ? "" : $value['fmarks14'];
    if($marks11 =='-2.00'|| $marks12 =='-2.00'|| $marks13=='-2.00'|| $marks14=='-2.00'){
        $marks11 = $value['fmarks11'] == '-2.00' ? "Ab" : $value['fmarks11'];
        $marks12 = $value['fmarks12'] == '-2.00' ? "Ab" : $value['fmarks12'];
        $marks13 = $value['fmarks13'] == '-2.00' ? "Ab" : $value['fmarks13'];
        $marks14 = $value['fmarks14'] == '-2.00' ? "Ab" : $value['fmarks14'];}
    $tot1= $marks11+ $marks12+ $marks13+ $marks14;

    if($marks11 == "" && $marks12 == "" && $marks13 == "" && $marks14 == ""){
        $tot1 = "";
      }

    $marks21 = $value['fmarks21'] == '-1.00' ? "" : $value['fmarks21'];
    $marks22 = $value['fmarks22'] == '-1.00' ? "" : $value['fmarks22'];
    $marks23 = $value['fmarks23'] == '-1.00' ? "" : $value['fmarks23'];
    $marks24 = $value['fmarks24'] == '-1.00' ? "" : $value['fmarks24'];
    if($marks21=='-2.00'|| $marks22 =='-2.00'|| $marks23=='-2.00'|| $marks24=='-2.00'){
        $marks21 = $value['fmarks21'] == '-2.00' ? "Ab" : $value['fmarks21'];
        $marks22 = $value['fmarks22'] == '-2.00' ? "Ab" : $value['fmarks22'];
        $marks23 = $value['fmarks23'] == '-2.00' ? "Ab" : $value['fmarks23'];
        $marks24 = $value['fmarks24'] == '-2.00' ? "Ab" : $value['fmarks24'];}
    $tot2= $marks21+ $marks22+ $marks23+ $marks24;

    if($marks21 == "" && $marks22 == "" && $marks23 == "" && $marks24 == ""){
        $tot2 = "";
      }

    $marks31 = $value['fmarks31'] == '-1.00' ? "" : $value['fmarks31'];
    $marks32 = $value['fmarks32'] == '-1.00' ? "" : $value['fmarks32'];
    $marks33 = $value['fmarks33'] == '-1.00' ? "" : $value['fmarks33'];
    $marks34 = $value['fmarks34'] == '-1.00' ? "" : $value['fmarks34'];
    if($marks31=='-2.00'|| $marks32 =='-2.00'|| $marks33=='-2.00'|| $marks34=='-2.00'){
        $marks31 = $value['fmarks31'] == '-2.00' ? "Ab" : $value['fmarks31'];
        $marks32 = $value['fmarks32'] == '-2.00' ? "Ab" : $value['fmarks32'];
        $marks33 = $value['fmarks33'] == '-2.00' ? "Ab" : $value['fmarks33'];
        $marks34 = $value['fmarks34'] == '-2.00' ? "Ab" : $value['fmarks34'];}
    $tot3= $marks31+ $marks32+ $marks33+ $marks34;
    
    if($marks31 == "" && $marks32 == "" && $marks33 == "" && $marks34 == ""){
        $tot3 = "";
      }

    $marks41 = $value['fmarks41'] == '-1.00' ? "" : $value['fmarks41'];
    $marks42 = $value['fmarks42'] == '-1.00' ? "" : $value['fmarks42'];
    $marks43 = $value['fmarks43'] == '-1.00' ? "" : $value['fmarks43'];
    $marks44 = $value['fmarks44'] == '-1.00' ? "" : $value['fmarks44'];
    if($marks41=='-2.00'|| $marks42 =='-2.00'|| $marks43=='-2.00'|| $marks44=='-2.00'){
        $marks41 = $value['fmarks41'] == '-2.00' ? "Ab" : $value['fmarks41'];
        $marks42 = $value['fmarks42'] == '-2.00' ? "Ab" : $value['fmarks42'];
        $marks43 = $value['fmarks43'] == '-2.00' ? "Ab" : $value['fmarks43'];
        $marks44 = $value['fmarks44'] == '-2.00' ? "Ab" : $value['fmarks44'];}
    $tot4= $marks41+ $marks42+ $marks43+ $marks44;
    
    if($marks41 == "" && $marks42 == "" && $marks43 == "" && $marks44 == ""){
        $tot4 = "";
      }

      if($value['FTOTAL'] == '-2.00'){
        $value['FTOTAL'] = "Ab";
    }
      elseif($value['FTOTAL'] == '-1.00'){
        $value['FTOTAL'] = "";
      }
      else{
        $value['FTOTAL'];
      }
      
      if($value['FTOTAL'] == "Ab" && $tot1 == '0' && $tot2 == '0' && $tot3 == '0' && $tot4 == '0'){
        $tot1 = "Ab";
        $tot2 = "Ab";
        $tot3 = "Ab";
        $tot4 = "Ab";
      }

    $objPHPExcel->getActiveSheet()->getRowDimension($slNo)->setRowHeight(25);
 
    $objPHPExcel->getActiveSheet()->setCellValue('A' . $slNo, $slNo - 3)->getColumnDimension('A')->setwidth(8);
    $objPHPExcel->getActiveSheet()->setCellValue('B' . $slNo, $value['FREGNO'])->getColumnDimension('B')->setwidth(15);
    $objPHPExcel->getActiveSheet()->setCellValue('C' . $slNo, $value['FNAME'])->getColumnDimension('C')->setwidth(35);
    $objPHPExcel->getActiveSheet()->setCellValue('D' . $slNo,$value['FACTTOTAL'])->getColumnDimension('D3')->setwidth(10); 
    $objPHPExcel->getActiveSheet()->setCellValue('E' . $slNo, $marks11 )->getColumnDimension('E3')->setwidth(2);
    $objPHPExcel->getActiveSheet()->setCellValue('F' . $slNo, $marks12 )->getColumnDimension('F3')->setwidth(2);
    $objPHPExcel->getActiveSheet()->setCellValue('G' . $slNo, $marks13 )->getColumnDimension('G3')->setwidth(2);
    $objPHPExcel->getActiveSheet()->setCellValue('H' . $slNo, $marks14 )->getColumnDimension('H3')->setwidth(2);
    $objPHPExcel->getActiveSheet()->setCellValue('I' . $slNo, $tot1 )->getColumnDimension('I3')->setwidth(2);

    $objPHPExcel->getActiveSheet()->setCellValue('J' . $slNo, $marks21 )->getColumnDimension('J3')->setwidth(2);
    $objPHPExcel->getActiveSheet()->setCellValue('K' . $slNo, $marks22 )->getColumnDimension('K3')->setwidth(2);
    $objPHPExcel->getActiveSheet()->setCellValue('L' . $slNo, $marks23 )->getColumnDimension('L3')->setwidth(2);
    $objPHPExcel->getActiveSheet()->setCellValue('M' . $slNo, $marks24 )->getColumnDimension('M3')->setwidth(2);
    $objPHPExcel->getActiveSheet()->setCellValue('N' . $slNo, $tot2 )->getColumnDimension('N3')->setwidth(2);

    $objPHPExcel->getActiveSheet()->setCellValue('O' . $slNo, $marks31 )->getColumnDimension('O3')->setwidth(2);
    $objPHPExcel->getActiveSheet()->setCellValue('P' . $slNo, $marks32 )->getColumnDimension('P3')->setwidth(2);
    $objPHPExcel->getActiveSheet()->setCellValue('Q' . $slNo, $marks33 )->getColumnDimension('Q3')->setwidth(2);
    $objPHPExcel->getActiveSheet()->setCellValue('R' . $slNo, $marks34 )->getColumnDimension('R3')->setwidth(2); 
    $objPHPExcel->getActiveSheet()->setCellValue('S' . $slNo, $tot3 )->getColumnDimension('S3')->setwidth(2);

    $objPHPExcel->getActiveSheet()->setCellValue('T' . $slNo, $marks41 )->getColumnDimension('T3')->setwidth(2);
    $objPHPExcel->getActiveSheet()->setCellValue('U' . $slNo, $marks42 )->getColumnDimension('U3')->setwidth(2);
    $objPHPExcel->getActiveSheet()->setCellValue('V' . $slNo, $marks43 )->getColumnDimension('V3')->setwidth(2);
    $objPHPExcel->getActiveSheet()->setCellValue('W' . $slNo, $marks44 )->getColumnDimension('W3')->setwidth(2);
    $objPHPExcel->getActiveSheet()->setCellValue('X' . $slNo, $tot4 )->getColumnDimension('X3')->setwidth(2);
    
    $objPHPExcel->getActiveSheet()->getStyle('A'.$slNo.':'.'X'.$slNo)->applyFromArray($styleArray);

    $objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':X' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    
}


}else{
  $objPHPExcel->getActiveSheet()->getStyle('1:1')->getFont()->setBold(true);
  $objPHPExcel->getActiveSheet()->getStyle('1:1')->getFont()->setSize(12);
  $objPHPExcel->getActiveSheet()->getRowDimension(1)->setRowHeight(25);
  $objPHPExcel->getActiveSheet()->getRowDimension(2)->setRowHeight(25);
  $objPHPExcel->getActiveSheet()->getRowDimension(3)->setRowHeight(25);
  $objPHPExcel->getActiveSheet()->getColumnDimension('A1')->setwidth(30);
  $objPHPExcel->getActiveSheet()->freezePane('A4');
  $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Sl No.');
  $objPHPExcel->getActiveSheet()->setCellValue('B1', 'USN');
  $objPHPExcel->getActiveSheet()->setCellValue('C1', 'Student Name ');
  $objPHPExcel->getActiveSheet()->setCellValue('D1', '1. Max. Marks(25)');
  $objPHPExcel->getActiveSheet()->setCellValue('D2', 'CO');
  $objPHPExcel->getActiveSheet()->setCellValue('D3', 'Total');
  $objPHPExcel->getActiveSheet()->setCellValue('E3', 'A');
  $objPHPExcel->getActiveSheet()->setCellValue('F3', 'B');
  $objPHPExcel->getActiveSheet()->setCellValue('G3', 'C');
  $objPHPExcel->getActiveSheet()->setCellValue('H3', 'D');
  $objPHPExcel->getActiveSheet()->setCellValue('I3', 'E');
  $objPHPExcel->getActiveSheet()->setCellValue('J3', 'F');
  $objPHPExcel->getActiveSheet()->mergeCells('D1:J1');
  $objPHPExcel->getActiveSheet()->mergeCells('A1:A3');
  $objPHPExcel->getActiveSheet()->mergeCells('B1:B3');
  $objPHPExcel->getActiveSheet()->mergeCells('C1:C3');
  $objPHPExcel->getActiveSheet()->getStyle('A1:J3')->applyFromArray($styleArray);
  $objPHPExcel->getActiveSheet()->getStyle('A1:J3')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);

  $arr = ['E', 'F', 'G', 'H', 'I', 'J'];
  for($i=0; $i<6; $i++){
    $objPHPExcel->getActiveSheet()->setCellValue($arr[$i].'2', $resCo[$i]['FCO']);
  } 
  
  
  
  
  
 
    foreach($result as $key => $value){
        $slNo = $key + 4;
        $marks11 = $value['fmarks11'] == '-1.0' ? "" : $value['fmarks11'];
        $marks12 = $value['fmarks12'] == '-1.0' ? "" : $value['fmarks12'];
        $marks13 = $value['fmarks13'] == '-1.0' ? "" : $value['fmarks13'];
        $marks14 = $value['fmarks14'] == '-1.0' ? "" : $value['fmarks14'];
        $marks15 = $value['fmarks15'] == '-1.0' ? "" : $value['fmarks15'];
        $marks16 = $value['fmarks16'] == '-1.0' ? "" : $value['fmarks16'];

        $marks11 = $value['fmarks11'] == '-2.00' ? "Ab" : $marks11;
        $marks12 = $value['fmarks12'] == '-2.00' ? "Ab" : $marks12;
        $marks13 = $value['fmarks13'] == '-2.00' ? "Ab" : $marks13;
        $marks14 = $value['fmarks14'] == '-2.00' ? "Ab" : $marks14;
        $marks15 = $value['fmarks15'] == '-1.0' ? "" : $marks15;
        $marks16 = $value['fmarks16'] == '-1.0' ? "" : $marks16;

        $objPHPExcel->getActiveSheet()->getRowDimension($slNo)->setRowHeight(25);
        $objPHPExcel->getActiveSheet()->setCellValue('A' . $slNo, $slNo - 3)->getColumnDimension('A')->setwidth(8);
        $objPHPExcel->getActiveSheet()->setCellValue('B' . $slNo, $value['FREGNO'])->getColumnDimension('B')->setwidth(15);
        $objPHPExcel->getActiveSheet()->setCellValue('C' . $slNo, $value['FNAME'])->getColumnDimension('C')->setwidth(50);
        $objPHPExcel->getActiveSheet()->setCellValue('D' . $slNo,$value['FACTTOTAL'])->getColumnDimension('D3')->setwidth(10); 
        $objPHPExcel->getActiveSheet()->setCellValue('E' . $slNo, $marks11)->getColumnDimension('E')->setwidth(8);
        $objPHPExcel->getActiveSheet()->setCellValue('F' . $slNo, $marks12)->getColumnDimension('F')->setwidth(8);
        $objPHPExcel->getActiveSheet()->setCellValue('G' . $slNo, $marks13)->getColumnDimension('G')->setwidth(8);
        $objPHPExcel->getActiveSheet()->setCellValue('H' . $slNo, $marks14)->getColumnDimension('H')->setwidth(8);
        $objPHPExcel->getActiveSheet()->setCellValue('I' . $slNo, $marks15)->getColumnDimension('I')->setwidth(8);
        $objPHPExcel->getActiveSheet()->setCellValue('J' . $slNo, $marks16)->getColumnDimension('J')->setwidth(8);

        $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('D' . $slNo . ':J' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
        $objPHPExcel->getActiveSheet()->getStyle('D' . $slNo . ':J' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
        
        $objPHPExcel->getActiveSheet()->getStyle('A'.$slNo.':'.'J'.$slNo)->applyFromArray($styleArray);
        
        

        
        // $objPHPExcel->getActiveSheet()->getRowDimension($slNo)->setRowHeight(25);
 
        // $objPHPExcel->getActiveSheet()->setCellValue('A' . $slNo, $slNo - 3)->getColumnDimension('A')->setwidth(8);
        // $objPHPExcel->getActiveSheet()->setCellValue('B' . $slNo, $value['FREGNO'])->getColumnDimension('B')->setwidth(15);
        // $objPHPExcel->getActiveSheet()->setCellValue('C' . $slNo, $value['FNAME'])->getColumnDimension('C')->setwidth(35);
        // $objPHPExcel->getActiveSheet()->setCellValue('D' . $slNo,$value['FACTTOTAL'])->getColumnDimension('D3')->setwidth(10); 
        // $objPHPExcel->getActiveSheet()->setCellValue('E' . $slNo, $marks11 )->getColumnDimension('E3')->setwidth(2);
        // $objPHPExcel->getActiveSheet()->setCellValue('F' . $slNo, $marks12 )->getColumnDimension('F3')->setwidth(2);
        // $objPHPExcel->getActiveSheet()->setCellValue('G' . $slNo, $marks13 )->getColumnDimension('G3')->setwidth(2);
        // $objPHPExcel->getActiveSheet()->setCellValue('H' . $slNo, $marks14 )->getColumnDimension('H3')->setwidth(2);
        // $objPHPExcel->getActiveSheet()->setCellValue('I' . $slNo, $tot1 )->getColumnDimension('I3')->setwidth(2);
     

    }
    // $objPHPExcel->getActiveSheet()->getStyle('A'.$slNo.':'.'I'.$slNo)->applyFromArray($styleArray);

    // $objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':I' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
}
    getheaders($objPHPExcel, $fileName);
  
}

?>