<?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;
	}

	.college_name {
		font-family: QTAbbie;
		font-size: 22px;
		font-weight: bold;
		padding: 2px 2px 2px 2px;
		text-align: center;
	}

	.college_address {
		font-family: Tahoma, Geneva, sans-serif;
		font-size: 11px;
		text-align: center;
		padding: 2px 2px 2px 2px;
	}

	.break {
		page-break-before: always;
	}
</style>
<div id="main-report">
	<?php
	if ($_REQUEST['branch_hidden'] == "") {
		?>
		<script language="javascript" type="text/javascript">
			location.href = 'report-student-list-yearwise.php';
		</script>
		<?php
	} elseif ($_SESSION['VedantnrCollegeId'] != "" && isset($_SESSION['VedantnrCollegeId'])) {
		$branch_id = Escape($_REQUEST['branch_hidden']);
		$condition = "";
		/*$SQL_STUDENT = "SELECT 
				CONCAT(sm.student_surname, ' ', sm.student_firstname, ' ', sm.student_lastname) AS student_name,
				sm.student_gturegno,
				(SELECT branch_name 
							FROM cms_branchmaster sec 
							WHERE sec.college_id   = '" . $_SESSION["VedantnrCollegeId"] . "' and sec.branch_id=sd.cur_branchid) AS branch_name,
								(SELECT year_name 
							FROM cms_yearmaster ym 
							WHERE ym.year_id=sd.year_id) AS year_name,
								(SELECT branchyear_name 
							FROM cms_branchyear bry 
							WHERE bry.college_id   = '" . $_SESSION["VedantnrCollegeId"] . "' and bry.branchyear_id=sd.cur_branchyearid) AS branchyear_name,
								(SELECT semester_name
							   FROM cms_semestermaster sem 
							WHERE  sem.college_id   = '" . $_SESSION["VedantnrCollegeId"] . "' AND sem.semester_id = sd.cur_semesterid) AS semester_name	  	
						 
			FROM 
				cms_studentmaster sm,
				cms_studentdetail sd 
				where 
				sm.student_id = sd.student_id";*/

		if ($branch_id != "" && $branch_id != "All") {
			$condition .= " AND sd.cur_branchid = " . $branch_id;
		}
		$condition .= " group by  sm.student_id order by  sm.student_surname, sm.student_firstname, sm.student_lastname ASC";

		//echo $SQL_STUDENT; exit;
		//dbquery("SET group_concat_max_len = 102400");
		//$RES_STUDENT = dbQuery($SQL_STUDENT);
	
		$objStudentMgmt = new StudentMgmt();
		$RES_STUDENT = $objStudentMgmt->getstudentyearwiselist($condition);
		ob_start();
		if (dbRows($RES_STUDENT) > 0) { ?>
			<div style="display: inline-block; vertical-align: middle;">
									<b style="font-size: 30px;"><?php echo $_SESSION["VedantnrCollegeName"]; ?></b><br>
									<?php echo $_SESSION["VedantnrCollegeAddress"]; ?><br>
									Phone: <?php echo $_SESSION["VedantnrCollegePhone"]; ?>&nbsp;&nbsp;
									Email: <?php echo $_SESSION["VedantnrCollegeEmail"]; ?>
								</div>

			<center>
				<h4>Student Status List</h4>
			</center><br /><br />
			<table class="table-report" border="1" cellpadding="0" cellspacing="0" width="100%">
				<tr>
					<th style="text-align:center;" width="1%">Sr</th>
					<th style="text-align:center;" width="7%">Enrollment Reg No</th>
					<th style="text-align:left;" width="12%">Student Name</th>
					<th style="text-align:center;" width="80%"> Detail</th>
				</tr>
				<?php
				$i = 1;
				$c = 0;
				while ($REC_STUDENT = dbArray($RES_STUDENT)) {

					?>
					<tr>
						<td style="text-align:center;">&nbsp;<?php echo $i++; ?></td>
						<td style="text-align:center;">&nbsp;<?php echo $REC_STUDENT['student_gturegno']; ?></td>
						<td style="text-align:left;">&nbsp;<?php echo $REC_STUDENT['student_name']; ?></td>
						<td colspan="6">
							<?php echo $REC_STUDENT['branch_name']; ?>
							| <?php echo $REC_STUDENT['year_name']; ?>
							| <?php if ($REC_STUDENT['branchyear_name'] != "") {
								echo $REC_STUDENT['branchyear_name'];
							}
							if ($REC_STUDENT['semester_name'] != "") { ?>
								| <?php echo $REC_STUDENT['semester_name'];
							} ?>
						</td>
					</tr>
				<?php }
				$i++; ?>
			</table>
			<?php

			$HtmlCode = ob_get_contents();
			ob_end_flush();
			$header_row_string = "";
			$HtmlUrl = "studentlist-report-yearwise.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
		} else {
			echo "NO DATA FOUND!";
		}
	} ?>
</div>
<?php require "_footer.php"; ?>