<?php

include("connect.php");

	$par3 = $_GET['receiptrefrenceid'];
    //$par3 = $_GET['skills'];

	$query_mobile = "select * from res_booking_master where bookingmid ='$par3'";
	$result_mobile = mysqli_query($conn, $query_mobile);
	$data="";
	if(mysqli_num_rows($result_mobile) > 0)
	{
		 while($rtcc = mysqli_fetch_assoc($result_mobile))
		{
			$totalamount= $rtcc['bookingtotalamount'];
			$bookingmid= $rtcc['bookingmid'];
			$eve41 = "select sum(bookingreceivedamount) as receiptamont from res_bookingpayment_detail where bookingmid=$bookingmid";

										$re41 = mysqli_query($conn, $eve41);
										$receiptamont=0;
										while($rt41 = mysqli_fetch_assoc($re41))

										{		
											$receiptamont=$rt41['receiptamont'];
											
										}
										$pendingamount=$totalamount-$receiptamont;
			$data = $pendingamount;
			break;
		}
	}
	
	echo trim($data);
?>		