<?php
//$alldept = ONLINEPAY:: showdept();
//require_once("../includes/initialize.php");
//  require_once("includes/mail.php");
//  require_once("includes/mailer.php");
//  require_once("includes/mailer3.php");
global $mail;
date_default_timezone_set('Africa/Lagos');
$dprepare ="";
//$allsession = ONLINEPAY:: showsession();

$tag = $_GET['type'];
$_SESSION['tablename'] =$tag;
//echo $_SESSION['tablename'];

?>






<?php

/*$query = mysql_query("SELECT * FROM certificate_tranzact WHERE email= ".$_SESSION['email']." AND responsecode ='00' LIMIT 1");
                while ($row = mysql_fetch_array($query)){
                 
                    $trans = $row['txt_ref'];
                   $fullname = strtoupper($row['fullname']);
                   $matricno = $row['matricno'];
                   $phone = $row['phone'];
                   $email = $row['email'];
                   $session =date('Y', strtotime($row['session'])); 
                   $department = $row['department'];
                  if ($row['ptype']=='FT'){
                      $ptype='Full time';
                  } else if (($row['ptype']=='PT')){
                      
                      $ptype='Part time';
                  } else if (($row['ptype']=='DP')){
                      
                      $ptype='Daily part time';
                  } else if ($row['ptype']=='CAP'){
                      $ptype='Continuous Academics Program (CAP)';
                  } else if (($row['ptype']=='EAP')){
                      
                      $ptype='Evening Academics Program (EAP)';
                  } else if (($row['ptype']=='certificate')){
                      
                      $ptype='Certificate';
                  }
                  
                  else if (($row['ptype']=='advancecertificate')){
                      
                      $ptype=' Advance Certificate';
                  }
                   $level = $row['level'];
                   $amount = $row['amount'];
                  // DATE_FORMAT('2012-12-24 12:13:14', '%Y/%m/%d')
                   $datetime = date('d/m/Y',strtotime($row['datetime']));
                   $cleared = $row['cleared'];
                   if ($cleared=='cleared'){
                       $cleared='Yes';
                   }else {
                       
                       $cleared='No';
                   }
                   $resultavail= $row['result_available'];
                   $picture = $row['picture'];
                   $_SESSION['picture']=$picture;
                   $picture2 = $row['picture2'];
                    $_SESSION['picture2']=$picture2;
                }
             //   $to = $_SESSION['email'];
                $to = "helpdesk@oscotechesaoke.edu.ng,";
                
                $to .= "Bursarycertificate@oscotechesaoke.edu.ng,";
                $to .= "academicscertificate@oscotechesaoke.edu.ng,";
                $to .= "registrycertificate@oscotechesaoke.edu.ng,";
                $to .= "bursarycertificate@gmail.com,";
                $to .= "registrycertificate@gmail.com,";
                $to .= "academiccertificate@gmail.com,";


                $subject =  $fullname;
              
                $body = PHP_EOL . PHP_EOL . "The Student with the following details has successfully applied for certificate collection:.";
                echo '<br/><br/>';
                $body .= PHP_EOL . "Response Code: " . $json["ResponseCode"];
                $body .= PHP_EOL . "Response Description: " . $json["ResponseDescription"];
                $body .= PHP_EOL . "Payment Reference: " . $json["PaymentReference"];
                $body .= PHP_EOL . "Transaction Reference: " . $_POST['txnref'];
                $body .= PHP_EOL . "Transaction Amount: " . ($json["Amount"] / 100);
                $body .= PHP_EOL . "Transaction Date: " . $json["TransactionDate"];
                $body .= PHP_EOL . PHP_EOL . PHP_EOL . "------------------------" . PHP_EOL . "Thanks";
                $body = stripslashes($body);

                $mdata = array("name" => $fullname, "txn_ref" => $_POST['txnref'],"matricno"=>$matricno,"phone"=>$phone,"email"=>$email,"session"=>$session,"department"=>$department,"ptype"=>$ptype,"level"=>$level,"amount"=>$amount,"datetime"=>$datetime,"cleared"=>$cleared,"result"=>$resultavail,"picture"=>$picture,"picture2"=>$picture2);
                $messagetomail = head() . paymentSuccessful(DOMAINURL, $mdata, DOMAINURL) . footer();




                $mail->from = "noreply@oscotechesaoke.edu.ng";
                $mail->fromname =  $fullname;
                $mail->to = $to;
                $mail->message = $messagetomail;

                $mail->subject = $subject;
                $mail->mailto($to);
//                echo($to);
//                echo($messagetomail);
//                mail($to, $subject, $body, $headers);




                $_SESSION['picture']='';
                  $_SESSION['picture2']='';
                 $to = $_SESSION['email'];
              //  $to = "adeyemibamigbola@gmail.com";
                $subject =  "Osun State College of Technology, Esa Oke.";
                $body = "Dear " . $_SESSION['surname'] . ",";
                $body .= PHP_EOL . PHP_EOL . "Certification request acknowledgement:.";
                echo '<br/><br/>';
                /*$body .= PHP_EOL . "Response Code: " . $json["ResponseCode"];
                $body .= PHP_EOL . "Response Description: " . $json["ResponseDescription"];
                $body .= PHP_EOL . "Payment Reference: " . $json["PaymentReference"];
                $body .= PHP_EOL . "Transaction Reference: " . $_POST['txnref'];
                $body .= PHP_EOL . "Transaction Amount: " . ($json["Amount"] / 100);
                $body .= PHP_EOL . "Transaction Date: " . $json["TransactionDate"];
                $body .= PHP_EOL . PHP_EOL . PHP_EOL . "------------------------" . PHP_EOL . "Thanks";*/
               /* $body = stripslashes($body);
                

                $mdata = array("name" => $fullname, "txn_ref" =>  $trans, "matricno"=>$matricno, "phone"=>$phone, "email"=>$email,"session"=>$session,"department"=>$department,"ptype"=>$ptype,"level"=>$level,"amount"=>$amount,"datetime"=>$datetime,"cleared"=>$cleared,"result"=>$resultavail,"picture"=>$picture,"picture2"=>$picture2);
                $messagetomail = head() . ackSuccessful(DOMAINURL, $mdata, DOMAINURL) . footer();

                $mail->from = "noreply@oscotechesaoke.edu.ng";
                $mail->fromname =  "Osun State College of Technology, Esa Oke";
                $mail->to = $to;
                $mail->message = $messagetomail;

                $mail->subject = $subject;
                $mail->mailto($to);






                echo '-------------------------------------------------------------------------- <br>';
                echo '<b>NOTE: <em>Your ePayment Transaction details sent successfully to OSCOTECH email box. Thanks.</b></em> <br>';

            } */?>















