<?php
ob_start();
error_reporting(0);
include("connect.php");
session_start(); 
$ver = $_SESSION["admin_id"];
if(!isset($_SESSION["admin_id"])){
   header('location:http://www.btcover.appexperts.net');
}

$da  = date("Y-m-d H:i:s");
$transaction_id=$_REQUEST['id'];
echo $ver = $_REQUEST['manager_id'];
	$policy_no=$_REQUEST['policy_no'];
	 $uniqe_id=$_REQUEST['unique_id'];
	
	$status='Reject';
	date_default_timezone_set('Asia/Calcutta');
	$cdate  = date("Y-m-d");
	$ctime=date('h:i:sa');
	$res_product_stock = mysqli_query($con,"SELECT transaction_id FROM  tbl_customer_premium where manager_id='$ver' and policy_no='$policy_no' and status='Pending' and transaction_id='$transaction_id'");

	if(mysqli_num_rows($res_product_stock)>0)
	{	
		$uq2=mysqli_query($con,"update tbl_customer_premium set status='$status',complete_date='$cdate',complete_time='$ctime' where transaction_id='$transaction_id'"); 

		$uq3=mysqli_query($con,"update tbl_policy_master set status='Expired',update_datetime='$cdate' where unique_id='$unique_id' and status = 'Renewal Pending' "); 

		$uq4=mysqli_query($con,"update tbl_policy_master set status='Expired',update_datetime='$cdate' where unique_id='$unique_id' and status = 'Pending' "); 
	}
 header('Location:agent-pending-work.php'); 
?>