Job Card
{{ $company->name ?? 'COMPANY NAME' }}
@if($company->tagline)
{{ $company->tagline }}
@endif
@if($company->address) @endif @if($company->city) @endif @if($company->vat_number) @endif @if($company->phone) @endif @if($company->email && stripos($company->email, 'sage-migration.local') === false) @endif @if($company->fax) @endif
Address: {{ $company->address }}
City: {{ $company->city }}
VAT Number: {{ $company->vat_number }}
Phone: {{ $company->phone }}
Email: {{ $company->email }}
Fax: {{ $company->fax }}

Banking Details

{{ $company->bank_account_name ?? $company->name }}

@if($company->bank_name)

Bank Name: {{ $company->bank_name }}

@endif @if($company->bank_account_number)

Acc No: {{ $company->bank_account_number }}

@endif @if($company->bank_sort_code)

Branch Code: {{ $company->bank_sort_code }}

@endif

To:

{{ $jobcard->customer->account_code ?? 'N/A' }}

{{ $jobcard->customer->name ?? 'CUSTOMER NAME' }}

@if($jobcard->contact)

Attn: {{ $jobcard->contact->name }}

@endif @if($jobcard->customer->address)

{{ $jobcard->customer->address }}

@endif @if($jobcard->customer->city)

{{ $jobcard->customer->city }}

@endif @if($jobcard->customer->postal_code)

{{ $jobcard->customer->postal_code }}

@endif @php $jobcardDisplayEmail = null; if ($jobcard->email && stripos($jobcard->email, 'sage-migration.local') === false) { $jobcardDisplayEmail = $jobcard->email; } elseif ($jobcard->customer->email && stripos($jobcard->customer->email, 'sage-migration.local') === false) { $jobcardDisplayEmail = $jobcard->customer->email; } @endphp @if($jobcardDisplayEmail)

{{ $jobcardDisplayEmail }}

@endif @if($jobcard->phone)

{{ $jobcard->phone }}

@elseif($jobcard->customer->phone)

{{ $jobcard->customer->phone }}

@endif
{{ ucfirst($jobcard->priority ?? 'Normal') }}
@if($jobcard->description)

Description

{{ $jobcard->description }}

@endif
Account {{ $jobcard->customer->account_code ?? 'N/A' }}
Date {{ $jobcard->created_at ? $company->formatLocalizedDate($jobcard->created_at) : $company->formatLocalizedDate(now()) }}
Order No {{ $jobcard->order_number ?? '' }}
Job No {{ $jobcard->job_number ?? 'N/A' }}
Due Date {{ $jobcard->due_date ? $company->formatLocalizedDate($jobcard->due_date) : 'TBD' }}
@php $lineGroups = $jobcard->lineGroups ?? collect(); $items = ($jobcard->lineItems ?? collect())->filter(function ($item) { return strtolower(trim((string) ($item->description ?? ''))) !== 'rounding adjustment'; }); $resolvedGroups = collect(); $renderedItemIds = collect(); foreach ($lineGroups->sortBy('sort_order') as $group) { $groupItems = $items->where('line_group_id', $group->id); if ($groupItems->isNotEmpty()) { $resolvedGroups->push((object) [ 'name' => $group->name, 'items' => $groupItems, ]); $renderedItemIds = $renderedItemIds->merge($groupItems->pluck('id')); } } $ungroupedItems = $items->filter(function ($item) use ($renderedItemIds) { return !$renderedItemIds->contains($item->id); }); if ($resolvedGroups->isEmpty() && $items->isNotEmpty()) { $resolvedGroups->push((object) [ 'name' => 'Items', 'items' => $items, ]); } elseif ($ungroupedItems->isNotEmpty()) { $resolvedGroups->push((object) [ 'name' => 'Items', 'items' => $ungroupedItems, ]); } @endphp @foreach($resolvedGroups as $group) @if($group->name) @endif @foreach($group->items->sortBy('sort_order') as $item) @endforeach @endforeach
Work Description QTY Rate Discount Tax Total (Excl)
{{ $group->name }}
{{ $item->description ?? 'Work Description' }}{{ ($item->product && ($item->product->sku ?? $item->product->barcode)) ? ' (' . ($item->product->sku ?? $item->product->barcode) . ')' : '' }} {{ $company->formatNumber($item->quantity ?? 0, 2) }} {{ $company->formatCurrencyZar($item->unit_price ?? 0) }} @if(($item->discount_percentage ?? 0) > 0) {{ $company->formatNumber($item->discount_percentage, 2) }}% @elseif(($item->discount_amount ?? 0) > 0) {{ $company->formatCurrencyZar($item->discount_amount) }} @else — @endif @if($item->taxRate) {{ $company->formatCurrencyZar($item->tax_amount ?? 0) }} @else — @endif {{ $company->formatCurrencyZar($item->total ?? 0) }}
@php $roundingAdjustment = ($jobcard->lineItems ?? collect())->reduce(function ($sum, $item) { $description = strtolower(trim((string) ($item->description ?? ''))); if ($description !== 'rounding adjustment') { return $sum; } $lineTotal = (float) ($item->total ?? (($item->quantity ?? 0) * ($item->unit_price ?? 0))); return $sum + $lineTotal; }, 0.0); @endphp
Subtotal: {{ $company->formatCurrencyZar($jobcard->subtotal ?? 0) }}
@if(($jobcard->tax_amount ?? 0) > 0)
Tax: {{ $company->formatCurrencyZar($jobcard->tax_amount) }}
@endif @if(($jobcard->discount_amount ?? 0) > 0)
Discount: -{{ $company->formatCurrencyZar($jobcard->discount_amount) }}
@endif @if(abs($roundingAdjustment) > 0.0001)
Rounding Adjustment: {{ $company->formatCurrencyZar($roundingAdjustment) }}
@endif
Total: {{ $company->formatCurrencyZar($jobcard->total ?? 0) }}

Work Notes & Instructions

@if($jobcard->notes)

Additional Notes: {{ $jobcard->notes }}

@endif @if($jobcard->terms_conditions)

Terms & Conditions: {{ $jobcard->terms_conditions }}

@endif
@if(($company->enable_document_signing ?? false) && ($jobcard->signatures ?? collect())->count() > 0)
Signatures
@foreach(($jobcard->signatures ?? collect())->chunk(3) as $signatureRow)
@foreach($signatureRow as $signature)
{{ $signature->signer_name }} @if($signature->signed_at) - {{ $company->formatLocalizedDateTime($signature->signed_at) }} @endif
@php($signatureDataUri = $signature->getSignaturePathForPdf()) @if($signatureDataUri) Signature @endif
@endforeach @for($i = $signatureRow->count(); $i < 3; $i++)
 
@endfor
@endforeach
@elseif(! ($company->enable_document_signing ?? false))
Received by
Date
Signature
@endif