| Server IP : 173.209.174.21 / Your IP : 216.73.216.89 Web Server : Apache/2.4.58 (Ubuntu) System : Linux wcfs-server 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : nodor ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/thelittlebigshow/self-hosted/ |
Upload File : |
<?php include 'protect.php'; ?>
<?php
include 'db.php';
include 'store_settings.php';
$tax_rate = getStoreTaxRate($conn);
$customer_id = isset($_POST['customer_id']) ? intval($_POST['customer_id']) : 0;
$confirm = $_POST['confirm'] ?? '';
if (!$customer_id) {
header("Location: index.php");
exit;
}
$stmt = $conn->prepare("SELECT first_name, last_name FROM customers WHERE id = ?");
$stmt->bind_param("i", $customer_id);
$stmt->execute();
$customer = $stmt->get_result()->fetch_assoc();
$customer_name = $customer['first_name'] . ' ' . $customer['last_name'];
if ($confirm === 'yes') {
$select = $conn->prepare("SELECT * FROM transactions WHERE customer_id = ?");
$select->bind_param("i", $customer_id);
$select->execute();
$transactions = $select->get_result();
$insert = $conn->prepare("
INSERT INTO archived_transactions (customer_id, item_name, quantity, price, taxable, notes, original_date, archived_on)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
");
$now = date('Y-m-d');
while ($t = $transactions->fetch_assoc()) {
$insert->bind_param(
"isidssss",
$t['customer_id'],
$t['item_name'],
$t['quantity'],
$t['price'],
$t['taxable'],
$t['notes'],
$t['date'],
$now
);
$insert->execute();
}
$delete = $conn->prepare("DELETE FROM transactions WHERE customer_id = ?");
$delete->bind_param("i", $customer_id);
$delete->execute();
header("Location: view_account.php?customer_id=$customer_id");
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Archive Customer Tab</title>
<style>
body {
font-family: 'Segoe UI', sans-serif;
background-color: #f9f9f9;
padding: 40px;
margin: 0;
color: #333;
}
.container {
max-width: 600px;
margin: auto;
background: #fff;
padding: 30px;
text-align: center;
box-shadow: 0 2px 6px rgba(0,0,0,0.1);
border-radius: 6px;
}
h1 {
margin-top: 0;
}
.buttons {
margin-top: 30px;
}
form {
display: inline-block;
margin: 0 10px;
}
input[type="submit"] {
font-size: 16px;
padding: 10px 20px;
border: none;
cursor: pointer;
border-radius: 4px;
}
.confirm {
background-color: #4CAF50;
color: white;
}
.cancel {
background-color: #ccc;
}
.confirm:hover {
background-color: #45a049;
}
.cancel:hover {
background-color: #bbb;
}
.back-link {
display: block;
margin-top: 30px;
}
</style>
</head>
<body>
<div class="container">
<h1>Archive Tab for <?= htmlspecialchars($customer_name) ?>?</h1>
<p>This will move all current transactions into the monthly archive and reset their account.</p>
<div class="buttons">
<form method="post">
<input type="hidden" name="customer_id" value="<?= $customer_id ?>">
<input type="hidden" name="confirm" value="yes">
<input type="submit" value="Yes, Archive Tab" class="confirm">
</form>
<form method="get" action="view_account.php">
<input type="hidden" name="customer_id" value="<?= $customer_id ?>">
<input type="submit" value="Cancel" class="cancel">
</form>
</div>
<a class="back-link" href="index.php">← Back to Dashboard</a>
</div>
</body>
</html>