@php $lang = $printLanguage ?? 0; // 0=en,1=si,2=ta (if used) $format = strtolower(request('format', $format ?? 'pos')); $paperSetting = request('paper_mm') ?? request('paper_width_mm') ?? request('paper_width') ?? ($receiptSettings['paper_width_mm'] ?? $receiptSettings['receipt_paper_width'] ?? ($location->paper_width ?? $location->receipt_width ?? 80)); $paperSetting = is_numeric($paperSetting) ? (float) $paperSetting : 80; $isA4 = $format === 'a4'; $isWideFormat = in_array($format, ['wide', 'letter', 'legal'], true); $isAnyAFormat = strpos($format, 'a') === 0; // Includes A3/A4/A5 etc. $isWide = ($paperSetting >= 150) || $isAnyAFormat || $isWideFormat; $returnTotal = $returnTotal ?? 0; $pageWideWidth = max($paperSetting, 110); // Logo widths are stored per location (settings UI writes to locations table) $logoWidthPos = $location->logo_width_pos ?? 95; $logoWidthA4 = $location->logo_width_a4 ?? 40; $appFontFile = (string) (($receiptSettings['receipt_font_file'] ?? '') ?: ($receiptSettings['ui_font_file'] ?? '') ?: ($receiptSettings['app_font_file'] ?? '')); $appFontUrl = $appFontFile !== '' ? asset('fonts/' . rawurlencode($appFontFile)) : ''; @endphp