@php $pdfLocale = app()->getLocale(); $isRtl = $pdfLocale === 'ar'; @endphp Customer Report - {{$client['client_name']}} @php $priceFormat = $setting['price_format'] ?? null; function formatPrice($number, $decimals = 2, $priceFormat = null) { $number = (float) $number; $decimals = (int) $decimals; if (empty($priceFormat)) { return number_format($number, $decimals, '.', ','); } switch ($priceFormat) { case 'comma_dot': return number_format($number, $decimals, '.', ','); case 'dot_comma': return number_format($number, $decimals, ',', '.'); case 'space_comma': return number_format($number, $decimals, ',', ' '); default: return number_format($number, $decimals, '.', ','); } } $pdfCssPath = public_path('css/report_client_pdf.css'); @endphp @if (is_file($pdfCssPath) && is_readable($pdfCssPath)) @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 $rptcPillMap = [ 'paid' => 'rptc-pill rptc-pill--paid', 'partial' => 'rptc-pill rptc-pill--partial', 'unpaid' => 'rptc-pill rptc-pill--unpaid', ]; $rptcPillKey = strtolower($sale['payment_status']); $rptcPillClass = $rptcPillMap[$rptcPillKey] ?? 'rptc-pill rptc-pill--default'; $rptcRowClass = ($rowIndex % 2 == 0) ? 'rptc-row rptc-row--even' : 'rptc-row rptc-row--odd'; @endphp @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); $hasTime = strpos($sale['date'], ' ') !== false && preg_match('/\d{1,2}:\d{2}/', $sale['date']); if ($hasTime) { $formattedDate = $dateTime->format($phpDateFormat . ' H:i'); 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)}} {{$sale['payment_status']}}