Server : LiteSpeed System : Linux us-phx-web1202.main-hosting.eu 4.18.0-553.84.1.lve.el8.x86_64 #1 SMP Tue Nov 25 18:33:03 UTC 2025 x86_64 User : u615232177 ( 615232177) PHP Version : 8.1.33 Disable Function : NONE Directory : /home/u615232177/public_html/ |
<?php session_start();
$page_name = basename($_SERVER['PHP_SELF']);
include("headerstrict.php"); ?>
<?php
if (isset($_GET['order_id'])){
$order_id = mysqli_real_escape_string($con,$_GET['order_id']);
$add_id = mysqli_real_escape_string($con,$_GET['add_id']);
$stmt = $con -> prepare('SELECT * FROM my_orders WHERE order_id=?');
$stmt -> bind_param('s',$order_id);
$stmt -> execute();
$stmt -> store_result();
$stmt -> bind_result($id,$user_id_db,$order_id,$total,$nice_date,$horrible_date,$status,$email_succesful,$email_delivered,$delivery_zone_complete,$payment_method);
$numrows = $stmt -> num_rows();
//status coloring
if($numrows > 0){
while ($stmt -> fetch()) {}
}
else{echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php\">";exit();}
//only owner can view
if($user_id == $user_id_db){
}
else{echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php\">";exit();}
//convert to kobo for paystack
function to_kobo($value)
{
return intval(
strval(floatval(
preg_replace("/[^0-9.]/", "", $value)
) * 100)
);
}
}
else{echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php\">";exit();}
?>
<title><?php echo $company_name; ?> - Additional Order for <?php echo $order_id; ?></title>
<!-- Start All Title Box -->
<div class="all-title-box">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h2>Additonal Request for ORDER ID: <?php echo $order_id ?></h2>
<ul class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item active"><?php echo $order_id ?></li>
</ul>
</div>
</div>
</div>
</div>
<!-- End All Title Box -->
<div class="checkout">
<div class="container">
<div class="row">
<div class="col-lg-6">
<div class="billing"><br/><br/>
<div class="checkout_title">Details</div><br/>
<?php
//check if they have money in the wallet.
$total_wallet=0; $success = "Success"; $failed = "Failed";
$stmt_withdraw = $con -> prepare('SELECT * FROM wallet WHERE user_id = ? AND status = ?');
$stmt_withdraw -> bind_param('ss',$user_id,$success);
$stmt_withdraw -> execute();
$stmt_withdraw -> store_result();
$stmt_withdraw -> bind_result($w_id,$wallet_id,$user_id,$wallet_order_id,$wallet_amount,$amount_remaining,$wallet_type,$wallet_action,$wallet_status,$wallet_date);
$numrows_withdraw = $stmt_withdraw -> num_rows();
if($numrows_withdraw > 0){
while ($stmt_withdraw -> fetch()) {
if($wallet_type == "Credit"){
$total_wallet += $wallet_amount;
}
if($wallet_type == "Debit"){
$total_wallet -= $wallet_amount;
}
}
}
$add_status_color = "black";
$stmt_add = $con -> prepare('SELECT * FROM additional_funds WHERE id = ?');
$stmt_add -> bind_param('s',$add_id);
$stmt_add -> execute();
$stmt_add -> store_result();
$stmt_add -> bind_result($add_id,$order_id,$amount_requested,$add_status,$date_requested,$date_accepted,$add_payment_method);
$numrows_add = $stmt_add -> num_rows();
if($numrows_add > 0){
while ($stmt_add -> fetch()) { }
}
else{echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php\">";exit();}
//full coverage
if($total_wallet >= $amount_requested){
$full_amount = 0;
$partial_amount = 0;
}
//if partial coverage
if($total_wallet > 0 AND $total_wallet < $amount_requested){
$partial_amount = $amount_requested - $total_wallet;
$full_amount = 0;
}
//no coverage
if($total_wallet == 0){
$full_amount = $amount_requested;
$partial_amount = 0;
}
$full_amount_kobo = to_kobo("$full_amount");
$partial_amount_kobo = to_kobo("$partial_amount");
$amount_requested_kobo = to_kobo("$amount_requested");
?>
<script>
function changePayment() {
const select_value = document.getElementById("payment_select").value;
const amount_requested = parseInt(<?php echo $amount_requested; ?>);
const total_wallet = parseInt(<?php echo $total_wallet; ?>);
const amount_payable = 0;
if(select_value == "full_coverage"){
//submit buttons
btn_full_coverage.style.display = "block";
btn_no_coverage.style.display = "none";
btn_partial_coverage.style.display = "none"
//wallet
wallet_div.style.display = "block";
wallet_full = amount_requested;
const formatted_wallet_full = wallet_full.toLocaleString("en-US");
const minus_currency = "-<?php echo $currency; ?>"
document.getElementById("wallet").innerHTML =minus_currency + formatted_wallet_full;
//amount payable
const formatted_amount_payable = amount_payable.toLocaleString("en-US");
const currency = "<?php echo $currency; ?>"
document.getElementById("amount_payable").innerHTML =currency + formatted_amount_payable;
}
if(select_value == "no_coverage_moniepoint"){
//submit buttons
btn_full_coverage.style.display = "none";
btn_no_coverage.style.display = "block";
btn_partial_coverage.style.display = "none"
wallet_div.style.display = "none";
const amount_payable_no_cover = amount_requested;
const formatted_amount_payable_no_cover = amount_payable_no_cover.toLocaleString("en-US");
const currency = "<?php echo $currency; ?>"
document.getElementById("amount_payable").innerHTML =currency + formatted_amount_payable_no_cover;
}
if(select_value == "no_coverage_opay"){
//submit buttons
btn_full_coverage.style.display = "none";
btn_no_coverage.style.display = "none";
btn_partial_coverage.style.display = "block"
wallet_div.style.display = "none";
const amount_payable_no_cover = amount_requested;
const formatted_amount_payable_no_cover = amount_payable_no_cover.toLocaleString("en-US");
const currency = "<?php echo $currency; ?>"
document.getElementById("amount_payable").innerHTML =currency + formatted_amount_payable_no_cover;
}
}
</script>
<?php
echo"<b>Total</b> <span class='number_box_order the_color'>$currency";echo number_format($amount_requested);echo"
</span><br>";
echo"<div class='lineo'></div>";
// wallet
echo"
<div class='hid' id='wallet_div'>
<b>Wallet</b>
<span id='wallet' class='number_box_order' style='color:forestgreen;'></span>
</div>";
// amount payable
echo"
<div id='amount_payable_div'>
<b>Amount Payable</b>
<span id='amount_payable' class='number_box_order the_color'>";echo"</span>
</div>";
echo"<br/><br/>";
?>
</div>
</div>
<div class="col-lg-6">
<div class="billing"><br/><br/>
<div class="checkout_title">Payment</div><br/>
<form method="POST" action="payment_result_full_coverage_add.php" class="php-email-form1">
<select class="form-control valid" id="payment_select" onchange="changePayment()" name='payment_select' required>
<option value=''>Please choose a payment option</option>
<?php
//if wallet balance can cover the purchase, show this option.
if($total_wallet >= $amount_requested){
?>
<option value="full_coverage">Pay using funds in your wallet. No further payment will be due</option>
<?php
}
?>
<option value="no_coverage_opay">Transfer <?php echo $currency ?><?php echo number_format($amount_requested); ?> to Opay 6114671127</option>
<option value="no_coverage_moniepoint">Transfer <?php echo $currency ?><?php echo number_format($amount_requested); ?> to Fidelity 5600740742</option>
</select>
<br>
<div class="text-center">
<input type="hidden" name='order_id' value='<?php echo $order_id; ?>'>
<input type="hidden" name='add_id' value='<?php echo $add_id; ?>'>
<button type="submit" name='full_coverage' id='btn_full_coverage' class="btn hvr-hover hid"> Proceed
</button>
<button type="submit" name='no_coverage_opay' id='btn_partial_coverage' class="btn hvr-hover hid"> I have done the transfer
</button>
<button type="submit" name='no_coverage_moniepoint' id='btn_no_coverage' class="btn hvr-hover hid"> I have done the transfer
</button>
</div> <br><br>
</form>
</div>
</div>
</div>
</div>
</div>
<?php include("footer.php"); ?>