<?php

if (isset($_POST['submit'])){
    
    
    $_SESSION['email'] = $_POST['email'];
    $_SESSION['message']= $_POST['message'];
    
    
    
    $to = $_SESSION['email'];
	$subject = 'OSCOTECH, Esa-Oke Certificate Processing System';
	
                    
	          //$body = "Dear " . $_SESSION['fullname'] . ", ";
                //$body .= PHP_EOL . PHP_EOL . "Certification Processing Completion.";
                 //echo '<br><br>'; 
                 
                 if ($_SESSION['status']=='completed'){
                $body = PHP_EOL . PHP_EOL.' Your certificate is ready for collection at the Registrar'."'".'s office. While coming to collect the certificate, you will be required to come along with the following documents:<br><br>';
	             //echo '<br><br>';  
	           $body .= PHP_EOL . PHP_EOL." 1.   Final Clearance (Original)<br>" ;
	           
	           $body .=PHP_EOL . PHP_EOL ." 2.   Admission Letter <br>";
	           
	           $body .=PHP_EOL . PHP_EOL . " 3.   Admission Clearance <br>";
	           
	           $body .=PHP_EOL . PHP_EOL ." 4.   Certificate of Registration <br>";
	            
	           $body .=PHP_EOL . PHP_EOL ." 5.   Verified O"."'"."Level Result <br>";
	            
	           $body .=PHP_EOL . PHP_EOL ." 6.   School ID Card <br>";
	       
	           $body .=PHP_EOL . PHP_EOL ." 7.   All College official receipts (Evidence of fees paid)<br>";
	         
	           
	            $body .=PHP_EOL . PHP_EOL ." 8.   Red background passport photograph <br><br>";
	         
	           $body .=PHP_EOL.PHP_EOL.PHP_EOL ." Best regards.";
	          
	          
	           
	          $body = stripslashes($body);
	          
                 }else if ($_SESSION['status']=='pending'){
	       
	        $body = PHP_EOL . PHP_EOL.' Your request for the collection of certificate is under processing. You will be notified when it is available for collection
	        <br><br>';
	      $body .=PHP_EOL.PHP_EOL.PHP_EOL ." Best regards.";
	          
	       $body = stripslashes($body);
                 }
                
                //$body .= PHP_EOL . PHP_EOL.$_SESSION['message'];
                
	$mdata = array("name" => $_SESSION['fullname'], "body"=>$body);
	
                $messagetomail = head() . ackSuccessful(DOMAINURL, $mdata, DOMAINURL) . footer();
                $mail->from = "noreply@oscotechesaoke.edu.ng";
                $mail->fromname = "OSUN STATE COLLEGE OF TECHNOLOGY, ESA-OKE";
                $mail->to = $to;
                $mail->message = $messagetomail;

                $mail->subject = $subject;
                $mail->mailto($to);

}

