<?php
session_start();
    $par=0;
	$branchmid = $_GET['branchmid'];
	
	
	include("connect.php");
	$totalin=0;
				$eve12 = "select sum(tctransferamount) as totalin from res_transfercash_detail where branchmid=$branchmid";
				$re12 = mysqli_query($conn, $eve12);
				if(mysqli_num_rows($re12) > 0)
				{
					while($rt12 = mysqli_fetch_assoc($re12))
					{
						$totalin=$rt12['totalin'];
					}
				
				}
				
				$totalout=0;
				$eve12 = "select sum(payamount) as totalout from res_pettycash_detail where branchmid=$branchmid";
				$re12 = mysqli_query($conn, $eve12);
				if(mysqli_num_rows($re12) > 0)
				{
					while($rt12 = mysqli_fetch_assoc($re12))
					{
						$totalout=$rt12['totalout'];
					}
				
				}
				
				
				$currentbal = $totalin - $totalout;
				

	 echo trim($currentbal);
	
	
	
	//echo trim($data);
	echo "";
?>		