@php
// Price formatting helper function
$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, '.', ',');
}
}
@endphp
@if(!empty($setting['logo']) && file_exists(public_path('images/'.$setting['logo'])))
@endif
|
PURCHASE RETURN
{{$return_purchase['Ref']}}
| Date: |
@php
$dateFormat = $setting['date_format'] ?? 'YYYY-MM-DD';
$dateTime = \Carbon\Carbon::parse($return_purchase['date']);
$phpDateFormat = str_replace(['YYYY', 'MM', 'DD'], ['Y', 'm', 'd'], $dateFormat);
// Check if original date string contains time
$hasTime = strpos($return_purchase['date'], ' ') !== false && preg_match('/\d{1,2}:\d{2}/', $return_purchase['date']);
if ($hasTime) {
$formattedDate = $dateTime->format($phpDateFormat . ' H:i');
// Preserve seconds if they exist
if (preg_match('/:\d{2}:\d{2}/', $return_purchase['date'])) {
$formattedDate = $dateTime->format($phpDateFormat . ' H:i:s');
}
} else {
$formattedDate = $dateTime->format($phpDateFormat);
}
@endphp
{{$formattedDate}}
|
| Return #: |
{{$return_purchase['Ref']}} |
| Purchase Ref: |
{{$return_purchase['purchase_ref']}} |
| Status: |
@php
$statusColors = [
'completed' => ['bg' => '#d1fae5', 'color' => '#065f46'],
'returned' => ['bg' => '#d1fae5', 'color' => '#065f46'],
'pending' => ['bg' => '#fef3c7', 'color' => '#92400e'],
];
$statusKey = strtolower($return_purchase['statut']);
$statusStyle = $statusColors[$statusKey] ?? ['bg' => '#e5e7eb', 'color' => '#374151'];
@endphp
{{$return_purchase['statut']}}
|
| Payment: |
@php
$paymentKey = strtolower($return_purchase['payment_status']);
$paymentStyle = $statusColors[$paymentKey] ?? ['bg' => '#e5e7eb', 'color' => '#374151'];
@endphp
{{$return_purchase['payment_status']}}
|
|
{{$return_purchase['supplier_name']}}
Phone: {{$return_purchase['supplier_phone']}}
Email: {{$return_purchase['supplier_email']}}
Address: {{$return_purchase['supplier_adr']}}
@if($return_purchase['supplier_tax'])
Tax #: {{$return_purchase['supplier_tax']}}
@endif
|
|
{{$setting['CompanyName']}}
Phone: {{$setting['CompanyPhone']}}
Email: {{$setting['email']}}
Address: {{$setting['CompanyAdress']}}
|
| PRODUCT |
COST |
QTY |
DISC |
TAX |
TOTAL |
@php $rowIndex = 0; @endphp
@foreach ($details as $detail)
|
{{$detail['name']}}
Code: {{$detail['code']}}
@if($detail['is_imei'] && $detail['imei_number'] !==null)
SN: {{$detail['imei_number']}}
@endif
|
{{formatPrice((float)$detail['cost'], 2, $priceFormat)}} |
{{$detail['quantity']}} {{$detail['unit_purchase']}} |
{{formatPrice((float)$detail['DiscountNet'], 2, $priceFormat)}} |
{{formatPrice((float)$detail['taxe'], 2, $priceFormat)}} |
{{formatPrice((float)$detail['total'], 2, $priceFormat)}} |
@php $rowIndex++; @endphp
@endforeach
|
| Subtotal: |
{{$symbol}} {{formatPrice((float)($return_purchase['GrandTotal'] - $return_purchase['TaxNet'] + $return_purchase['discount'] - $return_purchase['shipping']), 2, $priceFormat)}} |
| Order Tax: |
{{$symbol}} {{formatPrice((float)$return_purchase['TaxNet'], 2, $priceFormat)}} |
| Discount: |
- {{$symbol}} {{formatPrice((float)$return_purchase['discount'], 2, $priceFormat)}} |
| Shipping: |
{{$symbol}} {{formatPrice((float)$return_purchase['shipping'], 2, $priceFormat)}} |
| TOTAL RETURN: |
{{$symbol}} {{formatPrice((float)$return_purchase['GrandTotal'], 2, $priceFormat)}} |
| Refunded: |
{{$symbol}} {{formatPrice((float)$return_purchase['paid_amount'], 2, $priceFormat)}} |
| Amount Due: |
{{$symbol}} {{formatPrice((float)$return_purchase['due'], 2, $priceFormat)}} |
|
@if($setting['is_invoice_footer'] && $setting['invoice_footer'] !==null)
{{$setting['invoice_footer']}}
@endif
Thank you for your business!