<?php
include("../connect.php");
$response = array();
if(isset($_POST['admin_id']))
{
	$admin_id = $_POST['admin_id'];

	$select_payment = mysqli_query($con,"SELECT * FROM `tbl_bt_payment_plan` where plan_id in (SELECT plan_id FROM `tbl_admin_panel` where admin_id = '$admin_id')");
	
	$payments=array();
	if(mysqli_num_rows($select_payment)>0)
	{     
		while($fetch_payment=mysqli_fetch_assoc($select_payment))
		{
			$payments['plan_id'] = $fetch_payment['plan_id'];
			$payments['plan_name'] = $fetch_payment['plan_name'];
			$payments['base_charge'] = $fetch_payment['base_charge'];
			$payments['admin_charge'] = $fetch_payment['admin_charge'];
			$payments['total_charge'] = $fetch_payment['total_charge'];
			$payments['plan_type'] = $fetch_payment['plan_type'];
			$payments['status'] = $fetch_payment['plan_status'];
			//$payments['next_renew_date'] = $fetch_payment['next_renew_date'];

			$response['payments'][]=$payments;
		}
	}
	else
	{
		$response['payments'][]=$payments;
	}

	$response['success']=1;	
	$response['details']="Data Success";
}
else
{
	$response['success']=0;
	$response['details']="Required fields missing";
}
echo json_encode($response);
?> 