@php $pdfLocale = app()->getLocale(); $isRtl = $pdfLocale === 'ar'; // No colon in Arabic; English keeps colon after summary labels $rtlLabelSuffix = $isRtl ? '' : ':'; @endphp
|
@php
$logoSrc = null;
if (!empty($setting['logo'])) {
$logoPath = public_path(upload_path('settings').'/'.$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)
|
{{ __('pdf.sales_invoice') }}
{{$sale['Ref']}}
|
|
{{ __('pdf.bill_to') }}
{{$sale['client_name']}}
|
{{ __('pdf.from') }}
{{$setting['CompanyName']}}
|
| {{ __('pdf.product') }} | {{ __('pdf.price') }} | {{ __('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
|
{{formatPrice((float)$detail['price'], 2, $priceFormat)}} | {{$detail['quantity']}} {{$detail['unitSale']}} | {{formatPrice((float)$detail['DiscountNet'], 2, $priceFormat)}} | {{formatPrice((float)$detail['taxe'], 2, $priceFormat)}} | {{formatPrice((float)$detail['total'], 2, $priceFormat)}} |
@php
// Calculate subtotal from line items
$subtotal = 0;
foreach ($details as $detail) {
$subtotal += (float)$detail['total'];
}
$discountMethod = $sale['discount_Method'] ?? '2';
$discountValue = (float)$sale['discount'];
$manualDiscountAmount = $discountMethod === '1' ? $subtotal * ($discountValue / 100) : min($discountValue, $subtotal);
@endphp
|