Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Copied employee pages into admins, added pages for adding employee an…
…d reporting features
- Loading branch information
Josh
authored and
Josh
committed
Dec 4, 2016
1 parent
662d9f2
commit 6cb5995
Showing
28 changed files
with
1,203 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
require("../dbCon.php"); | ||
require("../commonFunctions.php"); | ||
|
||
?> | ||
|
||
<html> | ||
<head> | ||
<link rel="stylesheet" href="../style.css"> | ||
</head> | ||
<body> | ||
<div id="header"> | ||
<?php writeMenuAdm(basename($_SERVER['PHP_SELF'])); ?> | ||
|
||
</div> | ||
<div id='contentwrapper'> | ||
<h1> | ||
<?php | ||
echo "Welcome " . $_SESSION['AdminID'] . "!"; | ||
?> | ||
</h1> | ||
</div> | ||
</body> | ||
|
||
|
||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
require("../dbCon.php"); | ||
require("../commonFunctions.php"); | ||
|
||
?> | ||
|
||
<html> | ||
<head> | ||
<link rel="stylesheet" href="../style.css"> | ||
</head> | ||
<body> | ||
<div id="header"> | ||
<?php writeMenuAdm(basename($_SERVER['PHP_SELF'])); ?> | ||
|
||
</div> | ||
<div id='contentwrapper'> | ||
<h1> | ||
<?php | ||
echo "Welcome " . $_SESSION['AdminID'] . "!"; | ||
?> | ||
</h1> | ||
</div> | ||
</body> | ||
|
||
|
||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
require("../dbCon.php"); | ||
require("../commonFunctions.php"); | ||
|
||
if (isset($_GET['NewCatName'])){ //Add new category | ||
$query = "INSERT INTO categories (CategoryName, Description) VALUES (?, ?)"; | ||
$stmt = $con->prepare($query); | ||
$stmt ->bind_param("ss", $_GET['NewCatName'], $_GET['NewCatDesc']); | ||
$stmt ->execute(); | ||
}elseif (isset($_GET['NewName'])){ //Update old category | ||
$query = "UPDATE categories SET CategoryName = ?, Description = ? WHERE CategoryID = ?"; | ||
$stmt = $con->prepare($query); | ||
$stmt ->bind_param("ssd", $_GET['NewName'], $_GET['NewDesc'], $_GET['Category']); | ||
$stmt ->execute(); | ||
} | ||
|
||
?> | ||
|
||
<html> | ||
<head> | ||
<link rel="stylesheet" href="../style.css"> | ||
</head> | ||
<body> | ||
<div id="header"> | ||
<?php writeMenuAdm(basename($_SERVER['PHP_SELF'])); ?> | ||
</div> | ||
|
||
<div id="contentwrapper"> | ||
<div id="contentwrapperLeft"> | ||
|
||
<form action = "EditCategories.php" method = "get"> | ||
<h1>Add Category</h1> | ||
<div class="form-group"> | ||
<label>Name</label> | ||
<input type="text" name="NewCatName" id="NewCatName" required> | ||
|
||
<label>Description</label> | ||
<input type="text" name="NewCatDesc" id="NewCatDesc" required> | ||
|
||
<input type="submit" value="Create Category"> | ||
</div> | ||
</form> | ||
</div> | ||
|
||
<div id="contentwrapperRight"> | ||
<form action = "EditCategories.php" method = "get"> | ||
<h1>Edit Category</h1> | ||
<div class="form-group"> | ||
<label>Category to Edit</label> | ||
<select name="Category" id="Category" onchange="updateCatNameDesc()"> | ||
<?php | ||
$query ="SELECT * FROM categories"; | ||
$stmt = $con->prepare($query); | ||
|
||
$stmt ->execute(); | ||
$result = $stmt->get_result(); | ||
while($row = mysqli_fetch_array($result)) { | ||
echo "<option value='" . $row['CategoryID'] . "'>" . $row['CategoryName'] . "</option>"; | ||
} | ||
?> | ||
</select> | ||
|
||
<label>New Name</label> | ||
<input type="text" name="NewName" id="NewName" required> | ||
|
||
<label>New Description</label> | ||
<input type="text" name="NewDesc" id="NewDesc" required> | ||
|
||
<input type="submit" value="Update Category"> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</body> | ||
|
||
|
||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
<?php | ||
require("../dbCon.php"); | ||
require("../commonFunctions.php"); | ||
|
||
?> | ||
|
||
<html> | ||
<head> | ||
<link rel="stylesheet" href="../style.css"> | ||
</head> | ||
<body> | ||
<div id="header"> | ||
<?php writeMenuAdm(basename($_SERVER['PHP_SELF'])); ?> | ||
</div> | ||
<form action = "NewProduct.php" class="form-group" style='display: block; margin: auto; width: 960px;'> | ||
<input type="submit" value="New Product"> | ||
</form> | ||
|
||
<hr> | ||
<div id="contentwrapper"> | ||
<div id='contentwrapperLeft'> | ||
|
||
<form action = "EditProducts.php" method = "get"> | ||
<h1>Simple Search</h1> | ||
<div class="form-group"> | ||
<input type="text" name="SimpleSearch" id="SimpleSearch" required value="<?php | ||
if(isset($_GET['SimpleSearch'])){echo $_GET['SimpleSearch'];}?>"> | ||
<input type="submit" value="Search"> | ||
|
||
</div> | ||
</form> | ||
</div> | ||
<div id="contentwrapperRight"> | ||
|
||
<form action = "EditProducts.php" method = "get"> | ||
<h1>Advanced Search</h1> | ||
<div class="form-group"> | ||
<label>Product Name</label> | ||
<input type="text" name="ProductName" id="ProductName" value="<?php | ||
if(isset($_GET['ProductName'])){echo $_GET['ProductName'];}?>"> | ||
<label>Category</label> | ||
<select name="Category" id="Category"> | ||
<option value=""></option> | ||
<?php | ||
$category = ""; | ||
if(isset($_GET['Category'])){ | ||
$category = $_GET['Category']; | ||
} | ||
|
||
$query ="SELECT * FROM categories"; | ||
$stmt = $con->prepare($query); | ||
|
||
$stmt ->execute(); | ||
$result = $stmt->get_result(); | ||
while($row = mysqli_fetch_array($result)) | ||
{ | ||
echo "<option "; | ||
if($row['CategoryName'] === $category){ | ||
echo "selected='selected'"; | ||
} | ||
echo "value='" . $row['CategoryName'] . "'>" . $row['CategoryName'] . "</option>"; | ||
} | ||
?> | ||
</select> | ||
<label>Company Name</label> | ||
<input type="text" name="CompanyName" id="CompanyName" value="<?php | ||
if(isset($_GET['CompanyName'])){echo $_GET['CompanyName'];}?>"> | ||
<label>Unit Price Greater Than</label> | ||
<input type="text" name="UnitPriceLow" id="UnitPriceLow" value="<?php | ||
if(isset($_GET['UnitPriceLow'])){echo $_GET['UnitPriceLow'];}?>"> | ||
<label>Unit Price Less Than</label> | ||
<input type="text" name="UnitPriceHigh" id="UnitPriceHigh" value="<?php | ||
if(isset($_GET['UnitPriceHigh'])){echo $_GET['UnitPriceHigh'];}?>"> | ||
|
||
<input type="submit" value="Search"> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
<div id='contentwrapper'> | ||
<?php | ||
if (empty($_GET)) { //Show all products by default | ||
$query ="SELECT 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 | ||
FROM | ||
((products as p 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"; | ||
|
||
$stmt = $con->prepare($query); | ||
|
||
}elseif (isset($_GET["SimpleSearch"]) && !empty($_GET["SimpleSearch"])) { //Simple search | ||
$query ="SELECT 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 | ||
FROM | ||
((products as p 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 | ||
CategoryName LIKE ? OR | ||
ProductName LIKE ? OR | ||
CompanyName LIKE ?"; | ||
|
||
$SimpleSearch = "%" . $_GET['SimpleSearch'] . "%"; | ||
$stmt = $con->prepare($query); | ||
$stmt ->bind_param("sss", $SimpleSearch, $SimpleSearch, $SimpleSearch); | ||
|
||
}else{ //Advanced search | ||
|
||
$query ="SELECT 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 | ||
FROM | ||
((products as p 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 | ||
ProductName LIKE ? AND | ||
CompanyName LIKE ? AND | ||
CategoryName LIKE ? AND | ||
UnitPrice > ? AND | ||
UnitPrice < ?"; | ||
|
||
$ProductName = "%" . $_GET['ProductName'] . "%"; | ||
$CompanyName = "%" . $_GET['CompanyName'] . "%"; | ||
$Category = "%" . $_GET['Category'] . "%"; | ||
if (empty($_GET["UnitPriceLow"])){ | ||
$UnitPriceLow = 0.00; | ||
}else{ | ||
$UnitPriceLow = number_format($_GET['UnitPriceLow'], 2); | ||
} | ||
if (empty($_GET["UnitPriceHigh"])){ | ||
$UnitPriceHigh = 10000000.00; | ||
}else{ | ||
$UnitPriceHigh = number_format($_GET['UnitPriceHigh'], 2); | ||
} | ||
$stmt = $con->prepare($query); | ||
$stmt ->bind_param("sssdd", $ProductName, $CompanyName, $Category, $UnitPriceLow, $UnitPriceHigh); | ||
|
||
} | ||
|
||
$stmt ->execute(); | ||
$result = $stmt->get_result(); | ||
|
||
$trArgs = array("onclick=\"window.document.location='ViewProduct.php?productID=%ProductID%'\"", | ||
array('%ProductID%' => '_ProductID') | ||
); | ||
makeTable($result, $trArgs); | ||
|
||
|
||
?> | ||
</div> | ||
</body> | ||
|
||
|
||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
require("../dbCon.php"); | ||
require("../commonFunctions.php"); | ||
|
||
?> | ||
|
||
<html> | ||
<head> | ||
<link rel="stylesheet" href="../style.css"> | ||
</head> | ||
<body> | ||
<div id="header"> | ||
<?php writeMenuAdm(basename($_SERVER['PHP_SELF'])); ?> | ||
</div> | ||
<div id='contentwrapper'> | ||
<h1>Active orders</h1> | ||
<hr> | ||
<?php | ||
$sql = "SELECT * FROM northwind.`orders qry` WHERE EmployeeID is null ORDER BY RequiredDate ASC;"; | ||
if (!$result = $con->query($sql)){} | ||
|
||
|
||
$trArgs = array("onclick=\"window.document.location='ViewOrder.php?orderID=%OrderID%'\"", | ||
array('%OrderID%' => 'OrderID') | ||
); | ||
makeTable($result, $trArgs); | ||
?> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
require("../dbCon.php"); | ||
require("../commonFunctions.php"); | ||
|
||
?> | ||
|
||
<html> | ||
<head> | ||
<link rel="stylesheet" href="../style.css"> | ||
</head> | ||
<body> | ||
<div id="header"> | ||
<?php writeMenuAdm("Reports.php"); ?> | ||
</div> | ||
<div id='contentwrapper'> | ||
|
||
</div> | ||
</body> | ||
|
||
|
||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
require("../dbCon.php"); | ||
require("../commonFunctions.php"); | ||
|
||
?> | ||
|
||
<html> | ||
<head> | ||
<link rel="stylesheet" href="../style.css"> | ||
</head> | ||
<body> | ||
<div id="header"> | ||
<?php writeMenuAdm("Reports.php"); ?> | ||
</div> | ||
<div id='contentwrapper'> | ||
|
||
</div> | ||
</body> | ||
|
||
|
||
|
||
</html> |
Oops, something went wrong.