@extends('layouts.app') @section('title', $vendor->name) @section('content') @php($balance = $vendor->balance())

{{ $vendor->name }}

@if ($vendor->category){{ $vendor->category }}@endif @if ($vendor->location()){{ $vendor->location() }}@endif @if ($vendor->phone){{ $vendor->phone }}@endif @if ($vendor->email){{ $vendor->email }}@endif {{ $vendor->is_active ? 'Active' : 'Inactive' }}
@can('vendor_assignments.create') Assign orders @endcan @can('vendor_bills.create') Add bill @endcan @can('payments.create') Pay vendor @endcan @can('vendors.edit') Edit @endcan @can('vendors.delete') @endcan
Total billed
{{ money($vendor->billed()) }}
Paid
{{ money($vendor->paid()) }}
We owe
{{ money($balance) }}
@if ($assignments->isNotEmpty()) @php($asgTotal = $assignments->sum(fn ($x) => $x->total())) @php($asgPaid = $assignments->sum(fn ($x) => $x->paid())) @php($general = $vendor->generalPaid())
Assigned orders (incl. extras)
{{ money($asgTotal) }}
{{ $assignments->count() }} {{ \Illuminate\Support\Str::plural('assignment', $assignments->count()) }}
Paid against orders
{{ money($asgPaid) }}
Still to pay on orders: {{ money(max(0, $asgTotal - $asgPaid)) }}
General payments (not tied to an order)
{{ money($general) }}
Can be allocated to an assignment
@endif
Details
Contact
{{ $vendor->contact_person ?: '—' }}
Tax ID
{{ $vendor->tax_number ?: '—' }}
Address
{!! nl2br(e($vendor->address ?: '—')) !!}
Bank
{!! nl2br(e($vendor->bank_details ?: '—')) !!}
@if ($vendor->notes)
Notes
{!! nl2br(e($vendor->notes)) !!}
@endif
@can('vendor_bills.view')
Open bills
    @forelse ($bills->filter(fn ($b) => $b->due() > 0.004)->take(5) as $b)
  • {{ $b->bill_no ?: '#'.$b->id }} {{ $b->due_date ? 'Due '.$b->due_date->format('d M Y') : 'No due date' }}@if ($b->isOverdue()) · overdue @endif
    {{ money($b->due()) }}
  • @empty
  • Nothing outstanding.
  • @endforelse
@endcan
@can('vendor_assignments.view')
@forelse ($assignments as $x) @empty @endforelse
No.OrderAssignedAgreedExtraTotalPaymentBalance
{{ $x->number() }}@if ($x->description){{ $x->description }}@endif {{ $x->order->order_no }}{{ $x->order->client->name }} {{ $x->assigned_on->format('d M Y') }} {{ money($x->assigned_amount) }} {{ $x->extra() > 0.004 ? money($x->extra()) : '—' }} {{ money($x->total()) }} {{ money($x->due()) }}
Assign orders
@endcan @can('vendor_bills.view')
@forelse ($bills as $b) @empty @endforelse
BillDateDueDescriptionAmountPaymentBalance
{{ $b->bill_no ?: '#'.$b->id }} {{ $b->bill_date->format('d M Y') }} {{ $b->due_date?->format('d M Y') ?? '—' }} {{ $b->description ?: '—' }} {{ money($b->amount) }} {{ money($b->due()) }}
Add bill
@endcan @can('payments.view')
@forelse ($payments as $p) @empty @endforelse
DateAgainstMethodReferenceAmount
{{ $p->paid_on->format('d M Y') }} @if ($p->vendorAssignment){{ $p->vendorAssignment->number() }}@if ($p->vendorAssignmentItem){{ $p->vendorAssignmentItem->label() }}@endif @elseif ($p->vendorBill)Bill {{ $p->vendorBill->bill_no ?: '#'.$p->vendorBill->id }}@elseGeneral@endif {{ \App\Models\Payment::METHODS[$p->method] ?? $p->method }} {{ $p->reference ?: '—' }} −{{ money($p->amount) }}
Pay vendor
@endcan @can('payments.view')
Account statementFrom the general ledger · every line is a journal entry
@forelse ($statement as $r) @empty @endforelse @if ($statement->isNotEmpty())@endif
DateEntryReferenceDescriptionBilledPaidBalance owed
{{ $r['date']->format('d M Y') }} {{ $r['entry'] }} {{ $r['ref'] }} {{ $r['desc'] }} {{ $r['credit'] ? money($r['credit']) : '' }} {{ $r['debit'] ? money($r['debit']) : '' }} {{ money($r['balance']) }}
Balance owed{{ money($statement->last()['balance']) }}
@endcan
@endsection