@extends('layouts.master') @push('css') @endpush @section('content')

Loan / Advance Summary Report

{{-- ── Filter Form ── --}}
@if($reportData && count($reportData['departments'])) Print @endif

@if($reportData !== null) @if(empty($reportData['departments']))
No loan/advance records found for the selected period.
@else @php $n = fn($v) => $v ? number_format($v, 0) : '-'; $n0 = fn($v) => number_format($v, 0); @endphp {{-- Summary Cards --}}
Total Opening {{ $n($reportData['grand']['opening']) }}
Total Payments {{ $n0($reportData['grand']['payments']) }}
Total Deductions {{ $n0($reportData['grand']['deductions']) }}
Total Balance {{ $n0($reportData['grand']['balance']) }}
{{-- ── Report Table ── --}}
M.D.S
Loan / Advance Summary Report
From: {{ \Carbon\Carbon::parse($fromDate)->format('d/m/Y') }}  To:  {{ \Carbon\Carbon::parse($toDate)->format('d/m/Y') }} @if($selectedEmployee)  |  Employee: {{ $selectedEmployee->first_name }} {{ $selectedEmployee->last_name }} @endif @if($selectedDepartment)  |  Dept: {{ $selectedDepartment->name }} @endif
@foreach($reportData['departments'] as $deptName => $deptData) {{-- Department row --}} @foreach($deptData['rows'] as $row) @endforeach {{-- Dept Totals --}} @endforeach {{-- Grand Totals --}}
Name Designation Card No Opening Payments Deductions Balance
{{ $deptName }}
{{ $row['employee_name'] }} {{ $row['designation'] }} {{ $row['card_no'] }} {{ $n($row['opening']) }} {{ $n($row['payments']) }} {{ $n($row['deductions']) }} {{ $n($row['balance']) }}
Dept. Totals ==> {{ $n($deptData['totals']['opening']) }} {{ $n0($deptData['totals']['payments']) }} {{ $n0($deptData['totals']['deductions']) }} {{ $n0($deptData['totals']['balance']) }}
GRAND TOTALS ==> {{ $n($reportData['grand']['opening']) }} {{ $n0($reportData['grand']['payments']) }} {{ $n0($reportData['grand']['deductions']) }} {{ $n0($reportData['grand']['balance']) }}
{{-- .lar-wrap --}} @endif @endif
@endsection