<?php require "_header.php";?>
<script language="javascript" type="text/javascript">
document.getElementById("main-content").style.display = 'none';
</script>
<style>
	.table-report{
		border:1px solid #000;	
		font-family:Verdana, Geneva, sans-serif;
		font-size:11px;
		text-align:left;
	}
	.table-report-inner{
		font-family:Verdana, Geneva, sans-serif;
		font-size:11px;
	}
	.table-report-footer{
		font-family:Verdana, Geneva, sans-serif;
		font-size:10px;
	}
	.table-report tr{
		padding:1px 1px 1px 1px;
		border:1px solid #000;	
	}
	.table-report td{
		padding:1px 1px 1px 1px;
		border:1px solid #000;	
	}
	.table-report th{
		padding:1px 1px 1px 1px;
		font-weight:bold;
		text-align:left;
	}	
	.college_name{
		font-family:QTAbbie;
		font-size:22px;	
		font-weight:bold;
		padding:1px 1px 1px 1px;
		text-align:center;
		vertical-align:top;
	}
	.college_address{
		font-family:Tahoma, Geneva, sans-serif;
		font-size:11px;	
		text-align:center;
		padding:1px 1px 1px 1px;
		vertical-align:top;
	}
	.break{
		page-break-after:always;
				
	}
</style>
<div id="main-report">
<?php

if($_REQUEST['student_gturegno'] == "" &&  $_REQUEST['branch_hidden'] == "" && $_REQUEST['semester_hidden'] == ""  && $_REQUEST['division_id'] == ""  && $_REQUEST['student_hidden'] == "")
{
	   
?>
	<script language="javascript" type="text/javascript">
		location.href='report-student-fees-records.php';
	</script>
<?php
}
elseif($_SESSION['VedantnrCollegeId']!="" && isset($_SESSION['VedantnrCollegeId'])) 
{ 

			//echo "<pre>";print_r($rec_studentdata);exit;
	$branch_id 		= $_REQUEST['branch_hidden'];
	$semester_id	= $_REQUEST['semester_hidden'];
	$division_id	= $_REQUEST['division_id'];
	$batch_id 		= $_REQUEST['batch_id'];
	$year_id 	   	=   $_REQUEST['year_id'];
	
	$gturegno		= Escape($_REQUEST['student_gturegno']);
	$stuid		= Escape($_REQUEST['student_hidden']);
	
	$certificate_no		= Escape($_REQUEST['certificate_no']);
	
			$order_by = 'student_gturegno';
	$SQL_CONDITION  = "";
		
	$SQL_STUDENT = "
		SELECT
			
			
			sm.student_id,
			sd.cur_semesterid,
			sd.cur_branchid,
			student_admdate,
			CONCAT(student_surname,' ',student_firstname,' ',SUBSTR(student_lastname,1,1),'.') AS student_name,
			student_address,
			student_emailid,
			student_birthdate,
			student_gturegno,
			SUBSTR(student_gender,1,1) AS student_gender,
			student_mobilestudents,
			student_mobileparents,
			semester_name,
			branch.branch_name,
			sm.student_admby,
			sm.tfw_scheme ,
			sd.batch_id,
			sm.leave_type,
			sd.cur_divison
		FROM
			cms_studentmaster sm,
			cms_studentdetail sd,
			cms_semestermaster sem,
			cms_branchmaster branch
		WHERE  
			sm.student_id = sd.student_id AND
			sd.year_id = ".$_SESSION["VedantnrYearId"]." AND 
			sd.cur_semesterid = sem.semester_id AND
			sd.cur_branchid = branch.branch_id 	 ";
			
			
	
	if($branch_id != "" &&  $branch_id != "All"){
		$SQL_CONDITION .= " AND sd.cur_branchid = ".$branch_id;
	}
	if($semester_id != "" && $semester_id != "undefined"){
		$SQL_CONDITION .= " AND sd.cur_semesterid = ".$semester_id;
	}
	
			
	if($gturegno != ""){ 
		$SQL_CONDITION .= " AND sm.student_gturegno = '".$gturegno."' ";
	}
	
	if($stuid != ""){ 
		$SQL_CONDITION .= " AND sm.student_id = '".$stuid."' ";
	}
	
	$SQL_CONDITION .= " ORDER BY sd.cur_branchid ASC, sd.cur_semesterid ASC , sd.cur_divison ASC ";
	
	if($order_by != "" && $order_by != "undefined"){
		$SQL_CONDITION .= ",".$order_by." ASC ";
	}
	else{
		$SQL_CONDITION .= " ,student_gturegno ASC ";
	}
	
	
	if($SQL_CONDITION != ""){
		 $SQL_STUDENT .= $SQL_CONDITION;
	}
	  
	//echo 	 $SQL_STUDENT; exit;
	$RES_STUDENT = dbQuery($SQL_STUDENT);
	$i=1;
	?>
	<table class="table-report" cellpadding="0" cellspacing="0" width="100%"> 
		
				<tr>
				<td>Sr No</td>
				<td>Enrollment No</td>
				<td>Student Name</td>
				
				</tr>
	<?php			
	if(dbRows($RES_STUDENT)>0){?>
    	
  <?php
		
		while($REC_STUDENT = dbArray($RES_STUDENT))
		{
			
	?>	
        	<tr>
				<td><?php echo $i++; ?></td>
				<td><?php echo $REC_STUDENT['student_gturegno']; ?></td>
				<td><?php echo $REC_STUDENT['student_name']; ?></td>
				
				</tr>	               
          <?php
		}
		?>
			</table>   
    <?php    
	}
	else{
		echo "";	
	}?>
	

<?php
	$HtmlCode = ob_get_contents();
	ob_end_flush();
	$header_row_string="";
	$HtmlUrl = "student-overall-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 } ?>
<?php 
	require "_footer.php";
?>