@extends('layouts.app') @section('title', 'Bills Management - ISP ERP System') @section('page-title', 'Bills Management') @section('content')

@if(auth()->user()->role === 'mac_reseller') MAC Reseller Bills @else Bills Management @endif

@if(auth()->user()->role === 'mac_reseller') View and manage bills for your MAC reseller clients @else Manage client bills and payments @endif

@if(auth()->user()->role !== 'collector') Generate Bill @endif

{{ $totalBills }}

Total Bills

{{ $pendingBills }}

Pending Bills

{{ $paidBills }}

Paid Bills

{{ $overdueBills }}

Overdue Bills

All Bills
@if(\App\Helpers\PermissionHelper::isSuperUser(auth()->id())) Showing all bills (Super User) @elseif(auth()->user()->role === 'mac_reseller') Showing bills for your MAC reseller clients only @else @php $userBranchId = auth()->user()->branch_id; $hasSubBranches = $userBranchId ? \App\Models\Branch::where('parent_branch_id', $userBranchId)->exists() : false; @endphp @if($hasSubBranches) Showing bills from your main branch and all sub branches (ISP User) @else Showing bills from your branch only (Sub Branch User) @endif @endif
@if(request('search')) @endif
@if(request('search')) @endif
@if(session('success')) @endif @if(session('error')) @endif
@foreach($bills as $bill) @endforeach
Login ID Username Client Name Mobile Bill for Month Package Amount Status Payment Date Due Date Expire Date Created By Actions
@if($bill->clientInfo && $bill->clientInfo->client_login_id)
{{ $bill->clientInfo->client_login_id }} ®
@else N/A @endif
@if($bill->client && $bill->client->username) {{ $bill->client->username }} @else N/A @endif
{{ $bill->clientInfo->full_name ?? 'N/A' }}
@if($bill->clientInfo && $bill->clientInfo->mobile_number) {{ $bill->clientInfo->mobile_number }} @elseif($bill->client && $bill->client->phone) {{ $bill->client->phone }} @else N/A @endif {{ \Carbon\Carbon::createFromFormat('Y-m', $bill->month_year)->format('M, Y') }} @if($bill->client && $bill->client->package_name) {{ $bill->client->package_name }} @elseif($bill->clientInfo && $bill->clientInfo->package) {{ $bill->clientInfo->package }} @else N/A @endif
৳{{ number_format($bill->total_amount, 2) }} @if($bill->discount > 0) Discount: ৳{{ number_format($bill->discount, 2) }} @endif @if($bill->late_fee > 0) Late Fee: ৳{{ number_format($bill->late_fee, 2) }} @endif
@if($bill->status === 'pending') Pending @elseif($bill->status === 'paid') Paid @elseif($bill->status === 'overdue') Overdue @elseif($bill->status === 'cancelled') Cancelled @endif @if($bill->paid_date) {{ \Carbon\Carbon::parse($bill->paid_date)->format('M d, Y') }} @else - @endif {{ $bill->due_date->format('M d, Y') }}
@if($bill->expire_date) {{ $bill->expire_date->format('M d, Y') }} @else - @endif
@if($bill->creator) @else @endif
@if($bill->clientInfo && !$bill->clientInfo->registration_form_no) @endif @if($bill->status === 'pending') @endif
@csrf @method('DELETE')
{{ $bills->links() }}
@if(auth()->user()->role !== 'collector') @endif @endsection