<?php   include_once('../../config/db.php');  include_once('../../config/check2.php');
             
     $query = "                 SELECT sum(total) ans,mymonth, myyear,e.name ename , CONCAT(e.name,',', myyear) cname,branch,transmove  FROM
                              ( 
                                            SELECT a.transid,branch,total,transmove,b.id bid,b.transtype,b.date bdate,
                                            MONTH(b.date)mymonth, year(b.date) myyear,
                                            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 admonths e ON d.mymonth=e.monthid   
                                WHERE  d.transmove=5  AND d.branch= '$storeID' 
                              GROUP BY mymonth, myyear
                               ORDER BY myyear,mymonth asc
                               
                    ";

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

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

print json_encode($data);


?>





