v1.3.1 - siehe Release Notes
This commit is contained in:
18
export.php
18
export.php
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// define('DOMILI_ALLOW_WEB', true); // Zum Testen im Browser einkommentieren
|
||||
//define('DOMILI_ALLOW_WEB', true); // Zum Testen im Browser einkommentieren
|
||||
|
||||
if (php_sapi_name() !== 'cli' && !defined('DOMILI_ALLOW_WEB')) {
|
||||
die('Zugriff verweigert.');
|
||||
@@ -14,11 +14,17 @@ use Dompdf\Options;
|
||||
date_default_timezone_set('Europe/Berlin');
|
||||
|
||||
// === 1. Berichtsmonat ===
|
||||
$berichtsMonatEnde = new DateTime('last day of last month');
|
||||
$berichtsMonatBeginn = new DateTime('first day of last month');
|
||||
$berichtsMonatEnde = new DateTime('last day of last month');
|
||||
$berichtsMonatEnde->setTime(23, 59, 59);
|
||||
|
||||
// Backup für manuelles erzeugen eines PDF in einem anderen Zeitabschnitt
|
||||
//$berichtsMonatBeginn = new DateTime('2025-09-01 00:00:00');
|
||||
//$berichtsMonatEnde = new DateTime('2025-09-30 23:59:59');
|
||||
|
||||
|
||||
// === 2. Letzter Jahresabschluss ===
|
||||
$last_closing = '2020-01-01';
|
||||
$last_closing = '2025-01-01';
|
||||
$res = mysqli_query($conn, "SELECT MAX(closing_date) AS last_date FROM penalty_closings");
|
||||
if ($res && ($row = mysqli_fetch_assoc($res)) && !is_null($row['last_date'])) {
|
||||
$last_closing = $row['last_date'];
|
||||
@@ -33,7 +39,7 @@ while ($row = mysqli_fetch_assoc($resUsers)) {
|
||||
$userIds = array_keys($alleBenutzer);
|
||||
|
||||
// === 4. Alle relevanten Daten (nur completed + attended=1) ===
|
||||
$bisDatum = $berichtsMonatEnde->format('Y-m-d');
|
||||
$bisDatum = $berichtsMonatEnde->format('Y-m-d H:i:s');
|
||||
$stmt = mysqli_prepare($conn, "
|
||||
SELECT m.id AS meeting_id, m.meeting_date,
|
||||
mt.user_id, mt.wore_color, mt.paid, mt.birthday_pay
|
||||
@@ -59,8 +65,8 @@ $stmtMeta = mysqli_prepare($conn, "
|
||||
WHERE meeting_date >= ? AND meeting_date <= ? AND is_completed = 1
|
||||
ORDER BY meeting_date
|
||||
");
|
||||
$startDate = $berichtsMonatBeginn->format('Y-m-d');
|
||||
$endDate = $berichtsMonatEnde->format('Y-m-d');
|
||||
$startDate = $berichtsMonatBeginn->format('Y-m-d H:i:s');
|
||||
$endDate = $berichtsMonatEnde->format('Y-m-d H:i:s');
|
||||
mysqli_stmt_bind_param($stmtMeta, 'ss', $startDate, $endDate);
|
||||
mysqli_stmt_execute($stmtMeta);
|
||||
$resultMeta = mysqli_stmt_get_result($stmtMeta);
|
||||
|
||||
Reference in New Issue
Block a user