@extends('layout.app') @section('content')
{{-- One compact filter line: six fields across, then the buttons and the note. .commission-select, not .select2, so only this page's init claims them — the global .select2 initializer would bind them a second time. --}}
{{-- Month-only period: the controller snaps "from" to the 1st and "to" to the month end. --}}
{{-- Held managers are listed by default; picking some here makes the report a lookup of exactly those. --}}
Managers with no recharge, no commission and no dues here are hidden — pick them in Manager to see a zero row. Hold managers are listed too (marked Commission on hold) — pick them in Hold Manager to see only those. Reset {{-- Export carries the filters that produced what is on screen. --}} Excel
{{--

Commission period: {{ $fromLabel }} — {{ $toLabel }}. Net = Total Commission (Calculated) − Core Rent due − Monthly Installment due − Real IP Bill due − Product Installment due − Advance Commission.
Core Rent / Monthly Installment / Real IP Bill due = billed − cash-paid, for bills created within this period. Product Installment is schedule-based: only the monthly installments due within this period count ((Total − Speed Money) ÷ Count, monthly from approval). Advance Commission is also recovered in installments (Amount ÷ Count, monthly from the advance month) — only the installment due within the period is deducted. Amounts cleared via Settle Dues are paid from commission, so they stay deducted from Net; only manual/cash payments reduce the deduction.

--}} @php $gTotalAmount = $rows->sum('total_amount'); $gCompanyAmount = $rows->sum('company_amount'); $gCommission = $rows->sum('commission'); $gCoreRent = $rows->sum('core_rent'); $gMonthly = $rows->sum('monthly'); $gRealIp = $rows->sum('real_ip'); $gProduct = $rows->sum('product'); $gAdvance = $rows->sum('advance'); $gDeduction = $rows->sum('deduction'); $gNet = $rows->sum('net'); @endphp
@can('manager-commission-settle') @endcan @can('manager-commission-settle') @endcan @forelse ($rows as $i => $row) @php // Manager name with its type in brackets, e.g. "Rahim (Own)". $managerLabel = $row->reseller->name . ($row->reseller->reseller_type ? ' (' . ucfirst($row->reseller->reseller_type) . ')' : ''); @endphp @can('manager-commission-settle') @endcan @empty @endforelse
# Manager ID Manager Total Amount Company Amount Total Commission (Calculated) Type Core Rent Due Monthly Installment Due Real IP Bill Due Product Installment Due Advance Commission Total Deduction Net Commission Account No Account Name Bank Name Branch Name Routing NoAction
Total {{ number_format($gTotalAmount, 2) }} {{ number_format($gCompanyAmount, 2) }} {{ number_format($gCommission, 2) }} {{ number_format($gCoreRent, 2) }} {{ number_format($gMonthly, 2) }} {{ number_format($gRealIp, 2) }} {{ number_format($gProduct, 2) }} {{ number_format($gAdvance, 2) }} {{ number_format($gDeduction, 2) }} {{ number_format($gNet, 2) }}
{{ $i + 1 }} {{ $row->reseller->id }} {{ $managerLabel }} {{ number_format($row->total_amount, 2) }} {{ number_format($row->company_amount, 2) }} {{ number_format($row->commission, 2) }} {{ ucfirst($row->reseller->reseller_type) }} {{ $row->core_rent > 0 ? number_format($row->core_rent, 2) : '—' }} {{ $row->monthly > 0 ? number_format($row->monthly, 2) : '—' }} {{ $row->real_ip > 0 ? number_format($row->real_ip, 2) : '—' }} {{ $row->product > 0 ? number_format($row->product, 2) : '—' }} {{ $row->advance > 0 ? number_format($row->advance, 2) : '—' }} {{ number_format($row->deduction, 2) }} {{ number_format($row->net, 2) }} {{ $row->reseller->bank_account_no ?? '—' }} {{ $row->reseller->account_name ?? '—' }} {{ $row->reseller->bank_name ?? '—' }} {{ $row->reseller->branch_name ?? '—' }} {{ $row->reseller->routing_number ?? '—' }} @if ($row->reseller->commission_hold) {{-- Listed through the Commission Status filter, but nothing is payable while the commission is withheld. --}} Commission on hold @else @if ($row->unpaid > 0)
@csrf
@elseif ($row->core_rent + $row->monthly + $row->real_ip + $row->product + $row->advance > 0) Paid @endif {{-- Advance commission is own-type only. Recovery starts next month, so a carried deficit leaves this period's Net at 0 — the button is driven by `carryable` (deficit minus what is already booked), never by Net, so a second press cannot mint a duplicate advance. --}} @if ($row->carryable > 0 && $row->reseller->reseller_type === 'own') @endif @if ($row->carried > 0) Carried {{ number_format($row->carried, 2) }} @endif @if ($row->unpaid <= 0 && $row->carried <= 0 && $row->carryable <= 0 && ($row->core_rent + $row->monthly + $row->real_ip + $row->product + $row->advance) <= 0) — @endif @endif
No managers found.
@can('manager-commission-settle') @endcan @endsection @section('ajax') @endsection @include('partials.finance-sticky-table')