<?php

include("connect.php");

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

	$query_mobile = "select * from res_grn_master where grnmid ='$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['grnnetamount'];
			$grnmid= $rtcc['grnmid'];
			$eve41 = "select sum(outamount) as outamount from res_paymentout_master where outrefrenceid=$grnmid";

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

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