Add last meter consumption value.
This commit is contained in:
@@ -109,4 +109,13 @@ function get_year_production(mysqli $db, string $table, $date): array
|
||||
$sum_result = $db->query($sum_query);
|
||||
|
||||
return $sum_result->fetch_assoc();
|
||||
}
|
||||
|
||||
function get_last_value(mysqli $db, string $table, $date): float
|
||||
{
|
||||
$value_query = 'SELECT last_value FROM ' . $table . ' WHERE date LIKE "' . $date . '%" ORDER BY date DESC LIMIT 1;';
|
||||
$value_result = $db->query($value_query);
|
||||
$data = $value_result->fetch_assoc();
|
||||
|
||||
return floatval($data['last_value']) / 1000;
|
||||
}
|
||||
Reference in New Issue
Block a user