<?php
session_start();
include("../../php_crud/my_class.php");
$obj = new my_class();
extract($_POST);
//print_r($_POST);
$well_id = $well_id;
//$month = $month;
//$year = $year;
//$mon_yr = "$month-$year";
$from_year = date('Y', strtotime($from_date));
$from_month = date('m', strtotime($from_date));
$to_year = date('Y', strtotime($to_date));
$to_month = date('m', strtotime($to_date));

$data = array(
    'date' => array(),
    'auto' => array(),
    'manual' => array(),
);
foreach($obj->gw_wl_auto_manual_data_list($well_id,$from_date,$to_date) as $gw_am_data_list){
	$auto_data = "";
	$manu_data = "";
	if($gw_am_data_list['AUTO_DATA']!=""){
		$auto_data = $gw_am_data_list['AUTO_DATA'];
	}
	else{
		$auto_data = null;
	}
	if($gw_am_data_list['MANUAL_DATA']!=""){
		$manu_data = $gw_am_data_list['MANUAL_DATA'];
	}
	else{
		$manu_data = null;
	}
	$data['date'][] = $gw_am_data_list['TIMESTAMP'];
	$data['auto'][] = $auto_data;
	$data['manual'][] = $manu_data;
}
echo json_encode($data);
/*if(count($res)>0){
	echo $datas = json_encode($res);
}
else{
	$res[] = array('','','');
	echo $datas = json_encode($res);
}	
*/
?>