@extends('master.authMaster') @section('content') {{-- Form --}}

Members Yearly Record

Membership Total Amount :

0

@php // Check if yearly subscription exists in income heads $yearlyIncomeHead = $incomeHeads->first(function ($h) { $normalized = strtolower(str_replace(' ', '', trim($h->income_head_name))); return $normalized === 'yearlysubscription'; }); $yearlyIncomeHeadId = $yearlyIncomeHead->income_head_id ?? null; @endphp @if ($yearlyIncomeHead) @endif @foreach ($incomeHeads as $head) @php $normalizedHead = strtolower(str_replace(' ', '', trim($head->income_head_name))); @endphp @if ($normalizedHead !== 'yearlysubscription') @endif @endforeach @if ($yearlyIncomeHead) @endif @foreach ($donationData as $donorId => $data) @php $incomes = $data['incomes'] ?? []; $total = 0; @endphp {{-- Yearly Subscription --}} @if ($yearlyIncomeHead) @php $yearlyTransactions = $incomes[$yearlyIncomeHeadId] ?? []; $subscriptionSummary = $data['subscription_summary'] ?? ['subscription_total' => 0, 'contingent_total' => 0, 'is_completed' => 0]; $subscriptionFee = $subscriptionSummary['subscription_total'] ?? 0; $contingentFee = $subscriptionSummary['contingent_total'] ?? 0; $isSubscriptionCompleted = $subscriptionSummary['is_completed'] ?? 0 ; $total += $subscriptionFee + $contingentFee; @endphp @endif {{-- Other income heads --}} @foreach ($incomeHeads as $head) @php $headId = $head->income_head_id; $normalizedHead = strtolower(str_replace(' ', '', trim($head->income_head_name))); $transactions = $incomes[$headId] ?? []; $headTotal = array_sum(array_column($transactions, 'amount')); if ($normalizedHead !== 'yearlysubscription') { $total += $headTotal; } @endphp @if ($normalizedHead !== 'yearlysubscription') @if(!empty($transactions)) @foreach($transactions as $tran) @endforeach @endif @endif @endforeach @endforeach
Member NameYearly Subscription{{ ucwords($head->income_head_name) }} (₹)Total(₹)
Subscription Fee(₹) Contingent Fee(₹)
{{ $data['donor']->donor_name }} @php $totalPaid = $subscriptionFee + $contingentFee; @endphp @if($totalPaid > 0 && $totalPaid < 500) {{ number_format($subscriptionFee, 2) }} {{-- @foreach($yearlyTransactions as $tran) ({{ $tran['date'] }}) @endforeach --}} {{-- Case 2: Not paid yet (show + if not completed) --}} @elseif($totalPaid == 0 && !$isSubscriptionCompleted) {{-- Case 3: Fully paid (no button, just amount) --}} @elseif($totalPaid >= 500) {{ number_format($subscriptionFee, 2) }} {{-- @foreach($yearlyTransactions as $tran) ({{ $tran['date'] }}) @endforeach --}} @endif @if(($subscriptionFee + $contingentFee) > 0) {{ number_format($contingentFee, 2) }} {{-- @foreach($yearlyTransactions as $tran) ({{ $tran['date'] }}) @endforeach --}} @endif @if(!empty($transactions)) {{ $headTotal }} Problem @endif
{{--
--}} @endsection