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


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

$pdf_writer_class = $main_src . '/PHPExcel/Classes/PHPExcel.php';
require_once($pdf_writer_class);

function getheaders($objPHPExcel, $fileName)
{
    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);

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

    header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 
    header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 
    header('Cache-Control: cache, must-revalidate'); 
    header('Pragma: public');
    ob_clean();
    $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
    $objWriter->save('php://output');
}

function GeneratePrBill($aobj_context)
{
    session_start();
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
   
    $collcode=$_SESSION['collcode'];
    $funivcode = $_SESSION['FUNIVCODE'];
    $degree = $aobj_context->mobj_data["degree"]; 
	$examno = $aobj_context->mobj_data["examno"];
    $subcode = $aobj_context->mobj_data["subcode"];

    // var_dump($degree,$examno,$subcode,$collcode,"GROUPBY");die();
   
	$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";

    $query="SELECT DISTINCT c.fcollname,d.fdegree,d.fdescpn,d.fexamdate,a.fexamno 
    FROM colldeg cd INNER JOIN college c ON cd.fcollcode=c.fcollcode 
    INNER JOIN degree d ON cd.fdegree=d.fdegree
    INNER JOIN marks_pr a ON a.fdegree = d.fdegree 
    AND a.fexamno = d.fexamno
    WHERE c.fcollcode='{$collcode}' AND d.fdegree='{$degree}'";

    $result = $aobj_context->mobj_db->GetRow($query);
    
    $examcnd = "AND s.fexamno='{$examno}'";
    if($examno == 'All')
    {
        $examcnd = "";
    }

    $subcnd = "AND s.FSUBCODE='{$subcode}'";

    if($examno == 'All')
    {
        $subcnd = "";
    }

     $query1="SELECT  s.FDEGREE,s.FEXAMNO,s.FSUBCODE,sub.fsubname,s.FBATCH,mas.FACCNO,mas.fpanno,mas.FIFSCCODE,
     COUNT(s.fregno) AS bcnt,concat(pf.fexaminer1,'-',mas.fteachname) AS teachername,
      pf.FBATCH AS freezed_batch,COUNT(DISTINCT DATE_FORMAT(IFNULL(pf.FEXAMDATE,'00/00/0000'),'%d/%m/%Y')) AS FEXAMDA,pf.FEXAMTIME,pf.FEXAMDATE 
     FROM marks_pr s INNER JOIN subject sub ON s.FDEGREE=sub.FDEGREE AND s.FEXAMNO=sub.FEXAMNO AND s.FSUBCODE=sub.FCSUBCODE
     INNER JOIN practical_entry_freeze pf ON pf.FDEGREE=s.FDEGREE AND pf.FEXAM=s.FEXAMNO AND pf.FCSUBCODE=s.FSUBCODE 
     AND pf.FCOLLCODE=s.FCOLLCODE
     INNER JOIN masteach mas ON pf.fcollcode=mas.fcollcode AND  pf.fexaminer1=mas.fteachcode
     WHERE  s.fdegree ='$degree' 
     {$examcnd} {$subcnd}
     AND s.FCOLLCODE='$collcode' 
     AND IFNULL(s.FBATCH,'')<>''
     and ifnull(s.FMARKS11,'') <> '-1'
     group by s.FDEGREE,s.FEXAMNO,s.FSUBCODE,pf.fexaminer1
     UNION  
     SELECT s.FDEGREE,s.FEXAMNO,s.FSUBCODE,sub.fsubname,s.FBATCH,mas.FACCNO,mas.fpanno,mas.FIFSCCODE,
     COUNT(s.fregno) AS bcnt,concat(pf.fexaminer2,'-',mas.fteachname) AS teachername,
      pf.FBATCH AS freezed_batch,COUNT(DISTINCT DATE_FORMAT(IFNULL(pf.FEXAMDATE,'00/00/0000'),'%d/%m/%Y')) AS FEXAMDA,pf.FEXAMTIME,pf.FEXAMDATE
     FROM marks_pr s INNER JOIN subject sub ON s.FDEGREE=sub.FDEGREE AND s.FEXAMNO=sub.FEXAMNO AND s.FSUBCODE=sub.FCSUBCODE
     INNER JOIN practical_entry_freeze pf ON pf.FDEGREE=s.FDEGREE AND pf.FEXAM=s.FEXAMNO AND pf.FCSUBCODE=s.FSUBCODE 
     AND pf.FCOLLCODE=s.FCOLLCODE
     INNER JOIN masteach mas ON pf.fcollcode=mas.fcollcode AND  pf.fexaminer2=mas.fteachcode
     WHERE  s.fdegree ='$degree' 
     {$examcnd} {$subcnd}
     AND s.FCOLLCODE='$collcode' 
     AND IFNULL(s.FBATCH,'')<>''
     and ifnull(s.FMARKS11,'') <> '-1'
     group by s.FDEGREE,s.FEXAMNO,s.FSUBCODE,pf.fexaminer2
     UNION
     SELECT  s.FDEGREE,s.FEXAMNO,s.FSUBCODE,sub.fsubname,s.FBATCH,mas.FACCNO,mas.fpanno,mas.FIFSCCODE,
     COUNT(s.fregno) AS bcnt,concat(pf.fexaminer3,'-',mas.fteachname) AS teachername,
      pf.FBATCH AS freezed_batch,COUNT(DISTINCT DATE_FORMAT(IFNULL(pf.FEXAMDATE,'00/00/0000'),'%d/%m/%Y')) AS FEXAMDA,pf.FEXAMTIME,pf.FEXAMDATE 
     FROM marks_pr s INNER JOIN subject sub ON s.FDEGREE=sub.FDEGREE AND s.FEXAMNO=sub.FEXAMNO AND s.FSUBCODE=sub.FCSUBCODE
     INNER JOIN practical_entry_freeze pf ON pf.FDEGREE=s.FDEGREE AND pf.FEXAM=s.FEXAMNO AND pf.FCSUBCODE=s.FSUBCODE 
     AND pf.FCOLLCODE=s.FCOLLCODE
     INNER JOIN masteach mas ON pf.fcollcode=mas.fcollcode AND  pf.fexaminer3=mas.fteachcode
     WHERE  s.fdegree ='$degree' 
     {$examcnd} {$subcnd}
     AND s.FCOLLCODE='$collcode' 
     AND IFNULL(s.FBATCH,'')<>''
     and ifnull(s.FMARKS11,'') <> '-1'
     group by s.FDEGREE,s.FEXAMNO,s.FSUBCODE,pf.fexaminer3
     UNION
     SELECT  s.FDEGREE,s.FEXAMNO,s.FSUBCODE,sub.fsubname,s.FBATCH,mas.FACCNO,mas.fpanno,mas.FIFSCCODE,
     COUNT(s.fregno) AS bcnt,concat(pf.fexaminer4,'-',mas.fteachname) AS teachername,
      pf.FBATCH AS freezed_batch,COUNT(DISTINCT DATE_FORMAT(IFNULL(pf.FEXAMDATE,'00/00/0000'),'%d/%m/%Y')) AS FEXAMDA,pf.FEXAMTIME,pf.FEXAMDATE
     FROM marks_pr s INNER JOIN subject sub ON s.FDEGREE=sub.FDEGREE AND s.FEXAMNO=sub.FEXAMNO AND s.FSUBCODE=sub.FCSUBCODE
     INNER JOIN practical_entry_freeze pf ON pf.FDEGREE=s.FDEGREE AND pf.FEXAM=s.FEXAMNO AND pf.FCSUBCODE=s.FSUBCODE 
     AND pf.FCOLLCODE=s.FCOLLCODE
     INNER JOIN masteach mas ON pf.fcollcode=mas.fcollcode AND  pf.fexaminer4=mas.fteachcode
     WHERE  s.fdegree ='$degree' 
     {$examcnd} {$subcnd}
     AND s.FCOLLCODE='$collcode' 
     AND IFNULL(s.FBATCH,'')<>''
     and ifnull(s.FMARKS11,'') <> '-1'
     group by s.FDEGREE,s.FEXAMNO,s.FSUBCODE,pf.fexaminer4
     UNION 
     SELECT  s.FDEGREE,s.FEXAMNO,s.FSUBCODE,sub.fsubname,s.FBATCH,mas.FACCNO,mas.fpanno,mas.FIFSCCODE,
     COUNT(s.fregno) AS bcnt,concat(pf.fexaminer5,'-',mas.fteachname) AS teachername,
      pf.FBATCH AS freezed_batch,COUNT(DISTINCT DATE_FORMAT(IFNULL(pf.FEXAMDATE,'00/00/0000'),'%d/%m/%Y')) AS FEXAMDA,pf.FEXAMTIME,pf.FEXAMDATE
     FROM marks_pr s INNER JOIN subject sub ON s.FDEGREE=sub.FDEGREE AND s.FEXAMNO=sub.FEXAMNO AND s.FSUBCODE=sub.FCSUBCODE
     INNER JOIN practical_entry_freeze pf ON pf.FDEGREE=s.FDEGREE AND pf.FEXAM=s.FEXAMNO AND pf.FCSUBCODE=s.FSUBCODE 
     AND pf.FCOLLCODE=s.FCOLLCODE
     INNER JOIN masteach mas ON pf.fcollcode=mas.fcollcode AND  pf.fexaminer5=mas.fteachcode
     WHERE  s.fdegree ='$degree' 
     {$examcnd} {$subcnd}
     AND s.FCOLLCODE='$collcode' 
     AND IFNULL(s.FBATCH,'')<>''
     and ifnull(s.FMARKS11,'') <> '-1'
     group by s.FDEGREE,s.FEXAMNO,s.FSUBCODE,pf.fexaminer5";   
    //  var_dump($query1);
    //  die();
     $result1 = $aobj_context->mobj_db->GetAll($query1);
    
   
	include($pdf_writer_class);		

    $objPHPExcel = new PHPExcel();
    
    $fileName = 'PrBillReport.xls';
  
    $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);
  
    $styleArray = array(
        'borders' => array(
            'allborders' => array(
                'style' => PHPExcel_Style_Border::BORDER_THIN,
                'color' => array('argb' => '000000'),
            ),
        ),
    );
    $objPHPExcel->getActiveSheet()->getStyle('1:4')->getFont()->setBold(true);
    $objPHPExcel->getActiveSheet()->getStyle('1:1')->getFont()->setSize(18);
    $objPHPExcel->getActiveSheet()->getStyle('2:2')->getFont()->setSize(16);
    $objPHPExcel->getActiveSheet()->getStyle('2:3')->getFont()->setSize(12);

  $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','AE','AF','AG','AH','AI','AJ','AK','AL','AM','AN','AO','AP','AQ','AR','AS','AT','AU','AV','AW','AX','AY','AZ',
           'BA','BB','BC','BD','BE','BF','BG','BH','BI','BJ','BK','BL','BM','BN','BO','BP','BQ','BR','BS','BT','BU','BV','BW','BX','BY','BZ',
           'CA','CB','CC','CD','CE','CF','CG','CH','CI','CJ','CK','CL','CM','CN','CO','CP','CQ','CR','CS','CT','CU','CV','CW','CX','CY','CZ'];

  $objPHPExcel->getActiveSheet()->setCellValue('A1', $result['fcollname']);
  $objPHPExcel->getActiveSheet()->setCellValue('A2', $result['fdescpn'].' '. $result['fexamdate'].' '. '  Examination Remuneration');
  $objPHPExcel->getActiveSheet()->mergeCells('A1:Q1');
  $objPHPExcel->getActiveSheet()->mergeCells('A2:Q2');
  $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  $objPHPExcel->getActiveSheet()->getStyle('A2')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);

  $objPHPExcel->getActiveSheet()->setCellValue('A3', 'Sl No.');
  $objPHPExcel->getActiveSheet()->setCellValue('B3', 'Name');
  $objPHPExcel->getActiveSheet()->setCellValue('C3', 'Course Code');
  $objPHPExcel->getActiveSheet()->setCellValue('D3', 'Course Title');
  $objPHPExcel->getActiveSheet()->setCellValue('E3', 'Number Of Student');
  $objPHPExcel->getActiveSheet()->setCellValue('F3', 'Rate');
  $objPHPExcel->getActiveSheet()->setCellValue('G3', 'Date');
  $objPHPExcel->getActiveSheet()->setCellValue('H3', 'Days');
  $objPHPExcel->getActiveSheet()->setCellValue('I3', 'Remuneration');
  $objPHPExcel->getActiveSheet()->setCellValue('J3', 'TDS @ 10%');
  $objPHPExcel->getActiveSheet()->setCellValue('K3', 'Remuneration after TDS');
  $objPHPExcel->getActiveSheet()->setCellValue('L3', 'TA @ Rs. 10/per KM & DA @ Rs. 600/-');
  $objPHPExcel->getActiveSheet()->setCellValue('M3', 'Total');
  $objPHPExcel->getActiveSheet()->setCellValue('N3', 'PAN');
  $objPHPExcel->getActiveSheet()->setCellValue('O3', 'Ac. NO');
  $objPHPExcel->getActiveSheet()->setCellValue('P3', 'IFSC');
  $objPHPExcel->getActiveSheet()->setCellValue('Q3', 'Remarks');

  $objPHPExcel->getActiveSheet()->mergeCells('A3:A4');
  $objPHPExcel->getActiveSheet()->mergeCells('B3:B4');
  $objPHPExcel->getActiveSheet()->mergeCells('C3:C4');
  $objPHPExcel->getActiveSheet()->mergeCells('D3:D4');
  $objPHPExcel->getActiveSheet()->mergeCells('E3:E4');
  $objPHPExcel->getActiveSheet()->mergeCells('F3:F4');
  $objPHPExcel->getActiveSheet()->mergeCells('G3:G4');
  $objPHPExcel->getActiveSheet()->mergeCells('H3:H4');
  $objPHPExcel->getActiveSheet()->mergeCells('I3:I4');
  $objPHPExcel->getActiveSheet()->mergeCells('J3:J4');
  $objPHPExcel->getActiveSheet()->mergeCells('K3:K4');
  $objPHPExcel->getActiveSheet()->mergeCells('L3:L4');
  $objPHPExcel->getActiveSheet()->mergeCells('M3:M4');
  $objPHPExcel->getActiveSheet()->mergeCells('N3:N4');
  $objPHPExcel->getActiveSheet()->mergeCells('O3:O4');
  $objPHPExcel->getActiveSheet()->mergeCells('P3:P4');
  $objPHPExcel->getActiveSheet()->mergeCells('Q3:Q4');
  $i=0;
  foreach ($result1 as $key => $value) {
    $slNo = $key +5;
    // $teachers=$value['teachname'];
    // $teach= explode("|",$teachers);
    // var_dump(count($teach));
    // var_dump($value['FEXAMDA']);die();
    $amount=$value['FEXAMDA']*600;
    if($value['bcnt']!=0){
    $objPHPExcel->getActiveSheet()->getRowDimension($slNo)->setRowHeight(25);
    $objPHPExcel->getActiveSheet()->setCellValue('A' . $slNo, $slNo - 4)->getColumnDimension('A')->setwidth(8);
    $objPHPExcel->getActiveSheet()->setCellValue('B' . $slNo, $value['teachername'])->getColumnDimension('B')->setwidth(40);
    $objPHPExcel->getActiveSheet()->setCellValue('C' . $slNo, $value['FSUBCODE'])->getColumnDimension('C')->setwidth(12);
    $objPHPExcel->getActiveSheet()->setCellValue('D' . $slNo, $value['fsubname'])->getColumnDimension('D')->setwidth(40);
    $objPHPExcel->getActiveSheet()->setCellValue('E' . $slNo, $value['bcnt'])->getColumnDimension('E')->setwidth(20);
    $objPHPExcel->getActiveSheet()->setCellValue('F' . $slNo, "")->getColumnDimension('F')->setwidth(8);
    $objPHPExcel->getActiveSheet()->setCellValue('G' . $slNo, $value['FEXAMDATE'])->getColumnDimension('G')->setwidth(15);
    $objPHPExcel->getActiveSheet()->setCellValue('H' . $slNo, $value['FEXAMDA'])->getColumnDimension('H')->setwidth(12);
    $objPHPExcel->getActiveSheet()->setCellValue('I' . $slNo, "")->getColumnDimension('I')->setwidth(25);
    $objPHPExcel->getActiveSheet()->setCellValue('J' . $slNo, "")->getColumnDimension('J')->setwidth(15);
    $objPHPExcel->getActiveSheet()->setCellValue('K' . $slNo, "")->getColumnDimension('K')->setwidth(25);
    $objPHPExcel->getActiveSheet()->setCellValue('L' . $slNo, "600")->getColumnDimension('L')->setwidth(38);
    $objPHPExcel->getActiveSheet()->setCellValue('M' . $slNo, $amount)->getColumnDimension('M')->setwidth(15);
    $objPHPExcel->getActiveSheet()->setCellValue('N' . $slNo, $value['fpanno'])->getColumnDimension('N')->setwidth(20);
    $objPHPExcel->getActiveSheet()->setCellValue('O' . $slNo, "  ".$value['FACCNO'])->getColumnDimension('O')->setwidth(25);
    $objPHPExcel->getActiveSheet()->setCellValue('P' . $slNo, $value['FIFSCCODE'])->getColumnDimension('P')->setwidth(20);
    $objPHPExcel->getActiveSheet()->setCellValue('Q' . $slNo, "")->getColumnDimension('Q')->setwidth(12);

    $objPHPExcel->getActiveSheet()->getStyle('A3:Q3')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    $objPHPExcel->getActiveSheet()->getStyle('A5')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    $objPHPExcel->getActiveSheet()->getStyle('C5:Q5')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    $objPHPExcel->getActiveSheet()->getStyle('A' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    $objPHPExcel->getActiveSheet()->getStyle('C'. $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    $objPHPExcel->getActiveSheet()->getStyle('D'. $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    $objPHPExcel->getActiveSheet()->getStyle('E'. $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    $objPHPExcel->getActiveSheet()->getStyle('F'. $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    $objPHPExcel->getActiveSheet()->getStyle('G'. $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    $objPHPExcel->getActiveSheet()->getStyle('H'. $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    $objPHPExcel->getActiveSheet()->getStyle('I'. $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    $objPHPExcel->getActiveSheet()->getStyle('J'. $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    $objPHPExcel->getActiveSheet()->getStyle('K'. $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    $objPHPExcel->getActiveSheet()->getStyle('L'. $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    $objPHPExcel->getActiveSheet()->getStyle('M'. $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    $objPHPExcel->getActiveSheet()->getStyle('N'. $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    $objPHPExcel->getActiveSheet()->getStyle('O'. $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$i++;}
  }

 
 
  getheaders($objPHPExcel, $fileName);
  
}
?>