<?php
include("../db.php");

$s = $_POST['s'];
$e = $_POST['e'];

$txt = "select * from `cata` ";
$query = mysqli_query($db,$txt);
while($row = mysqli_fetch_assoc($query))
{
	$id_cata = $row['id_cata'];
	$name_cata = $row['name_cata'];
	$txt1 = "select sum(paid) as `t` from `stock_mony` left join `member` on `member`.`id_member` = `stock_mony`.`id_member` left join `cata` on `cata`.`id_cata` = `member`.`id_cata` where `cata`.`id_cata` = '$id_cata' and `stock_mony`.`date` between '$s' and '$e' and `cata`.`id_cata` = '$id_cata' ";
	$query1 = mysqli_query($db,$txt1);
	$row1 = mysqli_fetch_assoc($query1);
	$value = $row1['t'];
	$data[] = array("name_cata" => $name_cata,"value" => $value);
}
echo json_encode($data);
?>