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


        <div id="page-wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header">ND WEEKEND PART TIME LIST</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">                        	
                        	<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 = mysql_query("SELECT dept FROM department WHERE level<>'HND'");
                                                    while($row = mysql_fetch_array($getdept)){
                                                ?>
                                                    <option value="<?php echo $row['dept'] ?>"><?php echo $row['dept']?></option>
                                                <?php
                                                    }
                                            ?>
                                        </select>
                                	</td>
                                    <td>
                                    	<select name="session" class="form-control" id="session">
                                            <option value="">--Select Session 
                                            <option value="2019/2020">2019/2020</option>
                                            <option value="2020/2021">2020/2021</option>
                                            <option value="2021/2022">2021/2022</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">
                    <div class="panel panel-primary chat-panel">
                        <div class="panel-heading ">
                            Student Details Table
                        </div>
                        <?php echo $courses;
                          echo $session;
                        ?>
                        <!-- /.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>sub1</th>
                                            
                                            <th>sub2</th>
                                           
                                            <th>sub3</th>
                                            
                                            <th>sub4</th>
                                           
                                            <th>sub5</th>
                                         
                                            
                                        </tr>
                                    </thead>
					<?php
							$_SESSION['sek']= $_POST['session'];
							$_SESSION['courses']= $_POST['courses'];
							$_SESSION['fromdate']= $_POST['fromdate'];
							$_SESSION['todate']= $_POST['todate'];
							$courses=$_POST['courses'];
						
							echo $courses;
							
                        	if($_POST['session']=='2020/2021' )
							//	$sql = mysql_query("SELECT student_account.id,student_account.level, student_account.activated,student_account.surname,student.account.othernames, form_data.sex,form_data.formno,
							//			academics_data.sub1,academics_data.sub2,academics_data.sub3,academics_data.sub4,academics_data.sub5
							//			FROM academics_data, form_data, student_account 
							//			WHERE student_account.level='HND' AND student_account.activated='Y' AND student.account.department = '$courses'
                            //                                                    AND student_account.id=form_data.acc_id ANd student.account.id=academics_data.acc_id
                            //                                                    ");
                            
                            	$sql = mysql_query("SELECT student_account.id, student_account.level, student_account.activated, student_account.surname, student_account.othernames, form_data.sex,form_data.formno,
                            	academics_data.sub1,academics_data.sub2,academics_data.sub3,academics_data.sub4,academics_data.sub5
                            	FROM  academics_data, form_data, student_account 
                            	WHERE student_account.level='ND' AND 
                            	  student_account.progtype='CAPND' AND
                            	  student_account.activated='Y' AND student_account.department = '$courses' AND student_account.id=form_data.acc_id ANd student_account.id=academics_data.acc_id AND student_account.date Between '{$_SESSION['fromdate']}' AND '{$_SESSION['todate']}' order by form_data.formno");
                                                                               
                          // AND status = 'not-admitted'                                                      
                           
                           
                         elseif($_POST['session']=='2021/2022' )
						                                              
                            
                            	$sql = mysql_query("SELECT student_account.id, student_account.level, student_account.activated, student_account.surname, student_account.othernames, form_data21.sex,form_data21.formno,
                            	academics_data.sub1,academics_data.sub2,academics_data.sub3,academics_data.sub4,academics_data.sub5
                            	FROM  academics_data, form_data21, student_account 
                            	WHERE student_account.level='ND' AND 
                            	  student_account.progtype='CAPND' AND
                            	  student_account.activated='Y' AND student_account.department = '$courses' AND student_account.id=form_data21.acc_id ANd student_account.id=academics_data.acc_id AND student_account.date Between '{$_SESSION['fromdate']}' AND '{$_SESSION['todate']}' order by form_data21.formno");
                                                                               
                          // AND status = 'not-admitted'                                                      
                             
                        $i=0;
                        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['sub1'];?></td>
                                        
                                            <td><?php echo $row['sub2'];?></td>
                                           
                                            <td><?php echo $row['sub3'];?></td>
                                            
                                            <td><?php echo $row['sub4'];?></td>
                                           
                                            <td><?php echo $row['sub5'];?></td>
                                            
                                             
                                        </tr>
                                    </tbody>
                          <?php	
							}														
							?>
                                </table>
                            </div>
                            <!-- /.table-responsive -->
                          
                        </div>
                        <!-- /.panel-body --> 
                    </div> 
                    <!-- /.panel -->
                    	<center>
                       		<a href="2021_pt_wkp_spreadsheet.php" target="_new" class="btn btn-success">Send to Printer</a>
                        </center>
                    </form>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->

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

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