Add daily production values.
This commit is contained in:
131
public/index.php
131
public/index.php
@@ -29,61 +29,17 @@ $month_production = get_month_production($local_db, $table_production, $chosen_d
|
||||
$year_production = get_year_production($local_db, $table_production, $chosen_date);
|
||||
$last_value = get_last_value($local_db, $table_aggregation, $chosen_date);
|
||||
|
||||
$colors = ['#375BEB', '#90EB36', '#EB5F36', '#DAE32D'];
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<title>Consumption values</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
label {
|
||||
display: inline-block;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
span.color-1 {
|
||||
background-color: <?php echo $colors[0]; ?>;
|
||||
}
|
||||
|
||||
span.color-2 {
|
||||
background-color: <?php echo $colors[1]; ?>;
|
||||
}
|
||||
|
||||
span.color-3 {
|
||||
background-color: <?php echo $colors[2]; ?>;
|
||||
}
|
||||
|
||||
span.color-4 {
|
||||
background-color: <?php echo $colors[3]; ?>;
|
||||
}
|
||||
|
||||
span.color {
|
||||
display: inline-block;
|
||||
width: 40px;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
span {
|
||||
display: inline-block;
|
||||
width: 200px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#chart-container {
|
||||
position: relative;
|
||||
width: 80vw;
|
||||
height: 70vh;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="/css/layout.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<form action="/index.php" method="post" style="display: inline-block;float: left; margin-right: 100px;">
|
||||
<select name="date" onchange="submit();">
|
||||
<form style="display: grid; grid-template-columns: 5% 5% 20% 5%; gap: 10px;" action="/index.php" method="post">
|
||||
<label for="date">Datum</label>
|
||||
<select name="date" id="date" onchange="submit();">
|
||||
<?php
|
||||
foreach ($dates as $date) {
|
||||
$selected = ($date == $chosen_date) ? ' selected="selected"' : '';
|
||||
@@ -91,51 +47,35 @@ $colors = ['#375BEB', '#90EB36', '#EB5F36', '#DAE32D'];
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<span></span>
|
||||
<a class="button" href="production.php">Werte setzen</a>
|
||||
</form>
|
||||
|
||||
<form action="/index.php" method="post">
|
||||
<input type="hidden" name="date" value="<?php echo $chosen_date; ?>"/>
|
||||
<input type="hidden" name="action" value="set_values"/>
|
||||
<label style="text-align: right;" for="EG">EG</label>
|
||||
<input type="number" step="0.001" name="eg" id="EG" value="<?php echo $month_production['eg']; ?>"/>
|
||||
<label style="text-align: right;" for="OG">OG</label>
|
||||
<input type="number" step="0.001" name="og" id="OG" value="<?php echo $month_production['og']; ?>"/>
|
||||
<label style="text-align: right;" for="price">Preis</label>
|
||||
<input type="number" step="0.01" name="price" id="price" value="<?php echo $month_production['price']; ?>"/>
|
||||
<button type="submit">Werte setzen</button>
|
||||
</form>
|
||||
|
||||
<div style="margin-top: 20px; font-weight: bold;">
|
||||
<label>Messungen</label>
|
||||
<div style="display: grid; grid-template-columns: 5% 15% 15% 15% 15% 15% 15%; gap: 2px 10px; margin-top: 5px; border-top: 2px solid gray; padding-top: 5px;">
|
||||
<span class="color"></span>
|
||||
<span>Monat</span>
|
||||
<span>Jahr</span>
|
||||
<span>Min</span>
|
||||
<span>Max</span>
|
||||
<span>Durchschnitt</span>
|
||||
</div>
|
||||
<label><b>Messungen</b></label>
|
||||
<span><b>Monat</b></span>
|
||||
<span><b>Jahr</b></span>
|
||||
<span><b>Min</b></span>
|
||||
<span><b>Max</b></span>
|
||||
<span><b>Durchschnitt</b></span>
|
||||
|
||||
<div>
|
||||
<span class="color color-1"></span>
|
||||
<label>Verbrauch Zählerstand</label>
|
||||
<label>Verbrauch</label>
|
||||
<span><?php echo number_format($month_values['meter_consumption'], 3, ',', '.'); ?> KWh</span>
|
||||
<span><?php echo number_format($year_values['meter_consumption'], 3, ',', '.'); ?> KWh</span>
|
||||
<span><?php echo number_format($data['min_meter'] / 1000, 3, ',', '.'); ?> KWh</span>
|
||||
<span><?php echo number_format($data['max_meter'] / 1000, 3, ',', '.'); ?> KWh</span>
|
||||
<span><?php echo number_format($data['avg_meter'] / 1000, 3, ',', '.'); ?> KWh</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span class="color color-2"></span>
|
||||
<label>Verbrauch berechnet</label>
|
||||
<label>Berechnet</label>
|
||||
<span><?php echo number_format($month_values['power_sensor'], 3, ',', '.'); ?> KWh</span>
|
||||
<span><?php echo number_format($year_values['power_sensor'], 3, ',', '.'); ?> KWh</span>
|
||||
<span><?php echo number_format($data['min_power'] / 1000, 3, ',', '.'); ?> KWh</span>
|
||||
<span><?php echo number_format($data['max_power'] / 1000, 3, ',', '.'); ?> KWh</span>
|
||||
<span><?php echo number_format($data['avg_power'] / 1000, 3, ',', '.'); ?> KWh</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span class="color color-3"></span>
|
||||
<label>Einspeisung</label>
|
||||
<span><?php echo number_format($month_values['grid_feed'], 3, ',', '.'); ?> KWh</span>
|
||||
@@ -143,46 +83,42 @@ $colors = ['#375BEB', '#90EB36', '#EB5F36', '#DAE32D'];
|
||||
<span><?php echo number_format($data['min_feed'] / 1000, 3, ',', '.'); ?> KWh</span>
|
||||
<span><?php echo number_format($data['max_feed'] / 1000, 3, ',', '.'); ?> KWh</span>
|
||||
<span><?php echo number_format($data['avg_feed'] / 1000, 3, ',', '.'); ?> KWh</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span class="color color-4"></span>
|
||||
<label>Produktion EG</label>
|
||||
<span><?php echo number_format($month_production['eg'], 3, ',', '.'); ?> KWh</span>
|
||||
<span><?php echo number_format($year_production['eg'], 3, ',', '.'); ?> KWh</span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span><?php echo number_format($month_production['eg'] / count($data['date']), 3, ',', '.'); ?> kWh</span>
|
||||
</div>
|
||||
<span></span>
|
||||
|
||||
<div style="border-bottom: 1px solid black;">
|
||||
<span class="color color-4"></span>
|
||||
<label>Produktion OG</label>
|
||||
<span><?php echo number_format($month_production['og'], 3, ',', '.'); ?> KWh</span>
|
||||
<span><?php echo number_format($year_production['og'], 3, ',', '.'); ?> KWh</span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span><?php echo number_format($month_production['og'] / count($data['date']), 3, ',', '.'); ?> kWh</span>
|
||||
</div>
|
||||
<span><?php echo number_format($data['min_production'] / 1000, 3, ',', '.'); ?> KWh</span>
|
||||
<span><?php echo number_format($data['max_production'] / 1000, 3, ',', '.'); ?> KWh</span>
|
||||
<span><?php echo number_format($data['avg_production'] / 1000, 3, ',', '.'); ?> KWh</span>
|
||||
|
||||
<div>
|
||||
<span class="color"></span>
|
||||
<label><b>Ersparnis</b></label>
|
||||
<span><b><?php echo number_format(($month_production['eg'] + $month_production['og'] - $month_values['grid_feed']) * $month_production['price'] / 100, 2, ',', '.'); ?> €</b></span>
|
||||
<span><b><?php echo number_format(($year_production['eg_price'] + $year_production['og_price'] - array_sum($grid_feed_by_month)), 2, ',', '.'); ?> €</b></span>
|
||||
</div>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
|
||||
<div>
|
||||
<span class="color"></span>
|
||||
<label><b>Eigenverbrauch</b></label>
|
||||
<span><b><?php echo ($month_production['eg'] + $month_production['og'] > 0) ? number_format(100 - $month_values['grid_feed'] * 100 / ($month_production['eg'] + $month_production['og']), 2, ',', '.') : 0; ?> %</b></span>
|
||||
<span><b><?php echo number_format(100 - $year_values['grid_feed'] * 100 / ($year_production['eg'] + $year_production['og']), 2, ',', '.'); ?> %</b></span>
|
||||
</div>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
|
||||
<div>
|
||||
<span class="color"></span>
|
||||
<label><b>Letzter Zählerstand</b></label>
|
||||
<span><b><?php echo number_format($last_value, 3, ',', '.'); ?> kWh</b></span>
|
||||
<label><b>Zählerstand</b></label>
|
||||
<span><b><?php echo number_format($last_value, 1, ',', '.'); ?> kWh</b></span>
|
||||
</div>
|
||||
|
||||
<div id="chart-container">
|
||||
@@ -201,17 +137,22 @@ $colors = ['#375BEB', '#90EB36', '#EB5F36', '#DAE32D'];
|
||||
{
|
||||
label: 'Verbrauch Zählerstand',
|
||||
data: <?php echo json_encode($data['meter_consumption']); ?>,
|
||||
backgroundColor: '<?php echo $colors[0]; ?>',
|
||||
backgroundColor: '#375BEB',
|
||||
},
|
||||
{
|
||||
label: 'Verbrauch berechnet',
|
||||
data: <?php echo json_encode($data['power_sensor']); ?>,
|
||||
backgroundColor: '<?php echo $colors[1]; ?>',
|
||||
backgroundColor: '#90EB36',
|
||||
},
|
||||
{
|
||||
label: 'Einspeisung',
|
||||
data: <?php echo json_encode($data['grid_feed']); ?>,
|
||||
backgroundColor: '<?php echo $colors[2]; ?>',
|
||||
backgroundColor: '#EB5F36',
|
||||
},
|
||||
{
|
||||
label: 'Erzeugung',
|
||||
data: <?php echo json_encode($data['production']); ?>,
|
||||
backgroundColor: '#DAE32D',
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -222,4 +163,4 @@ $colors = ['#375BEB', '#90EB36', '#EB5F36', '#DAE32D'];
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
Reference in New Issue
Block a user