Files
alphacar-dashboard/personal.php

51 lines
1.4 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
session_start();
require 'config.php';
require 'db.php';
if ($dbhandle->connect_error) {
die("Verbindung fehlgeschlagen: " . $dbhandle->connect_error);
}
// Query
$sql = "SELECT clientname, SUM(preis) AS gesamt_einnahmen, ROUND(SUM(preis) * 0.1, 2) AS abschlag
FROM contracts
GROUP BY clientname
ORDER BY gesamt_einnahmen DESC";
$result = $dbhandle->query($sql);
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>Übersicht</title>
<style>
table { border-collapse: collapse; width: 80%; margin: auto; }
th, td { border: 1px solid #ddd; padding: 8px; text-align: center; }
th { background-color: #4CAF50; color: white; }
</style>
<link rel="stylesheet" href="style.css">
</head>
<body>
<?php include "header.php"?>
<h1 style="text-align:center;">Übersicht der Einnahmen</h1>
<table>
<tr>
<th>Dienstnummer + Name</th>
<th>Gesamteinnahmen (€)</th>
<th>10% Abschlag (€)</th>
</tr>
<?php while($row = $result->fetch_assoc()): ?>
<tr>
<td><?php echo htmlspecialchars($row['clientname']); ?></td>
<td><?php echo number_format($row['gesamt_einnahmen'], 2, ',', '.'); ?> €</td>
<td><?php echo number_format($row['abschlag'], 2, ',', '.'); ?> €</td>
</tr>
<?php endwhile; ?>
</table>
</body>
</html>
<?php
$dbhandle->close();
?>