<?php
include "includes/map.php";
?>
<body onLoad="load()">
	<article class="module width_quarter">
			<header>
            <h3 class="tabs_involved" style="background-image:url(images/icons/spreadsheet.png); background-repeat:no-repeat; padding-left:20px; margin-left:5px;">
            INFO DEBIT</h3>
            </header>
			<div class="message_list">
				<div class="module_content">
        		<table class="tablesorter" cellspacing="0" border="1">
                <thead>
                <tr>
                    <th>BALAI</th>
                    <th>&sum;-POS</th>
                    <th>&sum;-OFFLINE</th>
                    <th>&sum;-ONLINE</th>
                </tr>
</thead>
                <?php
				$sql_resume=mysql_query("SELECT
											a.nama_bbws,
											Count(b.id_bbws) AS jml_pos,
											(SELECT COUNT(c.icon) FROM m_lokasi AS c WHERE c.id_bbws=a.id_bbws AND c.icon='mati') AS offline,
											(Count(b.id_bbws)-(SELECT COUNT(c.icon) FROM m_lokasi AS c WHERE c.id_bbws=a.id_bbws AND c.icon='mati')) AS `online` 
											FROM
											m_bbws AS a
											LEFT JOIN m_lokasi AS b ON a.id_bbws = b.id_bbws
											GROUP BY a.id_bbws");
				$i=0;
				while($row_resume=mysql_fetch_array($sql_resume)){
				$i++;
				$totpos=$totpos+$row_resume['jml_pos'];
				$totposof=$totposof+$row_resume['offline'];
				$totposon=$totpoon+$row_resume['online'];
				?>
                <tr>
                <td align="left"><?php echo strtoupper($row_resume['nama_bbws']);?></td>
                <td style='background-image:url(images/icsu.kses.png); background-repeat:no-repeat; padding-left:20px;'><?php echo $row_resume['jml_pos'];?></td>
                <td style='background-image:url(images/icsukses.png); background-repeat:no-repeat; padding-left:20px;'><?php echo $row_resume['online'];?></td>
                <td style='background-image:url(images/icdanger.png); background-repeat:no-repeat; padding-left:20px;'><?php echo $row_resume['offline'];?></td>
              	</tr>
                <?php 
				} 
				?>
                <thead>
                <tr>
                    <th>&sum; TOTAL</th>
                    <th><?php echo $totpos;?></th>
                    <th><?php echo $totposof;?></th>
                    <th><?php echo $totposon;?></th>
                </tr>
</thead>
              	</table>
				</div>
			</div>
			<!--footer>
				<form class="post_message">
					<input type="text" value="Message" onFocus="if(!this._haschanged){this.value=''};this._haschanged=true;">
					<input type="submit" class="btn_post_message" value=""/>
				</form>
			</footer-->
		</article>

		<article class="module width_3_quarter">
		<header>
		<h3 class="tabs_involved" style="background-image:url(images/icons/stats_lines.png); background-repeat:no-repeat; padding-left:20px; margin-left:5px;">PETA BANJIR</h3>
		<form action="" method="post">
        <!--ul class="tabs">
        	<li>Periode : <input type="text" id="tgls" name="tgls" value="<?php echo date('Y-m-d',strtotime($tgls));?>" size="10" /> s/d <input type="text" id="tglf" name="tglf" value="<?php echo date('Y-m-d',strtotime($tglf));?>" size="10" />
            	<input type="submit" id="btncari" name="btncari" value="Search" />	
            </li>
        </ul-->
        </form>
		</header>
		<div class="tab_container">
				        <div id="map" style="width: 100%; height: 350px; background-color:aliceblue;"></div>
			<hr/>
            <article class="module width_quarter_battray">
            <header>
            <h3 class="tabs_involved" style="background-image:url(images/icon_online.png); background-repeat:no-repeat; padding-left:20px; margin-left:5px;">
           	Info Detail Pos</h3>
            </header>
            <div class="tab_container">
				<table class="tablesorter" cellspacing="0" border="0">
                <?php
				$sql_genangan=mysql_query("SELECT * FROM t_genangan WHERE status_approve='aktif'");
				$i=0;
				while($row_genangan=mysql_fetch_array($sql_genangan)){
				$i++;
				?>
                <tr>
                <td align="center">
	 	         <img src="gambarpos/<?php echo $row_genangan['foto_genangan'];?>" width="70" height="70" />
				</td>
                <td align="left" valign="top">
                <strong><?php echo $row_genangan['subject_genangan'];?></strong><br /><em><?php echo $row_genangan['waktu_genangan'];?></em>
                <br /><?php echo $row_genangan['isi_genangan'];?>
				</td>
              	</tr>
                <?php 
				} 
				?>
              	</table>
            </div><!-- end of .tab_container -->
            </article><!-- end of content manager article --> 

            <article class="module width_quarter_battray">
            <header>
            <h3 class="tabs_involved" style="background-image:url(images/battery.png); background-repeat:no-repeat; padding-left:20px; margin-left:5px;">
            Status Battery</h3>
            </header>
            <div class="tab_container">
                            <div id="battery" style="min-width: 310px; max-width: 400px; height: 250px; margin-top:-5px;"></div>
            </div><!-- end of .tab_container -->
            </article><!-- end of content manager article --> 
            	
		</div><!-- end of .tab_container -->
		</article><!-- end of content manager article -->        
</body>