Your IP : 13.59.91.59
<?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 Orders</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 Orders</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 Orders</li>
</ol>
</nav>
</div>
</div>
<?php if(isset($_GET['order'])){ $order = $_GET['order']; $st = sqLx('wallet','opt',$order,'status'); ?>
<div class="card">
<div class="card-body">
<div class="card-title">
<h5 class="mb-0"> Purchase Order Details</h5>
</div>
<hr/>
<div class="table-responsive mt-3">
<b>ITEM LIST</b>
<table id="example" class="table table-bordered table-striped table-sm">
<thead>
<tr>
<th>S/N</th>
<th>Item</th>
<th>Description</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php
$i=1; $sum = 0;
$s = $db->query("SELECT * FROM purchase WHERE trn='$order' ");
while($r=mysqli_fetch_assoc($s)){ $e=$i++; $id=$r['id']; $pid = $r['pid']; $sum += $r['cost']
?>
<tr>
<td><?php echo $e; ?></td>
<td><?php echo $r['item']; ?></td>
<td><?php echo sqLx('foodlist','sn',$pid,'note') ?></td>
<td><?php echo money($r['cost']) ?></td>
</tr>
<?php } ?>
<tr><th colspan="3">Total</th><th colspan=""><?= money(abs($sum)) ?></th></tr>
</tbody>
</table>
<b>CUSTOMER</b>
<table id="example" class="table table-bordered table-striped table-sm">
<thead>
<tr>
<th>Name</th>
<th>Username </th>
<th>Phone Number</th>
<th>Address</th>
</tr>
</thead>
<tbody>
<tr>
<td><?=userName($id)?></td>
<td><?=userName($id,'user')?></td>
<td><?=userName($id,'phone')?></td>
<td><?=userName($id,'address')?></td>
</tr>
</tbody>
</table>
<div style="float: right;">
<?php if($st==1){ ?>
<form method="post"> <button class="btn btn-primary btn-lg" name="processFoodOrder" value="<?= $order ?>" >Mark as Processed</button> </form>
<?php } else{ ?> <big>Successfully Processed</big> <?php } ?>
</div>
</div>
</div><!--end row-->
</div>
<?php } ?>
<div class="card">
<div class="card-body">
<div class="card-title">
<h5 class="mb-0">Food/Cash Purchase Orders</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>User</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$i=1; $sumx = 0;
$sql = $db->query("SELECT * FROM wallet WHERE status=1 AND type=13 AND cos<0 ORDER BY sn DESC LIMIT 200");
while($row = $sql->fetch_assoc()) { $e = $i++;
$sumx += $row['cos'];
$trn = $row['opt'];
?>
<tr <?php if($order==$trn){echo 'style="background-color: #CCF;"'; } ?>>
<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 userName($row['id']) ?> (<?php echo userName($row['id'],'user') ?>)</td>
<td><?= $pro->walletStatus($row['status']) ?></td>
<td><a class="btn btn-sm btn-primary" href="?order=<?=$row['opt']?>">Detail</a></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 class="card">
<div class="card-body">
<div class="card-title">
<h5 class="mb-0">Processed 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>User</th>
<th>Status</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<?php
$i=1; $sumx = 0;
$sql = $db->query("SELECT * FROM wallet WHERE status=2 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 number_format(abs($row['cos'])) ?></td>
<td><?php echo userName($row['id']) ?> (<?php echo userName($row['id'],'user') ?>)</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="" 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}</td><td>${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);
})
// $(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);}
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: 'NGN',
});
</script>
<script src="assets/js/index2.js"></script>
<!--app JS-->
<script src="assets/js/app.js"></script>
<script>
</script>
</body>
</html>