echo '<script>'.'Notification successfully sent'.'</script>';
?>
 
  
		<div class="container" style="position:relative;">
<!--<form method="POST" action="#">-->
    <div class="form-group input-group" align="Right">
    <table class="table table-bordered table-hover" align="center">
        <tr>
<div style="margin-top:5px; border-bottom:2px inset #000">

<td>
<label  style="margin-left:20px; width:100%" >Programme type</label>
<select class="ptype" class="form-control action" style="padding:5px; width:250px; border-radius:5px">
<option value="">Choose...</option>
<option value="FT">Full Time </option>
<option  value="PT"> Part Time </option>
            
 <option  value="DP">  Daily Part Time </option>

<option value="CAP">Continuous Academic Program </option>

<option value="EAP">Evening Academic Program</option>
<option value="certificate">Certificate </option>

<option value="advancecertificate">Advance Certificate</option>
<option value="PGD"> PGD</option>
</select>
</td>


<td>
<label  style="margin-left:20px; width:100%" >Student Name</label>
<select class="stuname"  class="form-control action" style="padding:5px; width:300px; border-radius:5px">

</select>
</td>


<td>
<label  style="margin-left:20px;  width:100%" >Status</label>
<select class="status"  class="form-control action" style="padding:5px; width:100px; border-radius:5px">
<option value="">Choose...</option>

<option value="completed">Completed </option>

</select>

</td>
</tr>




<tr>
    
<td colspan="3" class="fr">
    
    </td>
</tr>
</table>




 <!--<div id="bursar" style="width:880px; height:500px; overflow:scroll; background-color:; margin-left:3px ">
                        
                  
                  
</div>

<div id="summary" style="width:70%; height:40px; background-color:; margin-left:3px ">
                        
                  
                  
</div>
</div>-->

<!--</body>
<!--<script src="../javascripts/jquery.min.js"></script>        
<script src="../javascripts/bootstrap.min.js" type="text/javascript"></script>

</html>-->

                               

 
 
  
<script type="text/javascript">

function hide_mess(){
    $('#mess').hide();
}


$(document).ready(function() {
  
$('#mess').hide();

$('.ptype').on('change', function(){

var ptype = $('.ptype').val();
//alert(ptype);
$.ajax({                    
            method:"POST",
			url: "pages/certificate_students_name.php",
            data: {ptype:ptype},
            success:function(data)
            {
    
				$('.stuname').empty();
               $('.stuname').append(data);
            }
        })
	   
})

$('.status').on('change', function(){
var ptype = $('.ptype').val();
var stuname = $('.stuname').val();
var status = $('.status').val();
//alert(status);
if (ptype==''){
    alert(ptype);
    alert ("Select appropriate programme type !!! ");
   // status='';
}else if (stuname==''){
    //alert(stuname);
    alert ("Select target student name !!!");
   // status='';
}else {
  //alert(status +"Try"+ ptype +"Tryp"+ stuname);
    $.ajax({                    
            method:"POST",
			url:"pages/certificate_tracking.php",
            data:{ptype:ptype,stumatric:stuname,status:status},
            success:function(data)
            {
				//alert(data);
				$('.fr').empty();
              $('.fr').append(data);
            }
        })
	   
}

})
})
</script>