<?php
include("../connect.php"); 
$response = array();
if(isset($_POST['new_policy_number']) && isset($_POST['old_policy_number']))
{
	$new_policy_number = $_POST['new_policy_number'];
	$old_policy_number = $_POST['old_policy_number'];
	
	date_default_timezone_set('Asia/Calcutta');
	$cdate  = date("Y-m-d")." ".date('h:i:sa');
			
	$uq2=mysqli_query($con,"update tbl_policy_master set policy_no='$new_policy_number',update_datetime='$cdate' where policy_no='$old_policy_number'"); 
	$uq3=mysqli_query($con,"update tbl_customer_premium set policy_no='$new_policy_number' where policy_no='$old_policy_number'"); 
	$uq4=mysqli_query($con,"update tbl_agent_commission set policy_no='$new_policy_number' where policy_no='$old_policy_number'"); 
		
	$response['success']='1';
	$response['details']="Update Successful";
					
}
else
{
	$response['success']='0';
	$response['details']="Required field missing";
}	
echo json_encode($response);
?>