@extends('master.app') @section('title', 'Purchase Invoice') @section('body')
{{-- TOP BAR (Screen only) --}}
{{ $type == 1 ? 'Raw Materials' : 'Finished Goods' }} Invoice #{{ $bill->invoice_number }} {{ $bill->invoice_date }}
Purchase Invoice Details
Professional invoice + print + WhatsApp share
Back
@include('general.valert') @php $cur = $bill->currency->title_en ?? ($bill->currency->title_ps ?? ($bill->currency->title_dr ?? '')); $totalQty = $bill_items->sum('qty'); // Optional company info if you have $info from controller, otherwise fallback $companyName = $info->name ?? config('app.name', 'Company Name'); $companyPhone = $info->phone ?? ''; $companyEmail = $info->email ?? ''; $companyAddress = $info->address ?? ''; $companyLogo = isset($info->logo) ? asset('storage/' . $info->logo) : null; // adjust if needed @endphp {{-- ========================= PRINT AREA (Only this prints) ========================== --}}
{{-- HEADER --}}
@if ($companyLogo) logo @else
@endif

{{ $companyName }}

@if ($companyAddress)
{{ $companyAddress }}
@endif
@if ($companyPhone) {{ $companyPhone }} @endif @if ($companyEmail) {{ $companyEmail }} @endif
PURCHASE INVOICE
Invoice No: #{{ $bill->invoice_number }}
Date: {{ $bill->invoice_date }}
Type: {{ $type == 1 ? 'Raw Materials' : 'Finished Goods' }}
Currency: {{ $cur }}
Ex. Rate: {{ $bill->ex_rate ?? 1 }}
{{-- SUPPLIER + PAYMENT INFO --}}
Supplier
Name: {{ $bill->supplier->name ?? 'N/A' }}
@if (!empty($bill->supplier->phone))
Phone: {{ $bill->supplier->phone }}
@endif @if (!empty($bill->supplier->address))
Address: {{ $bill->supplier->address }}
@endif
Payment & Summary
Title: {{ $bill->title ?? 'N/A' }}
Total Qty {{ number_format((float) $totalQty, 2) }}
Grand Total {{ number_format((float) $bill->grand_total, 2) }} {{ $cur }}
Payment {{ number_format((float) $bill->payment, 2) }} {{ $cur }}
Balance {{ number_format((float) $bill->balance, 2) }} {{ $cur }}
Payment Type: @if ($bill->transaction_id == 1) Cash @elseif ($bill->transaction_id == 2) Bank @else Sarafi @endif @if ($bill->payment_by) | By: {{ $bill->payment_by }} @endif
{{-- ITEMS TABLE --}}
Items List
@if ($type == 1) @else @endif @forelse($bill_items as $row) @if ($type == 1) @else @endif @empty @endforelse @if ($bill_items->count() > 0) @endif
#Category Sub Category Unit Qty CPI SPI TotalCategory Sub Category Unit Weight Location Qty Price SPI Total
{{ $loop->iteration }}{{ $row->category->title_en ?? ($row->category->name ?? 'N/A') }} {{ $row->sub_category->title_en ?? ($row->sub_category->name ?? '-') }} {{ $row->unit->title_en ?? ($row->unit->title_ps ?? ($row->unit->name ?? 'N/A')) }} {{ number_format((float) $row->qty, 2) }} {{ number_format((float) $row->cpi, 2) }} {{ number_format((float) $row->spi, 2) }} {{ number_format((float) $row->total, 2) }} {{ $row->category->title_en ?? ($row->category->name ?? 'N/A') }} {{ $row->sub_category->title_en ?? ($row->sub_category->name ?? 'N/A') }} {{ $row->unit->title_en ?? ($row->unit->title_ps ?? ($row->unit->name ?? 'N/A')) }} {{ $row->weight->title_en ?? ($row->weight->title_ps ?? ($row->weight->name ?? '-')) }} {{ $row->location->title ?? ($row->location->name ?? '-') }} {{ number_format((float) $row->qty, 2) }} {{ number_format((float) $row->price, 2) }} {{ number_format((float) ($row->spi ?? 0), 2) }} {{ number_format((float) $row->total, 2) }}
No items found.
Grand Total {{ number_format((float) $bill->grand_total, 2) }} {{ $cur }}
{{-- FOOTER / TERMS / SIGNATURE --}}
Notes / Terms
  • All amounts are in {{ $cur }}. Exchange rate applied where required.
  • Please verify items and quantities upon receipt.
  • This invoice is system-generated and valid without signature, unless required by policy.
Authorized Signature
Supplier Signature
{{-- /printArea --}}
@include('purchase.bills.bill-modal') @endsection @section('pageJs') @endsection