@extends('layouts.app') @section('title', 'Vendor bills') @section('content') @php $pills = filter_pills([ 'status' => ['Status', ['unpaid' => 'Unpaid', 'partial' => 'Partly paid', 'paid' => 'Paid', 'overdue' => 'Overdue']], 'vendor_id' => ['Vendor', fn ($id) => optional($vendors->firstWhere('id', $id))->name ?? $id], 'from' => ['From', fn ($d) => pretty_date($d)], 'to' => ['To', fn ($d) => pretty_date($d)], ]); $filtered = count($pills) > 0 || request()->filled('q'); $chips = [[null, 'All', 'all'], ['unpaid', 'Unpaid', 'unpaid'], ['partial', 'Partly paid', 'partial'], ['paid', 'Paid', 'paid'], ['overdue', 'Overdue', 'overdue']]; @endphp @can('data.export') Export @endcan @can('vendor_bills.create') Add bill @endcan
@foreach ($chips as [$key, $label, $ck]) {{ $label }} {{ $stateCounts[$ck] }} @endforeach
@forelse ($bills as $b) @empty @endforelse @if ($bills->total() > 0) @endif
Order Actions
{{ $b->bill_no ?: '#'.$b->id }} @if ($b->description){{ $b->description }}@endif {{ $b->vendor->name }} {{ $b->bill_date->format('d M Y') }} {{ $b->due_date?->format('d M Y') ?? '—' }}@if ($b->isOverdue())overdue@endif @if ($b->order){{ $b->order->order_no }}@else —@endif {{ money($b->amount) }} {{ money($b->due()) }}
  • View
  • @can('vendor_bills.edit')
  • Edit
  • @endcan @if ($b->due() > 0.004) @can('payments.create')
  • Pay this bill
  • @endcan @endif @can('vendor_bills.delete')
  • @endcan
    @can('vendor_bills.create') Add a bill @endcan
    All {{ $bills->total() }} matching {{ \Illuminate\Support\Str::plural('bill', $bills->total()) }} {{ money($sums['amount']) }} {{ money($sums['paid']) }} paid {{ money($sums['due']) }}
    @endsection