@csrf @php $hasInvoice = isset($invoice) && $invoice !== null; $hasPayment = $hasInvoice && \App\Models\Payment::where('subscription_history_id', $history_id)->exists(); $totalPaid = $hasInvoice ? \App\Models\Payment::where('subscription_history_id', $history_id)->sum('amount_paid') : 0; $isFullyPaid = $hasInvoice && $invoice->total_amount > 0 && $totalPaid >= $invoice->total_amount; $isPartialPaid = $hasInvoice && $totalPaid > 0 && $totalPaid < $invoice->total_amount; $remainingAmount = $hasInvoice ? $invoice->total_amount - $totalPaid : 0; $isCreditNote = $hasInvoice && $invoice->is_credit_note; @endphp
students

Rate: ₹{{ number_format($monthly_rate_per_student ?? ($invoice->monthly_rate ?? 0)) }}/student/month × {{ $duration_months ?? ($history->duration_months ?? 1) }} month(s)

Calculated Base

₹0.00

Invoice Settings

@if($hasPayment)

{{ $isFullyPaid ? 'Fully Paid & Locked' : 'Partial Payment Received' }}

@endif

Apply GST (18%)

CGST 9% + SGST 9%

Apply Discount

Special offer or adjustment

@if($hasInvoice && $invoice->discount_amount > 0)

Applied: ₹{{ number_format($invoice->discount_amount, 2) }} @if($invoice->discount_type === 'percentage') ({{ $invoice->discount_value }}%) @endif

@endif

Invoice Summary

Rate per Student: ₹{{ number_format($monthly_rate_per_student ?? ($invoice->monthly_rate ?? 0), 2) }}/mo
Students: -
Duration: {{ $duration_months ?? ($history->duration_months ?? 1) }} month(s)
Base Amount: ₹0.00
Taxable Amount: ₹0.00
Total Amount: ₹0.00
@if(!$hasPayment) @else @endif @if($hasInvoice) @if(!$isCreditNote) @if($isFullyPaid) @elseif($isPartialPaid) @else @endif @endif @endif
@if($hasPayment)

{{ $isFullyPaid ? 'Invoice Fully Paid & Locked' : 'Partial Payment Received' }}

@if($isFullyPaid) This invoice has been fully paid. Save is disabled. @else Partial payment of ₹{{ number_format($totalPaid, 2) }} received. Balance: ₹{{ number_format($remainingAmount, 2) }}. @endif

@endif