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


        <div id="page-wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header">Admitted List By Department</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 dept FROM department where level!='ND'");
                                                    $result = $conn->query($getdept);
                                                     while($row = $result->fetch_assoc()) {
                                                   // while($row = mysql_fetch_array($getdept)){
                                                ?>
                                                    <option value="<?php echo $row['dept'] ?>"><?php echo $row['dept']?></option>
                                                <?php
                                                    }
                                            ?>
                                            ?>
                                        </select>
                                	</td>
                                    <td>
                                    	<select name="programme" class="form-control" id="programme">
                                            <option value="">--Select Programme--</option>
                                        
                                             
                                            <option value="HND">Higher National Diploma</option>
                                            
                                        </select>
                                    </td>
                                    <td>
                                    	<select name="session" class="form-control" id="session">
                                            <option value="">--Select Session--</option>
                                            <option value="2019/2020">2019/2020</option>
                                            <option value="2020/2021">2020/2021</option>
                                             <option value="2021/2022">2021/2022</option>
                                             <option value="2022/2023">2022/2023</option>
                                              <option value="2023/2024">2023/2024</option>
                                        </select>
                                    </td>
                                    <td>
				                       <input type="text" class="form-control" placeholder="From: yyyy-mm-dd"name="fromdate" title="Uploading Date " autocomplete="on">
                                    </td>
                                    <td>
				                       <input type="text" class="form-control" placeholder="To: yyyy-mm-dd"name="todate" title="Uploading Date " autocomplete="on">
                                    </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>FORM NO</th>
                                            <th>SURNAME</th>
                                            <th>OTHER NAMES</th>
                                            <th>SEX</th>
                                            <th>PHONE</th>
                                            <th>REMARK</th>
                                        </tr>
                                    </thead>
					<?php
							$_SESSION['sek']= $_POST['session'];
							$_SESSION['programme']= $_POST['programme'];
							$_SESSION['fromdate']= $_POST['fromdate'];
							$_SESSION['todate']= $_POST['todate'];
							$courses=$_POST['courses'];
						
							if ($courses=="Bio-chemistry")
							   $courses="Applied Science (Biochemistry Option)";
							elseif  ($courses=="Environmental Biology")
							   $courses="Applied Science (Environmental Biology Option)";
						    elseif  ($courses=="Microbiology (Option)")
							   $courses="Applied Science (Microbiology Option)";	   
						   elseif  ($courses=="Physics with Electronics (Option)")
							   $courses="Applied Science (Physics with Electronics Option)";	   
						   elseif  ($courses=="Chemistry (Option)")
							   $courses="Applied Science (Chemistry Option)";	   
							            
							   
							$_SESSION['courses'] = $courses;
						
							echo $courses,$_POST[programme],$_POST[session];
							
                          if($_POST[fromdate]=="" || $_POST[todate]=="" || $_POST['programme']=="HND" )
						
                           $sql = ("SELECT DISTINCT admission_list.formno,admission_list.department, admission_list.status, form_data23.formno,  form_data23.acc_id,form_data23.sex,form_data23.phone,student_account.id, student_account.surname, student_account.othernames
										FROM admission_list, form_data23,student_account
										WHERE admission_list.department='$courses' 
										AND admission_list.formno LIKE '%FT23%'
									 	AND admission_list.formno = form_data23.formno 
									 	AND form_data23.acc_id=student_account.id
										ORDER BY admission_list.formno ");
						
                      $result = $conn->query($sql);
                        $i=0;
                         while($row = $result->fetch_assoc()) {
                       // while($row=mysql_fetch_array($sql)){
                        $i++;
                        $color=($i%2==0)?"lightblue":"white";
                    ?>
                                    <tbody>
                                        <tr >
                                        	<td><?php echo $i;?></td>
                                            <td><?php echo $row['formno'];?></td>
                                            <td><?php echo $row['surname'];?></td>
                                            <td><?php echo $row['othernames'];?></td>
                                            <td><?php echo $row['sex'];?></td>
                                            <td><?php echo $row['phone'];?></td>
                                            <?php 
                                           	 	if($row['status']=='P') {
                                                    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="hnd_printout_admitted_student_spreadsheet_con.php" target="_new" class="btn btn-warning">Print Concessionary Admitted</a> 
                             <a href="hnd_printout_admitted_student_spreadsheet_pro.php" target="_new" class="btn btn-success">Print Provisional Admitted</a>
                            <p>&nbsp;</p>
                        </center>
                    </form>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->

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

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