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


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

<?php

function GenerateQPwiseCountUniv($aobj_context)
{
	session_start();
	$collcode=$_SESSION['collcode'];
	
	ini_set('memory_limit','300M');
	ini_set('max_execution_time',3300);
	
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$filename = 'university_qpcount.csv';
	$f = fopen('php://output', 'w'); 
	
	$qp_code_from = trim($aobj_context->mobj_data["qp_code_from"]);
	$qp_code_to = trim($aobj_context->mobj_data["qp_code_to"]);
	
	$cntr_from = trim($aobj_context->mobj_data["cntr_from"]);
	$cntr_to = trim($aobj_context->mobj_data["cntr_to"]);

	$date_from = trim($aobj_context->mobj_data["date_from"]);
	$date_to = trim($aobj_context->mobj_data["date_to"]);
	
	$centcode = trim($aobj_context->mobj_data["qpcount"]);
	
	if($centcode == 'summary')
	{
		$get_data ="SELECT DATE_FORMAT(s.FDOE,'%d/%m/%Y') AS Date_of_Exam, IF(IFNULL(s.FSESSION,'')<>'',
			IF(s.FSESSION = r.FREASONCD,r.FDESCPN,s.FSESSION),s.FSESSION) AS SESSION,s.FQPCODE AS Qp_Code, 
			CONCAT(s.FSUBNAME, ' ', s.FSSUBNAME) AS Subject_name, COUNT(distinct c.fregno) AS CAPACITY FROM degree d 
			INNER JOIN subject s ON d.FDEGREE = s.FDEGREE AND d.FEXAMNO = s.FEXAMNO 
			INNER JOIN canddet c ON s.FDEGREE = c.FDEGREE AND s.FEXAMNO = c.FEXAMNO AND s.FSUBCODE = c.FSUBCODE 
			INNER JOIN candsum m ON c.FREGNO = m.FREGNO LEFT JOIN reason r ON r.FREASONCD = s.FSESSION
			WHERE IFNULL(FRECPTDATE,'0000-00-00') <> '0000-00-00' 
			AND c.FPRESENT = 'P' AND IFNULL(c.FPASSMTH,'') = '' and ifnull(m.FTOTALFEE,'') > 0
			and s.FDOE BETWEEN DATE_FORMAT(STR_TO_DATE('{$date_from}', '%d/%m/%Y'),'%Y-%m-%d')  
			AND DATE_FORMAT(STR_TO_DATE('{$date_to}', '%d/%m/%Y'),'%Y-%m-%d')
			and INSTR(m.fhtenable,c.fexamno) >0
			AND s.FQPCODE BETWEEN '{$qp_code_from}' 
			AND '{$qp_code_to}' GROUP BY s.FQPCODE ORDER BY s.FQPCODE";
	}
	else
	{
		$get_data ="SELECT  {$centcode} AS Center_Code ,DATE_FORMAT(s.FDOE,'%d/%m/%Y') AS Date_of_Exam, IF(IFNULL(s.FSESSION,'')<>'',
		IF(s.FSESSION = r.FREASONCD,r.FDESCPN,s.FSESSION),s.FSESSION) AS SESSION,s.FQPCODE AS Qp_Code, 
		CONCAT(s.FSUBNAME, ' ', s.FSSUBNAME) AS Subject_name, COUNT(distinct c.fregno) AS CAPACITY FROM degree d 
		INNER JOIN subject s ON d.FDEGREE = s.FDEGREE AND d.FEXAMNO = s.FEXAMNO 
		INNER JOIN canddet c ON s.FDEGREE = c.FDEGREE AND s.FEXAMNO = c.FEXAMNO AND s.FSUBCODE = c.FSUBCODE 
		INNER JOIN candsum m ON c.FREGNO = m.FREGNO LEFT JOIN reason r ON r.FREASONCD = s.FSESSION
		WHERE IFNULL(FRECPTDATE,'0000-00-00') <> '0000-00-00' AND c.FPRESENT = 'P' 
		AND IFNULL(c.FPASSMTH,'') = '' and ifnull(m.FTOTALFEE,'') > 0
		and s.FDOE BETWEEN DATE_FORMAT(STR_TO_DATE('{$date_from}', '%d/%m/%Y'),'%Y-%m-%d')  
		AND DATE_FORMAT(STR_TO_DATE('{$date_to}', '%d/%m/%Y'),'%Y-%m-%d')
		and INSTR(m.fhtenable,c.fexamno) >0
		and {$centcode} between '{$cntr_from}' and '{$cntr_to}' AND s.FQPCODE BETWEEN '{$qp_code_from}'
		AND '{$qp_code_to}' GROUP BY {$centcode},s.FQPCODE ORDER BY s.FQPCODE,{$centcode}";
				
	}
	//var_dump($get_data);die();
	$lobj_get_data = $aobj_context->mobj_db->GetAll($get_data);
	
	$arrW =0;
	$subjRow ='';
		
	if(!empty($lobj_get_data))
	{
		$e_data.="<table cellspacing='0' cellpadding='1' border='1' width = ''>";
		$e_data.="<tr>";
		$e_data.="<td style = 'text-align:center;font-weight: bold;row-height:40px;' >Sl. No.</td>";
		if($centcode == 'm.FCNTRCODE')
			$e_data.="<td style = 'text-align:center;font-weight: bold;row-height:40px;' >Center code</td>";
		else if($centcode == 'm.FCOLLCODE')
			$e_data.="<td style = 'text-align:center;font-weight:bold;row-height:40px;' >College code</td>";
		$e_data.="<td style = 'text-align:center;font-weight:bold;row-height:40px;'>Exam Date</td>";
		$e_data.="<td style = 'text-align:center;font-weight:bold;row-height:40px;'>Session</td>";
		$e_data.="<td style = 'text-align:center;font-weight:bold;row-height:40px;' >QP. Code</td>";
		$e_data.="<td style = 'text-align:center;font-weight:bold;row-height:40px;' >Subject Title</td>";
		$e_data.="<td style = 'text-align:center;font-weight:bold;row-height:40px;' >Count</td>";		
		$e_data.="</tr>";							
		$k=0;
		$id=0;
		$m=0;

		$counter_degree = 1;
		foreach($lobj_get_data as $key=>$value)
		{
			if($k%2==0)
			{
				$class='tbl_row';
				$inp_class='tbl_row_input';
			}
			else
			{
				$input_class='tbl_row1'; 
				$inp_class='tbl_row1_input';
			}  
			
			$e_data.="<tr>";	
			$e_data.="<td style = 'text-align:center;' >{$counter_degree}</td>";	
			if($centcode != 'summary')			
				$e_data.="<td style = 'text-align:center;' >{$value['Center_Code']}</td>";
			$e_data.="<td style = 'text-align:center;' >{$value['Date_of_Exam']}</td>";
			$e_data.="<td style = 'text-align:left;' >{$value['SESSION']}</td>";
			$e_data.="<td style = 'text-align:center;' >{$value['Qp_Code']}</td>";
			$e_data.="<td style = 'text-align:left;' >{$value['Subject_name']}</td>";
			$e_data.="<td style = 'text-align:right;' >{$value['CAPACITY']}</td>";	
			$e_data.="</tr>";
			$k++;
			$id++;
			$m++;
			$counter_degree++;
		}
		$e_data.="</table>";
		//var_dump($e_data);die();
		$arr['total_count']= $m;						
		$arr['html']=$e_data;
		$arr['error']=0;
	}
	else
	{
		$arr['html'] = '<p> No record found </p>';
	}	
	header("Content-Type:application/xls");
	header("Content-Disposition: attachment; filename=enrolledreport.xls"); 
	echo $e_data;
}

?>