@php $pdfLocale = app()->getLocale(); $isRtl = $pdfLocale === 'ar'; $rtlLabelSuffix = $isRtl ? '' : ':'; @endphp Purchase Invoice - {{$purchase['Ref']}} @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, '.', ','); } } $purPillKeys = ['completed', 'received', 'pending', 'ordered', 'paid', 'unpaid', 'partial']; $statusKey = strtolower($purchase['statut']); $purStatusPill = in_array($statusKey, $purPillKeys, true) ? $statusKey : 'default'; $paymentKey = strtolower($purchase['payment_status']); $purPaymentPill = in_array($paymentKey, $purPillKeys, true) ? $paymentKey : 'default'; @endphp @php $pdfCssPath = public_path('css/pdf.css'); @endphp @if (is_file($pdfCssPath) && is_readable($pdfCssPath)) @endif @php $x = public_path('css/purchase_pdf.css'); @endphp @if (is_file($x) && is_readable($x)) @endif
{{ __('pdf.purchase_order') }}
{{$purchase['Ref']}}
{{ __('pdf.date') }}{{ $isRtl ? '' : ':' }} @php $dateFormat = $setting['date_format'] ?? 'YYYY-MM-DD'; $dateTime = \Carbon\Carbon::parse($purchase['date']); $phpDateFormat = str_replace(['YYYY', 'MM', 'DD'], ['Y', 'm', 'd'], $dateFormat); $hasTime = strpos($purchase['date'], ' ') !== false && preg_match('/\d{1,2}:\d{2}/', $purchase['date']); if ($hasTime) { $formattedDate = $dateTime->format($phpDateFormat . ' H:i'); if (preg_match('/:\d{2}:\d{2}/', $purchase['date'])) { $formattedDate = $dateTime->format($phpDateFormat . ' H:i:s'); } } else { $formattedDate = $dateTime->format($phpDateFormat); } @endphp {{$formattedDate}}
{{ __('pdf.order_no') }}{{ $isRtl ? '' : ':' }} {{$purchase['Ref']}}
{{ __('pdf.status') }}{{ $isRtl ? '' : ':' }} {{$purchase['statut']}}
{{ __('pdf.payment') }}{{ $isRtl ? '' : ':' }} {{$purchase['payment_status']}}
{{ __('pdf.supplier_info') }}
{{$purchase['supplier_name']}}
@if($isRtl) @if($purchase['supplier_tax']) @endif @else @if($purchase['supplier_tax']) @endif @endif
{{$purchase['supplier_phone']}}{{ __('pdf.phone') }}
{{$purchase['supplier_email']}}{{ __('pdf.email') }}
{{$purchase['supplier_adr']}}{{ __('pdf.address') }}
{{$purchase['supplier_tax']}}{{ __('pdf.tax_no') }}
{{ __('pdf.phone') }}:{{$purchase['supplier_phone']}}
{{ __('pdf.email') }}:{{$purchase['supplier_email']}}
{{ __('pdf.address') }}:{{$purchase['supplier_adr']}}
{{ __('pdf.tax_no') }}:{{$purchase['supplier_tax']}}
{{ __('pdf.company_info') }}
{{$setting['CompanyName']}}
@if($isRtl) @else @endif
{{$setting['CompanyPhone']}}{{ __('pdf.phone') }}
{{$setting['email']}}{{ __('pdf.email') }}
{{$setting['CompanyAdress']}}{{ __('pdf.address') }}
{{ __('pdf.phone') }}:{{$setting['CompanyPhone']}}
{{ __('pdf.email') }}:{{$setting['email']}}
{{ __('pdf.address') }}:{{$setting['CompanyAdress']}}
@php $rowIndex = 0; @endphp @foreach ($details as $detail) @php $rowIndex++; @endphp @endforeach
{{ __('pdf.product') }} {{ __('pdf.cost') }} {{ __('pdf.qty') }} {{ __('pdf.disc') }} {{ __('pdf.tax') }} {{ __('pdf.total') }}
{{$detail['name']}}
{{ __('pdf.code') }} {{$detail['code']}}
@if($detail['is_imei'] && $detail['imei_number'] !==null)
{{ __('pdf.sn') }} {{$detail['imei_number']}}
@endif
{{$detail['cost']}} {{$detail['quantity']}} {{$detail['unit_purchase']}} {{$detail['DiscountNet']}} {{$detail['taxe']}} {{$detail['total']}}
@if($isRtl) @else @endif
{{$symbol}} {{formatPrice((float)($purchase['GrandTotal'] - $purchase['TaxNet'] + $purchase['discount'] - $purchase['shipping']), 2, $priceFormat)}} {{ __('pdf.subtotal') }}{!! $rtlLabelSuffix !!}
{{$symbol}} {{formatPrice((float)$purchase['TaxNet'], 2, $priceFormat)}} {{ __('pdf.order_tax') }}{!! $rtlLabelSuffix !!}
- {{$symbol}} {{formatPrice((float)$purchase['discount'], 2, $priceFormat)}} {{ __('pdf.discount') }}{!! $rtlLabelSuffix !!}
{{$symbol}} {{formatPrice((float)$purchase['shipping'], 2, $priceFormat)}} {{ __('pdf.shipping') }}{!! $rtlLabelSuffix !!}
{{$symbol}} {{formatPrice((float)$purchase['GrandTotal'], 2, $priceFormat)}} {{ __('pdf.total_label') }}{!! $rtlLabelSuffix !!}
{{$symbol}} {{formatPrice((float)$purchase['paid_amount'], 2, $priceFormat)}} {{ __('pdf.paid_amount') }}{!! $rtlLabelSuffix !!}
{{$symbol}} {{formatPrice((float)$purchase['due'], 2, $priceFormat)}} {{ __('pdf.amount_due') }}{!! $rtlLabelSuffix !!}
{{ __('pdf.subtotal') }} {{$symbol}} {{formatPrice((float)($purchase['GrandTotal'] - $purchase['TaxNet'] + $purchase['discount'] - $purchase['shipping']), 2, $priceFormat)}}
{{ __('pdf.order_tax') }} {{$symbol}} {{formatPrice((float)$purchase['TaxNet'], 2, $priceFormat)}}
{{ __('pdf.discount') }} - {{$symbol}} {{formatPrice((float)$purchase['discount'], 2, $priceFormat)}}
{{ __('pdf.shipping') }} {{$symbol}} {{formatPrice((float)$purchase['shipping'], 2, $priceFormat)}}
{{ __('pdf.total_label') }} {{$symbol}} {{formatPrice((float)$purchase['GrandTotal'], 2, $priceFormat)}}
{{ __('pdf.paid_amount') }} {{$symbol}} {{formatPrice((float)$purchase['paid_amount'], 2, $priceFormat)}}
{{ __('pdf.amount_due') }} {{$symbol}} {{formatPrice((float)$purchase['due'], 2, $priceFormat)}}