<?php 
include "../config.php";
$month=array(1,2,3,4,5,6,7,8,9,10,11,12);
$month_name=array('jan', 'feb', 'mar', 'apr', 'may','jun', 'jul', 'aug', 'sep', 'oct','nov','dec');
$year=date('Y');
foreach($month as $id => $value)
{
    $month_value=sprintf('%02d', $month[$id]);
    $sales_sql="select ifnull(sum(netweight),0) as total from second_transaction where status!='deleted'&& date between '$year-$month_value-01' and '$year-$month_value-30' ";
    //echo $sales_sql;
$sales_count= mysqli_query($connect,$sales_sql);
while($sale_weight = mysqli_fetch_array($sales_count)){
   $output[]=(object)["month"=>$month_name[$id],"weight"=>$sale_weight['total']];
}

}
echo json_encode($output);

?>
