@extends('layouts.app') @section('content')
Fosa Details
Member Number
{{Auth::user()->member_number}}
Member Name
{{Auth::user()->fname}} {{Auth::user()->lname}}
Member Status
{{Auth::user()->member ? Auth::user()->member->status : 'N/A' }}
Account Balance
Ksh. {{number_format($totalBalance)}}

From date: To date:

@php $balance = 0; // Initialize the balance variable $totalDebit = 0; // Initialize the total debit variable $totalCredit = 0; // Initialize the total credit variable $minDate = ''; // Define and initialize the $minDate variable $maxDate = ''; // Define and initialize the $maxDate variable // Check if the start_date and end_date are provided in the URL parameters if (isset($_GET['start_date']) && isset($_GET['end_date'])) { $minDate = $_GET['start_date']; // Assign the value from the start_date input field $maxDate = $_GET['end_date']; // Assign the value from the end_date input field } else { // If no date range is provided, set the $minDate and $maxDate to cover all records $minDate = '0000-00-00'; $maxDate = '9999-12-31'; } @endphp @foreach($transactions as $transaction) @php // Calculate the balance based on transaction type if ($transaction->transaction_type === 'Debit') { $balance -= $transaction->transaction_amount; // Subtract debit amount $totalDebit += $transaction->transaction_amount; // Add debit amount to total } elseif ($transaction->transaction_type === 'Credit') { $balance += $transaction->transaction_amount; // Add credit amount $totalCredit += $transaction->transaction_amount; // Add credit amount to total } @endphp @php $transactionDate = strtotime($transaction->transaction_date); $minDateFilter = strtotime($minDate); $maxDateFilter = strtotime($maxDate); $isWithinDateRange = ($minDateFilter <= $transactionDate) && ($transactionDate <= $maxDateFilter); @endphp @if ($isWithinDateRange) @endif @endforeach
Account Type Date Posted Debit Amount Credit Amount Balance
{{ $transaction->account->accountType->name }} {{ $transaction->transaction_date }} {{ $transaction->transaction_type === 'Debit' ? number_format($transaction->transaction_amount) : '' }} {{ $transaction->transaction_type === 'Credit' ? number_format($transaction->transaction_amount) : '' }} {{ number_format($balance) }}
Totals {{ number_format($totalDebit) }} {{ number_format($totalCredit) }} {{ number_format($balance) }}
Search by Account Type
@endsection @pushOnce('scripts') @auth @endauth @endPushOnce