<?php 

require_once '../includes/DbOperations.php';

$response = array();

if($_SERVER['REQUEST_METHOD'] == 'POST'){
	
		if(isset($_POST['status'])) {
			$db =  new DbOperations();

			$result = $db -> clearingOrders($_POST['status']);

	if($result == 1){
				
				$response['error'] = false;
				$response['message'] = "Orders Cleared Successfully";	
			}
			elseif($result == 0){
				$response['error'] = true;
				$response['message'] = "Clearing Failed";
			}

}
}else{
	$response['error'] = true;
	$response['message'] = "Invalid Request";
}

echo json_encode($response);
?>