<?php
include("../connect.php"); 
$response = array();
if(isset($_POST['manager_id']))
{
	$dis_id = $_POST['manager_id'];
	$select_product = mysqli_query($con,"select * from tbl_customer_premium,tbl_customer,tbl_agent,tbl_policy_master where tbl_customer_premium.customer_id=tbl_customer.customer_id and tbl_customer_premium.agent_id=tbl_agent.agent_id and tbl_customer.customer_id=tbl_policy_master.customer_id and tbl_customer_premium.policy_no = tbl_policy_master.policy_no and tbl_customer_premium.status='Pending' and tbl_customer_premium.manager_id='$dis_id'");
	$customer=array();
	if(mysqli_num_rows($select_product)>0)
	{     
		while($fetch_product=mysqli_fetch_assoc($select_product))
		{
			$customer['transaction_id']=$fetch_product['transaction_id'];
			$customer['agent_id']=$fetch_product['agent_id'];
			$customer['agent_name']=$fetch_product['agent_name'];
			$customer['customer_id']=$fetch_product['customer_id'];
			$customer['customer_name']=$fetch_product['customer_name'];
			$customer['policy_no']=$fetch_product['policy_no'];
			$customer['premium_amt']=$fetch_product['premium_amt'];
			$customer['renewal_date']=$fetch_product['renewal_date'];
			$customer['transaction_date']=$fetch_product['transaction_date'];
			$customer['transaction_time']=$fetch_product['transaction_time'];
			$customer['policy_type']=$fetch_product['policy_type'];
			$customer['policy_term']=$fetch_product['policy_term'];
			$customer['term_value']=$fetch_product['term_value'];
			$customer['unique_id']=$fetch_product['unique_id'];
			$customer['NCB']=$fetch_product['NCB'];
			$customer['NCB_value']=$fetch_product['NCB_value'];
			$response['customer'][]=$customer;
		}
		$response['success']='1';
		$response['details']="Fetch Detail Successful";
	}
	else
	{
		$response['success']='0';
		$response['details']="No Data Available";
	}
}
else
{
	$response['success']='0';
	$response['details']="Required Field Missing!!";
}	
echo json_encode($response);
?>