@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 (item-wise breakdown) --}} @if($acceptedVariants->count())

Accepted Variant Profit

+${{ number_format($variantRevenue, 2) }}
@foreach($variantItemLines as $line) @php $isFirst = $loop->first || $variantItemLines[$loop->index - 1]['variant_id'] !== $line['variant_id']; @endphp @endforeach
Variant Item Description Item Code Unit Qty Retail Price W/Sale Price Retail Total W/Sale Total Profit
@if($isFirst){{ $line['variant_name'] }}@endif {{ $line['description'] }} {{ $line['item_code'] ?? '—' }} {{ $line['unit'] ?? '—' }} {{ number_format($line['qty'], 2) }} ${{ number_format($line['retail_price'], 2) }} ${{ number_format($line['wsale_price'], 2) }} ${{ number_format($line['retail_total'], 2) }} ${{ number_format($line['wsale_total'], 2) }} {{ $line['profit'] >= 0 ? '+' : '' }}${{ number_format($line['profit'], 2) }}
Total Variant Profit +${{ number_format($variantRevenue, 2) }} {{ $variantProfit >= 0 ? '+' : '' }}${{ number_format($variantProfit, 2) }}
@endif {{-- Quote Materials --}} @if($allItems->count())

Quote Materials

-${{ number_format($matCost, 2) }}
@foreach($allItems as $item) @endforeach
Description Section Qty Retail Total W/Sale Cost
{{ $item->description }} {{ $item->section?->name ?? '—' }} {{ $item->qty ?? 1 }} ${{ number_format($item->total_retail ?? $item->total ?? 0, 2) }} ${{ number_format($item->total_wsale ?? 0, 2) }}
Total Material Cost -${{ number_format($matCost, 2) }}
@endif {{-- Labour --}} @if($labourLines->count())

Labour Costs

-${{ number_format($labourCost, 2) }}
@foreach($labourLines as $line) @endforeach
Staff Role Date Hours Rate Cost
{{ $line['staff'] }} {{ $line['role'] }} {{ $line['date'] }} {{ $line['hours'] > 0 ? $line['hours'].'h' : '—' }} {{ $line['rate'] > 0 ? '$'.$line['rate'].'/hr' : '—' }} ${{ number_format($line['cost'], 2) }}
Total Labour Cost -${{ number_format($labourCost, 2) }}
@endif {{-- Invoice Deductions --}} @if($invoiceLines->count())

Invoice Deductions (reduces gross profit)

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

Inventory & PO 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 {{-- Works Order Fault Deductions --}} @if($faultLines->count())

Works Order Fault Costs (reduces gross profit)

-${{ number_format($faultDeductions, 2) }}
@foreach($faultLines as $line) @endforeach
Works Order # Fault Type Approved Cost
{{ $line['wo_number'] }} {{ $line['fault_num'] }} {{ $line['fault_type'] }} @if($line['approved'] === 'approved') Approved @else @endif -${{ number_format($line['cost'], 2) }}
Total Fault Deductions -${{ number_format($faultDeductions, 2) }}
@endif {{-- Summary footer --}}

Summary

Quote Revenue (ex. GST)${{ number_format($quoteRevenue, 2) }}
@if($variantRevenue > 0)
Accepted Variant Profit+${{ number_format($variantRevenue, 2) }}
@endif
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