@extends('layouts.adminapp')
@section('title') {{ __('lng.PendingStudentVehicleFeeReport') }} - {{ __('lng.StudentDetails') }} @endsection
@section('active_report', 'active')
@section('open_report', 'open')
@section('open_student_report', 'open')
@section('active_student_report', 'active')
@section('active_student_pending_vehicle_report', 'active')
@section('content')
    
    
    
    
    
    
        
        
            
                
                    
                        
                            | {{ __('lng.SiNo') }} | {{ __('lng.Name') }} | {{ __('lng.Contact') }} | {{ __('lng.Vehicle') }} | {{ __('lng.Route') }} | {{ __('lng.BalanceAmount') }} | 
                    
                    
                        @php $i=0;@endphp
                        @foreach ($Students as $Student)
                            @if ($Student->VehicleFee->Route ?? '')
                                @php
                                    $SetFeeAmounts = App\Models\StudentVehicleSetFee::where(
                                        'student_vehicle_route_id',
                                        $Student->VehicleFee->id,
                                    )
                                        ->where('batch_year', $Student->batch_year)
                                        ->where(function ($query) {
                                            $query->where('isCancelled', 0)->orWhere('isCancelled', null);
                                        })
                                        ->sum('total_amount');
                                    $PayedAmounts = App\Models\StudentVehiclePayFee::where('student_id', $Student->id)
                                        ->where('batch_year', $Student->batch_year)
                                        ->where(function ($query) {
                                            $query->where('isCancelled', 0)->orWhere('isCancelled', null);
                                        })
                                        ->sum('amount');
                                    $Balance = $SetFeeAmounts - $PayedAmounts;
                                @endphp
                                @if ($Balance > 0)
                                    
                                        | {{ ++$i }} | {{ $Student->name }} | {{ $Student->mobile }} | {{ $Student->VehicleFee->Vehicle->name ?? '' }} | {{ $Student->VehicleFee->Route->title ?? '' }} | @currency($Balance) | 
                                @endif
                            @endif
                        @endforeach
                    
                
             
         
        
     
    
    
    
    
@endsection