<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js">

 </script>

 <script>

 $(document).ready(function(){

 setInterval(function(){cache_clear()},18000000); //30menit

 });

 function cache_clear()

{

 window.location.reload(true);

}

</script>

<style>

table {

  table-layout: fixed; 

  width: 100%;

  *margin-left: -100px; /*ie7*/

}

td, th {

  vertical-align: top;

  border-top: 1px solid #ccc;

  padding: 10px;

  width: 70px;

}

.fix {

  position: absolute;

  *position: relative; /*ie7*/

  margin-left: -100px;

  width: 200px;

}

.outer {

  position: relative;

}

.inner {

  overflow-x: scroll;

  overflow-y: visible;

  width: 1315px; 

  margin-left: 100px;

}

</style>

<?php

include "config/conn.php";

date_default_timezone_set('Asia/Jakarta');

$tanggal= mktime(0,0,0,date('m'),date('d'),date('Y'));

$hariini = date("Y-m-d", $tanggal);

?>

          <title>.:: SIS BANJIR | CILIWUNG CISADANE ::.</title><table>

              <thead>
			  	<tr>
                 <th colspan="26" style="background-color:#006; color:#FC0; font-family:'Courier New', Courier, monospace; font-size:16px;" align="center">PANTAU MUKA AIR RATA-RATA <br />BALAI BESAR WILAYAH SUNGAI CILIWUNG CISADANE<br />Tanggal : <?php echo date('d-m-Y',strtotime($hariini));?></th>  
                </tr>
              </thead>	 
		  </table>
<div class="outer">
  <div class="inner">
<table>
              <thead>
              <tr>
                    <th style="background-color:#FFF; color:#000;" class="fix">LOKASI</th>

                    <!--th style="background-color:#03F; color:#FC0;" class="fix1">SIAGA 3</th>

                    <th style="background-color:#FF0; color:#FC0;" class="fix1">SIAGA 2</th>

                    <th style="background-color:#F00; color:#FC0;" class="fix1">SIAGA 1</th-->

                    <?php

					//include "config/conn.php";

					$sql_jam=mysql_query("SELECT DATE_FORMAT(jam_value,'%H:00') AS jam FROM m_jam ORDER BY jam_value ASC");

					while($rjam=mysql_fetch_array($sql_jam)){

					?>

                    	<th style="background-color:#FFF; color:#000; width:40px; margin-right:50px;"><?php echo $rjam['jam'];?></th>

					<?php

					}

                    ?>

               </tr>

               </thead>

              <?php 

			  $sql="SELECT * FROM m_lokasi WHERE 1=1 AND ReceivedDate='".$hariini."' AND id_bbws=1 AND id_tipe='PDA' AND status_lokasi=1 ORDER BY ReceivedDate DESC,ReceivedTime DESC";

              $query = mysql_query($sql);

			  $i=0;

              while ($row_detdata=mysql_fetch_array($query)){

              $i++;

			?>

              <tr>

                  	<td <?php echo $sts;?> style="background-color:#009; color:#FC0;" class="fix">
                    <?php echo str_replace('awlr_','',$row_detdata['nama_alat']);?> | 
                    <a href="" style="color:#00F"><?php echo $row_detdata['siaga3'];?></a>
                    <a href="" style="color:#FF0"><?php echo $row_detdata['siaga2'];?></a>
                    <a href="" style="color:#F00"><?php echo $row_detdata['siaga1'];?></a>
                   	</td>

             		<!--td style="background-color:#F00; color:#FC0;" class="fix1"><?php echo $row_detdata['siaga3'];?></td>

             		<td style="background-color:#F00; color:#FC0;" class="fix1"><?php echo $row_detdata['siaga2'];?></td>

             		<td style="background-color:#F00; color:#FC0;" class="fix1"><?php echo $row_detdata['siaga1'];?></td-->

                    <?php

					$sql_jam=mysql_query("SELECT DATE_FORMAT(jam_value,'%H:00') AS jam FROM m_jam ORDER BY jam_value ASC");

					while($rjam=mysql_fetch_array($sql_jam)){

					?>

                    	<?php 

						$sqlWL=mysql_query("SELECT MAX(WLevel) WL FROM ".$row_detdata['nama_lokasi']." WHERE ReceivedDate='".$hariini."' AND DATE_FORMAT(ReceivedTime,'%H:00')='".$rjam['jam']."' GROUP BY ReceivedDate,DATE_FORMAT(ReceivedTime,'%H:00')");

						$rWL=mysql_fetch_array($sqlWL);

						if($rjam['jam']>=date('H')) {

	if(number_format($rWL['WL'])<number_format($row_detdata['siaga3'],2)) {

		$wrn="#0F0"; //hijau

	} else if(number_format($rWL['WL'])>=number_format($row_detdata['siaga3'],2) && number_format($rWL['WL'])<=number_format($row_detdata['siaga2'],2)) {

    	$wrn="#03F"; //biru

	} else if(number_format($rWL['WL'])>number_format($row_detdata['siaga2'],2) && number_format($rWL['WL'])<=number_format($row_detdata['siaga1'],2)) {

    	$wrn="#FF0"; //kuning

	} else if(number_format($rWL['WL'])>number_format($row_detdata['siaga1'],2)) {

    	$wrn="#F00"; //merah

	} }

						?>

                        <td style="background-color:<?php echo $wrn;?>; font-family:'Courier New', Courier, monospace; font-size:12px; font-weight:bold;" align="center">

						<?php echo number_format($rWL['WL'],0); ?>

						</td>

					<?php

					}

                    ?>

              </tr>

              </tbody>

              <?php

              }

              ?> 	

            </table>

</div></div>