@lang('app.to')
@foreach($branches as $branch) @endforeach {{-- @foreach($registers as $register) @endforeach --}} @if(user_can('View Cash Register Reports')) @foreach($cashiers as $cashier) @endforeach @endif
@if($sessions->count() > 0)

@lang('cashregister::app.discrepancyReportClosings')

@lang('cashregister::app.exportCsv')

@lang('cashregister::app.totalSessions'): {{ $sessions->count() }}

@lang('cashregister::app.sessionsWithDiscrepancy'): {{ $sessions->where('discrepancy', '!=', 0)->count() }}

@lang('cashregister::app.highDiscrepancy') (≥ 200)

{{ $sessions->filter(function($s) { return abs($s->discrepancy) >= 200; })->count() }} @lang('cashregister::app.sessions')

@lang('cashregister::app.mediumDiscrepancy') (50-199)

{{ $sessions->filter(function($s) { return abs($s->discrepancy) >= 50 && abs($s->discrepancy) < 200; })->count() }} @lang('cashregister::app.sessions')

@lang('cashregister::app.lowDiscrepancy') (< 50)

{{ $sessions->filter(function($s) { return abs($s->discrepancy) < 50; })->count() }} @lang('cashregister::app.sessions')

@foreach($sessions as $session) @php $transactions = \Modules\CashRegister\Entities\CashRegisterTransaction::where('cash_register_session_id', $session->id)->get(); $cashSales = $transactions->where('type', 'cash_sale')->sum('amount'); $paymentMethodTotals = $transactions->whereIn('type', ['cash_sale', 'order_payment']) ->groupBy(function ($transaction) { return $transaction->payment_method ?: 'cash'; }) ->map(function ($items) { return (float) $items->sum('amount'); }) ->sortKeys() ->toArray(); $totalPayments = array_sum($paymentMethodTotals); $cashIn = $transactions->where('type', 'cash_in')->sum('amount'); $cashOut = $transactions->where('type', 'cash_out')->sum('amount'); $safeDrops = $transactions->where('type', 'safe_drop')->sum('amount'); $changeGiven = $transactions->where('type', 'change_given')->sum('amount'); $refunds = $transactions->where('type', 'refund')->sum('amount'); $expectedCash = (float) $session->opening_float + $totalPayments + $cashIn - $changeGiven - $cashOut - $safeDrops - $refunds; $discrepancy = (float) $session->counted_cash - $expectedCash; @endphp @endforeach
@lang('cashregister::app.date') @lang('cashregister::app.cashier') @lang('cashregister::app.paymentMethods') @lang('cashregister::app.expected') @lang('cashregister::app.counted') @lang('cashregister::app.diff') @lang('cashregister::app.status') @lang('cashregister::app.managerNote')
{{ $session->closed_at->timezone(timezone())->format('d M Y') }} {{ $session->cashier->name ?? __('cashregister::app.unknown') }}
@foreach($paymentMethodTotals as $method => $amount) {{ __('modules.order.' . $method) !== 'modules.order.' . $method ? __('modules.order.' . $method) : \Illuminate\Support\Str::title(str_replace('_', ' ', (string) $method)) }}: {{ currency_format((float) $amount, restaurant()->currency_id) }} @endforeach
{{ currency_format($expectedCash, restaurant()->currency_id) }} {{ currency_format($session->counted_cash, restaurant()->currency_id) }} {{ $discrepancy >= 0 ? '+' : '' }}{{ currency_format($discrepancy, restaurant()->currency_id) }} @lang('app.' . $session->status) {{ $session->closing_reason ?? '—' }}
@else

@lang('cashregister::app.noDataAvailable')

@lang('cashregister::app.noClosedSessionsFoundForSelectedCriteria')

@endif
@script @endscript