<?php require_once("../includes/initialize.php");
session_start();
/*if(!isset($_SESSION["matric_no"])) 
{
	header("Location:index.php");
session_unset();
session_destroy();
header ("location:index.php");

}*/
?>
<?php //include "conn.php";

 $_SESSION['famount'] ;
 $_SESSION['payment_no'];
 $_SESSION['matric_no'] ;
		$_SESSION['payment_no'] ;
		$_SESSION['level'] ;
		$_SESSION['full_name'];
		$_SESSION['famount'] ; 
	$pamount=$_SESSION['famount'] ; 
        //header("Refresh: 0; URL=pages/admin_process_payment.php");

 ?>

<!DOCTYPE HTML>
<html>
<head>
<script language="javascript">

                   var message="This function is not allowed here.";
                   function clickIE4(){

                                 if (event.button==2){
                                 alert(message);
                                 return false;
                                 }
                   }

                   function clickNS4(e){
                                 if (document.layers||document.getElementById&&!document.all){
                                                if (e.which==2||e.which==3){
                                                          alert(message);
                                                          return false;
                                                }
                                        }
                   }

                   if (document.layers){
                                 document.captureEvents(Event.MOUSEDOWN);
                                 document.onmousedown=clickNS4;
                   }

                   else if (document.all&&!document.getElementById){
                                 document.onmousedown=clickIE4;
                   }

                   document.oncontextmenu=new Function("alert(message);return false;")

    </script>
<title>OSCOTECH::Student portal</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="Learn Responsive web template, Bootstrap Web Templates, Flat Web Templates, Andriod Compatible web template, 
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<link href="css/bootstrap-3.1.1.min.css" rel='stylesheet' type='text/css' />
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>


