@extends('layouts.app') @section('title', 'Gross Profit — ' . $job->job_number) @section('breadcrumb')Gross Profit {{ $job->job_number }}@endsection @section('content')

Gross Profit Report

{{ $job->job_number }} · {{ $job->contact?->full_name }} · {{ $job->stageLabel() }}

Export PDF Back to Report
{{-- KPI Summary --}}
Revenue
${{ number_format($revenue) }}
Ex. GST @if($variantRevenue > 0) · incl. ${{ number_format($variantRevenue) }} variants @endif
Total Costs
${{ number_format($totalCost) }}
Mat + Labour + PO
Gross Profit
${{ number_format($grossProfit) }}
Gross Margin
{{ $margin }}%
{{-- Accepted Variants Revenue --}} @if($acceptedVariants->count())

Accepted Variant Revenue

+${{ number_format($variantRevenue, 2) }}
@foreach($acceptedVariants as $v) @endforeach
Variant Linked Quote Accepted By Date Price Adjustment
{{ $v->name }} @if($v->quote) {{ $v->quote->quote_number }} @else @endif {{ $v->respondedBy?->name ?? '—' }} {{ $v->responded_at?->format('d M Y') ?? '—' }} {{ $v->price_adjustment >= 0 ? '+' : '' }}${{ number_format($v->price_adjustment, 2) }}
Total Variant Revenue +${{ number_format($variantRevenue, 2) }}
@endif {{-- Job Invoice Deductions --}} @if($invoiceLines->count())

Invoice Deductions (reduces gross profit)

-${{ number_format($invoiceDeductions, 2) }}
@foreach($invoiceLines as $inv) @endforeach
Invoice # Date Note Added By Amount (incl GST)
{{ $inv['invoice_number'] }} {{ $inv['invoice_date'] }} {{ $inv['note'] ?: '—' }} {{ $inv['added_by'] }} -${{ number_format($inv['amount'], 2) }}
Total Invoice Deductions -${{ number_format($invoiceDeductions, 2) }}
@endif {{-- Works Order Fault Deductions --}} @if($faultLines->count())

Works Order Fault Costs (reduces gross profit)

-${{ number_format($faultDeductions, 2) }}
@foreach($faultLines as $f) @endforeach
Works Order # Fault Type Approval Cost
{{ $f['wo_number'] }} Fault {{ $f['fault_num'] }} {{ $f['fault_type'] }} @if($f['approved'] === 'approved') Approved @elseif($f['approved'] === 'rejected') Rejected @elseif($f['approved'] === 'pending') Pending @else @endif -${{ number_format($f['cost'], 2) }}
Total Fault Deductions -${{ number_format($faultDeductions, 2) }}
@endif {{-- Materials --}}

Material Costs (Quote)

${{ number_format($matCost, 2) }}
@if($allItems->count())
@foreach($allItems as $item) @endforeach
Description Qty W/Sale Retail Total W/Sale Total Retail
{{ $item->description }} @if($item->item_code)[{{ $item->item_code }}]@endif {{ number_format($item->qty, 2) }} ${{ number_format($item->wsale_price ?? 0, 2) }} ${{ number_format($item->retail_price ?? $item->unit_price ?? 0, 2) }} ${{ number_format($item->total_wsale ?? 0, 2) }} ${{ number_format($item->total_retail ?? $item->total ?? 0, 2) }}
Totals ${{ number_format($matCost, 2) }} ${{ number_format($revenue, 2) }}
@else
No quote items found.
@endif
{{-- Labour --}}

Labour Costs

${{ number_format($labourCost, 2) }}
@if($labourLines->count()) @foreach($labourLines as $line) @endforeach
Staff Date Hours Rate Cost
{{ $line['staff'] }} {{ $line['date'] }} {{ number_format($line['hours'], 2) }}h ${{ number_format($line['rate'], 2) }}/hr ${{ number_format($line['cost'], 2) }}
Total Labour ${{ number_format($labourCost, 2) }}
@else
No time entries recorded for this job.
@endif
{{-- PO Allocations --}} @if($poLines->count())

Inventory & Purchase Order Costs

${{ number_format($poCost, 2) }}
@foreach($poLines as $line) @endforeach
Description Source Qty Unit Cost Total
{{ $line['description'] }} {{ $line['source'] ?? '—' }} {{ number_format($line['qty'], 2) }} ${{ number_format($line['unit_cost'], 2) }} ${{ number_format($line['total'], 2) }}
Total PO Costs ${{ number_format($poCost, 2) }}
@endif {{-- Summary footer --}}

Summary

Revenue (ex. GST)${{ number_format($revenue, 2) }}
Material Cost-${{ number_format($matCost, 2) }}
Labour Cost-${{ number_format($labourCost, 2) }}
@if($poCost > 0)
Inventory & PO Costs-${{ number_format($poCost, 2) }}
@endif @if($invoiceDeductions > 0)
Invoice Deductions-${{ number_format($invoiceDeductions, 2) }}
@endif @if($faultDeductions > 0)
WO Fault Costs-${{ number_format($faultDeductions, 2) }}
@endif
Gross Profit ${{ number_format($grossProfit, 2) }}
Gross Margin {{ $margin }}%
@endsection