%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64 User : ndkhermy ( 1200) PHP Version : 8.5.12 Disable Function : NONE Directory : /home1/ndkhermy/public_html/website_93b53270/admin/manage_order/ |
Upload File : |
<?php
include("../function.php");
if($_SESSION['admin_id']==""){
header('location:../login.php');
}
$login_tbl=mysqli_fetch_array(mysqli_query($conn,"SELECT * FROM admin WHERE admin_id='".$_SESSION['admin_id']."'"));
include('../include/sidebar.php');
?>
<!-- [ Main Content ] start -->
<div class="pcoded-main-container">
<div class="pcoded-content">
<!-- [ breadcrumb ] start -->
<div class="page-header">
<div class="page-block">
<div class="row align-items-center">
<div class="col-md-12">
<div class="page-header-title">
<div class="card-header d-flex justify-content-between">
<button class="btn btn-dark text-light fw-bold btn-sm btn-round has-ripple"><i class="feather icon-check-square"></i> Manage Order</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- [ breadcrumb ] end -->
<!-- [ Main Content ] start -->
<div class="row">
<!-- [ col-md-12 ] start -->
<form method="post" action="">
<div class="col-md-12">
<div class="card">
<div class="card-header d-flex justify-content-between">
<h5>Manage Order</h5>
<div>
<select id="paymentStatus" class="form-control">
<option value="">Select Payment Status</option>
<option value="0" <?=($_GET['payment_status']=='0')?'selected':''?>>Pending</option>
<option value="1" <?=($_GET['payment_status']=='1')?'selected':''?>>Success</option>
<option value="2" <?=($_GET['payment_status']=='2')?'selected':''?>>Cancel</option>
</select>
</div>
<div>
<input class="btn btn-success btn-sm btn-round has-ripple" type="submit" value="Payment Success" name='but_active'>
<input class="btn btn-secondary btn-sm btn-round has-ripple" type="submit" value="Payment Pending" name='but_deactive'>
<input class="btn btn-danger btn-sm btn-round has-ripple" type="submit" value="Payment Cancel" name='but_canceled'>
</div>
</div>
<div class="card-body">
<?php if(isset($_SESSION['message'])){
echo '<div class="alert alert-success alert-dismissible fade show" role="alert">
<strong class="text-dark">'.$_SESSION['message'].' <i class="feather icon-thumbs-up text-success"></i></strong>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
</button>
</div>';
}
unset($_SESSION['message']);
?>
<?php if(isset($_SESSION['error'])){
echo '<div class="alert alert-success alert-dismissible fade show" role="alert">
<strong class="text-dark">'.$_SESSION['error'].' <i class="feather icon-thumbs-up text-danger"></i></strong>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
</button>
</div>';
}
unset($_SESSION['error']);
?>
<?php if(isset($_SESSION['delete'])){
echo '<div class="alert alert-success alert-dismissible fade show" role="alert">
<strong class="text-dark">'.$_SESSION['delete'].' <i class="feather icon-trash-2 text-danger"></i></strong>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
</button>
</div>';
}
unset($_SESSION['delete']);
?>
<div class="table-responsive">
<table id="report-table" class="table table-bordered table-striped mb-0">
<thead>
<tr>
<th><input type="checkbox" id="some1" data-check-pattern="[name^='delete']" />
</th>
<th>Sno</th>
<th>Order Id</th>
<th>Receive Date</th>
<th>User Details</th>
<th>User Type</th>
<th>Payment</th>
<!-- <th>Invoice</th> -->
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
if ($_GET['payment_status']=='1') {
$query=mysqli_query($conn,"SELECT * FROM order_tbl WHERE status=1 ORDER BY ID DESC");
}elseif ($_GET['payment_status']=='0') {
$query=mysqli_query($conn,"SELECT * FROM order_tbl WHERE status=0 ORDER BY ID DESC");
}elseif ($_GET['payment_status']=='2') {
$query=mysqli_query($conn,"SELECT * FROM order_tbl WHERE status=2 ORDER BY ID DESC");
}else{
$query=mysqli_query($conn,"SELECT * FROM order_tbl ORDER BY ID DESC");
}
$n=1;
while($fetch_row=mysqli_fetch_array($query)){
$fetch_row_user=mysqli_fetch_array(mysqli_query($conn,"SELECT * FROM `user_tbl` WHERE user_id='".$fetch_row['user_id']."'"));
$fetch_countries=mysqli_fetch_array(mysqli_query($conn,"SELECT * FROM `countries` WHERE id='".$fetch_row_user['phonecode']."'"));
?>
<tr>
<td><input type='checkbox' name='delete[]' value='<?=$fetch_row['id'];?>'></td>
<td><?=$n; $n++;?></td>
<td><?=$fetch_row['order_id']?></td>
<td><?=$fetch_row['recieve_date']?></td>
<td>
<strong>User_Id: </strong><?=$fetch_row_user['user_id']?><br>
<strong>Name: </strong><?=$fetch_row_user['name']?><br>
<strong>Email: </strong><?=$fetch_row_user['email']?><br>
<strong>Phone: </strong><?='+'.$fetch_countries['phonecode'].' '.$fetch_row_user['mobile_number']?><br>
</td>
<td>
<?php
if(($fetch_row['type']=='User')){
echo'<a class="btn btn-success btn-sm">Registered</a>';
}else{
echo'<a class="btn btn-secondary btn-sm">Guest</a>';
}
?>
</td>
<td>
<?php
if(($fetch_row['status']=='1')){
echo'<a href="show.php?page=order&&status_id='.$fetch_row['id'].'" class="btn btn-success btn-sm">Success</a>';
}elseif($fetch_row['status']=='2'){
echo'<a href="show.php?page=order&&status_id='.$fetch_row['id'].'" class="btn btn-danger btn-sm">Cancel</a>';
}else{
echo'<a href="show.php?page=order&&status_id='.$fetch_row['id'].'" class="btn btn-secondary btn-sm">Pending</a>';
}
?>
</td>
<!-- <td>
<a href="<?=$base_url?>invoice/<?=$fetch_row['order_id']?>.pdf" class="btn btn-info btn-sm">Download</a>
</td> -->
<td>
<a href="finvoice?order_id=<?=$fetch_row['order_id']?>" class="btn btn-danger btn-sm" style="background: #528373; border-color: #528373;" target='_blank'>View</a>
</td>
</tr>
<?php } ;?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</form>
<!-- col-md-12 end -->
</div>
<!-- [ Main Content ] end -->
</div>
</div>
<?php include('../include/footer.php'); ?>
<?php
if(!empty($_GET['status_id'])){
$id=$_GET['status_id'];
$stsQry=mysqli_fetch_array(mysqli_query($conn,"SELECT * FROM `order_tbl` WHERE id ='$id'"));
if($stsQry['status']==0){
$updtQry=mysqli_query($conn,"UPDATE `order_tbl` SET `status`='1' WHERE id='$id'")or die(mysqli_error($conn));
if($updtQry){
echo "<script>window.location='show.php?page=order';</script>";
$_SESSION['message']="Record Activated Successfully";
}
}
elseif($stsQry['status']==1){
$updtQry=mysqli_query($conn,"UPDATE `order_tbl` SET `status`='0' WHERE id='$id'")or die(mysqli_error($conn));
if($updtQry){
echo "<script>window.location='show.php?page=order';</script>";
$_SESSION['error']="Record Inactivated Successfully";
}
}
elseif($stsQry['status']==2){
$updtQry=mysqli_query($conn,"UPDATE `order_tbl` SET `status`='1' WHERE id='$id'")or die(mysqli_error($conn));
if($updtQry){
echo "<script>window.location='show.php?page=order';</script>";
$_SESSION['error']="Record Inactivated Successfully";
}
}
}
?>
<?php
if(!empty($_GET['delete_id'])){
$id=$_GET['delete_id'];
$dtQuery=mysqli_query($conn,"DELETE FROM `order_tbl` WHERE id=".$_GET['delete_id']);
if($dtQuery){
echo "<script>window.location='show.php?page=order';</script>";
$_SESSION['delete']="Record Deleted Successfully";
}
}
?>
<?php
if(isset($_POST['but_delete'])){
if(isset($_POST['delete'])){
foreach($_POST['delete'] as $deleteid){
$deleteUser = "DELETE from order_tbl WHERE id=".$deleteid;
mysqli_query($conn,$deleteUser);
}
echo "<script>window.location='show.php?page=order';</script>";
$_SESSION['delete']="All Record Deleted Successfully";
}
}
?>
<?php
if(isset($_POST['but_active'])){
if(isset($_POST['delete'])){
foreach($_POST['delete'] as $deleteid){
$deleteUser = "UPDATE `order_tbl` SET `status`='1' WHERE id=".$deleteid;
mysqli_query($conn,$deleteUser);
echo "<script>window.location='show.php?page=order';</script>";
$_SESSION['message']="All Record Activated Successfully";
}
}
}
?>
<?php
if(isset($_POST['but_deactive'])){
if(isset($_POST['delete'])){
foreach($_POST['delete'] as $deleteid){
$deleteUser = "UPDATE `order_tbl` SET `status`='0' WHERE id=".$deleteid;
mysqli_query($conn,$deleteUser);
}
echo "<script>window.location='show.php?page=order';</script>";
$_SESSION['error']="All Record Inactivated Successfully";
}
}
?>
<?php
if(isset($_POST['but_canceled'])){
if(isset($_POST['delete'])){
foreach($_POST['delete'] as $deleteid){
$deleteUser = "UPDATE `order_tbl` SET `status`='2' WHERE id=".$deleteid;
mysqli_query($conn,$deleteUser);
}
echo "<script>window.location='show.php?page=order_dlt';</script>";
$_SESSION['error']="All Record Cancel Successfully";
}
}
?>
<!-- Payment Filter Code Start -->
<script>
document.getElementById("paymentStatus").addEventListener("change", function() {
var selectedValue = this.value;
if (selectedValue == "") {
// Construct the new URL with the selected value as a parameter
var url = window.location.href.split('?')[0] + "?page=order";
// Redirect to the new URL
window.location.href = url;
}
if (selectedValue !== "") {
// Construct the new URL with the selected value as a parameter
var url = window.location.href.split('?')[0] + "?page=order&&payment_status=" + selectedValue;
// Redirect to the new URL
window.location.href = url;
}
});
</script>
<!-- Payment Filter Code End -->