@php // ✅ School profile (optional) $schoolInfo = \App\Models\SchoolProfile::first(); $schoolName = $schoolInfo->school_name ?? config('app.name'); $address = $schoolInfo->address ?? ''; $phone = $schoolInfo->phone ?? ''; $eiin = $schoolInfo->eiin_number ?? ''; $logo = $schoolInfo->school_logo ?? null; $saleDate = \Carbon\Carbon::parse($productSale->sale_date)->format('d-F-Y'); // Student info $studentName = ($productSale->student?->student_name_english) ?? 'N/A'; $studentId = ($productSale->student?->admission_roll) ?? 'N/A'; // Optional extras (if exists in your student model) $className = $productSale->student?->classModel?->name ?? ($productSale->student?->class_model?->name ?? 'N/A'); $groupName = $productSale->student?->group_name ?? '--'; $sectionName = $productSale->student?->section?->name ?? 'N/A'; @endphp
{{-- LEFT: Student Copy --}}
@if(!empty($logo)) @endif

{{ $schoolName }}

{{ $address }}

Phone: {{ $phone }} | EIIN: {{ $eiin }}

Product Sale Receipt — Student Copy

Invoice: {{ $productSale->sale_no }} | Date: {{ $saleDate }}

Student Information

Name: {{ $studentName }}

Student ID: {{ $studentId }}

Class: {{ $className }}

Group: {{ $groupName }}

Section: {{ $sectionName }}

Payment: {{ strtoupper($productSale->payment_method) }}

Sale Details
@php $count = 0; @endphp @foreach($productSale->items as $item) @php $count++; @endphp @endforeach
SL Description Qty Unit Total
{{ $count }} {{ $item->product->name ?? 'N/A' }} {{ $item->quantity }} {{ number_format($item->unit_price,0) }} {{ number_format($item->total_price,0) }}
Total {{ number_format($productSale->total_amount,0) }}
Paid {{ number_format($productSale->total_amount,0) }}
Total Due 0
{{-- RIGHT: School Copy --}}
@if(!empty($logo)) @endif

{{ $schoolName }}

{{ $address }}

Phone: {{ $phone }} | EIIN: {{ $eiin }}

Product Sale Receipt — School Copy

Invoice: {{ $productSale->sale_no }} | Date: {{ $saleDate }}

Student Information

Name: {{ $studentName }}

Student ID: {{ $studentId }}

Class: {{ $className }}

Group: {{ $groupName }}

Section: {{ $sectionName }}

Payment: {{ strtoupper($productSale->payment_method) }}

Sale Details
@php $count = 0; @endphp @foreach($productSale->items as $item) @php $count++; @endphp @endforeach
SL Description Qty Unit Total
{{ $count }} {{ $item->product->name ?? 'N/A' }} {{ $item->quantity }} {{ number_format($item->unit_price,0) }} {{ number_format($item->total_price,0) }}
Total {{ number_format($productSale->total_amount,0) }}
Paid {{ number_format($productSale->total_amount,0) }}
Total Due 0