<?php
session_start();
$branch=$_SESSION['branch_id'];
$business=$_SESSION['business_id'];
include '../includes/connection.php';
$idd=$_GET['id'];



$sql = "SELECT sum(paid) as paid  FROM sales where DATE_FORMAT(date_time, '%Y-%m-%d')='$idd' && branch_id='$branch'&& business_id='$business'";
$result = mysqli_query($conn, $sql);

if (mysqli_num_rows($result) > 0) {
$row = mysqli_fetch_assoc($result);
$paid=$row['paid'];
if (strlen($paid)<1) {
	$amount=0;
        
}else{
	$amount=$paid;

}
echo $amount;
       
    
} else {
    echo "0 results";
}

?>