@php $adminProfile = \App\Models\Admin::find(session('admin_id')); $shopName = $adminProfile && $adminProfile->shop_name ? $adminProfile->display_shop_name : ($adminProfile->name ?? 'Mandi Management'); $showReceiptLogo = (bool) ($adminProfile->show_pos_receipt_logo ?? false); $shopLogo = null; if ($showReceiptLogo && $adminProfile && $adminProfile->pos_receipt_logo) { $logoPath = storage_path('app/public/' . $adminProfile->pos_receipt_logo); if (file_exists($logoPath)) { $logoMime = mime_content_type($logoPath) ?: 'image/png'; $shopLogo = 'data:' . $logoMime . ';base64,' . base64_encode(file_get_contents($logoPath)); } } @endphp
@php($cutAmount = 0) @php($netPayable = max((float) ($purchase->remaining_amount ?? 0), 0))
@if ($shopLogo)
@endif

{{ $shopName }}

{{ $adminProfile?->display_address ?: 'N/A' }}
Phone: {{ $adminProfile->phone ?? 'N/A' }}
{{ __('Purchase Invoice') }}
{{ __('Dated:') }} {{ \Illuminate\Support\Carbon::parse($purchase->purchase_date)->format('d/m/Y') }}
{{ __('Time:') }} {{ $purchase->created_at->format('h:i A') }}
{{ __('Inv #:') }} {{ $purchase->invoice_no }}
{{ __('Status:') }} {{ ucfirst($purchase->status) }}
{{ __('Supplier:') }} {{ $purchase->supplier->display_name ?? 'N/A' }}
{{ __('Payment Status:') }} {{ ucfirst($purchase->payment_status ?? 'pending') }}
{{ __('Account:') }} {{ $purchase->account?->account_name ?? 'N/A' }}
{{ __('Paid By:') }} {{ $purchase->paid_by ?: 'N/A' }}
@foreach ($purchase->items as $item) @endforeach
{{ __('Item Description') }} {{ __('Price') }} {{ __('Qty.') }} {{ __('Amount') }}
{{ $item->product?->display_name ?: ($item->product_name ?? __('Product')) }} @if ($item->batch_no || $item->expiry_date)
@if ($item->batch_no) {{ __('Batch No:') }} {{ $item->batch_no }} @endif @if ($item->batch_no && $item->expiry_date) | @endif @if ($item->expiry_date) {{ __('Expiry:') }} {{ \Illuminate\Support\Carbon::parse($item->expiry_date)->format('d/m/Y') }} @endif
@endif
{{ number_format((float) $item->unit_price, 2) }} {{ number_format((float) $item->quantity, 2) }} {{ number_format((float) $item->sub_total, 2) }}
{{ __('Total Items') }} {{ number_format($purchase->items->count(), 2) }}
{{ __('Item Total') }} Rs. {{ number_format((float) $purchase->items->sum('sub_total'), 2) }}
{{ __('Discount') }} Rs. {{ number_format((float) $purchase->discount, 2) }}
{{ __('Shipping Cost') }} Rs. {{ number_format((float) $purchase->shipping_cost, 2) }}
{{ __('Grand Total') }} Rs. {{ number_format((float) $purchase->grand_total, 2) }}
{{ __('Received Amount') }} Rs. {{ number_format((float) $purchase->received_amount, 2) }}
{{-- @if($cutAmount > 0)
{{ __('Cut Amount') }} Rs. {{ number_format($cutAmount, 2) }}
@endif --}}
{{ __('Remaining Due:') }} Rs. {{ number_format((float) $netPayable, 2) }}
@if (!empty($purchase->note))
{{ $purchase->note }}
@endif
* {{ __('Thanks for shopping with us') }} *
Powered By Power Edge IT Services SMC PVT LTD