add files

This commit is contained in:
tbS
2025-08-02 13:10:21 +02:00
commit aa4fa9ae0f
702 changed files with 103724 additions and 0 deletions

110
admin/startseite_dev.php Normal file
View File

@@ -0,0 +1,110 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Statistiken</title>
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
<!-- Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>
<style>
body {
font-family: 'Roboto', sans-serif;
background-color: #f3f4f6;
color: #111827;
}
.card {
background: white;
border-radius: 12px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.card:hover {
transform: translateY(-5px);
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}
.table-header {
background-color: #1f2937;
color: white;
}
.highlight {
color: #10b981; /* Gr<47>n f<>r Gewinn */
font-weight: 500;
}
</style>
</head>
<body>
<div class="container mx-auto px-4 py-8">
<h1 class="text-3xl font-bold text-center mb-8 text-gray-800">Auftragsstatistiken</h1>
<?php
mysqli_set_charset($db, "utf8mb4");
$sql = "SELECT * FROM aufträge";
$result = mysqli_query($db, $sql);
$yearlyStats = array();
while ($row = mysqli_fetch_assoc($result)) {
$year = date('Y', strtotime($row['auftrag_beginn']));
if (!isset($yearlyStats[$year])) {
$yearlyStats[$year] = array(
'offeneAuftr<74>ge' => 0,
'beendeteAuftr<74>ge' => 0,
'umsatz' => 0,
'gewinn' => 0,
);
}
if ($row['beendet'] == '1') {
$yearlyStats[$year]['beendeteAuftr<74>ge']++;
} else {
$yearlyStats[$year]['offeneAuftr<74>ge']++;
}
$json = json_decode($row['materialien'], true);
$preis = $row['preis'];
$materialienSum = 0;
foreach ($json as $key => $value) {
$split = explode(":", $value);
$materialienSum += str_replace(',', '.', $split[1]);
}
$yearlyStats[$year]['umsatz'] += $preis;
$yearlyStats[$year]['gewinn'] += ($preis - $materialienSum);
}
krsort($yearlyStats);
foreach ($yearlyStats as $year => $stats) {
?>
<div class="card p-6 mb-6">
<h2 class="text-xl font-bold text-gray-700 mb-4">Statistiken f<>r <span class="text-indigo-600"><?php echo $year; ?></span></h2>
<table class="w-full text-left border-collapse">
<thead class="table-header">
<tr>
<th class="p-3">Offene Auftr<74>ge</th>
<th class="p-3">Beendete Auftr<74>ge</th>
<th class="p-3">Gewinn</th>
<th class="p-3">Umsatz</th>
</tr>
</thead>
<tbody>
<tr class="bg-gray-50 hover:bg-gray-100">
<td class="p-3"><?php echo $stats['offeneAuftr<74>ge']; ?></td>
<td class="p-3"><?php echo $stats['beendeteAuftr<74>ge']; ?></td>
<td class="p-3 highlight"><?php echo number_format($stats['gewinn'], 2) . " <20>"; ?></td>
<td class="p-3"><?php echo number_format($stats['umsatz'], 2) . " <20>"; ?></td>
</tr>
</tbody>
</table>
</div>
<?php
}
?>
</div>
</body>
</html>