<?php   include_once('../config/db.php');  //include_once('../config/check.php');
             
  


$query = "                 SELECT SUM(total_price) ans ,b.name cname  from orders a 
                       LEFT JOIN branches b  ON  a.branch_id=b.id
                     WHERE a.STATUS=2 OR a.status=4 
                      GROUP BY a.branch_id
                               
                    ";

$result = $conn->query($query);

		    foreach ($result as $row) {
		                                $data[] = $row;
		                             }

print json_encode($data);

///MONTH(b.date)

