Files
controls-web/controls-rework/data/cvp.php
2026-02-17 09:29:34 -06:00

223 lines
9.7 KiB
PHP

<?php
date_default_timezone_set('America/Chicago');
$curDate = date('l, M j, Y h:i:s a');
require "../includes/itemsAI.php";
$sanitizePercent = static function ($rawValue) {
$numeric = is_numeric($rawValue) ? (double) $rawValue : 0.0;
return $numeric > 10000 ? 0 : $numeric;
};
$renderPercent = static function (string $key, int $decimals = 0) use (&$value, &$rounded, $sanitizePercent) {
// Use $rounded (2 decimals from DB) when decimals requested, otherwise $value (0 decimals)
$source = $decimals > 0 ? $rounded : $value;
$val = $sanitizePercent($source[$key] ?? 0);
return number_format($val, $decimals);
};
?>
<table>
<tr >
<td id="datetime" colspan="4">
<?php echo $curDate; ?>
</td>
</tr>
<?php require __DIR__ . '/../includes/alerts.php'; ?>
</table>
<table
class="col-4 boiler-panel-table"
border="1"
cellspacing="0"
cellpadding="4"
data-boiler-section="fab-2"
data-boiler-title="C-CVP DATA"
> <tr>
<td colspan="4" id="title">C-CVP</td>
</tr>
<tr>
<td colspan="4" id="title">Side 1</td>
</tr>
<tr>
<td id="vtitle" id="padded" colspan="1" width="30%"></td>
<td id="vtitle" id="padded">Brix PV</td>
<td id="vtitle" id="padded">Brix SP</td>
<td id="vtitle" id="padded">Brix CV</td>
</tr>
<tr>
<td id="vtitle" id="padded">CELL 1</td>
<td id="sum-count"><?php echo $renderPercent('C01 PV', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('C01 SP', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('C01 CV'); ?>%</td>
</tr>
<tr>
<td id="vtitle" id="padded">CELL 2</td>
<td id="sum-count"><?php echo $renderPercent('C02 PV', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('C02 SP', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('C02 CV'); ?>%</td>
</tr>
<tr>
<td id="vtitle" id="padded">CELL 3</td>
<td id="sum-count"><?php echo $renderPercent('C03 PV', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('C03 SP', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('C03 CV'); ?>%</td>
</tr>
<tr>
<td id="vtitle" id="padded">CELL 4</td>
<td id="sum-count"><?php echo $renderPercent('C04 PV', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('C04 SP', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('C04 CV'); ?>%</td>
</tr>
<tr>
<td id="vtitle" id="padded">CELL 5</td>
<td id="sum-count"><?php echo $renderPercent('C05 PV', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('C05 SP', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('C05 CV'); ?>%</td>
</tr>
<tr>
<td id="vtitle" id="padded">CELL 6</td>
<td id="sum-count"><?php echo $renderPercent('C06 PV', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('C06 SP', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('C06 CV'); ?>%</td>
</tr>
<tr>
<td id="vtitle" id="padded">CELL 7</td>
<td id="sum-count"><?php echo $renderPercent('C07 PV', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('C07 SP', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('C07 CV'); ?>%</td>
</tr>
<tr>
<td id="vtitle" id="padded">CELL 8</td>
<td id="sum-count"><?php echo $renderPercent('C08 PV', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('C08 SP', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('C08 CV'); ?>%</td>
</tr>
<tr>
<td id="vtitle" id="padded" colspan="1" width="40%"></td>
<td id="vtitle" id="padded">PRS PV</td>
<td id="vtitle" id="padded">PRS SP</td>
<td id="vtitle" id="padded">PRS CV</td>
</tr>
<tr>
<td id="vtitle">Vapor PSIG</td>
<td id="sum-count"><?php echo $renderPercent('PCV C01 PV', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('PCV C01 SP', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('PCV C01 CV'); ?>%</td>
</tr>
<tr>
<td id="vtitle">Water Vacuum</td>
<td id="sum-count"><?php echo $renderPercent('PCV C02 PV', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('PCV C02 SP', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('PCV C02 CV'); ?>%</td>
</tr>
<!---More rows can be added here as needed--->
<tr>
<td colspan="2" id="vtitle" id="padded">Molasses Flow</td>
<td colspan="2" id="sum-count"><?php echo $renderPercent('MolassesFlow C01'); ?> CFH</td>
</tr>
<tr>
<td colspan="2" id="vtitle" id="padded">Grain Flow</td>
<td colspan="2" id="sum-count"><?php echo $renderPercent('GrainFlow C03'); ?> CFH</td>
</tr>
<tr>
<td colspan="2" id="vtitle" id="padded">Condensate</td>
<td colspan="2" id="sum-count"><?php echo $renderPercent('CondensateFlow C03'); ?> CFH</td>
</tr>
<tr>
<td colspan="4" id="title">Side 2</td>
</tr>
<tr>
<td id="vtitle" id="padded" colspan="1" width="30%"></td>
<td id="vtitle" id="padded">Brix PV</td>
<td id="vtitle" id="padded">Brix SP</td>
<td id="vtitle" id="padded">Brix CV</td>
</tr>
<tr>
<td id="vtitle" id="padded">CELL 1</td>
<td id="sum-count"><?php echo $renderPercent('B01 PV', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('B01 SP', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('B01 CV'); ?>%</td>
</tr>
<tr>
<td id="vtitle" id="padded">CELL 2</td>
<td id="sum-count"><?php echo $renderPercent('B02 PV', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('B02 SP', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('B02 CV'); ?>%</td>
</tr>
<tr>
<td id="vtitle" id="padded">CELL 3</td>
<td id="sum-count"><?php echo $renderPercent('B03 PV', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('B03 SP', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('B03 CV'); ?>%</td>
</tr>
<tr>
<td id="vtitle" id="padded">CELL 4</td>
<td id="sum-count"><?php echo $renderPercent('B04 PV', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('B04 SP', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('B04 CV'); ?>%</td>
</tr>
<tr>
<td id="vtitle" id="padded">CELL 5</td>
<td id="sum-count"><?php echo $renderPercent('B05 PV', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('B05 SP', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('B05 CV'); ?>%</td>
</tr>
<tr>
<td id="vtitle" id="padded">CELL 6</td>
<td id="sum-count"><?php echo $renderPercent('B06 PV', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('B06 SP', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('B06 CV'); ?>%</td>
</tr>
<tr>
<td id="vtitle" id="padded">CELL 7</td>
<td id="sum-count"><?php echo $renderPercent('B07 PV', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('B07 SP', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('B07 CV'); ?>%</td>
</tr>
<tr>
<td id="vtitle" id="padded">CELL 8</td>
<td id="sum-count"><?php echo $renderPercent('B08 PV', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('B08 SP', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('B08 CV'); ?>%</td>
</tr>
<tr>
<td id="vtitle" id="padded" colspan="1" width="40%"></td>
<td id="vtitle" id="padded">PRS PV</td>
<td id="vtitle" id="padded">PRS SP</td>
<td id="vtitle" id="padded">PRS CV</td>
</tr>
<tr>
<td id="vtitle">Vapor PSIG</td>
<td id="sum-count"><?php echo $renderPercent('PCV B01 PV', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('PCV B01 SP', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('PCV B01 CV'); ?>%</td>
</tr>
<tr>
<td id="vtitle">Water Vacuum</td>
<td id="sum-count"><?php echo $renderPercent('PCV B02 PV', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('PCV B02 SP', 1); ?></td>
<td id="sum-count"><?php echo $renderPercent('PCV B02 CV'); ?>%</td>
</tr>
<!---More rows can be added here as needed--->
<tr>
<td colspan="2" id="vtitle" id="padded">Molasses Flow</td>
<td colspan="2" id="sum-count"><?php echo $renderPercent('MolassesFlow B01'); ?> CFH</td>
</tr>
<tr>
<td colspan="2" id="vtitle" id="padded">Grain Flow</td>
<td colspan="2" id="sum-count"><?php echo $renderPercent('GrainFlow B03'); ?> CFH</td>
</tr>
<tr>
<td colspan="2" id="vtitle" id="padded">Condensate</td>
<td colspan="2" id="sum-count"><?php echo $renderPercent('CondensateFlow B03'); ?> CFH</td>
</tr>
</table>