Initial commit

This commit is contained in:
Local Administrator
2025-04-18 10:32:42 +02:00
commit b83134aca3
29643 changed files with 3045897 additions and 0 deletions

21
get_tab_total.php Normal file
View File

@@ -0,0 +1,21 @@
<?php
require_once("connection.php");
if (isset($_POST['tab_id'])) {
$tab_id = (int) $_POST['tab_id']; // Ensure it's an integer
// Get the total from the bar_transactions table
$query = "SELECT SUM(item_price) AS total FROM bar_transactions WHERE tab_id = '$tab_id'";
$result = mysqli_query($conn, $query);
if ($result) {
$row = mysqli_fetch_assoc($result);
$total = $row['total'] ? $row['total'] : 0; // If no transactions, total is 0
echo json_encode(['status' => 'success', 'total' => $total]);
} else {
echo json_encode(['status' => 'error', 'message' => 'Failed to fetch total.']);
}
} else {
echo json_encode(['status' => 'error', 'message' => 'Missing tab ID.']);
}
?>