<?php
set_time_limit(3600);
session_start();
include "../config/conn.php";
$sql_alat="SELECT * FROM m_merk WHERE 1=1";
$sql_lokasi="SELECT * FROM m_lokasi WHERE 1=1 AND id_tipe='PDA' AND status_lokasi=1 ";
if($_SESSION['id_level']==2 || $_SESSION['id_level']==3) { 
	$sql_lokasi.=" AND id_bbws='".$_SESSION['id_bbws']."'";
}
$query_alat=mysql_query($sql_alat);
$query_lokasi=mysql_query($sql_lokasi);
?>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
var htmlobjek;
$(document).ready(function(){
  //apabila terjadi event onchange terhadap object <select id=propinsi>
  $("#ialat").change(function(){
    var ialat = $("#ialat").val();
    $.ajax({
        url: "data/master.php",
        data: "ialat="+ialat,
        cache: false,
        success: function(msg){
            //jika data sukses diambil dari server kita tampilkan
            //di <select id=kota>
            $("#ipos").html(msg);
        }
    });
  });
});
</script>
<div class="modaldetailcp fade" id="formDetailLokasi" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modaldetailcp-header">
        <span>Form Pencatatan TMA</span>
    </div>
    <!--div class="modaldetailcp-body"-->
        <div id="sukses"></div>      
        <div id="new" style="background-color:#FFF; padding-left:10px; padding-top:10px;"></div>
    <!--/div-->
</div>
<div class="row">
			<div style="margin-bottom:0px;" class="col-xs-12" id="breadcrumb">
		        <a class="show-sidebar" href="#">
		            <i class="fa fa-bars"></i>
		        </a>
		        <ol class="breadcrumb pull-left">
		            <li><a href="home.php">Dashboard</a></li>
		            <li><a href="#">Data Hidrologi (Muka Air)</a></li>
		        </ol>
		    </div>
		    <div class="row" id="dashboard-header"></div>
            <div class="col-xs-12" style="padding:1px;">
                    <div class="box ui-draggable ui-droppable" style="border-color:#ddd;">
                        <div class="box-content" style="background-color:#fff;">
                        <em style="color:#00F;"> Tabel dibawah merupakan hasil pencatatan dari data hidrologi ketinggian Muka Air (TMA), Untuk melihat hasil pencatatan ketinggian muka air (TMA), silahkan pilih (<strong>JenisAlat, NamaPos, Bulan, dan Tahun</strong>), jika sudah silahkan klik tombol "<strong>Tampilkan Data</strong>". Untuk memasukan data pencatatan dari pos manual silahkan pilih Jenis Alat "Manual", setelah dipilih lalu lanjutkan klik tombol "<strong>Tampilkan Data</strong>", lalu klik <strong>Tanggal</strong> yang ada pada tabel dibawah.</em>
                        <br />
                        Jenis Alat : 
                        <select id="ialat" name="ialat">
                                        <option value="">-Pilih-</option>
                                        <?php 
                                        while($rm=mysql_fetch_array($query_alat)){
                                        ?>
                                            <option value="<?php echo $rm['code_merk']; ?>">
                                            <?php echo $rm['nama_merk']; ?>
                                            </option>
                                            <?php } ?>
                                     </select>
                        Nama Pos : 
                        <select id="ipos" name="ipos">
                                        <option value="">-Pilih-</option>
                                        <?php 
                                        while($rl=mysql_fetch_array($query_lokasi)){
                                        ?>
                                            <option value="<?php echo $rl['nama_lokasi']; ?>" <?php if ($_POST['id_bbws']!="") { echo 'selected="selected"';} ?>>
                                            <?php echo $rl['nama_lokasi']; ?>
                                            </option>
                                            <?php } ?>
                                     </select>
                        Bulan : 
                        <select id="bln" name="bln" >
                            <option value="">-Pilih-</option>
                        	<?php
							$i=1;
							for($i=1; $i<=12; $i++){
                            echo "<option value='".$i."'"; if ($_POST['bln']==$i) { echo 'selected="selected"';} echo ">Bulan ".$i."</option>";
                        	}
                            ?>
                        </select>
                        Tahun : 
                        <select id="thn" name="thn" >
                            <option value="">-Pilih-</option>
                            <option value="2013" <?php if ($redit['id_lokasi']=="2013") { echo 'selected="selected"';} ?>>2013</option>
                            <option value="2014" <?php if ($redit['id_lokasi']=="2014") { echo 'selected="selected"';} ?>>2014</option>
                            <option value="2015" <?php if ($redit['id_lokasi']=="2015") { echo 'selected="selected"';} ?>>2015</option>
                            <option value="2016" <?php if ($redit['id_lokasi']=="2016") { echo 'selected="selected"';} ?>>2016</option>
                            <option value="2017" <?php if ($redit['id_lokasi']=="2017") { echo 'selected="selected"';} ?>>2017</option>
                            <option value="2018" <?php if ($redit['id_lokasi']=="2018") { echo 'selected="selected"';} ?>>2018</option>
                            <option value="2019" <?php if ($redit['id_lokasi']=="2019") { echo 'selected="selected"';} ?>>2019</option>
                            <option value="2020" <?php if ($redit['id_lokasi']=="2020") { echo 'selected="selected"';} ?>>2020</option>
                        </select>
                        <input type="button" name="klik" id="klik" value="Tampilkan Data" onclick="CrdebitLokasi()">
						<input type="button" name="klik" id="klik" value="Download Xls" onclick="Download()">			                        			
                        </div>	
            </div>
			<div class="box-content" style="background-color:#fff;">           
            <!--div class="box-header">
                            <div class="box-name ui-draggable-handle">
                                <i class="fa fa-seasrch">Form Search</i>
                            </div>
                            <div class="no-move"></div>
                        </div-->
            
                <div id="data-area"></div>
                <div id="graphMa"></div>
            </div>	
</div>
</div>
<script src="js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="js/datahidrologima.js"></script>