query($check_query); if ($check_result->num_rows === 0) { $query = 'INSERT INTO ' . $table_production . ' (date, eg, og, price) VALUES ("' . $_POST['date'] . '-01", ' . $_POST['eg'] . ', ' . $_POST['og'] . ', ' . $_POST['price'] . ');'; } else { $query = 'UPDATE ' . $table_production . ' SET eg = "' . $_POST['eg'] . '", og = "' . $_POST['og'] . '", price = "' . $_POST['price'] . '" WHERE date = "' . $_POST['date'] . '-01";'; } $local_db->query($query); } $actual = new DateTime(); $dates = get_month($local_db, $table_aggregation); $chosen_date = (isset($_POST['date'])) ? $_POST['date'] : $actual->modify('-1 day')->format('Y-m'); $data = get_aggregation($local_db, $table_aggregation, $chosen_date); $month_values = get_month_aggregation($local_db, $table_aggregation, $chosen_date); $year_values = get_year_aggregation($local_db, $table_aggregation, $chosen_date); $grid_feed_by_month = get_grid_feed_by_month($local_db, $table_aggregation, $table_production, $chosen_date); $month_production = get_month_production($local_db, $table_production, $chosen_date); $year_production = get_year_production($local_db, $table_production, $chosen_date); $last_value = get_last_value($local_db, $table_aggregation, $chosen_date); $chosen_date_time = new DateTime($chosen_date); ?> Consumption values
modify('-1 month')->format('Y-m') . "\")'><"; } else { $chosen_date_time->modify('-1 month'); echo ''; } $chosen_date_time->modify('+1 month'); echo '' . $chosen_date_time->format('Y-m') . ''; if ($dates['last'] > $chosen_date_time->modify('+1 month')) { echo ""; } else { echo ''; } ?> Jahr Werte
Monat Jahr Min Max Durchschnitt KWh KWh KWh KWh KWh KWh KWh KWh KWh KWh KWh KWh KWh KWh KWh KWh KWh KWh KWh KWh 0) ? number_format(100 - $month_values['grid_feed'] * 100 / ($month_production['eg'] + $month_production['og']), 2, ',', '.') : 0; ?> % % kWh