<?php
	session_start();
	if($_SESSION['subadm'])
	{
		$userid=1111;
	}
	else
	{
		header('location:../login.php');
	}
?>
<?php
	include'connection.php';
	$id=$_GET['id'];
	$query="select * from paymentreq where Id=$id";
	$result=mysqli_query($con,$query);
	$data=mysqli_fetch_array($result);
	$amount=$data['Amount'];
	$uid=$data['Userid'];
	date_default_timezone_set("asia/Kolkata");
	$date= Date("y-m-d");
	$status="REJECTED";
	
	if(isset($_POST['submit']))
	{
		$respmsg=$_POST['respmsg'];
		$bankcharge=$_POST['bc'];
		if(empty($bankcharge))
		{
			$bankcharge=0;
		}
			$actualamount=$amount-$bankcharge;
			$query1="update paymentreq set Responsemsg='$respmsg', Bankcharge='$bankcharge', Status='$status', Active='1' where Id='$id'";
			if(mysqli_query($con,$query1))
			{
	
				echo "Request Have Been Rejected !";
			}
			else
			{
				echo "error";
			}
	

			
			
		
		
	}
?>
<html>
<head>

</head>
<body>
	<form method="post">
	<table border="0" cellpadding="10">
		<tr>
			<td>Request Amount : </td><td><?php echo $amount; ?></td>
		</tr>
		<tr>
			<td>Response Messege : </td><td>
			    <select name="respmsg">
			        <option>Transaction Not Found</option>
			        <option>Transaction Number Not Matched</option>
			        <option>Request Amount Not Matched</option>
			        <option>Rejected By Admin</option>
			    </select></td>
		</tr>
		<tr>
			<td>Bank Charge : </td><td><input type="text" name="bc"></td>
		</tr>
		<tr>
			<td></td><td><input type="submit" name="submit" value="Reject"></td>
		</tr>
	</table>
	</form>
</body>
</html>