<?php

include 'load.php';
require_once 'db_connection.php'; 

?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
<meta name="description" content="POS - Eat More Resturant   | Pos & Invetory System | Dashboard
">
<meta name="keywords" content="Eat More Resturant   | Pos & Invetory System | Dashboard
">
<meta name="author" content="Eat More Resturant   | Pos & Invetory System | Dashboard
">
<meta name="robots" content="noindex, nofollow">

<title>Home | Eat More Resturant   | Pos & Invetory System | Dashboard
</title>


<?php
require_once 'headercss.php';
?>
</head>
<body>
<div id="global-loader">
<div class="whirly-loader"> </div>
</div>

<div class="main-wrapper">

<?php
require_once 'header.php';
?>

<?php
require_once 'navbar.php';
?>

<div class="page-wrapper">
<div class="content">
<div class="page-header">
<div class="page-title">
<h4>Purchase List</h4>
<h6>Manage your Purchase</h6>
</div>
<div class="page-btn">
<a href="createpurchase.php" class="btn btn-added">
<img src="assets/img/icons/plus.svg" alt="img" class="me-2"> Add Purchase
</a>
</div>
</div>

<div class="card">
<div class="card-body">
<div class="table-top">

</div>

<div class="table-responsive">
<table class="table" id="betable">
<thead>
<tr>
<th>#ID</th>
<th>Action</th>
<th>Purchase No</th>
<th>Customer Name</th>
<th>Address</th>
<th>Contact Number</th>
<th>Value</th>
<th>Date/Time</th>
</tr>
</thead>
<tbody>

	<?php
	
	$count=0;
	
	$sql = "SELECT *  FROM mobilepurchase ORDER BY q_id  DESC";

		$result = $conn->query($sql);
		$rowCount = 0;
		if ($result->num_rows > 0) {
			while($row = $result->fetch_assoc()) {
				
				$rowCount = $rowCount+1;
				
				$q_id = $row["q_id"];
				$q_customer = $row["q_customer"];
				$q_contact = $row["q_contact"];
				$q_address = $row["q_address"];
				$q_amount = $row["q_amount"];
				$q_user = $row["q_user"];
				$q_date = $row["q_date"];
				
				$count++;
				
				?>
<tr>
<td><a target="_" href="purchase-view?id=<?php echo $q_id; ?>">View</a></td>
<td><?php echo $rowCount; ?></td>
<td><?php echo $q_id; ?></td>
<td><?php echo $q_customer; ?></td>
<td><?php echo $q_address; ?></td>
<td><?php echo $q_contact; ?></td>
<td><?php echo $q_amount; ?></td>
<td><?php echo $q_date; ?></td>
</tr>
<?php }  } ?>
</tbody>
</table>
</div>
</div>
</div>

</div>
</div>
</div>

<?php require_once 'footerjs.php'; ?>

</body>
</html>