<?php
include 'includes/auth.php';
include 'db.php';

if(!isset($_GET['order_id'])){
    die('Order ID is required.');
}

$order_id = intval($_GET['order_id']);

// Update order as reconciled
$update = $conn->query("UPDATE restaurant_orders SET is_reconciled=1 WHERE id=$order_id");

if($update){
    // Optional: send email notification here
    $success_msg = "Order #$order_id has been successfully reconciled.";
    header("Location:restaurant_analytics.php?success=".urlencode($success_msg));
    exit;
} else {
    die("Failed to reconcile order: ".$conn->error);
}
?>