<?php
include("../connect.php"); 
$response = array();
if(isset($_POST['admin_id']) && isset($_POST['percentage_value']))
{
	$admin_id = $_POST['admin_id'];
	$percentage_value=$_POST['percentage_value'];
	date_default_timezone_set('Asia/Calcutta');
	$cdate  = date("Y-m-d")." ".date('h:i:sa');
	$res_product_stock = mysqli_query($con,"SELECT percentage_value FROM  tbl_gst_percentage where admin_id='$admin_id' and percentage_value='$percentage_value'");
	if(mysqli_num_rows($res_product_stock)<=0)
	{									
		$query = mysqli_query($con,"INSERT INTO `tbl_gst_percentage`(`admin_id`, `percentage_value`, `status`, `insert_datetime`) VALUES ('$admin_id','$percentage_value','Active','$cdate')");	
		$response['success']='1';
		$response['details']="Insert Successful";			
	}
	else
	{
		$response['success']='0';
		$response['details']="Percentage Value already exists";
	}
}
else
{
	$response['success']='0';
	$response['details']="Required field missing";
}	
echo json_encode($response);
?>