Skip to content
Permalink
master
Go to file
 
 
Cannot retrieve contributors at this time
72 lines (62 sloc) 3.39 KB
<?php
require("../dbCon.php");
require("../commonFunctions.php");
$orderID = $_GET['orderID'];
?>
<html>
<head>
<link rel="stylesheet" href="../style.css">
</head>
<body>
<div id="header">
<?php writeMenuAdm('AllOrders.php'); ?>
</div>
<div id='contentwrapper'>
<?php
$where = " WHERE o.OrderID=" . $orderID . " ";
$sql = "SELECT
o.OrderID as _OrderID,
CONCAT(e.FirstName, ' ', e.LastName) as Employee,
DATE_FORMAT(OrderDate, '%m-%d-%Y') as `Order Date`, DATE_FORMAT(s.RequiredDate, '%m-%d-%Y') as `Required Date`, DATE_FORMAT(ShippedDate, '%m-%d-%Y') as `Shipped Date`,
Freight, ShipName as `Ship To`,
CONCAT(ShipAddress, ', ', ShipCity, '<br>', ShipRegion, ' ', ShipPostalCode, ', ', ShipCountry) as `Ship Address`,
CONCAT('$', FORMAT(Total,2)) as Total, pt.Name as `Paid Via`
FROM
((((orders o LEFT JOIN employees e ON o.EmployeeID = e.EmployeeID)
LEFT JOIN shipments sh ON o.OrderID = sh.OrderID)
LEFT JOIN shipaddresses s ON sh.ShipmentsID = s.ShipAddrID)
LEFT JOIN payment p ON o.orderID = p.orderID)
LEFT JOIN paymenttype pt ON pt.paymenttypeid = p.paymenttypeid
" . $where . " ORDER BY OrderDate DESC";
$result = $con->query($sql);
$trArgs = array("onclick=\"window.document.location='ViewOrder.php?orderID=%OrderID%'\"",
array('%OrderID%' => '_OrderID')
);
makeTable($result, $trArgs);
echo "<hr>";
$sql = "SELECT
p.ProductID as _ProductID,
ProductName as Product,
CategoryName as Category,
CompanyName as Company,
QuantityPerUnit as Quantity,
CONCAT('$', FORMAT(p.UnitPrice,2)) as Price,
UnitsInStock as Stock,
Quantity as `Amount Ordered`,
CONCAT('$', FORMAT(Quantity*p.UnitPrice,2)) as `Sub-total`
FROM
(((`order details` od LEFT JOIN products p ON od.ProductID = p.ProductID)
LEFT JOIN suppliers as s ON p.SupplierID = s.SupplierID)
LEFT JOIN categories c ON p.CategoryID = c.CategoryID)
LEFT JOIN company co ON s.CompanyId = co.CompanyID
WHERE orderid = " . $orderID . "
order by od.ProductID ASC";
$result = $con->query($sql);
$trArgs = array("onclick=\"window.document.location='ViewProduct.php?productID=%ProductID%'\"",
array('%ProductID%' => '_ProductID')
);
makeTable($result, $trArgs);
?>
</div>
</body>
</html>
You can’t perform that action at this time.