@php $printedAt = now()->format('d-m-Y H:i'); $sumToday = 0; $sumMonth = 0; $sumRange = 0; $sumAll = 0; $companyName = config('app.name', 'Laundry Dashboard'); $logoSrc = null; try { $company = \Illuminate\Support\Facades\DB::table('company_settings')->first(); if ($company && !empty($company->business_name)) { $companyName = $company->business_name; } $logoPath = $company && !empty($company->logo_path) ? trim((string)$company->logo_path) : ''; $candidateFiles = []; if ($logoPath !== '') { $candidateFiles[] = storage_path('app/public/' . ltrim($logoPath, '/')); $candidateFiles[] = public_path('storage/' . ltrim($logoPath, '/')); $candidateFiles[] = public_path(ltrim($logoPath, '/')); } $candidateFiles[] = public_path('logo.png'); foreach ($candidateFiles as $file) { if ($file && file_exists($file) && is_file($file)) { $mime = function_exists('mime_content_type') ? mime_content_type($file) : 'image/png'; if (!$mime) { $mime = 'image/png'; } $logoSrc = 'data:' . $mime . ';base64,' . base64_encode(file_get_contents($file)); break; } } } catch (\Throwable $e) { $companyName = config('app.name', 'Laundry Dashboard'); $logoSrc = null; } @endphp
رجوع للملخص
{{ $companyName }}
نظام متابعة المبيعات والفروع
@if($logoSrc) Logo @else
LOGO
@endif
ملخص المبيعات
تاريخ الطباعة: {{ $printedAt }}
الفرع: @if($selectedBranch) {{ $selectedBranch->branch_no }} - {{ $selectedBranch->name }} @else كل الفروع @endif من تاريخ: {{ $from ?: '-' }} إلى تاريخ: {{ $to ?: '-' }}
@foreach($rows as $r) @php $sumToday += (float)$r->total_today; $sumMonth += (float)$r->total_month; $sumRange += (float)$r->total_range; $sumAll += (float)$r->total_all; @endphp @endforeach
رقم الفرع اسم الفرع مبيعات اليوم مبيعات الشهر مبيعات الفترة إجمالي المبيعات آخر فاتورة
{{ $r->branch_no }} {{ $r->name }} {{ number_format((float)$r->total_today, 2) }} {{ number_format((float)$r->total_month, 2) }} {{ number_format((float)$r->total_range, 2) }} {{ number_format((float)$r->total_all, 2) }} @if(!empty($r->last_bill_date)) {{ \Carbon\Carbon::parse($r->last_bill_date)->format('d-m-Y H:i') }} @else - @endif
الإجمالي {{ number_format($sumToday, 2) }} {{ number_format($sumMonth, 2) }} {{ number_format($sumRange, 2) }} {{ number_format($sumAll, 2) }}
Generated by {{ $companyName }} - {{ $printedAt }}