%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_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');
$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'"));
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
?>
<!-- [ 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
$country=$OrderDtl['country'];
$Staty=$OrderDtl['state'];
$city=$OrderDtl['city'];
// $contory=mysqli_fetch_array(mysqli_query($conn,"SELECT * FROM `countries` WHERE id='$country'"));
// $Staty=mysqli_fetch_array(mysqli_query($conn,"SELECT * FROM `states` WHERE id='$Staty'"));
?>
<?=$OrderDtl['name'];?><br>
<?=$OrderDtl['email'];?> <br>
<?=$OrderDtl['phone'];?> <br>
<?=$country;?> , <?=$Staty;?> , <?=$city;?> <br>
<?=wordwrap($OrderDtl['address'],25,"<br>\n");?>
</p>
</div>
</div>
</div>
</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>Product ID</th>
<th>Image</th>
<th>Product name</th>
<th>Price</th>
<th>Quantity</th>
<th class="text-end">Total</th>
</tr>
</thead>
<tbody>
<?php
$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']."'"));
?>
<tr class="text-center">
<td><?=$n; $n++; ?></td>
<td><?=$product_row['product_id']?></td>
<td>
<a title="Flowers cotton dress">
<img src="<?=$base_url?>images/Upload/product/<?=$product_row['image1']?>" width="100" height="80">
</a>
</td>
<td>
<?=$product_row['title']?>
</td>
<td>AED <?=$product_row['price']?></td>
<td><?=$fetch_row['quantity']?></td>
<td class="text-end">AED <?=$fetch_row['subtotal_price']?></td>
</tr>
<?php } ?>
<tr>
<td colspan="6">
<div class="d-flex flex-column align-items-end justify-content-end">
<div class="mw-40 w-40">
<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>AED <?=$Order['totle_amount']?></b></span><br>
</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"><//?=$OrderDtl['currency']?><//?=$OrderDtl['total_discount']?></span>
</div>
<div class="d-flex w-100">
<span class="d-inline-block w-50">Shipping cost:</span>
<span class="d-inline-block w-50 text-end fw-normal"><//?=$OrderDtl['currency']?><//?=$OrderDtl['total_shipping']?></span>
</div> -->
<div class="d-flex w-100 mb-5">
<span class="d-inline-block w-50">Grand total:</span>
<span class="d-inline-block w-50 text-end fw-normal"><b> AED <?=$Order['totle_amount']?></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-danger text-dark fs-12px px-4 py-3">Pending</span>';
}else{
echo '<span class="d-inline-block w-50 text-end fs-20 fw-semibold"><span class="badge rounded-pill alert alert-success text-success fs-12px px-4 py-3">Payment done</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>