add all files

This commit is contained in:
Rucus
2026-02-17 09:29:34 -06:00
parent b8c8d67c67
commit 782d203799
21925 changed files with 2433086 additions and 0 deletions

View File

@@ -0,0 +1,195 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
<style>
td {
margin: 2px auto;
border: 2px solid black;
padding: 1px;
text-align: center;
}
</style>
<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 style="background-color: #a3a3a3cb; font-family: Arial, sans-serif;">
<?php
include("../dbinfo2.php");
// Check if database connection variables exist
if (!isset($host) || !isset($username) || !isset($password) || !isset($database)) {
die("Database configuration not found in dbinfo2.php");
}
$con = mysqli_connect($host, $username, $password, $database);
// Check connection
if (!$con) {
die("Connection failed: " . mysqli_connect_error());
}
// Get the selected query type from form submission, default to 'sum'
$queryType = isset($_POST['query_type']) ? $_POST['query_type'] : 'avg';
// Define different SQL queries based on selection
if ($queryType === 'avg') {
$setSql = "(SELECT DATE_FORMAT(`timestamp`,'%h:%i:%s') AS timeonly,
DATE_FORMAT(TIMESTAMP,'%Y-%m-%d') AS dateonly,
AVG(BLR1TOTSF) * (" . (isset($_POST['val']) ? floatval($_POST['val']) : 100) . " / 100) * 1000 AS BOILER1,
AVG(BLR2TOTSF) * (" . (isset($_POST['val']) ? floatval($_POST['val']) : 100) . " / 100) * 1000 AS BOILER2,
AVG(BLR3TOTSF) * (" . (isset($_POST['val']) ? floatval($_POST['val']) : 100) . " / 100) * 1000 AS BOILER3,
AVG(BLR4TOTSF) * (" . (isset($_POST['val']) ? floatval($_POST['val']) : 100) . " / 100) * 1000 AS BOILER4,
AVG(BLR5TOTSF) * (" . (isset($_POST['val']) ? floatval($_POST['val']) : 100) . " / 100) * 1000 AS BOILER5,
AVG(BLR6TOTSF) * (" . (isset($_POST['val']) ? floatval($_POST['val']) : 100) . " / 100) * 1000 AS BOILER6,
AVG(BLR7TOTSF) * 24 * (" . (isset($_POST['val']) ? floatval($_POST['val']) : 100) . " / 100) * 1000 AS BOILER7,
AVG(BLR8TOTSF) * 24 * (" . (isset($_POST['val']) ? floatval($_POST['val']) : 100) . " / 100) * 1000 AS BOILER8
FROM boilerstm24hravg WHERE TIME(`timestamp`) BETWEEN '07:00:00' AND '23:59:59'
GROUP BY dateonly
ORDER BY id ASC)";
$dataLabel = "YTD Total";
$exportto = "total.php";
} else {
$setSql = "(SELECT DATE_FORMAT(`TIMESTAMP`,'%h:%i:%s') AS timeonly,
DATE_FORMAT(TIMESTAMP, '%Y-%m-%d') AS dateonly,
AVG(BLR1TOTSF) * 24 * 1000 * (" . (isset($_POST['val']) ? floatval($_POST['val']) : 100) . " / 100) as BOILER1,
AVG(BLR2TOTSF) * 24 * 1000 * (" . (isset($_POST['val']) ? floatval($_POST['val']) : 100) . " / 100) as BOILER2,
AVG(BLR3TOTSF) * 24 * 1000 * (" . (isset($_POST['val']) ? floatval($_POST['val']) : 100) . " / 100) as BOILER3,
AVG(BLR4TOTSF) * 24 * 1000 * (" . (isset($_POST['val']) ? floatval($_POST['val']) : 100) . " / 100) as BOILER4,
AVG(BLR5TOTSF) * 24 * 1000 * (" . (isset($_POST['val']) ? floatval($_POST['val']) : 100) . " / 100) as BOILER5,
AVG(BLR6TOTSF) * 24 * 1000 * (" . (isset($_POST['val']) ? floatval($_POST['val']) : 100) . " / 100) as BOILER6,
AVG(BLR7TOTSF) * 24 * 1000 * (" . (isset($_POST['val']) ? floatval($_POST['val']) : 100) . " / 100) as BOILER7,
AVG(BLR8TOTSF) * 24 * 1000 * (" . (isset($_POST['val']) ? floatval($_POST['val']) : 100) . " / 100) as BOILER8
FROM boilerstm24hravg
WHERE TIME(`TIMESTAMP`) BETWEEN '07:00:00' AND '23:59:59'
GROUP BY DAY(`TIMESTAMP`)
ORDER BY id ASC)";
$dataLabel = "YTD 24hr Average";
$exportto = "24hr.php";
}
$result = mysqli_query($con, $setSql);
// Check query execution
if (!$result) {
die("Query failed: " . mysqli_error($con));
}
?>
<!-- Query Selection Form -->
<div style="margin: 20px auto; text-align: center; width: 1600px;">
<form method="POST" action="">
<fieldset style="border: 2px solid #000000ff; padding: 10px;">
<legend><strong>Select Data Type:</strong></legend>
<label>
<input type="radio" name="query_type" value="avg" <?php echo ($queryType === 'avg') ? 'checked' : ''; ?>>
YTD Total
</label>
&nbsp;&nbsp;&nbsp;
<label>
<input type="radio" name="query_type" value="sum" <?php echo ($queryType === 'sum') ? 'checked' : ''; ?>>
24hr Average
</label>
&nbsp;&nbsp;&nbsp;
<label>
Reduce To:
<input type="number" name="val" value="<?php echo isset($_POST['val']) ? htmlspecialchars($_POST['val']) : '100'; ?>" style="width: 80px;">
</label>%
<input type="submit" value="Update Data" style="padding: 5px 15px;">
</fieldset>
</form>
</div>
<div style="text-align: center; margin: 10px;">
<h3>Boiler Data - <?php echo $dataLabel; ?></h3>
</div>
<div style="text-align: center; margin: 10px;">
<form action="<?php echo $exportto; ?>" method="post" style="display: inline;">
<input type="hidden" name="query_type" value="<?php echo $queryType; ?>">
<input type="hidden" name="val" value="<?php echo isset($_POST['val']) ? htmlspecialchars($_POST['val']) : '100'; ?>">
<button type="submit" style="padding: 8px 20px; font-size: 16px; background-color: #2c2c2cff; color: #fff; border: none; border-radius: 4px; cursor: pointer;">
Export To Excel
</button>
</form>
</div>
<table id="data-table" style="th: nth-child; margin: 1px auto; border: 2px solid black; border-collapse: collapse; width: 1600px;" 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>
<th>Boiler7</th>
<th>Boiler8</th>
</tr>
</thead>
<tbody>
<?php
while ($rec = mysqli_fetch_assoc($result))
{
echo "<tr class='data-row'>";
echo "<td width='10%'>" . htmlspecialchars($rec['dateonly']) . "</td>";
echo "<td width='11.25%'>" . number_format($rec['BOILER1'], 2) . " </td>";
echo "<td width='11.25%'>" . number_format($rec['BOILER2'], 2) . " </td>";
echo "<td width='11.25%'>" . number_format($rec['BOILER3'], 2) . " </td>";
echo "<td width='11.25%'>" . number_format($rec['BOILER4'], 2) . " </td>";
echo "<td width='11.25%'>" . number_format($rec['BOILER5'], 2) . " </td>";
echo "<td width='11.25%'>" . number_format($rec['BOILER6'], 2) . " </td>";
echo "<td width='11.25%'>" . number_format($rec['BOILER7'], 2) . " </td>";
echo "<td width='11.25%'>" . number_format($rec['BOILER8'], 2) . " </td>";
echo "</tr>";
}
// Close database connection
mysqli_close($con);
?>
</tbody>
</table>
<script type="text/javascript">
$('#edit').click(function() {
var headers = $('#data-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 = $('#data-table th:nth-child(' + cssIndex + '), #data-table td:nth-child(' + cssIndex + ')');
if (show)
tags.show();
else
tags.hide();
});
$('#tableEditor').remove();
return false;
});
return false;
});
</script>
</body>
</html>