<?php include("../Header/Session.php"); ?>
<?php include("../Header/Connection.php"); ?>

<!DOCTYPE html>
<html lang="en">
<?php include ("../Header/head.php"); ?>
<body class="skin-default fixed-layout">

<!-- Main wrapper - style you can find in pages.scss -->
<div id="main-wrapper">    
<?php include ("../Header/header.php"); ?>
<?php include ("../Header/left_menu.php"); ?>
<?php include ("../Header/right_sidebar.php"); ?>
        
<!-- Page wrapper  -->
<div class="page-wrapper">
<!-- Container fluid  -->
<div class="container-fluid">
<!-- Bread crumb and right sidebar toggle -->
<!--?php include ("../Header/breadcumb.php"); ?-->
<br><br>
<!-- End Bread crumb and right sidebar toggle -->
<!-- Start Page Content -->
<!-- ============================================================== -->

<?php
if ($ref_code != "MGP10000") 
{
    echo "<script type='text/javascript'>alert('You are not authorized');</script>";
    unset($_SESSION['sess_user']);
    session_destroy();
    echo "<script type='text/javascript'> document.location='https://mygoldsdnbhd.com/log-masuk/'; </script>";
} 
?>

<div class="row">
<div class="col-lg-12">
<div class="card">
    <div class="card-body">
        <form method="post" action="profit_sharing_process.php" enctype="multipart/form-data">
            <div class="form-body">
                <h3 class="card-title">Process Wallet Shortage TopUp</h3>
                <hr>
                <div class="row p-t-20">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label">Member ID</label>
                            <input type="text" placeholder="MGP10001" class="form-control" name="ref_code">
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-actions">
                <button name="Wallet_Topup" class="btn btn-success"><i class="fa fa-check"></i> Process Now</button>
            </div>
        </form>
    </div>
</div>
</div>
</div>

<div class="row">
<div class="col-12">
<div class="card">
    <div class="card-body">
        <h4 class="card-title">Wallet Auto Top Up</h4>
        <div class="table-responsive m-t-40">            
            <table id="example23" class="display nowrap table table-hover table-striped table-bordered" cellspacing="0" width="100%">
                <thead>
                    <tr>
                        <th>Member ID</th>
                        <th>Short (USD)</th>
                        <th>Already Top up (USD)</th>
                    </tr>
                </thead>                                      
                <tbody>
                    <?php
                    $q = "SELECT *
                    FROM topup_wallet
                    Where topup_status IN ('0','1')
                    And topup_investment_status IN ('0','1')
                    order by ref_code Asc";
                    $result = $mysqli->query($q);
                    if ($result ->num_rows > 0)
                    {
                        while($record = $result -> fetch_assoc())
                        {  
						    $id = $record['id'];
                            $ref_code = $record['ref_code'];
                            $balance = $record['balance'];
                            $next_balance = $record['next_balance']; 
                            $topup = $record['topup']; 
                    ?>
                    <form method="post" onsubmit="return confirm('Do you want to proceed?');" action="../Controller/Database_sql.php" enctype="multipart/form-data">
                    <tr>
                        <td><?php echo $ref_code; ?></td>
                        <td><?php echo $topup; ?></td>
                        <td><?php echo $topup; ?></td>
                    </form> 
                    </tr>
                    <?php 
                    }
                    }
                    ?>
                </tbody>
            </table>
            </form>                                 
        </div>
    </div>
</div>                      
</div>
</div>
<!-- ============================================================== -->
<!-- End PAge Content -->

</div>
<!-- End Container fluid  -->
</div>
<!-- End Page wrapper  -->

<!-- Footer Start-->
<?php include ("../Footer/footer.php"); ?>
<!-- Footer End-->

</div>
<!-- End Wrapper -->
<!-- All Jquery -->
    

<!-- All Jquery Start-->
<?php include ("../Header/all_jquery.php"); ?>
<!-- All Jquery End-->

</body>

</html>