diff --git a/html/.Trash-1000/files/rep-month_old.php b/html/.Trash-1000/files/rep-month_old.php
new file mode 100644
index 0000000..4f982eb
--- /dev/null
+++ b/html/.Trash-1000/files/rep-month_old.php
@@ -0,0 +1,112 @@
+ 12) {
+ $month = 1;
+ $year++;
+}
+
+// Daten abrufen für den ausgewählten Monat
+$sql = "
+SELECT
+c.category_id AS kategorie_id,
+c.name AS kategorie_name,
+COALESCE(SUM(e.amount), 0) AS summe_je_kategorie
+FROM
+categories c
+LEFT JOIN
+entries e
+ON e.category = c.category_id
+AND EXTRACT(YEAR FROM e.date) = :year
+AND EXTRACT(MONTH FROM e.date) = :month
+GROUP BY
+c.category_id, c.name
+ORDER BY
+c.category_id ASC
+";
+
+$stmt = $pdo->prepare($sql);
+$stmt->execute([
+ 'year' => $year,
+ 'month' => $month
+]);
+$entries = $stmt->fetchAll();
+
+?>
+
+
+
+
+
+FSCash - Monatsreport
+
+
+
+
+
+
+
+
= strftime('%B %Y', mktime(0, 0, 0, $month, 1, $year)) ?>
+
+
+
+
+| ID |
+Kategorie |
+Summe |
+
+
+
+
+
+| = htmlspecialchars($entry['kategorie_id'] ?? '') ?> |
+= htmlspecialchars($entry['kategorie_name'] ?? '') ?> |
+= htmlspecialchars(number_format($entry['summe_je_kategorie'], 2, ',', '.')) ?> |
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/html/.Trash-1000/info/rep-month_old.php.trashinfo b/html/.Trash-1000/info/rep-month_old.php.trashinfo
new file mode 100644
index 0000000..5a7b0c3
--- /dev/null
+++ b/html/.Trash-1000/info/rep-month_old.php.trashinfo
@@ -0,0 +1,3 @@
+[Trash Info]
+Path=rep-month_old.php
+DeletionDate=2026-01-25T09:06:35
diff --git a/html/rep-month.php b/html/rep-month.php
index 4f982eb..f88b2bc 100644
--- a/html/rep-month.php
+++ b/html/rep-month.php
@@ -23,8 +23,8 @@ if ($month < 1) {
$year++;
}
-// Daten abrufen für den ausgewählten Monat
-$sql = "
+// Daten für die Summen-Tabelle abrufen
+$sql_sum = "
SELECT
c.category_id AS kategorie_id,
c.name AS kategorie_name,
@@ -42,13 +42,68 @@ ORDER BY
c.category_id ASC
";
-$stmt = $pdo->prepare($sql);
-$stmt->execute([
+$stmt_sum = $pdo->prepare($sql_sum);
+$stmt_sum->execute([
'year' => $year,
'month' => $month
]);
-$entries = $stmt->fetchAll();
+$entries_sum = $stmt_sum->fetchAll();
+// Daten für den CSV-Export (alle Einträge) abrufen
+$sql_csv = "
+SELECT
+e.id AS id,
+e.user_id AS benutzer_id,
+u.username AS benutzer_name,
+c.category_id AS kategorie_id,
+c.name AS kategorie_name,
+e.amount AS betrag,
+pm.name AS zahlungsmethode,
+e.subject AS betreff,
+e.date AS datum
+FROM
+entries e
+LEFT JOIN
+categories c ON e.category = c.category_id
+LEFT JOIN
+users u ON e.user_id = u.id
+LEFT JOIN
+payment_methods pm ON e.payment_method = pm.payment_method_id
+WHERE
+EXTRACT(YEAR FROM e.date) = :year
+AND EXTRACT(MONTH FROM e.date) = :month
+ORDER BY
+e.date ASC
+";
+
+$stmt_csv = $pdo->prepare($sql_csv);
+$stmt_csv->execute([
+ 'year' => $year,
+ 'month' => $month
+]);
+$entries_csv = $stmt_csv->fetchAll();
+
+// CSV-Export-Logik
+if (isset($_GET['export']) && $_GET['export'] === 'csv') {
+ header('Content-Type: text/csv; charset=utf-8');
+ header('Content-Disposition: attachment; filename=monatsreport_'.$year.'_'.$month.'.csv');
+ $output = fopen('php://output', 'w');
+ fputcsv($output, ['ID', 'Datum', 'Benutzer', 'Kat-ID', 'Kategorie', 'Betreff', 'Betrag', 'Zahlungsmethode'], ';');
+ foreach ($entries_csv as $entry) {
+ fputcsv($output, [
+ $entry['id'] ?? '',
+ $entry['datum'] ?? '',
+ $entry['benutzer_name'] ?? '',
+ $entry['kategorie_id'] ?? '',
+ $entry['kategorie_name'] ?? '',
+ $entry['betreff'] ?? '',
+ number_format($entry['betrag'], 2, ',', '.'),
+ $entry['zahlungsmethode'] ?? ''
+ ], ';');
+ }
+ fclose($output);
+ exit;
+}
?>
@@ -88,7 +143,7 @@ $entries = $stmt->fetchAll();
-
+
| = htmlspecialchars($entry['kategorie_id'] ?? '') ?> |
= htmlspecialchars($entry['kategorie_name'] ?? '') ?> |
@@ -98,8 +153,10 @@ $entries = $stmt->fetchAll();
-
+
+