<?php
include '../includes/config.php';
$data = json_decode(file_get_contents('php://input'), true);

if (!isset($data['id'])) {
    echo json_encode(['success' => false, 'error' => 'Invalid data received.']);
    exit;
}

try {
    $query = "DELETE FROM customer_bill_manual WHERE id = :id";
    $stmt = $conn->prepare($query);
    $stmt->execute([
        'id' => $data['id'],
    ]);

    echo json_encode(['success' => true]);
} catch (PDOException $e) {
    echo json_encode(['success' => false, 'error' => $e->getMessage()]);
}
