@extends('schoolLayout.app') @section('content')

Student Ledger

@error('start_date')
{{ 'Required' }}
@enderror
@error('end_date')
{{ 'Required' }}
@enderror
@if (request('head_code') && request('start_date') && request('end_date')) Download PDF @endif

Reg No: {{ $regNo ?? 'Null' }}

Student name: {{ $stdName ?? 'Null' }}

Father name: {{ $fthName ?? 'Null' }}

Father CNIC: {{ $fthCnic ?? 'Null' }}

@php $totalDebit = 0; $totalCredit = 0; $runningBalance = $stdOpenBalance ?? 0; @endphp @if ($stdLedger->isNotEmpty()) @foreach ($stdLedger as $item) @php $totalDebit += $item->debit; $totalCredit += $item->credit; $runningBalance += $item->debit - $item->credit; @endphp @endforeach @else @endif
Opening Balance {{ $stdOpenBalance ?? 0 }}
Date Type Description Debit Credit Total
{{ \Carbon\Carbon::parse($item->created_at)->format('Y-m-d') }} {{ $item->transaction_type ?? '-' }} {{ $item->remarks ?? '-' }} {{ $item->debit > 0 ? number_format($item->debit, 2) : '' }} {{ $item->credit > 0 ? number_format($item->credit, 2) : '' }} {{ number_format($runningBalance, 2) }}
No record found.

Total

{{ number_format($totalDebit, 2) }} {{ number_format($totalCredit, 2) }} {{ number_format($stdOpenBalance + $totalDebit - $totalCredit, 2) }}
@endsection