<?php
session_start();
include("../../php_crud/my_class.php");
$obj = new my_class();
extract($_POST);

/*$month='03';
$year = 2015;
$well_id = 'GT9347900';*/
//$mon_yr_arr = explode("-", $mon_yr);
$month = $month;
$year = $year;

$month_day = cal_days_in_month(CAL_GREGORIAN,$month,$year);
$res = array();
for($d=1; $d<=$month_day; $d++)
{
	$time = mktime(12, 0, 0, $month, $d, $year);
	$sel_date = date('d-M-Y', $time);
	$sel_date = strtoupper($sel_date);
	
	$wt_cond = "WELL_ID='$well_id' AND TO_DATE(DT, 'DD-MON-RRRR')='$sel_date' ORDER BY DT ASC";
	$wt_cols = "TO_DATE(DT, 'DD-MON-RR') AS WT_DATE,WATER_TBL";
	//$wt_cols = "TO_CHAR(DT, 'DD-MM-RR') AS WT_DATE,WATER_TBL";
	$wt_info = $obj->View_column_details_By_Cond("HYDROLOGY.GWT_DILY_TBL@HYDRO10",$wt_cols,$wt_cond);
	$sel_wt_date = $wt_info['WT_DATE'];
	$sel_wt_val = $wt_info['WATER_TBL'];
	$res[] = array("$sel_wt_date","$sel_wt_val");
}
if(count($res)>0){
	echo $datas = json_encode($res);
}
else{
	$res[] = array('','');
	echo $datas = json_encode($res);
}	
?>