<?php
include("../connect.php"); 
$response = array();
if(isset($_POST['vehicle_id']) && isset($_POST['admin_id']) && isset($_POST['commission_id']) && isset($_POST['percentage']) && isset($_POST['start_date']))
{
	$ver = $_POST['admin_id'];
	$vehicle_id=$_POST['vehicle_id'];
	$start_date=$_POST['start_date'];
	$percentage=$_POST['percentage'];
	$commission_id=$_POST['commission_id'];

	date_default_timezone_set('Asia/Calcutta');
	$cdate  = date("Y-m-d")." ".date('h:i:sa');
	$res_product_stock = mysqli_query($con,"SELECT percentage FROM  tbl_commission_type where commission_id='$commission_id' and admin_id='$ver'");
	if(mysqli_num_rows($res_product_stock)>0)
	{	
		$res_customer = mysqli_query($con,"SELECT * FROM  tbl_commission_type where commission_id='$commission_id'");
		while($fetch_detail=mysqli_fetch_assoc($res_customer))
		{
						
			$uq2=mysqli_query($con,"update tbl_commission_type set vehicle_id='$vehicle_id',percentage='$percentage',admin_id='$ver',start_date='$start_date',update_datetime='$cdate' where commission_id='$commission_id'"); 
		
			$response['success']='1';
			$response['details']="Update Successful";
		}			
	}
	else
	{
		$response['success']='0';
		$response['details']="Invalid Commission Id";
	}
}
else
{
	$response['success']='0';
	$response['details']="Required field missing";
}	
echo json_encode($response);
?>