@extends('layouts.app') @section('title', 'Opening Balance - ' . $branch->name . ' - Cash Book') @section('content')

Opening Balance - {{ $branch->name }}

Back to Branches
@if(session('success'))
{{ session('success') }}
@endif @if($errors->any())
    @foreach($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif
Current Currency Rate: 1 SAR = {{ number_format($currencyRate, 2) }} BDT
@csrf @method('PUT')

Cash

Total Cash (SAR): {{ number_format((float)$branch->opening_balance_cash_sr + ((float)$branch->opening_balance_cash_tk / $currencyRate), 2) }}

Bank

Total Bank (SAR): {{ number_format((float)$branch->opening_balance_bank_sr + ((float)$branch->opening_balance_bank_tk / $currencyRate), 2) }}
Combined Opening Balance (SAR): {{ number_format((float)$branch->opening_balance_cash_sr + ((float)$branch->opening_balance_cash_tk / $currencyRate) + (float)$branch->opening_balance_bank_sr + ((float)$branch->opening_balance_bank_tk / $currencyRate), 2) }}
Cancel
@if($histories->isNotEmpty())

Change History

@foreach($histories as $history) @endforeach
Date Changed By Changes
{{ $history->created_at?->format('Y-m-d H:i') ?? 'N/A' }} {{ $history->user->name ?? 'N/A' }} @foreach($history->changes as $field => $change) @php $label = $field === 'cash' ? 'Cash' : 'Bank'; $oldDisplay = number_format($change['old'], 2); $newDisplay = number_format($change['new'], 2); if (!empty($change['new_bdt']) || !empty($change['old_bdt'])) { $rate = $change['rate'] ?? $currencyRate; $oldDisplay .= $change['old_bdt'] > 0 ? ' [from ' . number_format($change['old_bdt'], 2) . ' BDT @ ' . number_format($rate, 2) . ']' : ''; $newDisplay .= $change['new_bdt'] > 0 ? ' [from ' . number_format($change['new_bdt'], 2) . ' BDT @ ' . number_format($rate, 2) . ']' : ''; } @endphp
{{ $label }}: {{ $oldDisplay }} → {{ $newDisplay }}
@endforeach
@endif
@endsection