@push('header') @endpush
{{-- Date --}}
{{-- Supplier Filter --}}
{{-- Designation Filter --}}
{{-- Multi-Select Salesman --}}

Moon Traders
CASH DETAIL REPORT
Date:{{ \Carbon\Carbon::parse($date)->format('d-M-Y') }}
@if($supplierId) Supplier: {{ $suppliers->find($supplierId)->supplier_name }}
@endif @if($designation) Designation: {{ $designation }}
@endif @if(!empty($employeeIds)) Salesmen: @foreach($allEmployees->whereIn('id', $employeeIds) as $emp) {{ $emp->name }}@if(!$loop->last), @endif @endforeach
@endif Printed by: {{ auth()->user()->name }} | {{ now()->format('d-M-Y h:i A') }}

{{-- Main Content Grid --}} @php // Calculate maximum rows to ensure all tables identify with the same height // Natural rows for Cash Detail is 8 (7 denoms + 1 coin) $maxRows = max($salesmanData->count(), $bankSlipsData->count(), 8); $maxRows2 = max($bankTransfersData->count(), $chequesData->count(), 1); @endphp
{{-- 1. Salesman Cash --}}

Salesman Cash

@php $totalSalesmanAmount = 0; @endphp @forelse($salesmanData as $index => $data) @php $totalSalesmanAmount += $data->amount; @endphp @empty @endforelse {{-- Filler rows --}} @for($i = $salesmanData->count(); $i < $maxRows; $i++) @endfor
Sr.# Salesman Amount
{{ $loop->iteration }} {{ $data->salesman_name }} {{ $data->amount > 0 ? number_format($data->amount, 0) : '-' }}
No data found
     
Total: {{ number_format($totalSalesmanAmount, 0) }}
{{-- 2. Cash Detail --}}

Cash Detail

@php $grandTotalCash = 0; $denomsList = [5000, 1000, 500, 100, 50, 20, 10]; $sr = 1; @endphp @foreach($denomsList as $val) @php $qty = $denominations[$val] ?? 0; $subtotal = $qty * $val; $grandTotalCash += $subtotal; @endphp @endforeach {{-- Coins --}} @php $coins = $denominations['coins'] ?? 0; $grandTotalCash += $coins; @endphp {{-- Filler rows --}} @for($i = 8; $i < $maxRows; $i++) @endfor
Sr.# Denom Qty Value
{{ $sr++ }} {{ $val }} {{ $qty > 0 ? $qty : '-' }} {{ $qty > 0 ? number_format($subtotal, 0) : '-' }}
{{ $sr++ }} Coins - {{ $coins > 0 ? number_format($coins, 0) : '-' }}
       
Total: {{ number_format($grandTotalCash, 0) }}
{{-- 3. Bank Slips --}}

Bank Slips

@php $totalBankSlips = 0; @endphp @forelse($bankSlipsData as $index => $slip) @php $totalBankSlips += $slip->amount; @endphp @empty @endforelse {{-- Filler rows --}} @for($i = $bankSlipsData->count(); $i < $maxRows; $i++) @endfor
Sr.# Salesman Amount
{{ $loop->iteration }} {{ $slip->salesman_name }} {{ $slip->amount > 0 ? number_format($slip->amount, 2) : '-' }}
No bank slips
     
Total: {{ number_format($totalBankSlips, 2) }}
{{-- Grand Total Summary --}}
Grand Total (Salesman Cash + Bank Slips): {{ number_format($totalSalesmanAmount + $totalBankSlips, 2) }}
{{-- Row 2: Bank Transfers + Cheques --}}
{{-- 4. Bank Transfers --}}

Bank Transfers

@php $totalBankTransfers = 0; @endphp @forelse($bankTransfersData as $row) @php $totalBankTransfers += $row->amount; @endphp @empty @endforelse @for($i = $bankTransfersData->count(); $i < $maxRows2; $i++) @endfor
Sr.# Salesman Amount
{{ $loop->iteration }} {{ $row->salesman_name }} {{ $row->amount > 0 ? number_format($row->amount, 2) : '-' }}
No bank transfers
     
Total: {{ number_format($totalBankTransfers, 2) }}
{{-- 5. Cheques --}}

Cheques

@php $totalCheques = 0; @endphp @forelse($chequesData as $row) @php $totalCheques += $row->amount; @endphp @empty @endforelse @for($i = $chequesData->count(); $i < $maxRows2; $i++) @endfor
Sr.# Salesman Amount
{{ $loop->iteration }} {{ $row->salesman_name }} {{ $row->amount > 0 ? number_format($row->amount, 2) : '-' }}
No cheques
     
Total: {{ number_format($totalCheques, 2) }}
{{-- Grand Total Row 2: Bank Transfers + Cheques --}}
Grand Total (Bank Transfers + Cheques): {{ number_format($totalBankTransfers + $totalCheques, 2) }}
{{-- Overall Grand Total --}}
Overall Grand Total (Cash + Bank Slips + Bank Transfers + Cheques): {{ number_format($totalSalesmanAmount + $totalBankSlips + $totalBankTransfers + $totalCheques, 2) }}
@push('scripts') @endpush