Upedia Academy
10062 Al Ahli Bank Building
Zahraa Al Maadi, Cairo, Egypt

Invoice

#{{ $studentInvoice->invoice_number }}
Date: {{ $studentInvoice->created_at->format('Y-m-d') }}
@php $pdfCompletionStatusClass = $studentInvoice->display_completion_status === 'complete' ? 'bg-success' : 'bg-warning'; $pdfLastSessionAt = $studentInvoice->display_last_session_at; $pdfNetPrice = (float) ($studentInvoice->display_total_amount ?? ($studentInvoice->net_price ?? $studentInvoice->total_price ?? 0)); $pdfPaidAmount = (float) ($studentInvoice->display_paid_amount ?? 0); $receivedAmounts = app(\App\Services\InvoiceReceiptPresentationService::class)->groups($studentInvoice); $pdfDepositAmount = (float) ($studentInvoice->display_deposit_amount ?? 0); $pdfRemainingAmount = (float) ($studentInvoice->display_remaining_amount ?? max($pdfNetPrice - $pdfPaidAmount, 0)); @endphp
Student Information
Name: {{ $studentInvoice->student->first_name }} {{ $studentInvoice->student->last_name }} Email: {{ $studentInvoice->student->email ?? 'Not available' }}
Completion Status: {{ $studentInvoice->display_completion_status_label }} Last Session: {{ $pdfLastSessionAt ? $pdfLastSessionAt->format('Y-m-d H:i') : 'Not available' }}
Payment Status: {{ $studentInvoice->display_payment_status_label ?? ucfirst(str_replace('_', ' ', $studentInvoice->payment_status ?? 'not_paid')) }} Deposit: {{ $pdfDepositAmount > 0 ? number_format($pdfDepositAmount, 2) : 'Not available' }}
@if ($studentInvoice->transactions && $studentInvoice->transactions->count() > 0)
Transaction Details
@foreach ($studentInvoice->transactions as $index => $transaction) @endforeach
# Payment Type Amount Status
{{ $index + 1 }} {{ ucfirst($transaction->payment_type) }} {{ number_format($transaction->treasury_amount ?? $transaction->amount, 2) }} {{ $transaction->treasury_currency ?: $transaction->currency }} @if ($transaction->status == 'pending') Pending @elseif ($transaction->status == 'accepted') Accepted @elseif ($transaction->status == 'rejected') Rejected @else {{ ucfirst($transaction->status) }} @endif
@endif
@if ($studentInvoice->type === 'track') Track Details @elseif($studentInvoice->product) Product Details @else Course Details @endif
@if ($studentInvoice->type === 'track') @else @endif @if ($studentInvoice->type === 'track') @foreach ($studentInvoice->courseStudentInvoices as $item) @php $course = $item->course; @endphp @endforeach @else @foreach ($studentInvoice->courseStudentInvoices as $item) @php $course = $item->course; @endphp @endforeach @endif
Course Start End Teacher PriceName Start End Teacher Price
{{ $course->track->name_en }} {{ $course->start_date }} {{ $course->end_date }} @if ($course->staff) {{ $course->staff->first_name }} {{ $course->staff->last_name }} @else — @endif {{ number_format($studentInvoice->total_price, 2) }}
{{ $course->academyProduct->name_en }} {{ $course->start_date }} {{ $course->end_date }} @if ($course->staff) {{ $course->staff->first_name }} {{ $course->staff->last_name }} @else — @endif {{ number_format($studentInvoice->total_price, 2) }}
@if ($studentInvoice->promocode_id)
Promocode Details
Code: {{ $studentInvoice->promocode->code }} Type: {{ ucfirst($studentInvoice->promocode_type) }} Discount: @if ($studentInvoice->promocode_type == 'fixed') {{ number_format($studentInvoice->promocode_price, 2) }} @else {{ number_format($studentInvoice->promocode_price, 0) }}% @endif
@endif @if ($studentInvoice->discount_plan_id)
Pricing Plan Details
Plan: {{ $studentInvoice->discountPlan->name_en }} Total Price: {{ number_format($studentInvoice->total_price, 2) }} Discount: @if ($studentInvoice->discount_plan_type == 'fixed') {{ number_format($studentInvoice->discount_plan_price, 2) }} @else {{ number_format($studentInvoice->discount_plan_price, 0) }}% @endif After Discount: {{ number_format($studentInvoice->net_price, 2) }}
@endif @php $pdfTotalPrice = (float) ($studentInvoice->total_price ?? 0); $pdfDiscountAmount = max($pdfTotalPrice - $pdfNetPrice, 0); $pdfVatAmount = (float) ($studentInvoice->vat_amount ?? 0); if ($pdfVatAmount <= 0) { $pdfVatAmount = max($pdfNetPrice - $pdfTotalPrice + $pdfDiscountAmount, 0); } $pdfVatRate = (float) ($studentInvoice->vat_rate ?? 0); @endphp @if($pdfVatAmount > 0)
VAT{{ $pdfVatRate > 0 ? ' (' . number_format($pdfVatRate, 2) . '%)' : '' }}: {{ number_format($pdfVatAmount, 2) }}
@endif
@if($pdfDepositAmount > 0) @endif
Final Total: @if($pdfRemainingAmount <= 0 && $receivedAmounts) @include('dashboard.student_invoices._received_amounts', ['receiptGroups' => $receivedAmounts]) @else {{ number_format($pdfNetPrice, 2) }} {{ $studentInvoice->currency ?: 'EGP' }} @endif
Paid: @include('dashboard.student_invoices._received_amounts', ['receiptGroups' => $receivedAmounts, 'receiptFallbackAmount' => $pdfPaidAmount, 'receiptFallbackCurrency' => $studentInvoice->currency ?: 'EGP'])
Deposit: @include('dashboard.student_invoices._received_amounts', ['receiptGroups' => $receivedAmounts, 'receiptFallbackAmount' => $pdfDepositAmount, 'receiptFallbackCurrency' => $studentInvoice->currency ?: 'EGP'])
Remaining: {{ number_format($pdfRemainingAmount, 2) }}