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


Current Path : /var/www/html/college/Report_details/
Upload File :
Current File : /var/www/html/college/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 FUNIVCODE, 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'];
	$FUNIVCODE = $lobj_page_header_university['FUNIVCODE'];
	
	//echo $pdf->sub_degree_code; die();
	
	//end header		
	//var_dump($FUNIVCODE);
	//and sub.FDEGREE=op.FDEGREE


	if($section == 'both')
	{
		$sectionvalue = "";
	}
	else 
	{
		$sectionvalue = "and sub.fsession like '{$section}'";
	}	
	
	if($FUNIVCODE == '005' || $FUNIVCODE == '026'|| $FUNIVCODE == '003' || $FUNIVCODE == '032' 
	|| $FUNIVCODE == '003U' || $FUNIVCODE == '003D'|| $FUNIVCODE == '017' 
	|| $FUNIVCODE == '034' || $FUNIVCODE == '027' || $FUNIVCODE == '046')
	{
		$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')";
	}
 
	$date = "'{$qp_frm_date}' and '{$qp_to_date}' ";

	$canddettmp = "canddet";
	$candsumttmp = "candsum"; 
	$studenttmp = "student"; 
	$tot_cnd = "";
	if($FUNIVCODE == '046' || $FUNIVCODE == '037' ) {
		$tot_cnd = "";
	}
	else {
		$tot_cnd = "and ifnull(cs.ftotalfee,0) > 0";
	}

