fetchAll('SELECT clave, valor FROM lab_config ORDER BY clave'); foreach ($rows as $r) { $cfg[$r['clave']] = $r['valor']; } } catch (Exception $e) { // BD no disponible: continuar con defaults } $empresa = htmlspecialchars($cfg['empresa_nombre'] ?? 'Laboratorio Clínico', ENT_QUOTES, 'UTF-8'); $subtitulo= htmlspecialchars($cfg['empresa_subtitulo'] ?? 'Sistema de Gestión ERP', ENT_QUOTES, 'UTF-8'); $color = preg_match('/^#[0-9a-fA-F]{3,8}$/', $cfg['doc_color'] ?? '') ? $cfg['doc_color'] : '#1565c0'; $logo = $cfg['doc_logo_base64'] ?? ''; // Calcular color derivado más oscuro para el gradiente function adjustColor(string $hex, int $amount): string { $hex = ltrim($hex, '#'); $r = max(0, min(255, hexdec(substr($hex, 0, 2)) + $amount)); $g = max(0, min(255, hexdec(substr($hex, 2, 2)) + $amount)); $b = max(0, min(255, hexdec(substr($hex, 4, 2)) + $amount)); return sprintf('#%02x%02x%02x', $r, $g, $b); } $colorDark = adjustColor($color, -40); ?>
Bienvenido
Inicia sesión en el sistema ERP