@extends('layouts.app') @section('title', 'Contract Details - ' . $contract->contract_no) @section('content')

Contract: {{ $contract->contract_no }}

Print Edit Back

Contract Information

@php $statusColors = [ 'draft' => 'background: #fafafa; color: #666;', 'active' => 'background: #e8f5e9; color: #2e7d32;', 'completed' => 'background: #e3f2fd; color: #1565c0;', 'cancelled' => 'background: #ffebee; color: #c62828;', ]; @endphp {{ ucfirst($contract->status) }}
Contract No: {{ $contract->contract_no }}
Title: {{ $contract->title }}
Type: @if($contract->type == 'purchase') Purchase @else Sale @endif
Party: {{ $contract->party->name ?? '-' }}
Item: {{ $contract->item->name ?? 'General Contract' }}
Start Date: {{ $contract->start_date->format('d M, Y') }}
End Date: {{ $contract->end_date ? $contract->end_date->format('d M, Y') : 'Open Ended' }} @if($contract->is_expired) Expired @endif
Agent Commission: {{ number_format($contract->agent_commission_rate, 2) }} / unit
Transport Rate: {{ number_format($contract->transport_rate, 2) }} / unit
Created By: {{ $contract->creator->name ?? '-' }}
@if($contract->terms || $contract->remarks)
@if($contract->terms)
Terms & Conditions

{{ $contract->terms }}

@endif @if($contract->remarks)
Remarks

{{ $contract->remarks }}

@endif
@endif

Related {{ $contract->type == 'purchase' ? 'Purchases' : 'Sales' }}

@if($relatedTransactions->count() > 0) @foreach($relatedTransactions as $transaction) @endforeach
{{ $contract->type == 'purchase' ? 'Bill' : 'Invoice' }} No Date Quantity Amount Action
{{ $transaction->bill_no ?? $transaction->invoice_no }} {{ $transaction->date->format('d M, Y') }} {{ number_format($transaction->items->sum('quantity'), 2) }} {{ number_format($transaction->total_amount, 2) }} @if($contract->type == 'purchase') @else @endif
@else

No {{ $contract->type == 'purchase' ? 'purchases' : 'sales' }} linked to this contract yet.

@endif

Delivery Progress

Progress {{ $contract->completion_percentage }}%
Agreed Quantity: {{ number_format($contract->agreed_quantity, 2) }} {{ $contract->quantity_unit }}
Delivered: {{ number_format($contract->delivered_quantity, 2) }} {{ $contract->quantity_unit }}
Pending: {{ number_format($contract->pending_quantity, 2) }} {{ $contract->quantity_unit }}

Value Summary

Rate Per Unit: {{ number_format($contract->agreed_rate, 2) }}

Contract Value: {{ number_format($contract->contract_value, 2) }}
Delivered Value: {{ number_format($contract->delivered_value, 2) }}
Pending Value: {{ number_format($contract->pending_value, 2) }}
@if($contract->status == 'active' && $contract->pending_quantity > 0)
@if($contract->type == 'purchase') Create Purchase @else Create Sale @endif
@endif
@endsection