<!-- call datable with export -->
<script  src="js/call_datatable_with_exports.js"></script>

 <?php 

 $uname = get_security_id($user_id);

  $tk = md5(rand(0,100));
  if (isset($_GET['qi'])) {
    
    
    $qi = $_GET['qi'];
    $pt = $_GET['pt'];
    $sess = $_GET['ses'];
    $qual  = '';
    if($qi == 1){
      $qual = 'Qualified ';
    }else{
    	$qual = 'Not Qualified ';
    }

    
  }else{
    header('location: gateway.php?act=view_admission_reports_landing');
  }

  $msg = '';

	if (isset($_POST['clear_btn'])) {
		
		$id = $_POST['app_id'];
		$clr_msg = $_POST['action_msg'];
		$pid = $_POST['app_prog_id'];
		
        
        $clear_status = 1;
    	

       //when Qualified
        if ($qi == 1) {
        
	       if(clear_applicant_nce_olevel($pt,$pid ,$sess,$id,$clr_msg,$clear_status,$uname)){
	       		$msg = '<h4 class="alert alert-success">Olevel Cleared</h4>';
	       }else{
	       		$msg = '<h4 class="alert alert-danger">Olevel Not Cleared</h4>';

	       }
        }else{
        	
        }
       
        
	}
	//convert from NCE to PRE
	if (isset($_POST['swap_prog_btn'])) {
		
		$id = $_POST['app_id'];
		$s_id = $_POST['swap_prog_id'];

       //when Qualified
        
       if(convert_applicant_nce_to_prence($ptt = 1,$s_id ,$sess,$id,$uname)){
       		$msg = '<h4 class="alert alert-success">Conversion to PRE-NCE Successful</h4>';
       }else{
       		$msg = '<h4 class="alert alert-danger">Conversion to PRE-NCE Not Successful</h4>';

       }
      
       
        
	}

	if (isset($_POST['reject_btn'])) {
		
		$id = $_POST['app_id'];
		$clr_msg = $_POST['action_msg'];

        $clear_status = 0;
       
       if(reject_applicant_nce_olevel($id,$clr_msg,$clear_status,$uname)){
       		$msg = '<h4 class="alert alert-success">Olevel Rejected</h4>';
       }else{
       		$msg = '<h4 class="alert alert-danger">Olevel Not Rejected</h4>';

       }
       
        
	}
	if (isset($_POST['change_cs_btn'])) {
		
		$id = $_POST['app_id'];
		$prg = $_POST['prog_id'];
		
        $sch_id =  get_school_id_by_programme($prg);
        $dept_id = get_department_id_by_programme($prg);
        $q = 1;

       if(change_applicant_course2($id,$prg,$dept_id,$sch_id,$sess,$q,$uname)){
       		$msg = '<h4 class="alert alert-success">Course Changed</h4>';
       }else{
       		$msg = '<h4 class="alert alert-danger">Course Not Changed</h4>';

       }
       
        
	}

	if (isset($_POST['change_cs_btn2'])) {
		
		 $id = $_POST['app_id'];
		 $prg = $_POST['prog_id'];
		
		
        $sch_id =  get_school_id_by_programme($prg);
        $dept_id = get_department_id_by_programme($prg);
        $q = 1;

       if(change_applicant_course3($id,$prg,$dept_id,$sch_id,$sess,$q,$uname)){
       		$msg = '<h4 class="alert alert-success">Course Changed</h4>';
       }else{
       		$msg = '<h4 class="alert alert-danger">Course Not Changed</h4>';

       }
       
        
	}
  
    ?>

	
    
<ul class="breadcrumb">
     
       <li><a href="gateway.php?act=view_admission_reports"> Admission Manager</a> <span class="divider"></span></li>
     
        <li class="active"><?php echo $qual; ?> Applicants (NCE) Records  </li>
            
</ul>


<div class="well">
	<?php 

		if(isset($msg) && $msg !='')
		  {
				echo $msg;
		    
		  }



	 ?>	

      <ul class="tabs"> 
        
        <li><a href="#view1"><?php echo $qual; ?> Applicants (NCE) Records </a></li> 
       
       </ul> 
      <div class="tabcontents"> 
       
        
        <div id="view1">

        		
             <?php 
			  
			  
			  
				  //collect the token
				  
				 
				  /*
				  
				   //collect the passed
				  if(isset($_GET['p']))
				  {
					 $p =  $_GET['p'];
				  }
				  
			    
				   //collect the session
				  if(isset($_GET['ses']))
				  {
					 $ses =  $_GET['ses'];
				  }
				  
			  */ 

			  	//$md  is mode , $pt is prog type  , $s is session
     			//pass data as array
				/*  $prence_data = array($md = 1, $pt = 1 ,$s = 4);
				  $nce_data = array($pt = 2, $s = 4);
				  $nce_lvsp_data = array($pt = 2, $md = 2, $s = 3 );*/

	             //$pt , $mode, $sess 
	               //echo get_records_applicants_nce($pt = 2, $s = 4); 

				  if ($qi == 1) {
				  

					  //display based on batch
		             echo get_records_applicants_qualify($pt, $sess,$qi); 
				  }else{
		             echo get_records_applicants_not_qualify($pt, $sess,$qi); 

				  }
				  //echo show_month(1);

              ?>
              
        
        </div> 
	
 
      </div>
</div>

</form>

