@extends('platform.layout') @section('title', 'Income') @section('content') @php($monthNames = [1 => 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'])

Income

What each pharmacy has paid you, month by month (by date paid).

Total income {{ $year }}
{{ formatCurrency($yearTotal) }}
Average per month
{{ formatCurrency($monthsCounted ? $yearTotal / $monthsCounted : 0) }}
{{ $monthsCounted ? 'over ' . $monthsCounted . ' ' . ($monthsCounted == 1 ? 'month' : 'months') . ' since the first payment' : 'no income yet' }}
Pending approval (not yet counted)
{{ formatCurrency($pendingTotal) }}
{{-- Pharmacy x month --}}
@foreach($monthNames as $m => $name) @endforeach @forelse($tenants as $row) @foreach($monthNames as $m => $name) @php($amount = $row['months'][$m] ?? 0) @endforeach @empty @endforelse @foreach($monthNames as $m => $name) @endforeach
Pharmacy {{ $name }} Total {{ $year }} Pending
{{ $row['tenant']->name }}
{{ $row['tenant']->planName() }}
{{ $amount ? number_format($amount) : '–' }} {{ formatCurrency($row['total']) }} @if($row['pending']) {{ number_format($row['pending']) }} @else – @endif
No shops yet.
Total{{ $monthTotals[$m] ? number_format($monthTotals[$m]) : '–' }}{{ formatCurrency($yearTotal) }} {{ $pendingTotal ? number_format($pendingTotal) : '–' }}
Amounts in MWK. Click a month to list its payments.
{{-- Payments of the selected month --}}

Payments in {{ \Carbon\Carbon::create($year, $month)->format('F Y') }}

{{ formatCurrency($monthTotals[$month]) }}
@forelse($monthPayments as $payment) @empty @endforelse
Date paidPharmacyForMethodReferenceRecorded byAmount
{{ $payment->paid_on->format('d M Y') }} {{ $payment->tenant->name ?? '—' }} {{ $payment->months }} {{ $payment->months == 1 ? 'month' : 'months' }}
{{ $payment->period_from->format('d M') }} – {{ $payment->period_to->format('d M Y') }}
{{ $payment->method ?? '—' }} {{ $payment->reference ?? '—' }} {{ $payment->recorded_by }} {{ formatCurrency($payment->amount) }}
No payments in this month.
@endsection