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


$query = "                 SELECT sum(total) ans,e.name dname , e.name cname,d.branch,transmove,item  FROM
                              ( 
                                            SELECT a.transid,branch,item,total,transmove,b.id bid,b.transtype,
                                            b.transaction,b.transmode  FROM  acctransactionsdetails a
                                            LEFT JOIN acctransactions b ON a.transid=b.id                            
                                            WHERE  b.transtype=18 OR b.transtype=10
                                            
                              )d LEFT JOIN item e ON d.item=e.id   
                                WHERE  d.transmove=1  AND d.branch='$storeID'
                              GROUP BY d.item
                               ORDER BY d.item asc
                               
                    ";

$result = $conn->query($query);
$data = [];
		    foreach ($result as $row) {
		                                $data[] = $row;
		                             }

print json_encode($data);

///MONTH(b.date)

