Intern/selectReceipt.php
2024-09-13 17:42:15 +08:00

231 lines
8.4 KiB
PHP

<?php
session_start();
if (!isset($_SESSION['AccID'])) {
header('Location: login.html');
exit();
}
include("connection.php");
$AccID = $_SESSION['AccID'];
// Fetching the user's name
$sql = "SELECT Renter_Name FROM renter WHERE Renter_ID = '$AccID'";
$result = mysqli_query($conn, $sql);
$user = mysqli_fetch_assoc($result);
$userName = $user['Renter_Name'];
// Fetching records from the orders and payment tables for the current user
$sql_places = "SELECT o.*, p.* FROM orders o
LEFT JOIN payment p ON o.OrderID = p.OrderID
WHERE o.Renter_ID = '$AccID'";
$result_places = mysqli_query($conn, $sql_places);
$sql_receipt = "SELECT * FROM payment WHERE Renter_ID = '$AccID' ";
$result_receipt = mysqli_query($conn, $sql_receipt);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Select Receipt | UITM BAZAAR</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="style2.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<style type="text/css">
tbody tr td h1{
margin-left: 100px;
text-align: center;
}
.table-common{
width: 1050px;
height: 95px;
border: 1px solid white;
border-collapse: collapse;
margin: 0 auto;
text-align: center;
}
.table-common thead tr{
background-color: purple;
color: white;
}
.table-common td, .table-common th{
border: 1px solid white;
font-size: 18px;
padding: 10px 20px;
}
.table-actions input, .table-actions button{
margin-left: 10px;
background: purple;
color: white;
padding: 10px 20px;
border: none;
cursor: pointer;
}
.table-actions input:hover, .table-actions button:hover{
background: #e91e63;
}
button{
padding: 10px 15px;
margin-left: 7px;
background: white;
}
button:hover{
background: #e91e63;
}
</style>
</head>
<body>
<aside class="sidebar">
<div class="logo">
<img src="pic/profiles.png" alt="logo">
<h2><?php echo $userName; ?>'s</h2>
</div>
<ul class="links">
<h4>Main Menu</h4>
<li>
<span class="material-symbols-outlined"><img src="pic/home.png"></span>
<a href="rentermenu.php">Main Menu</a>
</li>
<hr>
<h4>Advanced</h4>
<li>
<span class="material-symbols-outlined"><img src="pic/receipt.png"></span>
<a href="selectReceipt.php">Receipt</a>
</li>
<hr>
<h4>Account</h4>
<li>
<span class="material-symbols-outlined"><img src="pic/profile2.png"></span>
<a href="renterProfile.php">Profile</a>
</li>
<hr>
<h4>Sign Out</h4>
<li class="logout-link">
<span class="material-symbols-outlined"><i class="fa-solid fa-right-from-bracket"></i></span>
<a href="logout.php">Logout</a>
</li>
</ul>
</aside>
<header class="header">
<a href="rentermenu.php" class="logo">Welcome
<span><?php echo $userName; ?>'s</span></a>
<i class="fa-solid fa-bars" id="menu-icon"></i>
<nav class="navbar">
<a href="rentPlace.php">Rent Place</a>
<a href="sawEvents.php">Event</a>
<a href="payment.php">Payment</a>
<a href="sentFeedback.php">Sent Feedback</a>
</nav>
</header>
<section class="home" id="home">
<div class="home-content">
<br><br>
<table width="882" border="0">
<tbody>
<tr>
<td><h1>RECEIPT</h1></td>
</tr>
</tbody>
</table>
<table class="table-common" id="table-1" border="1">
<thead>
<tr>
<th>NO</th>
<th>ORDER ID</th>
<th>PLACE NUMBER</th>
<th>PAYMENT TYPE</th>
<th>PAY DATE</th>
<th>PAY STATUS</th>
<th>Receipt</th>
</tr>
</thead>
<tbody>
<?php
if ($result_receipt->num_rows > 0) {
$no = 1;
while ($row = $result_places->fetch_assoc()) {
$isPay = $row['Pay_Status'] == 1;
if ($isPay) {
echo "<tr align='center'>";
echo "<td>{$no}</td>";
echo "<td>{$row['OrderID']}</td>";
echo "<td>{$row['Place_Num']}</td>";
echo "<td>{$row['Pay_Type']}</td>";
echo "<td>{$row['Pay_Date']}</td>";
echo "<td>" . ($isPay ? '<i class="fa fa-check"></i>' : '❌') . "</td>";
echo "<td>";
echo "<form action='viewReceipt.php' method='POST' style='display:inline;'>";
echo "<input type='hidden' name='OrderID' value='" . $row['OrderID'] . "'>";
echo "<input type='hidden' name='Renter_ID' value='" . $row['Renter_ID'] . "'>";
echo "<input type='hidden' name='Place_Num' value='" . $row['Place_Num'] . "'>";
echo "<input type='hidden' name='Transaction_No' value='" . $row['Transaction_No'] . "'>";
echo "<input type='hidden' name='Pay_AmountTotal' value='" . $row['Pay_AmountTotal'] . "'>";
echo "<input type='hidden' name='Pay_Date' value='" . $row['Pay_Date'] . "'>";
echo "<input type='hidden' name='Pay_Type' value='" . $row['Pay_Type'] . "'>";
echo "<input type='hidden' name='License' value='" . $row['License'] . "'>";
echo "<input type='hidden' name='Dates' value='" . $row['Dates'] . "'>";
echo "<button type='submit' name='submit'>View</button>";
echo "</form>";
echo "</td>";
echo "</tr>";
$no++;
}
}
} else {
echo "<tr align='center'><td colspan='8'>No Payment Being Made</td></tr>";
}
?>
</tbody>
</table>
</div>
</section>
<footer class="footer" id="footer">
<div class="social">
<a onclick="showPopup()"><i class="fa-solid fa-phone"></i></a>
<a onclick="showPopup2()"><i class="fa-solid fa-envelope"></i></a>
</div>
<div id="popup" class="popup">
<h2>This is Our No Phone!</h2><br>
<p>016-430 6562</p>
<button class="btns" onclick="closePopup()">Close</button>
</div>
<div id="popup2" class="popup">
<h2>This is Our Email!</h2><br>
<p>uitm@student.uitm.edu.my</p>
<button class="btns" onclick="closePopup2()">Close</button>
</div>
<ul class="list">
<li>
<a href="sentFeedback.php">Rate Us</a>
</li>
<li>
<a href="sawEvents.php">Event</a>
</li>
<li>
<a href="renterProfile.php">Profile</a>
</li>
<li>
<a href="https://bendahari.uitm.edu.my/index.php/component/contact/category/55-cawangan-negeri-perak-kampus-tapah">Website</a>
</li>
</ul>
<p class="copyright">
© NextGen Techne | All Rights Reserved
</p>
</footer>
<script src="script.js"></script>
<script type="text/javascript">
function confirmCancel(event) {
if (!confirm("Are you sure you want to cancel this order?")) {
event.preventDefault();
}
}
</script>
</body>
</html>