Your IP : 18.225.72.181
<?php
session_start(); ob_start();
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--favicon-->
<link rel="icon" href="assets/images/favicon-32x32.png" type="image/png" />
<!--plugins-->
<link href="assets/plugins/simplebar/css/simplebar.css" rel="stylesheet" />
<link href="assets/plugins/perfect-scrollbar/css/perfect-scrollbar.css" rel="stylesheet" />
<link href="assets/plugins/highcharts/css/highcharts.css" rel="stylesheet" />
<link href="assets/plugins/vectormap/jquery-jvectormap-2.0.2.css" rel="stylesheet" />
<link href="assets/plugins/metismenu/css/metisMenu.min.css" rel="stylesheet" />
<link href="assets/plugins/datatable/css/dataTables.bootstrap5.min.css" rel="stylesheet" />
<!-- loader-->
<link href="assets/css/pace.min.css" rel="stylesheet" />
<script src="assets/js/pace.min.js"></script>
<!-- Bootstrap CSS -->
<link href="assets/css/bootstrap.min.css" rel="stylesheet">
<link href="assets/css/bootstrap-extended.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" rel="stylesheet">
<link href="assets/css/app.css" rel="stylesheet">
<link href="assets/css/icons.css" rel="stylesheet">
<!-- Theme Style CSS -->
<link rel="stylesheet" href="assets/css/dark-theme.css" />
<link rel="stylesheet" href="assets/css/semi-dark.css" />
<link rel="stylesheet" href="assets/css/header-colors.css" />
<title>Food/Cash Bonuses</title>
</head>
<body>
<!--wrapper-->
<div class="wrapper">
<?php include('nav.php') ?>
<!--start page wrapper -->
<div class="page-wrapper">
<div class="page-content">
<div class="page-breadcrumb d-none d-sm-flex align-items-center mb-3">
<div class="breadcrumb-title pe-3">Food/Cash Bonuses</div>
<div class="ps-3">
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0 p-0">
<li class="breadcrumb-item"><a href="javascript:;"><i class="bx bx-home-alt"></i></a>
</li>
<li class="breadcrumb-item active" aria-current="page">Food/Cash Bonus Ledger</li>
</ol>
</nav>
</div>
</div>
<div class="card">
<div class="card-body">
<div class="card-title">
<h5 class="mb-0">Food/Cash Bonus Ledger</h5>
</div>
<hr/>
<div class="table-responsive mt-3">
<table id="example" class="table table-bordered table-striped table-sm">
<thead>
<tr>
<th>S/N</th>
<th>Date</th>
<th>Bonus Worth</th>
<th>Food/Cash Bonus</th>
<th>Stage</th>
</tr>
</thead>
<tbody>
<?php
$i=1; $sum = 0;
$sql = $db->query("SELECT * FROM wallet WHERE id='$uid' AND type=13 AND cos>0");
while($row = $sql->fetch_assoc()) { $e = $i++;
$sum += $row['cos'];
?>
<tr>
<td><?php echo $e; ?></td>
<td><?php echo date('d/m/y', $row['ctime']); ?></td>
<td><?php echo number_format($row['cos']) ?></td>
<td><?php echo $row['remark'] ?></td>
<td><?php echo $row['stage']; ?></td>
</tr>
<?php } ?>
<tr><th colspan="2">Balance</th><th colspan="3"><?= number_format($sum) ?></th></tr>
</tbody>
</table>
<p><big>Food/Cash Balance: <?php $fb = $pro->wallet($uid,13); echo money($fb) ?></big></p>
</div>
</div><!--end row-->
</div>
<div class="card">
<div class="card-body">
<div class="card-title">
<h5 class="mb-0">Food Store </h5>
</div>
<hr/>
<div class="table-responsive mt-3">
<div class="row">
<?php
$i=1;
$sql = $db->query("SELECT * FROM foodlist ");
while($row = $sql->fetch_assoc()) { $e = $i++;
?>
<div class="col-lg-4">
<div class="card border border-default"><img src="<?= $row['picture'] ?>" width="100%">
<br>
<div class="p-2"><?php echo $row['title']; ?>
(<?php echo $row['note']; ?>) <br>
<b><big>$<?php echo number_format($row['cost']); ?></big></b> <br>
<button class="btn btn-primary btn-block editfood" style="width:100%" data-data='<?= json_encode($row) ?>'>Add to Cart</button>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
</div><!--end row-->
</div>
<div class="card">
<div class="card-body">
<div class="card-title">
<h5 class="mb-0">My Cart: <span id="sumit2"></span> (<span id="allitem">0</span>)</h5>
</div>
<hr/>
<div class="table-responsive mt-3">
<form method="post">
<table id="example" class="table table-bordered table-striped">
<thead>
<tr>
<th>S/N</th>
<th>Item</th>
<th>Cost</th>
<th>Action</th>
</tr>
</thead>
<tbody id="mycart">
</tbody>
<tfoot>
<tr id="total"><th colspan="3">Total</th><th colspan="2" id="sumit"></th></tr>
</tfoot>
</table>
<div style="float: left; display: none;" id="clearcart">
<button type="button" onclick="clearCart()" class="btn btn-secondary btn-lg" >Clear Cart</button>
</div>
<div style="float: right;">
<button type="submit" id="checkout" class="btn btn-primary btn-lg" name="CheckOut" disabled>Checkout</button>
</div>
</form>
</div>
</div><!--end row-->
</div>
<div class="card">
<div class="card-body">
<div class="card-title">
<h5 class="mb-0">Food/Cash Purchases</h5>
</div>
<hr/>
<div class="table-responsive mt-3">
<table id="example" class="table table-bordered table-striped table-sm">
<thead>
<tr>
<th>S/N</th>
<th>Date</th>
<th>Purchase Worth</th>
<th>Status</th>
<th>Status</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<?php
$i=1; $sumx = 0;
$sql = $db->query("SELECT * FROM wallet WHERE id='$uid' AND type=13 AND cos<0 ");
while($row = $sql->fetch_assoc()) { $e = $i++;
$sumx += $row['cos'];
$trn = $row['opt'];
?>
<tr>
<td><?php echo $e; ?></td>
<td><?php echo date('d/m/y', $row['ctime']); ?></td>
<td><?php echo money(abs($row['cos'])) ?></td>
<td><?php echo $row['remark'] ?></td>
<td><?= $pro->walletStatus($row['status']) ?></td>
<td><?php $s = $db->query("SELECT * FROM purchase WHERE trn='$trn' ");
while($r=mysqli_fetch_assoc($s)){ echo $r['item'].' ('.number_format($r['cost']).'), '; } ?></td>
</tr>
<?php } ?>
<tr><th colspan="2">Total</th><th colspan="4"><?= number_format(abs($sumx)) ?></th></tr>
</tbody>
</table>
</div>
</div><!--end row-->
</div>
</div>
<!--end page wrapper -->
<?php include('foot.php') ?>
</div>
<!--end wrapper-->
<!-- Modal --> <form method="post">
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Insufficient balance!!!</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p>You do not have sufficient fund to cover additional items. You can add and remove items from your cart that will accommodate your account balance</p>
</div>
<div class="modal-footer">
<a href="javascript:;" onclick="removeStart()" class="btn btn-secondary">Remove all items and start all over</a>
</div>
</div>
</div>
</div>
</form>
<!-- Bootstrap JS -->
<script src="assets/js/bootstrap.bundle.min.js"></script>
<!--plugins-->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/plugins/simplebar/js/simplebar.min.js"></script>
<script src="assets/plugins/metismenu/js/metisMenu.min.js"></script>
<script src="assets/plugins/perfect-scrollbar/js/perfect-scrollbar.js"></script>
<script src="assets/plugins/vectormap/jquery-jvectormap-2.0.2.min.js"></script>
<script src="assets/plugins/vectormap/jquery-jvectormap-world-mill-en.js"></script>
<script src="assets/plugins/highcharts/js/highcharts.js"></script>
<script src="assets/plugins/highcharts/js/exporting.js"></script>
<script src="assets/plugins/highcharts/js/variable-pie.js"></script>
<script src="assets/plugins/highcharts/js/export-data.js"></script>
<script src="assets/plugins/highcharts/js/accessibility.js"></script>
<script src="assets/plugins/apexcharts-bundle/js/apexcharts.min.js"></script>
<script src="assets/plugins/datatable/js/jquery.dataTables.min.js"></script>
<script src="assets/plugins/datatable/js/dataTables.bootstrap5.min.js"></script>
<script>
$(document).ready(function() {
$('#example').DataTable();
} );
sessionStorage.removeItem('sn');
$('body').on('click', '.editfood', function() {
data = $(this).data('data')
var sn='';
if(sessionStorage.getItem('sn')===null){
var sn = 1;
sessionStorage.setItem('sn',sn);
$("tr:even").css("background-color", "#CCC");
}
else{
var sn = Number(sessionStorage.getItem('sn'))+1;
sessionStorage.setItem('sn',sn);
}
$('#mycart').append(`<tr id="${sn}"><td>${sn}</td><td>${data.title} (${data.note})</td><td>${formatter.format(data.cost)}</td><td><input type="hidden" value="${data.sn}" name="item[]"><input type="hidden" value="${data.cost}" class="sum"><button class="btn btn-xs text-danger" onclick="removeit(${sn})"><i class='bx bx-trash'></i></button></td></tr>`);
sumit(sn);
})
function removeStart(){
$('#mycart').html('');
sumit();
$('#exampleModal').modal('hide');
}
function clearCart(){
$('#mycart').html('');
sumit();
}
// $(document).ready(function(){
// $("tr:odd").css("background-color", "#CCC");
// });
function sumit(sn=''){
var x = document.getElementsByClassName('sum');
var i =0; var s=0;
while(i<x.length){
s += Number(x[i].value);
i++;
}
var total = <?= $fb ?>;
//remove and recalculate
if(total<s){
//$("#total").css("background-color", "red");
$('#exampleModal').modal('show');
//alert('Cart summary is greater than your available funds');
removeit(sn);
var i =0; var s=0;
while(i<x.length){
s += Number(x[i].value);
va[i].value = i;
i++;
}
}
if(s>0){$('#checkout').attr('disabled',false); }else{$('#checkout').attr('disabled',true);}
if(s>0){$('#clearcart').css("display", "block"); }else{$('#clearcart').css("display", "none");}
var sum = formatter.format(s);
$('#sumit').html(sum);
$('#sumit2').html(sum);
$('#allitem').html(document.getElementsByClassName('sum').length);
}
function removeit(v){
$('#'+v).html('');
sumit();
}
function com(v){
return (v).toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
}
var formatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
});
</script>
<script src="assets/js/index2.js"></script>
<!--app JS-->
<script src="assets/js/app.js"></script>
<script>
</script>
</body>
</html>