@extends('garage.layouts.app') @section('title', 'Purchase invoice '.$purchaseInvoice->bill_number) @push('styles') @include('shared.garage-purchase-order-ui-styles') @endpush @section('content') @php $canReturn = in_array($purchaseInvoice->status, ['received','partial','paid','overdue'], true); @endphp

{{ $purchaseInvoice->bill_number }}

{{ \Carbon\Carbon::parse($purchaseInvoice->bill_date)->format('M d, Y') }} · {{ $purchaseInvoice->vendor_name ?? 'No vendor' }} · {{ ucfirst($purchaseInvoice->status) }}

Journal voucher @if($purchaseInvoice->status === 'draft') Edit @endif @if($canReturn) Record return @endif Back
@if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif
Line items
@foreach($items as $item) @php $name = $item->part_name ?? $item->labor_name ?? $item->service_group_name ?? $item->description ?? '—'; $returned = (int) ($item->quantity_returned ?? 0); @endphp @endforeach
Item Qty Returned Unit Total
{{ $name }} ({{ $item->item_type }}) {{ $item->quantity }} {{ $returned }} {{ number_format($item->unit_price, 2) }} {{ number_format($item->total_price, 2) }}
@if(isset($returns) && $returns->count())
Purchase returns
    @foreach($returns as $ret)
  • {{ $ret->return_number }} · {{ \Carbon\Carbon::parse($ret->return_date)->format('M d, Y') }} -{{ number_format($ret->total_amount, 2) }}
  • @endforeach
@endif
Subtotal{{ number_format($purchaseInvoice->subtotal, 2) }}
Tax{{ number_format($purchaseInvoice->tax_amount, 2) }}
Paid{{ number_format($purchaseInvoice->paid_amount, 2) }}

Total{{ number_format($purchaseInvoice->total_amount, 2) }}
Balance{{ number_format($purchaseInvoice->balance_amount, 2) }}
@if(!empty($purchaseInvoice->journal_voucher_id))

Journal voucher linked — open Voucher for details.

@else

No journal voucher yet. Set status to Received with a vendor to post JV.

@endif
@endsection