@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($shifts->count() > 0)

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

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

@lang('cashregister::app.totalSessions'): {{ $summary['total_shifts'] }}

@lang('cashregister::app.completionRate'): {{ round($summary['completion_rate'], 1) }}%

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

{{ $summary['total_shifts'] }}

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

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

{{ $summary['completed_shifts'] }}

{{ round($summary['completion_rate'], 1) }}% @lang('cashregister::app.completionShort')

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

{{ $summary['pending_shifts'] }}

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

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

{{ $summary['open_shifts'] }}

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

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

@if($summary['average_duration_minutes'] > 0) {{ floor($summary['average_duration_minutes'] / 60) }}h {{ $summary['average_duration_minutes'] % 60 }}m @else @lang('cashregister::app.openSession') @endif

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

{{ currency_format($summary['total_opening_float'], restaurant()->currency_id) }}

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

{{ $summary['total_discrepancy'] >= 0 ? '+' : '' }}{{ currency_format($summary['total_discrepancy'], restaurant()->currency_id) }}

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

{{ currency_format($summary['total_cash_sales'], restaurant()->currency_id) }}

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

{{ currency_format($summary['total_payments'], restaurant()->currency_id) }}

@if(!empty($summary['payment_method_totals'])) @foreach($summary['payment_method_totals'] as $method => $amount) @continue($method === 'cash')

{{ __('modules.order.' . $method) !== 'modules.order.' . $method ? __('modules.order.' . $method) : \Illuminate\Support\Str::title(str_replace('_', ' ', (string) $method)) }} @lang('cashregister::app.sales')

{{ currency_format((float) $amount, restaurant()->currency_id) }}

@endforeach @endif
@foreach($shifts as $shift) @php $transactions = \Modules\CashRegister\Entities\CashRegisterTransaction::where('cash_register_session_id', $shift->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) $shift->opening_float + $totalPayments + $cashIn - $changeGiven - $cashOut - $safeDrops - $refunds; $countedCash = (float) ($shift->counted_cash ?? 0); $diff = $countedCash - $expectedCash; @endphp @endforeach
@lang('cashregister::app.date') @lang('cashregister::app.cashier') @lang('cashregister::app.sessionType') @lang('cashregister::app.duration') @lang('cashregister::app.openingFloat') @lang('cashregister::app.paymentMethods') @lang('cashregister::app.expectedCash') @lang('cashregister::app.countedCash') @lang('cashregister::app.discrepancy') @lang('cashregister::app.status')
{{ $shift->opened_at->timezone(timezone())->format('d M Y') }} {{ $shift->cashier->name ?? '--' }} {{ $this->getSessionType($shift) }} {{ $this->getSessionDuration($shift) }} {{ currency_format($shift->opening_float, restaurant()->currency_id) }}
@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($countedCash, restaurant()->currency_id) }} {{ $diff >= 0 ? '+' : '' }}{{ currency_format($diff, restaurant()->currency_id) }} @lang('app.' . $shift->status)

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

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

@php $sessionTypes = $shifts->groupBy(function($shift) { return $this->getSessionType($shift); }); @endphp @foreach($sessionTypes as $type => $sessionsOfType)
{{ $type }}: {{ $sessionsOfType->count() }} @lang('cashregister::app.sessions')
@endforeach

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

@php $cashierSessions = $shifts->groupBy('opened_by'); @endphp @foreach($cashierSessions->take(5) as $cashierId => $sessionsOfCashier) @php $cashier = $sessionsOfCashier->first()->cashier; @endphp
{{ $cashier->name ?? __('cashregister::app.unknown') }}: {{ $sessionsOfCashier->count() }} @lang('cashregister::app.sessions')
@endforeach
@else

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

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

@endif
@script @endscript