{{-- Z report as a small PDF (App\Services\ZReportPdf). Built-in Helvetica only, no images, plain ASCII text: the file stays a few KB and nothing has to be embedded. Colours are the theme colours from Settings. --}} @php $r = $report; $m = fn ($v) => number_format((float) $v, 2); $variance = $r['cash_variance']; $brand = brand_color('primary'); $accent = brand_color('secondary'); $tint = brand_tint($brand, 0.92); $stripe = brand_tint($brand, 0.965); $contact = implode(' | ', array_filter([$r['business']['location'] ?? null, !empty($r['business']['telephone']) ? 'Tel ' . $r['business']['telephone'] : null])); @endphp
{{ $r['business']['name'] }}
@if($contact)
{{ $contact }}
@endif
Z REPORT {{ $r['report_no'] }}
@unless($r['is_closed'])
PREVIEW - REGISTER STILL OPEN
@endunless
 
Cashier
{{ $r['cashier']->name ?? 'Unknown' }}
Register
#{{ $r['register']->id }}{{ $r['location'] ? ' ' . $r['location'] : '' }}
Opened
{{ $r['opened_at']?->format('d M Y H:i') }}
{{ $r['is_closed'] ? 'Closed' : 'As at' }}
{{ $r['closed_at']->format('d M Y H:i') }} ({{ $r['duration'] }})
Total sales
{{ $m($r['gross_sales']) }}
MWK
Transactions
{{ $r['sales_count'] }}
avg {{ $m($r['average_sale']) }}
Items sold
{{ rtrim(rtrim(number_format($r['items_sold'], 2), '0'), '.') }}
 
Gross profit
{{ $m($r['gross_profit']) }}
{{ $r['profit_incomplete'] ? 'some costs missing' : 'MWK' }}
@if($r['total_due'] > 0 || $r['edited_count'])
Unpaid (due): {{ $m($r['total_due']) }}  |  Edited sales: {{ $r['edited_count'] }}
@endif

Payments received

@forelse($r['payments'] as $p) @empty @endforelse
MethodCountAmount (MWK)
{{ $p['label'] }}@if($p['split_count']) (incl. {{ $m($p['split_amount']) }} from {{ $p['split_count'] }} split)@endif {{ $p['count'] }} {{ $m($p['amount']) }}
No sales
Total{{ $m($r['gross_sales']) }}
@if($r['split_sales']->count())

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

@foreach($r['split_sales'] as $t) @endforeach
{{ \Carbon\Carbon::parse($t->created_at)->format('H:i') }} {{ $t->invoice_no }} {{ collect($t->split)->map(fn ($s) => $s['label'] . ' ' . $m($s['amount']))->implode(' + ') }} {{ $m($t->total_amount) }}
@endif

Cash drawer

@if(($r['cash_paid_out'] ?? 0) > 0) @endif @if($r['counted_cash'] !== null) @endif
Opening cash{{ $m($r['opening_cash']) }}
+ Cash received{{ $m($r['cash_sales']) }}
- Paid out (expenses){{ $m($r['cash_paid_out']) }}
Expected in drawer{{ $m($r['expected_cash']) }}
Counted by cashier{{ $m($r['counted_cash']) }}
@if($r['counted_cash'] !== null)
{{ $variance < 0 ? 'SHORT' : ($variance > 0 ? 'OVER' : 'Drawer balanced') }} MWK {{ $m(abs((float) $variance)) }}
@endif

Profit

Gross sales{{ $m($r['gross_sales']) }}
- Cost of sales{{ $r['profit_incomplete'] ? ' (some costs missing)' : '' }}{{ $m($r['cost_of_sales']) }}
Gross profit{{ $m($r['gross_profit']) }}
@if($r['integrity_events']->count())

Loss prevention alerts ({{ $r['integrity_events']->count() }})

@foreach($r['integrity_events']->take(15) as $e) @endforeach
{{ $e->created_at->format('H:i') }} {{ strtoupper($e->severity) }} {{ \Illuminate\Support\Str::limit(\Illuminate\Support\Str::ascii($e->description), 150) }}
@if($r['integrity_events']->count() > 15)
and {{ $r['integrity_events']->count() - 15 }} more in Loss Prevention
@endif @endif @if($r['products']->count())

Products sold

@foreach($r['products'] as $p) @endforeach
ProductQtyAmount (MWK)
{{ \Illuminate\Support\Str::ascii($p->name ?? 'Deleted product') }} {{ rtrim(rtrim(number_format((float) $p->qty, 2), '0'), '.') }} {{ $m($p->amount) }}
@endif

{{ $r['business']['name'] }}  |  Generated {{ $r['generated_at']->format('d M Y H:i') }}{{ setting('powered_by') ? ' - ' . setting('powered_by') : '' }}