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


Current Path : /var/www/html/rcub/Report_details/
Upload File :
Current File : /var/www/html/rcub/Report_details/appear_list_center_qp_wise.php

<?php
function GenerateCenterAppearingListQPWise($aobj_context)
{
    session_start();
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $college_code = $_SESSION['collcode'];
    $FUNIVCODE = $_SESSION['FUNIVCODE'];
    //echo $college_code; 
    $qp_code_start =  substr("0000000000" . $aobj_context->mobj_data["qp_code_start"], -5);
    $qp_code_end =  substr("ZZZZZZZZZZ" . $aobj_context->mobj_data["qp_code_end"], -5);
    $qp_frm_date =  $aobj_context->mobj_data["qp_frm_date"];
    $section = $aobj_context->mobj_data["section"];
    $qp_to_date = $aobj_context->mobj_data["qp_to_date"];
    $pageeject = $aobj_context->mobj_data["pageeject"];

    $main_src_obj = (explode("/", $_SERVER["REQUEST_URI"]));
    $main_src = $main_src_obj[1];
    $pdf_writer_class = $aobj_context->main_src . "/maya-pdf/fpdf.php";
    $tarkaheader = $aobj_context->main_src . "/Report_details/tarkaheader.php";
    $root_pdf_file_download = $aobj_context->main_src . "/Report_details/output/report_admission_list.pdf";
    // global varibales
    $p_count = 1;
    // end global varibales	
    include($pdf_writer_class);
    $pdf = new FPDF();
    //$pdf->$title='20000 Leagues Under the Seas';
    $pdf->SetFont('Times', '', 10);
    $pdf->SetMargins(15, 9.5);
    $pdf->AliasNbPages();
    $sub_degree_cond = "";
    if (!empty($sub_degree_code)) {
        $sub_degree_cond = " and s.FSUBDEGREE='{$sub_degree_code}'";
        $page_header_sub_degree = "select concat('[',FDEGREE,'] - ', FDESCPN) as sub_degree_name, FADYEAR  
								from degree where FDEGREE = '{$sub_degree_code}' and FEXAMNO='{$exam_no}' ";

        $lobj_page_header_sub_degree = $aobj_context->mobj_db->GetRow($page_header_sub_degree);
    }
    //print_r($lobj_page_header_sub_degree); die();
    /* $degree_cond="  ";
	if(strtolower($exam_no)=='c')
	$degree_cond=" s.FSUBDEGREE='{$degree_code}' "; */

    // query for the page header	
    $page_header_university = "select FUNIVNAME,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);



    //echo $page_header_degree; die();
    $pdf->aobj_context = $aobj_context;
    $pdf->WhichReport = 'AppearListQpWise';
    $pdf->FUNIVNAME = $lobj_page_header_university['FUNIVNAME'];
    $pdf->FTOWN = $lobj_page_header_university['FTOWN'];
    $pdf->date_1 = $lobj_page_header_university['date'];
    $pdf->college_name = $lobj_page_header_college['college_name'];

    //echo $pdf->sub_degree_code; die();

    //end header		
    //var_dump($FUNIVCODE);
    //and sub.FDEGREE=op.FDEGREE


    if ($section == 'both') {
        $sectionvalue = "";
    } else {
        $sectionvalue = "and subject.fsession like '{$section}'";
    }

    if ($FUNIVCODE == '005' || $FUNIVCODE == '026' || $FUNIVCODE == '003' || $FUNIVCODE == '032' || $FUNIVCODE == '003U' || $FUNIVCODE == '003D' || $FUNIVCODE == '017' || $FUNIVCODE == '034' || $FUNIVCODE == '027') {
        $date = "'{$qp_frm_date}' and '{$qp_to_date}' ";
    } else {
        $date = "date_format(STR_TO_DATE('{$qp_frm_date}', '%d/%m/%Y'),'%Y-%m-%d')  and date_format(STR_TO_DATE('{$qp_to_date}', '%d/%m/%Y'),'%Y-%m-%d')";
    }


    $canddettmp = "canddet";
    $candsumttmp = "candsum";
    $studenttmp = "student";

    /*
		$query = "CREATE TEMPORARY TABLE IF NOT EXISTS {$candsumttmp} AS
					select * from candsum where FCNTRCODE = '{$college_code}'";
		$aobj_context->mobj_db->execute($query);

		$query = "CREATE INDEX tmpcansum
		ON {$candsumttmp} (fcollcode, fdergee, fregno)";	
		$aobj_context->mobj_db->execute($query);

		$query = "CREATE TEMPORARY TABLE IF NOT EXISTS {$studenttmp} AS
					select s.* from student s inner join {$candsumttmp} cs on 
					and s.fcollcode = cs.fcollcode and s.fdegree = cs.fdegree and 
					s.fregno = cs.fregno  
					 where FCNTRCODE = '{$college_code}'";	
		$aobj_context->mobj_db->execute($query);

		$query = "CREATE INDEX tmpstudent
		ON {$candsumttmp} (fcollcode, fdergee, fregno)";	
		$aobj_context->mobj_db->execute($query);

		$query = "CREATE TEMPORARY TABLE IF NOT EXISTS {$canddettmp} AS
					select cd.* from canddet cd inner join {$candsumttmp} cs on cd.fcollcode = cs.fcollcode 
					and cd.fdegree = cs.fdegree and cd.fregno = cs.fregno where 
					cs.FCNTRCODE = '{$college_code}'";
		$aobj_context->mobj_db->execute($query);	

		$query = "CREATE INDEX tmpcanddet
		ON {$canddettmp} (fcollcode, fdergee, fregno, fsubcode)";	
		$aobj_context->mobj_db->execute($query);*/


    $get_subject_data = "Select subject.fqpcode,canddet.fdegree,degree.fexamdate as fddate, subject.fcsubcode as fsubcode , 
	concat(subject.fsubname,' ', subject.fssubname) as fsubname,
	subject.fsubshort as fsubshort, date_format(subject.fdoe,'%d/%m/%Y')   as fdoe, reason.fdescpn as fsession ,
	GROUP_CONCAT(candsum.fregno order by subject.fqpcode, candsum.fcntrcode, case when candsum.fcntrcode=candsum.fcollcode then '0' else candsum.fcollcode end, candsum.fdegree, candsum.fregno) as data_set,
	subject.fqpcode as fqpcode from {$candsumttmp} candsum, {$canddettmp} canddet, degree, subject, reason, 
	{$studenttmp} student
	where candsum.fcollcode = canddet.fcollcode and candsum.fdegree = canddet.fdegree 
	and candsum.fregno = canddet.fregno and candsum.fyear = canddet.fyear 
	and candsum.fexamtype = canddet.fexamtype 
	and canddet.fdegree = degree.fdegree
	and canddet.fexamno = degree.fexamno and candsum.fyear = degree.fmeyear
	and candsum.fexamtype = degree.fmeexamtyp and canddet.fdegree = subject.fdegree
	and canddet.fexamno = subject.fexamno and canddet.fsubcode = subject.fsubcode 
	and candsum.fregno = student.fregno and candsum.fdegree = student.fdegree
	and subject.fsession = reason.freasoncd and candsum.fcntrcode =  '{$college_code}' 
	and subject.fqpcode between '{$qp_code_start}' and '{$qp_code_end}' 
	and subject.FDOE between {$date}
	and ifnull(candsum.ftotalfee,0) > 0 and ifnull(canddet.fpassmth,'') =''
	and ifnull(subject.ftheory,'F') = 'T' and ifnull(subject.fintass,'F') <> 'T' and ifnull(canddet.fpresent,'') = 'P' and ifnull(canddet.fthpr,'F') <> 'T'
    
    and ifnull(student.fdeleted,'') <> 'T'
	and INSTR(candsum.fhtenable,canddet.fexamno) >0
	{$sectionvalue}
	group by  subject.fqpcode 
	order by subject.fdoe,subject.fqpcode,subject.fsession, candsum.fcntrcode, candsum.fcollcode, candsum.fdegree, candsum.fregno";
    //var_dump($get_subject_data);
    //die();
    //#and ifnull(candsum.fcntrcodex,'') <> 'gold'
    $aobj_context->mobj_db->execute("SET @@session.group_concat_max_len=1000000");
    $lobj_subject_data = $aobj_context->mobj_db->GetAll($get_subject_data);

    //print_r($get_subject_data); die();
    $pdf->fddate = $lobj_subject_data[0][fddate];
    if ($pageeject == 'F')
        $pdf->AddPage();
    //$pdf->Ln();
    $pdf->SetFont('Times', '', 10);

    foreach ($lobj_subject_data as $key => $value) {
        if ($pageeject == 'F') {
            if ($pdf->GetY() > 260) {
                $pdf->AddPage();
            }
        } else
            $pdf->AddPage();
        $fqpcode = $value['fqpcode'];
        $page_header_degree = "select concat(sub.fqpcode,' - ', sub.FSUBNAME, space(2), '( ',sub.FSSUBNAME,' )') as qp_code
						from subject sub 	
							  where fqpcode = '{$fqpcode}'  ";
        $lobj_page_header_degree = $aobj_context->mobj_db->GetRow($page_header_degree);

        $pdf->qp_code = $lobj_page_header_degree['qp_code'];


        $fsubcode = $value['fsubcode'];
        $fqpcode = $value['fqpcode'];
        $fsession = $value['fsession'];
        $data_set = $value['data_set'];
        $fsubname = $value['fsubname'];
        $fdoe = $value['fdoe'];
        $fsubshort = $value['fsubshort'];
        $pdf->SetFont('Times', 'B', 11);

        $pdf->Cell(0, 6, 'Subject : ' . $pdf->qp_code, 0, 1, 'C');
        $pdf->Cell(0, 6, 'Exam Date : ' . $fdoe . ', Exam Time  : ' . $fsession, 0, 1, 'C');
        $data_arr = (explode(",", $data_set));
        $pdf->Ln(5);
        $count = 0;
        //print_r( $data_arr); die();
        $data_set_count = count($data_arr);
        for ($i = 0; $i < $data_set_count; $i++) {

            if ($count == 6) {
                $pdf->Ln(5);
                $count = 0;
            }
            $pdf->SetFont('Times', '', 12);
            $pdf->Cell(30, 5, $data_arr[$i], 1, 0, 'C');
            $count++;
        }

        if ($pageeject == 'T') {
            $pdf->Ln(15);
            $pdf->Cell(150, 5, 'Total No. of students Appearing', 1, 0, 'L');
            $pdf->Cell(30, 5, $data_set_count, '1', 1, 'C');
            $pdf->Cell(150, 5, 'Total No. of students Absent', 'LRB', 0, 'L');
            $pdf->Cell(30, 5, '', 'LRB', 1, 'C');
            $pdf->Cell(150, 5, 'Total No. of Answer Books Dispatched', 'LRB', 0, 'L');
            $pdf->Cell(30, 5, '', 'LRB', 1, 'C');
            $pdf->Ln(15);
            $pdf->Cell(180, 5, 'Signature of Chief Superintendent', '0', 1, 'R');
            $x = $pdf->GetX();
            $y = $pdf->GetY();
            $pdf->Line($x, $y, $x + 184, $y);
            $pdf->SetFont('Times', '', 10);
            $pdf->Cell(180, 6, "Note : 1. Circle the register number if absent. Make Absent, MPC and Bundle entry in OASIS", "0", 1, "L");
            $pdf->Cell(180, 6, "           2. This report should not be used for Room Allotment purpose.", "0", 1, "L");
        } else {
            $pdf->Ln(6);
            $pdf->Cell(0, 5, 'Total Student :' . $data_set_count, 0, 1, 'L');
        }
    }

    $pdf->Output("SubjectWiseStudentList.pdf", "D");
}