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.22.41.80
<?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"];
$sectionfrom = $aobj_context->mobj_data["sectionfrom"];
$sectionto = $aobj_context->mobj_data["sectionto"];
$dbname = "resultsg_reva2";
$fp = fopen('php://output', 'w');
$slno=0;
$query = "select concat(FDEGREE ,' - ',FDESCPN) as degree,concat(' ', FEXAMNAME ,' Examination ',FEXAMDATE,'') as exam
from degree where FDEGREE = '{$degree_code}' and FEXAMNO='{$exam_code}' ";
$result = $aobj_context->mobj_db->GetRow($query);
$degree = $result['degree'];
$exam = $result['exam'];
$table ="<table cellspacing='0' cellpadding='1' border='1' >";
$table.= "<tr>";
$table.= "<td style = 'vertical-align:middle;text-align:center;font-weight: bold;' colspan='4' height = '40' >Degree : {$degree} </td>";
$table.= "</tr>";
$table.= "<tr>";
$table.= "<td style = 'vertical-align:middle;text-align:center;font-weight: bold;' colspan='4' height = '40' >Exam : {$exam} </td>";
$table.= "</tr>";
$table.= "</table>";
echo $table;
$sql = " select m.FREGNO, SUBSTRING(stu.FNAME,1,36) as Name1,
SUBSTRING(stu.FNAME,37) as Name2,
concat(s.FSUBNAME,', ', FSSUBNAME) as sub_name,
if(ifnull(m.FMARKS,-1) >= 0,right(concat('000',m.FMARKS),3),if(ifnull(m.FMARKS,-1) = -2,'ABSENT','')) as Marks,
m.FSUBCODE, s.FSMAXMARKS,stu.fsection
from marks m inner join student stu on m.fdegree = stu.fdegree and m.FREGNO=stu.FREGNO
inner join subject s on m.fdegree = s.fdegree and m.fexamno = s.fexamno and m.FSUBCODE = s.FCSUBCODE
where m.FDEGREE = '{$degree_code}' and m.FEXAMNO = '{$exam_code}' AND IF(IFNULL(stu.fsection,'') <> '', stu.fsection BETWEEN '{$sectionfrom}' AND '{$sectionto}',1=1)
and m.FSUBCODE between '{$sublist_start}' and '{$sublist_end}' and SUBSTR(fssubname,1,2) = '{$element_type}'
and m.FCOLLCODE = '{$college_code}' and m.FCOLLCODE = '{$college_code}'
and IFNULL(stu.FDELETED,'F') <> 'T'
group by stu.fsection, FCSUBCODE, m.FREGNO order by stu.fsection,FCSUBCODE, m.FREGNO";
//var_dump($sql);die();
$result = $aobj_context->mobj_db->GetAll($sql);
$first = true;
$sl_no=1;
$k2=1;
$oldsub = "";
$oldsection = "";
$newsub = "";
$newsection = "";
foreach($result as $key => $value)
{
$newsub = $value['FSUBCODE'];
$newsection = $value['fsection'];
if($newsub != $oldsub || $newsection != $oldsection)
{
$first = true;
$sl_no=1;
$e_data.="<table cellspacing='1' cellpadding='1' border='0' width = ''>";
$e_data.="<tr>";
$e_data.="<td style = 'text-align:center;font-weight: bold;' > </td>";
$e_data.="</tr>";
$e_data.="<tr>";
$e_data.="<td style = 'text-align:center;font-weight: bold;' > </td>";
$e_data.="</tr>";
$e_data.="</table>";
echo $e_data;
}
$oldsub = $newsub;
$oldsection = $newsection;
if($first)
{
$e_data ="<table cellspacing='0' cellpadding='1' border='1' >";
$e_data.="<tr>";
$e_data.="<td style = 'vertical-align:middle;text-align:left;font-weight: bold;' colspan='4' height = '40' >Subject : {$newsub}-{$value['sub_name']},Max. Marks {$value['FSMAXMARKS']}</td>";
$e_data.="</tr>";
if($value['fsection'] != '')
{
$e_data.="<tr>";
$e_data.="<td style = 'vertical-align:middle;text-align:left;font-weight: bold;' colspan='4' height = '40' >Section : {$value['fsection']}</td>";
$e_data.="</tr>";
}
$e_data.="</table>";
$e_data.="<table cellspacing='0' cellpadding='1' border='1' width = ''>";
$e_data.="<tr>";
$e_data.="<td style = 'text-align:center;font-weight: bold;' >Sl. No.</td>";
$e_data.="<td style = 'text-align:center;font-weight: bold;' >Register No.</td>";
$e_data.="<td style = 'text-align:center;font-weight: bold;'>Name</td>";
$e_data.="<td style = 'text-align:center;font-weight: bold;' >Marks</td>";
$e_data.="</tr>";
$first=false;
}
$e_data.="<tr>";
$e_data.="<td style = 'text-align:center;' >{$sl_no}</td>";
$e_data.="<td style = 'text-align:center;' >{$value['FREGNO']}</td>";
$e_data.="<td style = 'text-align:left;'>{$value['Name1']}</td>";
$e_data.="<td style = 'text-align:center;' >{$value['Marks']}</td>";
$e_data.="</tr>";
$count++;
$row_cnt++;
++$sl_no;
++$k2;
}
$e_data.="</table>";
header("Content-Type:application/xls");
header("Content-Disposition: attachment; filename=iamarkslist.xls");
echo $e_data;
}
?>
|