D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home3
/
encodto1
/
siliguritoys.com
/
slgadmintoys
/
Filename :
product_sales.php
back
Copy
<?php include 'config.php'; ?> <!DOCTYPE html> <html lang="en" data-theme="light"> <head> <?php include 'style.php'; ?> </head> <body> <?php include 'sidebar.php'; ?> <main class="dashboard-main"> <?php include 'header.php'; ?> <div class="dashboard-main-body"> <div class="d-flex flex-wrap align-items-center justify-content-between gap-3 mb-24"> <h6 class="fw-semibold mb-0">Sales Notifications</h6> <ul class="d-flex align-items-center gap-2"> <li class="fw-medium"> <a href="index.html" class="d-flex align-items-center gap-1 hover-text-primary"> <iconify-icon icon="solar:home-smile-angle-outline" class="icon text-lg"></iconify-icon> Dashboard </a> </li> <li>-</li> <li class="fw-medium">Sales Notifications</li> </ul> </div> <div class="row gy-4"> <div class="col-lg-12"> <div class="card"> <div class="card-header"> <h5 class="card-title mb-0">Recent Orders</h5> <a href="purchase_report.php" class="btn btn-primary btn-sm">View Full Purchase Report</a> </div> <div class="card-body"> <div class="table-responsive"> <table class="table bordered-table mb-0"> <thead> <tr> <th>Order ID</th> <th>Customer</th> <th>Email</th> <th>Phone</th> <th>Amount</th> <th>Payment ID</th> <th>Date</th> <th>Status</th> <th>Action</th> </tr> </thead> <tbody> <?php $query = "SELECT o.*, c.customer_name, c.customer_email, c.customer_phone FROM orders o JOIN slgtoys_customer c ON o.customer_id = c.customer_id ORDER BY o.created_at DESC LIMIT 15"; $result = mysqli_query($conn, $query); if (mysqli_num_rows($result) > 0) { // Fixed: Added closing parenthesis and > 0 while ($row = mysqli_fetch_assoc($result)) { $status = $row['status'] ?? 'pending'; // Default to pending if status doesn't exist ?> <tr> <td><?= $row['id']; ?></td> <td><?= $row['customer_name']; ?></td> <td><?= $row['customer_email']; ?></td> <td><?= $row['customer_phone']; ?></td> <td>₹<?= number_format($row['grand_total'], 2); ?></td> <td><?= $row['razorpay_payment_id'] ? substr($row['razorpay_payment_id'], 0, 10).'...' : 'N/A'; ?></td> <td><?= date("d M Y, h:i A", strtotime($row['created_at'])); ?></td> <td> <span class="badge <?= $status == 'approved' ? 'bg-success' : ($status == 'rejected' ? 'bg-danger' : 'bg-warning') ?>"> <?= ucfirst($status); ?> </span> </td> <td> <?php if($status == 'pending'): ?> <a href="update_order_status.php?id=<?= $row['id']; ?>&status=approved" class="btn btn-success btn-sm">Approve</a> <a href="update_order_status.php?id=<?= $row['id']; ?>&status=rejected" class="btn btn-danger btn-sm">Reject</a> <?php endif; ?> <a href="order_details.php?id=<?= $row['id']; ?>" class="btn btn-info btn-sm">View</a> </td> </tr> <?php } } else { echo "<tr><td colspan='9' class='text-center'>No orders found</td></tr>"; } ?> </tbody> </table> </div> </div> </div> </div> </div> </div> <?php include 'Footer.php'; ?> </main> </body> </html>