<?php
ob_start();
session_start();
include "../inc/config.php";
 
// Soft Delete Here
if($_POST['type']=="soft_delete"){
$statement = $pdo->prepare("UPDATE ".$_POST['table']." SET cust_status=? WHERE id=?");
$result=$statement->execute(array(1, $_POST['delete_id']));
if($result==1)
	{
	    $message='Success..';
	    $error='1';
	}
	else
	{
	    $message='Failed..';
	    $error='0';
	}
		$datas[] = array('message' => $message, 'error' => $error);                   
        echo $message;
}

// Hard Delete Here
if($_POST['type']=="hard_delete"){
    $id=$_POST['delete_id'];
    $statement = $pdo->prepare("DELETE from ".$_POST['table']." WHERE id=$id");
    $result=$statement->execute();
if($result==1)
	{
	    $message='Success..';
	    $error='1';
	}
	else
	{
	    $message='Failed..';
	    $error='0';
	}
		$datas[] = array('message' => $message, 'error' => $error);                   
        echo $message;
}

if($_POST['type']=="dynamic_in_active"){
$statement = $pdo->prepare("UPDATE ".$_POST['table']." SET cust_status=? WHERE id=?");
$result=$statement->execute(array(1,$_POST['delete_id']));
if($result==1)
	{
	    $message='Success..';
	    $error='1';
	}
	else
	{
	    $message='Failed..';
	    $error='0';
	}
		$datas[] = array('message' => $message, 'error' => $error);                   
        echo $message;
}

if($_POST['type']=="dynamic_active"){
$statement = $pdo->prepare("UPDATE ".$_POST['table']." SET cust_status=? WHERE id=?");
$result=$statement->execute(array(0,$_POST['delete_id']));
if($result==1)
	{
	    $message='Success..';
	    $error='1';
	}
	else
	{
	    $message='Failed..';
	    $error='0';
	}
		$datas[] = array('message' => $message, 'error' => $error);                   
        echo $message;
}

if($_POST['type']=="tbl_client_rate_master_delete"){
    $statement = $pdo->prepare("DELETE from tbl_client_rate_master WHERE id=?");
    $result=$statement->execute(array($_POST['delete_id']));
    if($result==1)
    	{
    	    $message='Success..';$error='1';
    	}
    	else
    	{
    	    $message='Failed..';$error='0';
    	}
    $datas[] = array('message' => $message, 'error' => $error);                   
    echo $message;
}




// Soft Delete Here
if($_POST['type']=="soft_delete_table"){
$statement = $pdo->prepare("UPDATE ".$_POST['table']." SET status=? WHERE id=?");
$result=$statement->execute(array(0, $_POST['delete_id']));
if($result==1)
	{
	    $message='Success..';
	    $error='1';
	}
	else
	{
	    $message='Failed..';
	    $error='0';
	}
		$datas[] = array('message' => $message, 'error' => $error);                   
        echo $message;
}

?>