fix: changed query for employee overview

This commit is contained in:
Ioannis20x
2025-07-07 14:31:57 +02:00
parent 1ffd531aa3
commit 080c76ebe0
2 changed files with 7 additions and 3 deletions

View File

@@ -8,11 +8,15 @@ if ($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
$sql = "SELECT CONCAT(u.discord_name) AS clientname,
SUM(c.preis) AS gesamt_einnahmen,
ROUND(SUM(c.preis) * 0.1, 2) AS abschlag
FROM contracts c
INNER JOIN users u ON c.user_id = u.id
GROUP BY u.id, u.discord_name
ORDER BY gesamt_einnahmen DESC";
$result = $dbhandle->query($sql);
?>
<!DOCTYPE html>