%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/www/website_6031bb72/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');
$order_id = $_GET['order_id'];
$Order = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM `order_tbl` WHERE order_id='$order_id'"));
$OrderDtl = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM `order_detail_tbl` WHERE order_id='$order_id'"));
$currencyType = $Order['currencyType'];
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(0);
?>
<!-- [ 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"> Manage Order</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- [ breadcrumb ] end -->
<!-- [ Main Content ] start -->
<div class="card rounded-4">
<header class="card-header bg-transparent p-7">
<div class="row align-items-center">
<div class="col-md-6 ml-auto d-flex flex-wrap">
<a class="btn btn-secondary btn-sm print ms-5 my-3 px-4 py-2 " href="<?= $admin_url ?>manage_order/show.php?page=order">Back</a>
</div>
<div class="col-md-6 ml-auto d-flex justify-content-md-end flex-wrap">
<a class="btn btn-info btn-sm print ms-5 my-3 p-2" id="printButton" onclick="printInvoiceInvoice()">Print Invoice</a>
<a class="btn btn-dark btn-sm print ms-5 my-3 p-2" id="printButtonAdd" onclick="printInvoiceAddress()">Print Address</a>
</div>
</div>
</header>
<div class="card-body p-7" id="invoiceContent">
<div class="row mb-8 mt-4 order-info-wrap" id="address_div">
<div class="col-md-12 mb-lg-0 mb-6 text-center">
<span style="font-size: 25px;"><i class="far fa-calendar "></i> <?= $Order['recieve_date'] ?> </span>
<br>
<span style="font-size: 25px;">Order ID: <?= $Order['order_id'] ?></span>
<br>
<span style="font-size: 15px;">User Type: <?= $OrderDtl['type']; ?></span><br>
</div>
<div class="col-md-6 mb-md-0 mb-7">
<div class="d-flex flex-nowrap">
<div class="icon-wrap">
<span class="rounded-circle px-5 me-6 d-inline-block">
<i class="fas fa-user px-2"></i>
</span>
</div>
<div class="media-body">
<h6 class="mb-6">From</h6>
<p class="mb-6"><?= $rows_website['website_name'] ?> <br>
<?= $rows_website['website_email_id'] ?> <br>
<?= $rows_website['mobile_number1'] ?> <br>
<?= wordwrap($rows_website['website_address'], 25, "<br>\n"); ?>
</p>
</div>
</div>
</div>
<div class="col-md-6">
<div class="d-flex flex-nowrap justify-content-md-end">
<div class="icon-wrap">
<span class="rounded-circle px-5 me-6 d-inline-block">
<i class="fas fa-truck px-2"></i>
</span>
</div>
<div class="media-body">
<h6 class="mb-6">Deliver to</h6>
<p class="mb-6"><?php
$val = explode(' - ', $Order['address'] ?? '');
$country_name = $val[0] ?? '';
$city = $val[1] ?? '';
$address_code = $val[2] ?? '';
$name = $val[3] ?? '';
$phone = $val[4] ?? '';
?>
<strong>Country : </strong> <?= htmlspecialchars($country_name) ?><br>
<strong>City : </strong> <?= htmlspecialchars($city) ?><br>
<strong>Address Code : </strong> <?= htmlspecialchars($address_code) ?><br>
<strong>Name : </strong> <?= htmlspecialchars($name) ?><br>
<strong>Phone : </strong> +<?= htmlspecialchars($phone) ?><br>
</p>
</div>
</div>
</div>
<center class="pb-2"><strong>Transaction ID: </strong><?=$Order['transaction_id']?></center>
</div>
<div class="row">
<div class="col-lg-12">
<div class="table-responsive">
<table class="table table-borderless">
<thead>
<tr class="text-center">
<th>Sr.no</th>
<th>Image</th>
<th>Product Details</th>
<th>Quantity</th>
<th>Price</th>
<th class="text-end">Total</th>
</tr>
</thead>
<tbody>
<?php
$subtotal = 0;
$n = 1;
$pro_row = mysqli_query($conn, "SELECT * FROM order_detail_tbl WHERE order_id='$order_id'");
while ($fetch_row = mysqli_fetch_assoc($pro_row)) {
$product_row = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM `product_tbl` WHERE id='" . $fetch_row['product_id'] . "'"));
$brand_row = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM `category_tbl` WHERE id='" . $product_row['cat_id'] . "'"));
$model_row = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM `sub_category_tbl` WHERE id='" . $product_row['sub_cat_id'] . "'"));
$product_price = $fetch_row['price'];
$subtotal = $fetch_row['amount'];
?>
<tr class="text-center">
<td><?= $n;
$n++; ?></td>
<td>
<a title="Flowers cotton dress">
<img src="<?= $base_url ?>images/Upload/product/<?= $product_row['image1'] ?>" width="100" height="80">
</a>
</td>
<td>
<strong>Product Id :</strong> <?= $product_row['product_id'] ?><br>
<strong>Name :</strong> <?php if (isset($_COOKIE['ar'])){ echo $product_row['title_ar']; }else{ echo $product_row['title']; } ?><br>
<strong>Brand :</strong> <?php if (isset($_COOKIE['ar'])){ echo $brand_row['title_ar']; }else{ echo $brand_row['title']; } ?><br>
<strong>Model :</strong> <?php if (isset($_COOKIE['ar'])){ echo $model_row['title_ar']; }else{ echo $model_row['title']; } ?><br>
</td>
<td><?= $fetch_row['quantity'] ?></td>
<td><?= $Order['currencyType'] ?> <?= $product_row['price'] ?></td>
<td class="text-end"><?= $Order['currencyType'] ?> <?=number_format($fetch_row['amount'],3); ?></td>
</tr>
<?php } ?>
<tr>
<td colspan="7">
<div class="d-flex flex-column align-items-end justify-content-end">
<div class="mw-40" style="width: 30% !important;">
<div class="d-flex w-100">
<span class="d-inline-block w-50">Subtotal:</span>
<span class="d-inline-block w-50 text-end fw-normal"><b><?= $Order['currencyType'] ?> <?= number_format($subtotal,3) ?></b></span><br>
</div>
<?php if (!empty($Order['coupon'])) { ?>
<div class="d-flex w-100">
<span class="d-inline-block w-50">Coupon:</span>
<span class="d-inline-block w-50 text-end fw-normal"><b><?= $Order['coupon'] ?></b></span>
</div>
<div class="d-flex w-100">
<span class="d-inline-block w-50">Discount Cost:</span>
<span class="d-inline-block w-50 text-end fw-normal"><b><?= $Order['currencyType'] ?> <?= $Order['discount'] ?></b></span>
</div>
<?php } ?>
<div class="d-flex w-100">
<span class="d-inline-block w-50">Shipping:</span>
<?php if ($Order['shipping'] == 0 || $Order['shipping'] == 'Free') { ?>
<span class="d-inline-block w-50 text-end fw-normal"><b>Free</b></span>
<?php } else { ?>
<span class="d-inline-block w-50 text-end fw-normal"><b><?= $Order['currencyType'] ?> <?= $Order['shipping'] ?></b></span>
<?php } ?>
</div>
<!-- <div class="d-flex w-100">
<span class="d-inline-block w-50">Payment Method: </span>
<span class="d-inline-block w-50 text-end fw-normal"><b></?= $Order['payment_method'] ?></b></span><br>
</div> -->
<div class="d-flex w-100 mb-5">
<span class="d-inline-block w-50">Grand total: </span>
<?php
if ($Order['shipping'] == 0 || $Order['shipping'] == 'Free') {
$grand_total = $subtotal - $Order['discount'];
} else {
$grand_total = $subtotal + $Order['shipping'] - $Order['discount'];
}
?>
<span class="d-inline-block w-50 text-end fw-normal"><b><?= $Order['currencyType'] ?> <?= number_format($grand_total,3); ?></b></span>
</div>
<div class="d-flex w-100">
<span class="d-inline-block w-50 mt-2">Status:</span>
<?php
if ($OrderDtl['status'] == 1) {
echo '<span class="d-inline-block w-50 text-end fs-20 fw-semibold"><span class="badge rounded-pill alert alert-success fs-12px px-4 py-3" style="color: #1b6120;">Payment Done</span>';
} elseif($OrderDtl['status'] == 2) {
echo '<span class="d-inline-block w-50 text-end fs-20 fw-semibold"><span class="badge rounded-pill alert alert-success fs-12px px-4 py-3" style="color: #9e0c0cff;">Payment Failed</span>';
} else {
echo '<span class="d-inline-block w-50 text-end fs-20 fw-semibold"><span class="badge rounded-pill alert alert-danger text-dark fs-12px px-4 py-3">Pending</span>';
}
?>
</span>
</div>
</div>
</div>
</td>
</tr>
<tr>
<td colspan="6">
<div class="d-flex flex-column align-items-end justify-content-end">
<div class="mw-40 w-40">
<div id="contact-message"></div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="invoice_div">
</div>
</div>
</div>
</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";
}
}
}
?>
<?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";
}
}
?>
<script>
function printInvoiceInvoice() {
// Open a new window
var printWindow = window.open('', '_blank');
// Get the content of the invoice div from the other page
fetch('finvoice.php?order_id=<?= $order_id ?>')
.then(response => response.text())
.then(html => {
// Set the content of the new window
printWindow.document.open();
printWindow.document.write(html);
printWindow.document.close();
// Print the content
printWindow.print();
// Close the window after printing
printWindow.close();
})
.catch(error => {
console.error('Error fetching invoice content:', error);
});
}
</script>
<script>
function printInvoiceAddress() {
// Open a new window
var printWindow = window.open('', '_blank');
// Get the content of the invoice div from the other page
fetch('address.php?order_id=<?= $order_id ?>')
.then(response => response.text())
.then(html => {
// Set the content of the new window
printWindow.document.open();
printWindow.document.write(html);
printWindow.document.close();
// Print the content
printWindow.print();
// Close the window after printing
printWindow.close();
})
.catch(error => {
console.error('Error fetching invoice content:', error);
});
}
</script>