101 lines
3.2 KiB
PHP
101 lines
3.2 KiB
PHP
<head>
|
|
<link rel="stylesheet" href="styles.css">
|
|
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
|
|
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<?php
|
|
$username="corey";
|
|
$password="41945549";
|
|
$database="controls";
|
|
|
|
mysql_connect('192.168.0.2',$username,$password);
|
|
@mysql_select_db($database) or die( "Unable to select database");
|
|
$query = "(SELECT DATE_FORMAT(`TIMESTAMP`,'%h:%i:%s') AS timeonly, DATE_FORMAT(TIMESTAMP, '%Y-%m-%d') dateonly, SUM(BOILER1STMFLO) / 3600 / 24 as BOILER1, SUM(BOILER2STMFLO) / 3600 / 24 as BOILER2, SUM(BOILER3STMFLO) / 3600 / 24 as BOILER3, SUM(BOILER4STMFLO) / 3600 / 24 as BOILER4, SUM(BOILER5STMFLO) / 3600 / 24 as BOILER5, SUM(BOILER6STMFLO) / 3600 / 24 as BOILER6
|
|
FROM boilers WHERE TIME(`TIMESTAMP`) BETWEEN '07:00:00' AND '23:59:59'
|
|
GROUP BY DAY(`TIMESTAMP`)
|
|
ORDER BY id ASC)";
|
|
|
|
$result=mysql_query($query);
|
|
|
|
mysql_close();
|
|
|
|
?>
|
|
|
|
<table id="table" style="margin: 1px auto; border: 2px solid black; border-collapse: collapse; width=850px;" class="stat">
|
|
<thead>
|
|
<tr style="margin: 1px auto; border: 1px solid black; border-collapse: collapse;">
|
|
<th>Date</th>
|
|
<th>Boiler1</th>
|
|
<th>Boiler2</th>
|
|
<th>Boiler3</th>
|
|
<th>Boiler4</th>
|
|
<th>Boiler5</th>
|
|
<th>Boiler6</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
while($row=mysql_fetch_assoc($result))
|
|
{
|
|
echo "<tr>";
|
|
echo "<td width=100>".$row [ 'dateonly' ]."</td>";
|
|
echo "<td width=150>".number_format ($row [ 'BOILER1' ], 2)." kpph</td>";
|
|
echo "<td width=150>".number_format ($row [ 'BOILER2' ], 2)." kpph</td>";
|
|
echo "<td width=150>".number_format ($row [ 'BOILER3' ], 2)." kpph</td>";
|
|
echo "<td width=150>".number_format ($row [ 'BOILER4' ], 2)." kpph</td>";
|
|
echo "<td width=150>".number_format ($row [ 'BOILER5' ], 2)." kpph</td>";
|
|
echo "<td width=150>".number_format ($row [ 'BOILER6' ], 2)." kpph</td>";
|
|
echo "</tr>";
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
<script type="text/javascript">
|
|
$('#edit').click(function() {
|
|
var headers = $('#table th').map(function() {
|
|
var th = $(this);
|
|
return {
|
|
text: th.text(),
|
|
shown: th.css('display') != 'none'
|
|
};
|
|
});
|
|
|
|
var h = ['<div id=tableEditor><button id=done>Done</button><table><thead>'];
|
|
$.each(headers, function() {
|
|
h.push('<tr><th><input type=checkbox',
|
|
(this.shown ? ' checked ' : ' '),
|
|
'/> ',
|
|
this.text,
|
|
'</th></tr>');
|
|
});
|
|
h.push('</thead></table></div>');
|
|
$('body').append(h.join(''));
|
|
|
|
$('#done').click(function() {
|
|
var showHeaders = $('#tableEditor input').map(function() { return this.checked; });
|
|
$.each(showHeaders, function(i, show) {
|
|
var cssIndex = i + 1;
|
|
var tags = $('#table th:nth-child(' + cssIndex + '), #table td:nth-child(' + cssIndex + ')');
|
|
if (show)
|
|
tags.show();
|
|
else
|
|
tags.hide();
|
|
});
|
|
|
|
$('#tableEditor').remove();
|
|
return false;
|
|
});
|
|
|
|
return false;
|
|
});
|
|
</script>
|
|
<table id="table" style="margin: 1px auto; width=850px;" class="stat">
|
|
<tr>
|
|
<td align="left" colspan="6" bgcolor="#FFFFFF" border="0"><font color="#00BFFF"><i><a href="../data/boilerexport.php"> Export To Excel </a></i></font></td>
|
|
</tr>
|
|
</table>
|
|
</body>
|
|
</html>
|