@extends('layouts.app') @section('title', __('Daily Report')) @section('content')

{{ __('Daily Report') }}

@component('components.widget', ['title' => __('report.filters')])
@endcomponent
@component('components.widget', ['class' => 'box-primary'])
@foreach($transactions as $transaction) @endforeach
# Invoice No Location Date Amount Added By
{{ $loop->iteration }} {{ $transaction->invoice_no }} {{ $transaction->location_name }} {{ \Carbon\Carbon::parse($transaction->transaction_date)->format('d/m/Y H:i') }} {{ number_format($transaction->final_total, 2) }} {{ $transaction->added_by }}

{{ __('Credit Payments') }}

@forelse($creditPayments as $cp) @php // === PAYMENT METHOD – SAME LOGIC AS PAYMENT & EXPENSE SUMMARY === $rawMethod = $cp->method; $method = ucfirst($rawMethod); if (in_array($method, ['Cash', 'Card', 'Bank Transfer', 'Cheque', 'Other'])) { // Standard method – keep as-is } else { // Custom method: use label from business settings $method = $customLabels[$rawMethod] ?? ucfirst(str_replace('_', ' ', $rawMethod)); } $customer = $cp->customer_name ?? $cp->supplier_business_name ?? '-'; @endphp @empty @endforelse
# {{ __('Invoice No') }} {{ __('Transaction Date') }} {{ __('Customer') }} {{ __('Payment Method') }} {{ __('Amount') }} {{ __('Paid On') }}
{{ $loop->iteration }} {{ $cp->invoice_no }} {{ $cp->sell_date?->format('d/m/Y H:i') ?? '-' }} {{ $customer }} {{ $method }} {{ number_format($cp->amount, 2) }} {{ $cp->paid_on?->format('d/m/Y H:i') ?? '-' }}
{{ __('No credit payments found for the selected filters.') }}
{{ __('Total Credit Payments') }}: {{ number_format($totalCreditAmount, 2) }}

@component('components.widget', ['class' => 'box-primary'])

{{ __('Payment Summary') }}

@foreach($paymentMethodsFormatted as $method => $amount) @endforeach
Payment Method Amount
{{ $method }} {{ number_format($amount, 2) }}
@endcomponent
@component('components.widget', ['class' => 'box-primary'])

{{ __('Expense Summary') }}

@foreach($expensesFormatted as $expense) @endforeach
Expense Category Amount Payment Method
{{ $expense['category_name'] }} {{ number_format($expense['total_expense'], 2) }} {{ $expense['method'] }}
@endcomponent



@component('components.widget', ['class' => 'box-primary'])

{{ __('Money in Hand') }}

@php $totalAmountInHand = 0; // Variable to keep track of the total amount in hand // Get all unique payment methods from both summaries $allPaymentMethods = collect($paymentMethodsFormatted)->keys()->merge(collect($expensesFormatted)->pluck('method'))->unique(); @endphp @foreach($allPaymentMethods as $method) @php // Get the payment amount for the current method, default to 0 if not found $paymentAmount = $paymentMethodsFormatted[$method] ?? 0; // Get all expenses for the current payment method, default to 0 if not found $matchingExpenses = collect($expensesFormatted)->filter(function($expense) use ($method) { return $expense['method'] == $method; }); // Sum the total expense for the current payment method, default to 0 if not found $totalExpense = $matchingExpenses->sum('total_expense'); // Calculate remaining amount (amount in hand) $remainingAmount = $paymentAmount - $totalExpense; $totalAmountInHand += $remainingAmount; // Add to the total @endphp @endforeach
Payment Method Amount Amount in Hand
{{ $method }} {{ number_format($paymentAmount, 2) }} {{ number_format($remainingAmount, 2) }}
{{ __('Total Amount in Hand') }} {{ number_format($totalAmountInHand, 2) }}
@endcomponent
@endcomponent
@endsection @section('javascript') @endsection