@php $r = $report; $accent = $r['business']['primary']; $accent2 = $r['business']['secondary']; // Embed the logo in the email itself (works offline / on local servers); fall back to the URL in the browser preview $logoSrc = null; if (!empty($r['business']['logo_bytes'])) { $logoSrc = isset($message) ? $message->embedData($r['business']['logo_bytes'], 'logo', $r['business']['logo_mime']) : $r['business']['logo_url']; } elseif ($r['business']['logo_path']) { $logoSrc = isset($message) ? $message->embed($r['business']['logo_path']) : $r['business']['logo_url']; } $cell = 'padding:8px 12px;border-bottom:1px solid #eef0f3;font-size:13px;color:#333;'; $head = 'padding:8px 12px;background:#f6f7f9;font-size:11px;text-transform:uppercase;letter-spacing:.5px;color:#6b7280;text-align:left;'; $section = 'margin:0 0 10px;font-size:13px;font-weight:700;text-transform:uppercase;letter-spacing:.6px;color:' . $accent . ';'; $txLimit = 100; // Phone as an explicit white link, so Gmail / Apple Mail don't auto-link it in blue $phone = $r['business']['telephone'] ? '' . e($r['business']['telephone']) . '' : null; @endphp Z Report {{ $r['report_no'] }}
@if($r['split_sales']->isNotEmpty()) @endif @php $alerts = $r['integrity_events']->whereIn('severity', ['medium', 'high', 'critical']); $lowCount = $r['integrity_events']->where('severity', 'low')->count(); $sevColor = ['medium' => '#0369a1', 'high' => '#b45309', 'critical' => '#b91c1c']; @endphp @if($r['integrity_events']->isNotEmpty()) @endif
@if($logoSrc) @endif
{{ $r['business']['name'] }}
{{ $r['business']['name'] }}
{{ $r['business']['location'] }}@if($r['business']['location'] && $phone) · @endif{!! $phone !!}
{{ $r['is_closed'] ? 'End of Shift' : 'Preview (register still open)' }}
Z REPORT
{{ $r['report_no'] }}
@if($r['location']) @endif
Cashier {{ $r['cashier']->name ?? 'Unknown' }} ({{ $r['cashier']->email ?? '' }})
Location {{ $r['location'] }}
Opened {{ optional($r['opened_at'])->format('D, d M Y H:i') }}
{{ $r['is_closed'] ? 'Closed' : 'As at' }} {{ $r['closed_at']->format('D, d M Y H:i') }} @if($r['duration']) · shift length {{ $r['duration'] }} @endif
@foreach([ ['Gross Sales', formatCurrency($r['gross_sales'])], ['Transactions', number_format($r['sales_count'])], ['Items Sold', number_format($r['items_sold'])], ['Average Sale', formatCurrency($r['average_sale'])], ] as [$label, $value]) @endforeach
{{ $label }}
{{ $value }}

Payments Received

@forelse($r['payments'] as $p) @empty @endforelse
Method Count Amount
{{ $p['label'] }} @if($p['split_amount'] > 0)
incl. {{ formatCurrency($p['split_amount']) }} from {{ $p['split_count'] }} split payment{{ $p['split_count'] > 1 ? 's' : '' }} @endif
{{ number_format($p['count']) }} {{ formatCurrency($p['amount']) }}
No payments recorded
Total {{ formatCurrency(collect($r['payments'])->sum('amount')) }}
@if($r['total_due'] > 0)

Outstanding (unpaid) balance on sales: {{ formatCurrency($r['total_due']) }}

@endif

Split Payments ({{ $r['split_sales']->count() }})

@foreach($r['split_sales'] as $t) @endforeach
Time Invoice Paid with Total
{{ \Carbon\Carbon::parse($t->created_at)->format('H:i') }} {{ $t->invoice_no }} @forelse($t->split as $part)
{{ $part['label'] }} {{ formatCurrency($part['amount']) }}
@empty No breakdown recorded @endforelse
{{ formatCurrency($t->total_amount) }}

Cash Drawer

@if($r['counted_cash'] !== null) @php $v = $r['cash_variance']; @endphp @else @endif
Opening cash{{ formatCurrency($r['opening_cash']) }}
+ Cash sales{{ formatCurrency($r['cash_sales']) }}
Expected in drawer{{ formatCurrency($r['expected_cash']) }}
Counted by cashier{{ formatCurrency($r['counted_cash']) }}
{{ $v < 0 ? 'Short' : ($v > 0 ? 'Over' : 'Difference') }} {{ abs($v) < 0.01 ? 'Balanced' : ($v < 0 ? '−' : '+') . formatCurrency(abs($v)) }}
Expected in drawer{{ formatCurrency($r['expected_cash']) }}

Profit

Gross sales{{ formatCurrency($r['gross_sales']) }}
− Cost of sales{{ formatCurrency($r['cost_of_sales']) }}
Gross profit{{ formatCurrency($r['gross_profit']) }}
@if($r['profit_incomplete'])

Some items had no recorded cost, so profit may be overstated.

@endif

Integrity Alerts

@if($alerts->isNotEmpty()) @foreach($alerts as $a) @endforeach
{{ $a->created_at->format('H:i') }} {{ $a->severity }} {{ $a->label }}
{{ $a->description }}
@endif @if($lowCount)

{{ $lowCount }} item(s) were removed from carts before payment during this shift.

@endif

Review these under Loss Prevention in the system.

Products Sold

@forelse($r['products'] as $p) @empty @endforelse
Product Qty Amount
{{ $p->name ?? 'Deleted product' }}@if($p->sku)
{{ $p->sku }}@endif
{{ number_format($p->qty) }} {{ formatCurrency($p->amount) }}
No products sold

Transactions

@forelse($r['transactions']->take($txLimit) as $t) @empty @endforelse
Time Invoice Customer Payment Amount
{{ \Carbon\Carbon::parse($t->created_at)->format('H:i') }} {{ $t->invoice_no }}@if($t->is_edited) (edited)@endif {{ $t->customer_name ?: 'Walk-In Customer' }} @if($t->split) Split @foreach($t->split as $part)
{{ $part['label'] }} {{ formatCurrency($part['amount']) }} @endforeach @else {{ $t->payment_label }} @endif
{{ formatCurrency($t->total_amount) }}
No transactions during this shift
@if($r['transactions']->count() > $txLimit)

Showing the first {{ $txLimit }} of {{ $r['transactions']->count() }} transactions. The full list is in the attached CSV.

@endif @if($r['edited_count'] > 0)

{{ $r['edited_count'] }} sale(s) in this shift were edited after being made.

@endif
@if($r['is_closed']) Generated on {{ $r['generated_at']->format('d M Y H:i') }} for the register closed at {{ $r['closed_at']->format('H:i') }}.
@else Preview generated on {{ $r['generated_at']->format('d M Y H:i') }}. The register is still open, so figures may change.
@endif A CSV copy of this report is attached. Manage who receives these emails under Notifications.
{{ $r['business']['name'] }}@if($phone) · {!! $phone !!}@endif