<?php
include("../db.php");
$s = date('Y-m-d');
$e = date('Y-m-d');


$date_today =  date('Y-m-d');

$query = mysqli_query($db,"select * from `cus` where `date_cus` between '$s' and '$e'");
$row = mysqli_fetch_assoc($query);
$num = mysqli_num_rows($query);
$data['new_cus'] = $num;

$query = mysqli_query($db,"select * from `table_day` where `date_table` between '$s' and '$e'");
$row = mysqli_fetch_assoc($query);
$num = mysqli_num_rows($query);
$data['rev_cus'] = $num;



$query = mysqli_query($db,"select sum(paid) as `t` from `stock_mony` where `date` between '$s' and '$e'");
$row = mysqli_fetch_assoc($query);
$data['paid'] = $row['t'];


$query = mysqli_query($db,"select sum(p_f) as `t` from `sales` where `date` between '$s' and '$e'");
$row = mysqli_fetch_assoc($query);
$data['sales'] = $row['t'];


$query = mysqli_query($db,"select sum(value_exp) as `t` from `exp_mony` where `date_exp` between '$s' and '$e'");
$row = mysqli_fetch_assoc($query);
$data['exp'] = $row['t'];

// $query = mysqli_query($db,"select sum(mony) as `t` from `mony_cus` where `date_mony` between '$s' and '$e'");
// $row = mysqli_fetch_assoc($query);
// $data['inp'] = $row['t'];




// $query = mysqli_query($db,"select sum(p_f) as `t` from `sales` where `date` between '$s' and '$e'");
// $row = mysqli_fetch_assoc($query);
// $data['sales'] = $row['t'];



// $data['all'] = ( $data['inp'] - $data['exp'] );


echo json_encode($data);
?>