<?php
	include("../config.php");
	$response = array();
	if ($_POST['delete']) {
		$id 			   = $_POST['delete'];
		$type              = 'cancel_lr';
	    $user_id           = $_SESSION['user_detail']['id'];
	    $data              = serialize($_POST);
	    $created_datetime  = date('Y-m-d H:i:s');
	    $created_id        = $_SESSION['user_detail']['id'];
	    $updated_datetime  = date('Y-m-d H:i:s');
	    $updated_id        = $_SESSION['user_detail']['id'];
	    
	    $update = mysqli_query($conn, "UPDATE `lr_mst` SET `cancel_flag` = 'Y' WHERE `id` = '".$id."'");

		$activiti = "INSERT INTO `activities`(`type`, `user_id`, `data`, `created_id`, `created_datetime`, `updated_id`, `updated_datetime`) VALUES ('".$type."','".$user_id."','".$data."','".$created_id."','".$created_datetime."','".$updated_id."','".$updated_datetime."')";
    	$acttivity_res = mysqli_query($conn,$activiti);

    	if ($update) {
			$response['status']  = 'success';
			$response['message'] = 'Lr Deleted Successfully ...';
		} else {
			$response['status']  = 'error';
			$response['message'] = 'Unable to delete product ...';
		}
		
		echo json_encode($response);
	}