/*
		$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);*/	


		if($FUNIVCODE == '046')
		{
			$order = "sub.fdoe,sub.fqpcode, st.fayear,cs.FREGNO";
		}else if($FUNIVCODE == '021'){
			$order = "sub.fdoe,sub.fqpcode,sub.fsession, cs.fcntrcode,  cs.fregno";
		}else
		{
			$order = "sub.fdoe,sub.fqpcode,sub.fsession, cs.fcntrcode, cs.fcollcode, cs.fdegree, cs.fregno";
		}

	


	
		
	// $get_subject_data = "Select sub.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 {$order}) as data_set,
	// subject.fqpcode as fqpcode from {$candsumttmp} candsum, {$canddettmp} canddet, degree, subject, reason, 
	// {$studenttmp} student, attshort at
	// 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 at.fdegree = canddet.fdegree and canddet.fexamno = at.fexamno 
	// and at.fregno = canddet.fregno 
	// and left(at.fsubcode,4) = canddet.fsubcode
	// 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}
	// {$tot_cnd} 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'
	// {$sectionvalue}
	// group by  subject.fqpcode 
	// order by {$order}"; 

	// $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 {$order}) as data_set,
	// subject.fqpcode as fqpcode from candsum,degree, subject,student, reason,canddet
	// left outer join attshort a on  a.fdegree = canddet.fdegree and canddet.fexamno = a.fexamno and a.fregno = canddet.fregno and left(a.fsubcode,4) = canddet.fsubcode
	// left join absent  ab on   ab.fregno = canddet.fregno 
	// where candsum.fdegree = canddet.fdegree and candsum.fcollcode = canddet.fcollcode
	// and candsum.fregno = canddet.fregno 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 subject.fsession = reason.freasoncd 
	// and candsum.fregno = student.fregno and candsum.fdegree = student.fdegree
	// and ab.fqpcode = subject.fqpcode
	// and candsum.fcntrcode =  '{$college_code}' 
	// and subject.fqpcode between '{$qp_code_start}' and '{$qp_code_end}' 
	// and subject.FDOE between {$date}
	// and ifnull(a.fregno,'') = ''
	// and ifnull(ab.fabstype,'') <> 'QpM'
	// {$tot_cnd} and ifnull(canddet.fpassmth,'') =''
	// and ifnull(subject.ftheory,'F') = 'T' 
	// and ifnull(subject.fintass,'F') <> 'T' 
	// and ifnull(canddet.fpresent,'') = 'P'
	// {$sectionvalue}
	// group by  subject.fqpcode 
	// order by {$order}"; 



	if($_SESSION['fexamseparate'] == 'T')
	{
		$candsum = "examcandsum"; 
		$canddet = "examcanddet"; 

	}else
	{
		$candsum = "candsum"; 
		$canddet = "canddet"; 
	}	

	$get_subject_data = "Select sub.fqpcode,cd.fdegree,d.fexamdate as fddate, sub.fcsubcode as fsubcode , 
	sub.fsubshort as fsubshort, 
	if('{$FUNIVCODE}' = '055',concat(sub.fsubshort,' - ',sub.fsubname),concat(sub.fsubname,' ', sub.fssubname)) as fsubname,
	date_format(sub.fdoe,'%d/%m/%Y') as fdoe, r.fdescpn as fsession , 
	GROUP_CONCAT(cs.fregno order by {$order}) as data_set, sub.fqpcode as fqpcode 
	from {$candsum} cs inner join {$canddet} cd on cs.fregno = cd.fregno 
	and cs.fcollcode = cd.fcollcode
	and cs.fdegree = cd.fdegree
	inner join subject sub on cd.fdegree = sub.fdegree and cd.fexamno = sub.fexamno
	and cd.fsubcode = sub.fsubcode and ifnull(sub.ftheory,'F') = 'T' 
	and ifnull(sub.fintass,'F') <> 'T'
	inner join degree d on cd.fdegree = d.fdegree and d.fexamno = cd.fexamno
	inner join student st on cs.fregno = st.fregno and cs.fdegree = st.fdegree
	inner join reason r on sub.fsession = r.freasoncd
	left join attshort a on a.fdegree = cd.fdegree and cd.fexamno = a.fexamno 
	and a.fregno = cd.fregno and left(a.fsubcode,4) = cd.fsubcode 
	left join absent ab on ab.fregno = cs.fregno 
	and ab.fqpcode = sub.fqpcode
	where cs.fcntrcode = '{$college_code}' 
	and sub.fqpcode between '{$qp_code_start}' and '{$qp_code_end}' 
	and sub.FDOE between {$date} 
	and ifnull(a.fregno,'') = '' and ifnull(ab.fabstype,'') <> 'QpM' 
	{$tot_cnd} and ifnull(cd.fpassmth,'') ='' 
	and ifnull(cd.fpresent,'') = 'P' 
	and ifnull(cd.FTHPR,'') <> 'T'
	and INSTR(cs.fhtenable,cd.fexamno) >0
	{$sectionvalue}
	group by sub.fqpcode
	order by {$order}";

	// var_dump($get_subject_data);
	// die();
	$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','',12);	
	 								 									
	$pdf->Cell(0,6,'Subject :'.$pdf->qp_code,0,1,'C'); 											 									
	$pdf->Cell(0,5,'Date and Session  : '.$fdoe .' '.$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 Allotment',1,0,'L');
		$pdf->Cell(30,5,$data_set_count,'1',1,'L');
		$pdf->Cell(150,5,'Total No. of students appeared',1,0,'L');
		$pdf->Cell(30,5,"",'1',1,'L');
		$pdf->Cell(150,5,'Total No. of students Absent','LRB',0,'L');
		$pdf->Cell(30,5,'','LRB',1,'L');
		$pdf->Cell(150,5,'No. of Additions','LRB',0,'L');
		$pdf->Cell(30,5,'','LRB',1,'L');
		$pdf->Cell(150,5,'Total No. of Answer Scripts Dispatched','LRB',0,'L');
		$pdf->Cell(30,5,'','LRB',1,'L');
		$pdf->Ln(15);
		if($FUNIVCODE == '021')
		{
			$pdf->Cell(90,5,'Signature of Deputy chief Superintendent','0',0,'L');
			$pdf->Cell(90,5,'Signature of Chief Superintendent','0',1,'R');
		}else
		{
			$pdf->Cell(90,5,'Signature of Chief Superintendent','0',0,'L');
			$pdf->Cell(90,5,'Signature of Office Superintendent','0',1,'R');
		}
		$x=$pdf->GetX();
		$y=$pdf->GetY();
		$pdf->Line($x,$y,$x+184,$y);
		$pdf->Cell(180,7,"*Note : Round off reg. no. for absent","0",1,"C");

	}else
	{
		$pdf->Ln(6);
		$pdf->Cell(0,5,'Total Student :'.$data_set_count,0,1,'L');
	}
	
	}

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