@extends('layouts.app') @section('title', 'Invoice ' . $sale->invoice_number) @section('content')

{{ $sale->invoice_number }}

Invoice details

Print @if($sale->payment_status != 'cancelled') @if($sale->payment_status == 'paid' && !$sale->record_only) Mark Record Only @elseif($sale->payment_status != 'paid') Edit @endif @endif Back
@if($sale->payment_status == 'paid') Paid @elseif($sale->payment_status == 'partial') Partial Payment @elseif($sale->payment_status == 'cancelled') Cancelled @else Unpaid @endif @if($sale->record_only) Record Only (No Stock Deduction) @endif
@if($sale->record_only)

Record Only Sale

This sale was recorded for reference only. No stock was deducted from inventory. @if($sale->linked_order_number)
Linked Order: {{ $sale->linked_order_number }} @endif @if($sale->stock_restored)
Stock restored on {{ \Carbon\Carbon::parse($sale->stock_restored_at)->format('d M Y H:i') }} @endif

@endif

BILL TO

{{ $sale->customer_name }}

{{ $sale->customer_phone }}

@if($sale->customer_email)

{{ $sale->customer_email }}

@endif @if($sale->customer_address)

{{ $sale->customer_address }}
{{ $sale->customer_postcode }} {{ $sale->customer_city }}, {{ $sale->customer_state }}

@endif

INVOICE DETAILS

Invoice Date:
{{ \Carbon\Carbon::parse($sale->invoice_date)->format('d M Y') }}
Payment Method:
{{ ucfirst(str_replace('_', ' ', $sale->payment_method)) }}
Created:
{{ \Carbon\Carbon::parse($sale->created_at)->format('d M Y H:i') }}
@foreach($items as $item) @endforeach
Product Qty Price Total
{{ $item->product_name }}
{{ $item->sku }}
{{ $item->quantity }} RM {{ number_format($item->unit_price, 2) }} RM {{ number_format($item->line_total, 2) }}
Subtotal: RM {{ number_format($sale->subtotal, 2) }}
@if($sale->discount_amount > 0)
Discount ({{ $sale->discount_percent }}%): - RM {{ number_format($sale->discount_amount, 2) }}
@endif
Total: RM {{ number_format($sale->total, 2) }}
Amount Paid: RM {{ number_format($sale->amount_paid, 2) }}
@if($sale->total - $sale->amount_paid > 0)
Balance Due: RM {{ number_format($sale->total - $sale->amount_paid, 2) }}
@endif
@if($sale->notes)

Notes

{{ $sale->notes }}

@endif @if($sale->cancel_reason)

Cancellation Reason

{{ $sale->cancel_reason }}

@endif @php $balanceDue = max(0, $sale->total - $sale->amount_paid); @endphp @if($sale->payment_status != 'cancelled' && $sale->payment_status != 'paid' && $balanceDue > 0)

Actions

@csrf
@elseif($sale->payment_status != 'cancelled' && $sale->payment_status != 'paid' && $balanceDue <= 0)

This invoice appears to be fully paid. Please refresh the page or contact admin if status is incorrect.

@endif
@endsection