@extends('layout.layout') @section('content') @include('components.alert') @php $originalPrice = (float) ($studentInvoice->original_amount ?: $studentInvoice->total_price ?: $studentInvoice->net_price ?: 0); $invoiceTotal = (float) ($studentInvoice->final_amount ?: $studentInvoice->net_price ?: $studentInvoice->total_price ?: 0); $discountAmount = (float) ($studentInvoice->discount_amount ?? max(0, round($originalPrice - $invoiceTotal, 2))); $paidAmount = (float) $studentInvoice->transaction ->whereIn('status', ['paid', 'approved']) ->sum('amount'); $remainingAmount = max(0, round($invoiceTotal - $paidAmount, 2)); $isDepositInvoice = in_array($studentInvoice->payment_status, ['deposite', 'paid_deposite'], true) || (float) ($studentInvoice->deposite ?? 0) > 0; $invoiceStatusLabel = $studentInvoice->payment_status ? ucfirst(str_replace('_', ' ', $studentInvoice->payment_status)) : 'Not paid'; $formatDiscount = function ($type, $value) { $value = (float) ($value ?? 0); if ($value <= 0) { return '0'; } return $type === 'percentage' ? number_format($value, 0) . '%' : number_format($value, 2); }; @endphp
Back to List Download PDF

Upedia

10062 Al Ahli Bank Building, Main Carrefour Street,
Zahraa Al Maadi, Cairo, Egypt

Invoice
{{ $studentInvoice->invoice_number }}
{{ $isDepositInvoice ? 'Deposit invoice' : $invoiceStatusLabel }}
Invoice Date: {{ $studentInvoice->created_at->format('Y-m-d') }}
Student Information

Basic student contact details.

Name
{{ $studentInvoice->student->first_name ?? '' }} {{ $studentInvoice->student->last_name ?? '' }}
Email
{{ $studentInvoice->student->email ?? 'Not available' }}
{{ $isDepositInvoice ? 'Remaining Balance' : 'Final Total' }}
{{ number_format($isDepositInvoice ? $remainingAmount : $invoiceTotal, 2) }}
@if ($isDepositInvoice) Paid {{ number_format($paidAmount, 2) }} from {{ number_format($invoiceTotal, 2) }}. @else Net payable amount after discounts and promocodes. @endif
Invoice Type {{ $isDepositInvoice ? 'Deposit invoice' : 'Full invoice' }}
Invoice Total {{ number_format($invoiceTotal, 2) }}
Discount Amount {{ number_format($discountAmount, 2) }}
Paid Before {{ number_format($paidAmount, 2) }}
Remaining Due {{ number_format($remainingAmount, 2) }}
Original Price {{ number_format($originalPrice, 2) }}
Total Discount {{ number_format($discountAmount, 2) }}
Final Total {{ number_format($invoiceTotal, 2) }}
Transactions

Payment attempts, transaction proof, reasons, and status.

{{ $studentInvoice->transaction->count() }} Transaction(s)
@forelse ($studentInvoice->transaction as $index => $transaction) @empty @endforelse
# Transaction Date Payment Method Amount Transaction Img Reason Status
{{ $index + 1 }} {{ $transaction->created_at->format('Y-m-d H:i') }} {{ $transaction->payment_type }} {{ number_format($transaction->amount, 2) }} @if ($transaction->transaction_img) Transaction Image @else No image @endif {{ $transaction->reason ?? '--' }} @if ($transaction->status == 'paid') Paid @elseif ($transaction->status == 'pending') Pending @else Rejected @endif
No transactions found for this invoice.

There are no payment records attached to this invoice yet.

@if ($studentInvoice->discount_plan_id)
Pricing Plan Details

Applied discount plan information.

Discount Plan {{ $studentInvoice->discount_plan->name_en ?? '' }}
Total Price {{ number_format($originalPrice, 2) }}
Discount {{ $formatDiscount($studentInvoice->discount_plan_type, $studentInvoice->discount_plan_price) }}
@endif @if ($studentInvoice->referral_activity_id)
Referral Discount

Applied referral reward information.

Referral #{{ $studentInvoice->referral_activity_id }}
Discount {{ $formatDiscount($studentInvoice->referral_activity_type, $studentInvoice->referral_activity_price) }}
@endif @if ($studentInvoice->promocode_id)
Promocode Details

Applied promocode information.

Promocode {{ $studentInvoice->promocode->code ?? '' }}
Total Price {{ number_format($originalPrice, 2) }}
Discount {{ $formatDiscount($studentInvoice->promocode_type, $studentInvoice->promocode_price) }}
Net Price {{ number_format($studentInvoice->net_price, 2) }}
@endif
{{ $isDepositInvoice ? 'Remaining Due' : 'Final Total' }}
{{ $isDepositInvoice ? 'Amount still required to complete this invoice.' : 'Amount due after all applied deductions.' }}
{{ number_format($isDepositInvoice ? $remainingAmount : $invoiceTotal, 2) }}
@endsection @push('styles') @endpush