@php $lang = $printLanguage ?? 0; $format = strtolower(request('format', $format ?? 'pos')); $paperSetting = request('paper_mm') ?? request('paper_width_mm') ?? request('paper_width') ?? ($paperSetting ?? ($receiptSettings['paper_width_mm'] ?? $receiptSettings['receipt_paper_width'] ?? ($location->paper_width ?? $location->receipt_width ?? 80))); $paperSetting = is_numeric($paperSetting) ? (float) $paperSetting : 80; $isWideFormat = in_array($format, ['wide', 'letter', 'legal'], true); $isAnyAFormat = strpos($format, 'a') === 0; $isWide = ($paperSetting >= 150) || $isAnyAFormat || $isWideFormat; $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 Quotation Print - {{ $quotation->bill_no }}
@php $explicitTier = request('price_tier', request('tier', null)); $tier = ($explicitTier === null || $explicitTier === '') ? (int) (($quotation->customer?->price_tier ?? null) ?? ($location->default_price_tier ?? 3)) : (int) $explicitTier; // Some quotations are created with MRP prices even if tier isn't passed/stored. // Detect that case: if all quotation lines match the product MRP, use the MRP receipt layout. $allLinesAtMrp = false; if (!empty($quotation?->items) && $quotation->items->count() > 0) { $eps = 0.0001; $allLinesAtMrp = $quotation->items->every(function ($it) use ($eps) { $p = $it?->product; $mrp = 0.0; if (!empty($p)) { $mrp = (float) ($p->default_price ?? $p->price_sale ?? 0); } if ($mrp <= 0) { return false; } $price = (float) ($it->price ?? 0); return abs($price - $mrp) <= $eps; }); } $isMrpTier = ($tier === 3) || $allLinesAtMrp; $receiptPartial = $isMrpTier ? 'pos.quotations.partials.receipt_mrp' : 'pos.quotations.partials.receipt'; @endphp @include($receiptPartial, [ 'quotation' => $quotation, 'location' => $location, 'receiptSettings' => $receiptSettings, 'format' => $format, 'paperSetting' => $paperSetting, 'lang' => $lang, 'unitCodesById' => $unitCodesById ?? [], ])