<!-- Custom Theme files -->
<link href="css/style.css" rel='stylesheet' type='text/css' />
<link rel="stylesheet" href="css/jquery.countdown.css" />
<link href='//fonts.googleapis.com/css?family=PT+Sans+Narrow:400,700' rel='stylesheet' type='text/css'>
<!----font-Awesome----->
<link href="css/font-awesome.css" rel="stylesheet"> 
<!----font-Awesome----->
<script>
$(document).ready(function(){
    $(".dropdown").hover(            
        function() {
            $('.dropdown-menu', this).stop( true, true ).slideDown("fast");
            $(this).toggleClass('open');        
        },
        function() {
            $('.dropdown-menu', this).stop( true, true ).slideUp("fast");
            $(this).toggleClass('open');       
        }
    );
});
</script>
<style type="text/css">
.style1 {color: #FF0000}
.style16 {	color: #361414;
	font-size: 36px;
	font-weight: bold;
}
.style2 {font-family: Arial, Helvetica, sans-serif}
body,td,th {
	font-family: "PT Sans Narrow", sans-serif;
}
body {
	background-color: #CCC;
}
</style>

</head>
<body>
<!-- banner -->

<div style="background-color:#CCC">...</div>
    <!-- //banner -->
	
          <div class="col-md-6 admission_left">
	   	  	<h2>Payment Confirmation : <strong style="text-decoration:blink; font-size:16px; color:#F00"><?php echo $message; ?>.</strong></h2>
</div>  <p class="lead">.</p>
            <table class="timetable">
              <thead>
                <tr>
                  <th colspan="5">Payment Confirmation</th>
                </tr>
                
                <tr>
                  <th colspan="2">&nbsp;
<?php
 //echo $txnref = uniqid('sbcstx');

echo $txnref = $_SESSION['payment_no'];
echo $famount=$_SESSION['famount'];
echo $_SESSION["matric_no"];
if (isset($_SESSION['payment_no'])) {
 //   $txnref = $_SESSION['payment_no'];	
	$sql = "SELECT * FROM acceptance_tranzact  WHERE  txt_ref='".$txnref."' ;";
	$result=$mysqli->query($sql);
// 	while($result)
// 	$student = $result->fetch_array(MYSQLI_ASSOC);

  //  $mysqli->query("INSERT INTO payments(transaction_no,matric_no) VALUES('" . $txnref . "','".$_SESSION['matric_no']."')");
  $tamount = ($famount + VSESC_LATE_REG);
    $xml_items = '';

    $topay = $tamount + CONVENIENCE_FEE;

    $cut = (($topay * 1.5) / 100);

    $commission = CONVENIENCE_FEE - $cut;

	$xml_items .= '<item_detail item_id="1" item_name="OSCOTECH-ESA-OKE" item_amt="' . (($topay-(CONVENIENCE_FEE + DEDUCTION_FEE_2 + VSESC_LATE_REG+100)) * 100) . '" bank_id="' . BANK_ID1 . '" acct_num="' . BANK_ACC_NUM1 . '" />';
    $xml_items .= "\n";
    $xml_items .= '<item_detail item_id="2" item_name="OSCOTECH-ESA-OKE" item_amt="' . (($commission+100) * 200 ) . '" bank_id="' . BANK_ID2 . '" acct_num="' . BANK_ACC_NUM2 . '" />';
    $xml_items .= "\n";
    $pamount = $topay * 100;
// 		$xml_items .= '<item_detail item_id="4" item_name="POLYIB-VSESC-CAFE" item_amt="' . (DEDUCTION_FEE_2 * 100 ) . '" bank_id="' . BANK_ID4 . '" acct_num="' . BANK_ACC_NUM4 . '" />';
    // $xml_items .= "\n";
		///////for late registration
// 	$xml_items .= '<item_detail item_id="5" item_name="POLYIB-VSESC-LATE-REG" item_amt="' . (VSESC_LATE_REG * 100 ) . '" bank_id="' . BANK_ID5 . '" acct_num="' . BANK_ACC_NUM5 . '" />';
    $xml_items .= "\n";
	

    $concatenation = $txnref . P_ID . P_I_ID . $pamount . SITE_REDIRECT_URL . MAC_KEY;
    $hash = hash('sha512', $concatenation);
    ?>

    <form name="pay_form" action="<?= WEBPAY_URL ?>" method="post" id="pay_form">
        <input name="product_id" type="hidden" value="<?= P_ID ?>" />
        <input name="amount" type="hidden" value="<?= $_SESSION['famount'];?>" />
        <input name="currency" type="hidden" value="566" />
        <input name="site_redirect_url" type="hidden" value="<?= SITE_REDIRECT_URL ?>" />
        <input name="site_name" type="hidden" value="<?= BASE_PATH ?>" />
        <input name="cust_id" type="hidden" value="<?= $_SESSION['matric_no'] ?>" />
        <input name="cust_id_desc" type="hidden" value="Student" />
        <input name="cust_name" type="hidden" value="<?= $_SESSION['full_name'] ?>" />
        <input name="cust_name_desc" type="hidden" value="Customer Name" />
        <input name="txn_ref" type="hidden" value="<?= $_SESSION['payment_no']; ?>" />
        <input name="txnref" type="hidden" value="<?= $_SESSION['payment_no']; ?>" />
        <input name="pay_item_id" type="hidden" value="<?= P_I_ID ?>" />
        <input name="pay_item_name" type="hidden" value="Acceptance Fees" />
        <input name="local_date_time" type="hidden" value="<?= date("d-M-y h:i:s"); ?>" />
        <input name="hash" type="hidden" value="<?= $hash ?>" />
        <input name="payment_params" type="hidden" value="college_split" />
        <input name="xml_data" type="hidden" value='<payment_item_detail>
               <item_details detail_ref="<?= $txnref ?>" college="PIBV">
               <?= $xml_items ?>
               </item_details>
               </payment_item_detail>'/>
        <hr>
        <h2>
            Transaction #: <?= $txnref ?><br>
            Student's Name: <?= $_SESSION['full_name'] ?> (
            <?= $_SESSION['matric_no'] ?>
          )<br>            
            Amount: <?= $tamount ?><br>
            <!--Convenience Fee: <?= CONVENIENCE_FEE ?><br>
            Total: <?= $tamount + CONVENIENCE_FEE;?><br>-->
        </h2>
      <hr>
        <button type="submit" class="btn btn-primary btn-lg">Proceed <i class="fa fa-chevron-right"></i></button>
    </form>
    <?php
}
?><br/>
</th>
                </tr>
              </thead>
              <tbody>
                <tr>
                  <td height="133" colspan="5" align="center" style="text-align:left">                    . </td>
                </tr>
              </tbody>
            </table>
<p></p>

	
       <?php //require_once('footer.php') ?>
<script src="vendors/jquery/jquery-3.2.1.min.js" type="text/javascript"></script>
<script src="vendors/bootstrap/js/bootstrap.min.js"></script>
<?php
if (isset($_POST['pay'])) {
    ?>
    <script>
        var form = $('#pay_form');
    //form.submit();
    </script>
<?php } ?> 

<img src="../images/image001.png">
</body>
</html>	