<?php require "_header.php";?>
<script language="javascript" type="text/javascript">
document.getElementById("main-content").style.display = 'none';
</script>
<style type="text/css">
	.table-report{
		font-family:Verdana, Geneva, sans-serif;
		font-size:12px;
		text-align:left;
		border-right:0px none;
		border-bottom:0px none;
	}
	.table-report-inner{
		font-family:Verdana, Geneva, sans-serif;
		font-size:12px;
	}
	.table-report tr{
		padding:2px 2px 2px 2px;
	}
	.table-report td{
		padding:2px 2px 2px 2px;
		border-top:0px none;
		border-left:0px none;
	}
	.table-report th{
		padding:2px 2px 2px 2px;
		font-weight:bold;
		text-align:left;
		border-top:0px none;
		border-left:0px none;
	}	
	.break { page-break-before: always; }
</style>
<div id="main-report">
<?php
if($_SESSION['VedantnrCollegeId']!="" && isset($_SESSION['VedantnrCollegeId'])) 
{ 
	ob_start();
	
	$student_id 	= $_SESSION['student_id'];

	$order_by = $_REQUEST['hid_orderby'];
	$SQL_CONDITION  = "";
	
	$SQL_STUDENT = "
		SELECT 
			sm.student_id,
			sem.semester_name,
			branch.branch_name,
			cur_divison,
			sbm.subject_name,
			rm.test_type,
			rm.obtain_mark,
			rm.	present,
			rm.result,
			em.exam_name,
			es.total_marks
		FROM
			cms_studentmaster sm,
			cms_studentdetail sd,
			cms_semestermaster sem,
			cms_branchmaster branch,
			cms_exammaster em,
			cms_examsetup es,
			cms_resultmaster rm,
			cms_subjectmaster sbm
		WHERE 
			sm.student_active = 1 AND 
			sm.student_id = sd.student_id AND
			sd.current_active = 1 AND
			em.exam_id = rm.exam_id AND
			sd.cur_semesterid = sem.semester_id AND
			sd.cur_branchid = branch.branch_id 	 AND
			sm.student_id = rm.student_id AND
			rm.subject_id = sbm.subject_id AND
			sbm.subject_id = es.subject_id AND
			sm.student_id = ".$_SESSION["student_id"]." AND
			rm.year_id = sd.year_id AND 
			rm.year_id = es.year_id 
			order by sd.cur_semesterid,es.exam_id,rm.subject_id";
		
	
	
	
	$RES_STUDENT = dbQuery($SQL_STUDENT);
	
	if(dbRows($RES_STUDENT)>0){?>
        <center><h4>All Exams Result Information</h4></center>
      <br />
		<table class="table-report" border="1" cellpadding="0" cellspacing="0" width="100%">
        <tr>
        	<th style="text-align:center;" width="5%">Sr</th>
            <th style="text-align:center;" width="20%">Subject</th>
            <th style="text-align:center;" width="10%">ExamName</th>
            <th style="text-align:center;" width="8%">Type</th>
            <th style="text-align:center;" width="5%" >Present</th>
            <th style="text-align:center;"   width="10%">Total Marks</th>
            <th style="text-align:center;" width="10%" >Obtain Marks</th>
            <th style="text-align:center;" width="10%" >Result</th>
            
            
        </tr>
		<?php
		$i = 1;
		$temp = "";
		while($REC_STUDENT = dbArray($RES_STUDENT)){
			 if($REC_STUDENT["semester_name"] != $temp)
			 {
				 $temp1=$REC_STUDENT["branch_name"];
				 $temp=$REC_STUDENT["semester_name"];
				?>
                <tr><th colspan="8"><?php echo strtoupper($temp1)."  ".$REC_STUDENT['semester_name'].'-'.$REC_STUDENT['cur_divison']; ?></th></tr><?php
			}?>
            <tr>
				<td style="text-align:center;">&nbsp;<?php echo $i++; ?></td>
                <td style="text-align:left;">&nbsp;<?php echo $REC_STUDENT['subject_name'];?></td>
                <td style="text-align:center;">&nbsp;<?php echo $REC_STUDENT['exam_name']; ?></td>
                <td style="text-align:center;">&nbsp;
				<?php if($REC_STUDENT['test_type']=='f')
						echo "First Test";
					  else if($REC_STUDENT['test_type']=='r')
					  	echo "Retest";
					  	?></td>
                  <td style="text-align:center;">&nbsp;
				<?php if($REC_STUDENT['present']=='1')
						echo "Yes";
					  else if($REC_STUDENT['present']=='0')
					  	echo "No";
					  	?></td>
                 
                <td style="text-align:center;">&nbsp;<?php echo $REC_STUDENT['total_marks']; ?></td>
                <td style="text-align:center;">&nbsp;<?php echo $REC_STUDENT['obtain_mark']; ?></td>
                 <td style="text-align:center;">&nbsp;<?php echo $REC_STUDENT['result']; ?></td>
             
       		</tr><?php
		}
		?>
		</table>
		<?php
	}
	else{
		echo "NO DATA FOUND!";	
	}
	
?>

<?php
	$HtmlCode = ob_get_contents();
	ob_end_flush();
	$HtmlUrl = "studentresultlist-report.html";
	$HtmlPath =	"report/".$HtmlUrl;
	createHTMLReportPage($header_row_string,$HtmlUrl,$HtmlPath,$HtmlCode,false);
?>
<br/>
<form name="frm" id="frm" action="" method="post">		
    <input type="hidden"   name="txtFile" id="txtFile" value="<?php echo $HtmlUrl ;?>" />
    <input type="button"  name="btnPrint" id="btnPrint" value="Print" onClick="SetPageAction('PRINT');"/>
    <input type="button"  name="btnPdf" id="btnPdf" value="Create PDF" onClick="SetPageAction('PDF');"/>
    <input type="button" name="btnHtml" id="btnHtml" value="Create HTML" onClick="SetPageAction('HTML');"/>
    <input type="button" name="btnWord" id="btnWord" value="Create WORD" onClick="SetPageAction('WORD');"/>
    <input type="button" name="btnExcel" id="btnExcel" value="Create EXCEL" onClick="SetPageAction('Excel');"/>
</form>
<script language="javascript" type="text/javascript">
function SetPageAction(varAction) {
	if(varAction=="PRINT"){			
		document.frm.action="print/create-print.php";
		document.frm.target = "_blank";
		document.frm.submit();
	}
	else if(varAction=="PDF"){			
		document.frm.action="convertpdf/create-pdf.php";
		document.frm.target = "_blank";
		document.frm.submit();
	}
	else if(varAction=="HTML"){
		document.frm.action="<?php echo $HtmlPath ;?>";
		document.frm.target = "_blank";
		document.frm.submit();
	}
	else if(varAction=="WORD"){
		document.frm.action="convertword/create-word.php";
		document.frm.target="_blank";
		document.frm.submit();
	}
	else if(varAction=="Excel"){
		document.frm.action="convertword/create-excel.php";
		document.frm.target="_blank";
		document.frm.submit();
	}
}
</script>
<?php } ?>
</div>
<?php 
	require "_footer.php";
?>