<?php
	error_reporting(0);
	define('INCLUDE_CHECK',true);
	session_start();
	require ('classes/config2.php');
	require_once('classes/session.php');
	
	
?>
<title>OSCOTECH, ESA-OKE :: Admin-Dashboard > Faculty Admitted List</title>


        <div id="page-wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header">MATRICULATION LIST REPORT</h1>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            <div class="row">
                <div class="col-lg-12">
                	<div class="well" style="background:#FFF">
                    	<form method="post" action="" role="form" enctype="multipart/form-data">                        	
                        	<div class="form-group input-group">
                        	<table class="table table-bordered table-hover">
                            	<tr>
                                		<td>
                                        <select name="courses" id="courses"  class="form-control">
                                          <option value="">-- Select Department -- </option>
                                             <?php 
                                                    $getdept = ("SELECT department FROM department_mat");
                                                     $result = $conn1->query($getdept);
                                                     while($row = $result->fetch_assoc()) {
                                                ?>
                                                    <option value="<?php echo $row['department'] ?>"><?php echo $row['department']?></option>
                                                <?php
                                                    }
                                            ?>
                                            ?>
                                        </select>
                                	</td>
                                    <td>
                                    	<select name="programme" class="form-control" id="programme">
                                            <option value="">--Select Programme--</option>
                                           
                                           <?php 
                                           
                                                    $getsetup = ("SELECT ptypename, faculty, code FROM fo_setup where  code='1' or code='2'");
                                                     $res = $conn1->query($getsetup);
                                                     while($row = $res->fetch_assoc()) {
                                                ?>
                                                    <option value="<?php echo $row['ptypename'] ?>"><?php echo $row['faculty']?></option>
                                                <?php
                                                    }
                                            ?>
                                            ?>
                                        </select>
                                    </td>
                                    <td>
                                    	<select name="session" class="form-control" id="session">
                                            <option value="">--Select Session--</option>
                                             <!-- <option value="2022/2023">2022/2023</option>-->
                                            <option value="2023/2024">2023/2024</option>
                                            
                                            
                                            
                                        </select>
                                    </td>
                                    <td>
                                    	<div class="input-group date form_date col-md-11" data-date="" data-date-format="yyyy-mm-dd" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
				                       		<input type="text" class="form-control" placeholder="From: yyyy-mm-dd" name="fromdate" title="Uploading Date " autocomplete="on">
											<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                                       </div>
                                    </td>
                                    <td>
                                    	<div class="input-group date form_date col-md-11" data-date="" data-date-format="yyyy-mm-dd" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
				                       		<input type="text" class="form-control" placeholder="To: yyyy-mm-dd"name="todate" title="Uploading Date " autocomplete="on" >
                                            <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                                       </div>
                                    </td>
                                	<td>
                                        <span class="input-group-btn">
                                            <input type="submit" class="btn btn-danger" name="btnsearch" value="Search" id="button-search" title="Search Student">
                                        </span>
                                    </td>
                             	</tr>
                            </table>
                            </div>
                        </form>
                    </div>
                    <form action="" method="post" enctype="multipart/form-data">
                    <div class="panel panel-primary chat-panel">
                        <div class="panel-heading ">
                            Student Admitted Table
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                            <div class="dataTable_wrapper">
                                <table class="table table-bordered table-hover">
                                    <thead>
                                       <tr height="20">
                                            <th>S/N</th>
                                            <th>MATRIC NO</th>
                                            <th>STUDENT NAMES</th>
                                            <th>DEPARTMENT</th>
                                             
                                        </tr>
                                    </thead>
					<?php
						$_SESSION['sek']= $_POST['session'];
							$_SESSION['programme']= $_POST['programme'];
							$_SESSION['fromdate']= $_POST['fromdate'];
							$_SESSION['todate']= $_POST['todate'];
							$courses=$_POST['courses'];
							$_SESSION['courses'] = $courses;
							
						    $progtype=$_SESSION['programme'];
						    
						  // echo $_SESSION['accessed_level'];
					 
						
							echo $courses,$_POST[programme],$_POST[session];
							
                        	if($_POST[fromdate]=="" || $_POST[todate]=="")
                        	{
								$sql = ("SELECT DISTINCT admission_list.formno, admission_list.department,admission_list.names, student_activity_level.formno, student_activity_level.matricno  
								FROM admission_list, student_activity_level  
								      WHERE admission_list.session='$_SESSION[sek]'
								      AND student_activity_level.formno=admission_list.formno AND student_activity_level.formno LIKE '$progtype' AND admission_list.department='$courses' AND student_activity_level.matricno>0  
									 	ORDER BY student_activity_level.matricno  ");
                        	}
                        	$result = $conn1->query($sql);
                           
                        $i=0;
                       // while($row=mysql_fetch_array($sql)){
                       while($row = $result->fetch_assoc()) {
                        $i++;
                        $color=($i%2==0)?"lightblue":"white";
                    ?>
                                    <tbody>
                                        <tr >
                                        	<td><?php echo $i;?></td>
                                            <td><?php echo $row['matricno'];?></td>
                                            <td><?php echo $row['names'];?></td>
                                            
                                            <td><?php echo $row['department'];?></td>
                                             
                                            <?php /*
                                           	 	if($row['type']=='PRO') {
                                                    echo "<td>Provisional Admission</td>";
												}else{
													echo "<td>Concessionary Admission</td>";
												}*/
											?>
                                        </tr>
                                    </tbody>
                          <?php	
							}
							?>
                                </table>
                            </div>
                            <!-- /.table-responsive -->
                          
                        </div>
                        <!-- /.panel-body --> 
                    </div> 
                    <!-- /.panel -->
                    	<center>
                       		 <a href="#" target="_new" class="btn btn-warning">Download Matriculation List</a> 
                             <a href="printout_matric_list.php" target="_new" class="btn btn-success">Print Matriculation List</a>
                        </center>
                    </form>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->

        </div>
        <!-- /#page-wrapper -->
       

    </div>
    <!-- /#wrapper -->
    
