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

extract($_GET);

// $well_list = '';
// $tbl_name = "GWM_TBL";
// $cols = "WELL_ID,OLD_ID";
// $where_cond = "UPAZILA_CODE='$upazila'";
// foreach ($obj->View_colmn_By_Cond_hydro($tbl_name, $cols, $where_cond) as $well_info) {
//         $well_list .= "'" . $well_info['WELL_ID'] . "',";
// }
// $well_list = substr($well_list, 0, -1);
?>

<style type='text/css'>
  select, textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input {
  display: inline-block;
  height: 1px!important;
  padding: 8px 3px!important;
  margin-bottom: 2px!important;
  font-size: 13px!important;
  line-height: 23px!important;
  color: #555;
  vertical-align: middle;
  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;
  border-radius: 4px;
}
.table th, .table td {
  padding: 2px!important;
  line-height: 20px;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid #ddd;
}
.button{
 position: relative;
 top: -20px;
}
.tbl{
 position: relative;
 top: -15px;
}
.zero-cell {
 color: red;
 background-color: #FFFF00;
}

.table td {
 text-align: center;
        }
</style>
<div class="row-fluid">
	<div class="span8">
		<div class="control-group" style="float:right;">
			<div class="controls">
					<button id="sal_sva_btn" type="button" style="margin-top:5px; margin-right: 1px; font-size: 12px;" class="btn btn-small btn-success" onclick="download_excel_gw_quality_info()"><i class="icon-save"></i><b>Excel</b></button>
			</div>
		</div>
	</div>
	<div class="span4"></div>
</div>
<div class="row-fluid" style="margin-top: 5px;">
	<div class="span8">
		<table id="av_gw_quality_datatbl" class="table table-bordered table-hover">
			<thead>
          <tr>
					<td style="text-align:center;  font-size:13px;" class="table-header">Well ID</td>
					<td style="text-align:center;  font-size:13px;" class="table-header">Old ID</td>
					<td style="text-align:center;  font-size:13px;" class="table-header">District</td>
					<td style="text-align:center;  font-size:13px;" class="table-header">Upazila</td>
					<td style="text-align:center;  font-size:13px;" class="table-header">Year</td>
          <td style="text-align:center;  font-size:13px;" class="table-header">Count of Data</td>
          </tr>
			</thead>
			<tbody>
                <?php
                //echo $well_list;
                //echo $from_year;
                //echo  $to_year;
                foreach ($obj->load_gwt_quality_data_count($from_year, $to_year) as $quality_info) {
                       //var_dump($quality_info);
                        echo '<tr>';
                        echo '<td>' . $quality_info['WELL_ID'] . '</td>';
                        echo '<td>' . $quality_info['OLD_ID'] . '</td>';
                        echo '<td style="text-align: left;">&nbsp;&nbsp;' . $quality_info['DISTRICT_NAME'] . '</td>';
                        echo '<td style="text-align: left;">&nbsp;&nbsp;' . $quality_info['UPZL_NAME'] . '</td>';
                        echo '<td>' . $quality_info['YEAR_VAL'] . '</td>';
                        echo '<td class="' . ($quality_info['DATA_COUNT'] == 0 ? 'zero-cell' : '') . '">' . $quality_info['DATA_COUNT'] . '</td>';
                        echo '</tr>';
                }
                ?>
			</tbody>
		</table>
	</div>
	<div class="span4"></div>
</div>

<script type="text/javascript">
$(document).ready(function() {
    var oTable2 = $('#av_gw_quality_datatbl').DataTable({
        "columns": [
            { "orderable": true },
            null, null, null, null,
            { "orderable": true }
        ],
        "iDisplayLength": 50
    });
});
</script>