@extends('temple.layouts.app') @section('title', 'Mark Payment — ' . ($receipt->receipt_number ?: $receipt->id)) @section('content') @php /* |-------------------------------------------------------------------------- | DEVOTEE GROUPS (same logic as receipts index / receipt view) |-------------------------------------------------------------------------- */ $devotees = $receipt->devotees ?? collect(); if (! $devotees instanceof \Illuminate\Support\Collection) { $devotees = collect($devotees); } $groups = collect(); foreach ($devotees as $devoteeRow) { $groupItems = $devoteeRow->items ?? collect(); if (! $groupItems instanceof \Illuminate\Support\Collection) { $groupItems = collect($groupItems); } $groups->push([ 'name' => $devoteeRow->devotee_name ?: 'Walk-in Devotee', 'nakshatram' => $devoteeRow->nakshatram, 'items' => $groupItems, ]); } if ($groups->isEmpty()) { $legacyItems = $receipt->items ?? collect(); if (! $legacyItems instanceof \Illuminate\Support\Collection) { $legacyItems = collect($legacyItems); } $groups->push([ 'name' => $receipt->devotee_name ?: 'Walk-in Devotee', 'nakshatram' => $receipt->nakshatram, 'items' => $legacyItems, ]); } $groupCount = $groups->count(); $grandTotal = $groups->sum(function ($group) { return $group['items']->sum(function ($item) { return (float) ($item->amount ?? 0); }); }); $grandQuantity = $groups->sum(function ($group) { return $group['items']->sum(function ($item) { return (int) ($item->quantity ?? 0); }); }); $totalAmount = (float) ($receipt->total_amount ?: $grandTotal); @endphp
Update payment status and collection method for Receipt #{{ $receipt->receipt_number ?: $receipt->id }}
| Vazhipad Offering | Quantity | Amount (₹) |
|---|---|---|
| Devotee {{ $loop->iteration }} — {{ $group['name'] }} @if(!empty($group['nakshatram'])) {{ $group['nakshatram'] }} @endif | ||
| {{ $item->vazhipad?->name ?? $item->vazhipad?->vazhipad_name ?? 'Offering' }} | {{ $item->quantity ?? 1 }} | ₹{{ number_format((float) ($item->amount ?? 0), 2) }} |
| No Vazhipad items found. | ||
| {{ $group['name'] }} Total | {{ $groupQty }} | ₹{{ number_format($groupTotal, 2) }} |
| Grand Total | {{ $grandQuantity }} items | ₹{{ number_format($totalAmount, 2) }} |