$value !== null && $value !== ''
);
$path = auth_current_path();
$queryString = http_build_query($query, '', '&', PHP_QUERY_RFC3986);
return $queryString === '' ? $path : $path . '?' . $queryString;
}
function auth_format_bestellung_date(?string $value): string
{
if ($value === null || $value === '') {
return '';
}
try {
return (new DateTimeImmutable($value))->format('d.m.Y H:i');
} catch (Throwable) {
return $value;
}
}
function auth_format_bestellung_total(?float $value): string
{
if ($value === null) {
return '';
}
return 'CHF ' . number_format($value, 2, '.', '\'');
}
function auth_render_bestellungen_large_table(array $bestellungenTable): string
{
$rows = $bestellungenTable['rows'] ?? [];
$search = (string) ($bestellungenTable['search'] ?? '');
$sortColumn = (string) ($bestellungenTable['sort_column'] ?? 'order_date');
$sortDirection = strtoupper((string) ($bestellungenTable['sort_direction'] ?? 'DESC'));
$limit = (int) ($bestellungenTable['limit'] ?? 20);
$pageSize = (int) ($bestellungenTable['page_size'] ?? 20);
$hasMore = (bool) ($bestellungenTable['has_more'] ?? false);
$nextLimit = (int) ($bestellungenTable['next_limit'] ?? $limit);
$sortColumns = [
'order_date' => 'Bestelldatum',
'external_ref' => 'Bestellnummer',
'name' => 'Name',
'total_amount' => 'Gesamtsumme',
];
$html = [];
$html[] = '
Naurua-Chargennummer: ' . auth_escape_html((string) ($lot['lot_number'] ?? 'Nicht hinterlegt')) . '
'
. 'Status: Abgeschlossen
'
. 'Eingangsmenge: ' . auth_format_lager_quantity((float) ($lot['qty_in'] ?? 0)) . '
'
. 'Verbrauchte Menge: ' . auth_format_lager_quantity((float) ($lot['qty_out'] ?? 0)) . '
'
. 'Verbrauchszeitraum: ' . auth_format_lager_date($lot['first_in_at'] ?? null) . ' – ' . auth_format_lager_date($lot['last_out_at'] ?? null) . '
'
. 'Aufgebraucht am: ' . $emptyDate . '
'
. 'MHD: ' . auth_format_lager_date($lot['expiry_date'] ?? null) . '
'
. 'Hersteller: ' . auth_escape_html((string) ($lot['manufacturer_name'] ?? 'Nicht hinterlegt')) . '
'
. 'Hersteller-Chargennummer: ' . auth_escape_html((string) ($lot['manufacturer_lot_number'] ?? 'Nicht hinterlegt')) . '
Naurua-Chargennummer: ' . auth_escape_html((string) ($lot['lot_number'] ?? 'Nicht hinterlegt')) . '
'
. 'Status: Vorbereitet
'
. 'Bestand: ' . auth_format_lager_quantity((float) ($lot['qty_net'] ?? 0)) . '
'
. 'Eingangsmenge: ' . auth_format_lager_quantity((float) ($lot['qty_in'] ?? 0)) . '
'
. 'Hersteller: ' . auth_escape_html((string) ($lot['manufacturer_name'] ?? 'Nicht hinterlegt')) . '
'
. 'Hersteller-Chargennummer: ' . auth_escape_html((string) ($lot['manufacturer_lot_number'] ?? 'Nicht hinterlegt')) . '
'
. 'Herstellungsdatum: ' . auth_format_lager_date($lot['mfg_date'] ?? null) . '
'
. 'MHD: ' . auth_format_lager_date($lot['expiry_date'] ?? null) . '
'
. 'Einkaufsdatum: ' . auth_format_lager_date($lot['purchase_date'] ?? null) . '
Physischer Bestand: ' . $availableQty . '
'; $otcProductRows .= 'Keine aktiven OTC-Produkte erfasst.
'; } $moduleNavigation = json_encode( [ 'Übersicht' => [], 'ERP' => ['Bestellungen', 'Lager', 'Produkte', 'Artikel', 'Kontakte'], 'Buchhaltung' => [], 'Kundenberatung' => [], ], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES ); $bestellungenContent = auth_render_bestellungen_content($bestellungenTable); $lagerContent = auth_render_lager_content($lagerProducts, $lagerArtikel, $lagerManufacturers, auth_csrf_token()); $moduleContentCards = json_encode( [ 'Bestellungen' => $bestellungenContent, 'Lager' => $lagerContent, 'Artikel' => auth_render_lager_content([], $lagerArtikel, $lagerManufacturers, auth_csrf_token(), 'Artikel'), ], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES ); $moduleHeadings = json_encode( [ 'Übersicht' => 'Willkommen bei Naurua Übersicht', 'ERP' => 'Willkommen bei Naurua ERP', 'Buchhaltung' => 'Willkommen bei Naurua Buchhaltung', 'Kundenberatung' => 'Willkommen bei Naurua Kundenberatung', ], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES ); echo ''; echo ''; echo ''; echo ''; echo ''; echo 'Naurua ERP
'; echo ''; echo ''; echo '