@php $pdfLocale = app()->getLocale(); $isRtl = $pdfLocale === 'ar'; @endphp Customer Report - {{$client['client_name']}}
@php $logoSrc = null; if (!empty($setting['logo'])) { $logoPath = public_path('images/'.$setting['logo']); if (file_exists($logoPath) && is_readable($logoPath)) { $logoData = @file_get_contents($logoPath); if ($logoData !== false) { $logoB64 = base64_encode($logoData); $logoExt = strtolower(pathinfo($logoPath, PATHINFO_EXTENSION)); $logoMime = $logoExt === 'svg' ? 'image/svg+xml' : (in_array($logoExt, ['png','jpeg','jpg','gif','webp'], true) ? 'image/'.$logoExt : 'image/png'); if ($logoExt === 'jpg') { $logoMime = 'image/jpeg'; } $logoSrc = 'data:'.$logoMime.';base64,'.$logoB64; } } } @endphp @if($logoSrc) Logo @endif
{{ __('pdf.customer_report') }}
{{$client['client_name']}}
{{ __('pdf.customer_details') }}
{{$client['client_name']}}
{{ __('pdf.phone') }}{{ $isRtl ? '' : ':' }} {{$client['phone']}}
{{ __('pdf.total_sales') }}{{ $isRtl ? '' : ':' }} {{$client['total_sales']}}
{{ __('pdf.total_amount') }}{{ $isRtl ? '' : ':' }} {{$symbol}} {{formatPrice((float)$client['total_amount'], 2, $priceFormat)}}
{{ __('pdf.total_paid') }}{{ $isRtl ? '' : ':' }} {{$symbol}} {{formatPrice((float)$client['total_paid'], 2, $priceFormat)}}
{{ __('pdf.sales_due') }}{{ $isRtl ? '' : ':' }} {{$symbol}} {{formatPrice((float)$client['due'], 2, $priceFormat)}}
{{ __('pdf.return_due') }}{{ $isRtl ? '' : ':' }} {{$symbol}} {{formatPrice((float)$client['return_Due'], 2, $priceFormat)}}
{{ __('pdf.company_info') }}
{{$setting['CompanyName']}}
{{ __('pdf.phone') }}{{ $isRtl ? '' : ':' }} {{$setting['CompanyPhone']}}
{{ __('pdf.email') }}{{ $isRtl ? '' : ':' }} {{$setting['email']}}
{{ __('pdf.address') }}{{ $isRtl ? '' : ':' }} {{$setting['CompanyAdress']}}

{{ __('pdf.all_sales') }}

@php $rowIndex = 0; @endphp @foreach ($sales as $sale) @php $rowIndex++; @endphp @endforeach
{{ __('pdf.date') }} {{ __('pdf.ref') }} {{ __('pdf.paid') }} {{ __('pdf.due') }} {{ __('pdf.payment_status') }}
@php $dateFormat = $setting['date_format'] ?? 'YYYY-MM-DD'; $dateTime = \Carbon\Carbon::parse($sale['date']); $phpDateFormat = str_replace(['YYYY', 'MM', 'DD'], ['Y', 'm', 'd'], $dateFormat); // Check if original date string contains time $hasTime = strpos($sale['date'], ' ') !== false && preg_match('/\d{1,2}:\d{2}/', $sale['date']); if ($hasTime) { $formattedDate = $dateTime->format($phpDateFormat . ' H:i'); // Preserve seconds if they exist if (preg_match('/:\d{2}:\d{2}/', $sale['date'])) { $formattedDate = $dateTime->format($phpDateFormat . ' H:i:s'); } } else { $formattedDate = $dateTime->format($phpDateFormat); } @endphp {{$formattedDate}} {{$sale['Ref']}} {{$symbol}} {{formatPrice((float)$sale['paid_amount'], 2, $priceFormat)}} {{$symbol}} {{formatPrice((float)$sale['due'], 2, $priceFormat)}} @php $paymentColors = [ 'paid' => ['bg' => '#d1fae5', 'color' => '#065f46'], 'partial' => ['bg' => '#fef3c7', 'color' => '#92400e'], 'unpaid' => ['bg' => '#fee2e2', 'color' => '#991b1b'], ]; $paymentKey = strtolower($sale['payment_status']); $paymentStyle = $paymentColors[$paymentKey] ?? ['bg' => '#e5e7eb', 'color' => '#374151']; @endphp {{$sale['payment_status']}}

Customer Sales Report