@extends('layouts.app')
@section('title', $commercialAccount->name . ' — Commercial Account')
@section('breadcrumb')
Commercial Accounts
{{ $commercialAccount->name }}
@endsection
@section('content')
{{-- ── Header ── --}}
{{ $commercialAccount->name }}
{{ $commercialAccount->typeLabel() }}
@if($commercialAccount->notes)
{{ $commercialAccount->notes }}
@endif
{{-- ── Tabs ── --}}
{{-- ════════════════════════════════════════════════════════════ --}}
{{-- TAB: BUILDER CONTRACTS --}}
{{-- ════════════════════════════════════════════════════════════ --}}
{{-- Contract Amount summary --}}
@php
$builderContractAmt = $commercialAccount->builderPos->where('contract_related', true)->sum('po_amount');
$builderTotalPo = $commercialAccount->builderPos->sum('po_amount');
@endphp
Contract Amount
${{ number_format($builderContractAmt, 2) }}
Auto-calculated from Contract-Related POs below
Total PO Value
${{ number_format($builderTotalPo, 2) }}
Sum of all purchase orders
{{-- ── Purchase Orders ── --}}
Purchase Orders
{{ $commercialAccount->builderPos->count() }} record{{ $commercialAccount->builderPos->count()!==1?'s':'' }}
@if($commercialAccount->builderPos->count())
| P/O Amount |
P/O Number |
P/O Date |
Invoice No. |
Invoice Date |
Inv Paid |
Contract Related |
|
@foreach($commercialAccount->builderPos as $po)
| ${{ number_format($po->po_amount, 2) }} |
{{ $po->po_number ?? '—' }} |
{{ $po->po_date?->format('d/m/Y') ?? '—' }} |
{{ $po->invoice_no ?? '—' }} |
{{ $po->invoice_date?->format('d/m/Y') ?? '—' }} |
{{ $po->inv_paid_date?->format('d/m/Y') ?? '—' }} |
@if($po->contract_related)
Yes
@else
No
@endif
|
|
@endforeach
@endif
{{-- Add PO form --}}
{{-- ── ETS / Purchase Order Requests ── --}}
ETS / Purchase Order Requests
{{ $commercialAccount->builderEts->count() }} record{{ $commercialAccount->builderEts->count()!==1?'s':'' }}
@if($commercialAccount->builderEts->count())
| Customer Rep |
ETS Date Request |
ETS Amount |
ETS Reference |
ETS Received |
ETS Ref No. |
Reg. Invoicing |
Comments |
|
@foreach($commercialAccount->builderEts as $ets)
| {{ $ets->customer_rep ?? '—' }} |
{{ $ets->ets_date_request?->format('d/m/Y') ?? '—' }} |
${{ number_format($ets->ets_amount, 2) }} |
{{ $ets->ets_reference ?? '—' }} |
{{ $ets->ets_received_date?->format('d/m/Y') ?? '—' }} |
{{ $ets->ets_ref_no ?? '—' }} |
@if($ets->registered_for_invoicing)
Yes
@else
—
@endif
|
{{ Str::limit($ets->comments, 60) ?? '—' }} |
|
@endforeach
@endif
{{-- Add ETS form --}}
{{-- ════════════════════════════════════════════════════════════ --}}
{{-- TAB: PRIVATE CONTRACTS --}}
{{-- ════════════════════════════════════════════════════════════ --}}
@php
$privateContractAmt = $commercialAccount->privateDetails->where('contract_related', true)->sum('amount');
$privateTotalAmt = $commercialAccount->privateDetails->sum('amount');
$totalPayments = $commercialAccount->privatePayments->sum('payment_amount');
@endphp
Contract Amount
${{ number_format($privateContractAmt, 2) }}
Auto-calculated from Contract-Related items
Total Value
${{ number_format($privateTotalAmt, 2) }}
Sum of all contract items
Payments Received
${{ number_format($totalPayments, 2) }}
Sum of payment structure
{{-- ── Contract Details ── --}}
Contract Details
{{ $commercialAccount->privateDetails->count() }} record{{ $commercialAccount->privateDetails->count()!==1?'s':'' }}
@if($commercialAccount->privateDetails->count())
| Type |
Reference |
Date |
Amount |
Contract Related |
|
@foreach($commercialAccount->privateDetails as $detail)
|
{{ $detail->typeLabel() }}
|
{{ $detail->contract_reference ?? '—' }} |
{{ $detail->contract_date?->format('d/m/Y') ?? '—' }} |
${{ number_format($detail->amount, 2) }} |
@if($detail->contract_related)
Yes
@else
No
@endif
|
|
@endforeach
| Total Contract Related: |
${{ number_format($privateContractAmt, 2) }} |
|
@endif
{{-- Add Private Detail form --}}
{{-- ── Contract Payment Structure ── --}}
Contract Payment Structure
{{ $commercialAccount->privatePayments->count() }} record{{ $commercialAccount->privatePayments->count()!==1?'s':'' }}
@if($commercialAccount->privatePayments->count())
| Payment Detail |
Amount |
Invoice No. |
Invoice Date |
Invoice Paid |
|
@foreach($commercialAccount->privatePayments as $pmt)
| {{ $pmt->typeLabel() }} |
${{ number_format($pmt->payment_amount, 2) }} |
{{ $pmt->invoice_no ?? '—' }} |
{{ $pmt->invoice_date?->format('d/m/Y') ?? '—' }} |
{{ $pmt->invoice_paid_date?->format('d/m/Y') ?? '—' }} |
|
@endforeach
| Total Payments: |
${{ number_format($totalPayments, 2) }} |
|
@endif
{{-- Add Payment form --}}
@endsection