@extends('layouts.business.pdf.pdf_layout') @section('pdf_title') @endsection @section('pdf_content')
{{-- HEADER --}}
@php $defaultLogo = public_path('assets/images/default.svg'); $customLogo = public_path( get_business_option('business-settings')['a4_invoice_logo'] ?? 'assets/images/default.svg', ); $logoPath = file_exists($customLogo) ? $customLogo : $defaultLogo; $logoData = base64_encode(file_get_contents($logoPath)); $logoType = pathinfo($logoPath, PATHINFO_EXTENSION); @endphp @if ((get_business_option('business-settings')['show_a4_invoice_logo'] ?? 0) == 1) @endif
{{ __('Address') }} : {{ $purchase->branch?->address ?? $purchase->business?->address }}
{{ __('Mobile') }} : {{ $purchase->branch?->phone ?? $purchase->business?->phoneNumber }}
{{ __('Email') }} : {{ $purchase->branch?->email ?? $purchase->business?->email }}
@if (($purchase->business->meta['show_vat'] ?? 0) == 1) {{ $purchase->business->vat_name }} @endif {{ ($purchase->business->meta['show_vat'] ?? 0) == 1 && ($purchase->business->meta['show_vat'] ?? 0) == 1 ? ':' : '' }} @if (($purchase->business->meta['show_vat'] ?? 0) == 1) {{ $purchase->business->vat_no ?? '' }} @endif
{{-- INVOICE BADGE --}}

{{ __('INVOICE') }}

{{-- SUPPLIER / PURCHASE INFO --}}
{{ __('Supplier Name') }} : {{ $purchase->party->name }}
{{ __('Mobile') }} : {{ $purchase->party->phone }}
{{ __('Address') }} : {{ $purchase->party->address }}
{{ __('Invoice') }} : {{ $purchase->invoiceNumber }}
{{ __('Date') }} : {{ formatted_date($purchase->purchaseDate) }}
{{ __('Purchases By') }} : {{ $purchase->user->role != 'staff' ? __('Admin') : $purchase->user->name }}
{{-- ITEM TABLE --}} @usercan('purchases.price') @endusercan @php $subtotal = 0; @endphp @foreach ($purchase->details as $detail) @php $productTotal = ($detail->productPurchasePrice ?? 0) * ($detail->quantities ?? 0); $subtotal += $productTotal; @endphp @usercan('purchases.price') @endusercan @endforeach
{{ __('SL') }} {{ __('Item') }} {{ __('Quantity') }}{{ __('Unit Price') }}{{ __('Total Price') }}
{{ $loop->iteration }} {{ ($detail->product->productName ?? '') . (!empty($detail->stock?->batch_no) ? ' (' . $detail->stock?->batch_no . ')' : '') }} {{ $detail->quantities }} {{ currency_format($detail->productPurchasePrice, currency: business_currency()) }} {{ currency_format($productTotal, currency: business_currency()) }}
@if ((get_business_option('business-settings')['show_note'] ?? 0) == 1) @endif
{{ amountInWords($subtotal) }}
{{ __('Paid by') }} : {{ $transactionTypes ?? ($purchase->payment_type_id ? ($purchase->payment_type->name ?? '') : ($purchase->paymentType ?? '')) }}
{{ get_business_option('business-settings')['note'] ?? '' }}
{{-- BANK DETAILS --}} @if (($bank_detail->show_in_invoice ?? 0) == 1)
{{ __('Bank Details') }}
{{ __('Name') }} : {{ $bank_detail->name }}
{{ __('Account No') }} : {{ $bank_detail->meta['account_number'] ?? '' }}
{{ __('UPI ID') }} : {{ $bank_detail->meta['upi_id'] ?? '' }}
{{ __('Holder’s Name') }} : {{ $bank_detail->meta['account_holder'] ?? '' }}
@endif
{{ __('Subtotal') }} {{ currency_format($subtotal, currency: business_currency()) }}
{{ __('Vat') }} {{ currency_format($purchase->vat_amount, currency: business_currency()) }}
{{ __('Shipping Charge') }} {{ currency_format($purchase->shipping_charge, currency: business_currency()) }}
{{ __('Discount') }} {{ currency_format($purchase->discountAmount, currency: business_currency()) }}
{{ __('Total Amount') }} {{ currency_format($purchase->totalAmount, currency: business_currency()) }}
{{ __('Total Return Amount') }} {{ currency_format($returnTotal ?? 0, currency: business_currency()) }}
{{ __('Payable Amount') }} {{ currency_format($purchase->totalAmount, currency: business_currency()) }}
{{ __('Paid Amount') }} {{ currency_format($purchase->paidAmount, currency: business_currency()) }}
{{ __('Due') }} {{ currency_format($purchase->dueAmount, currency: business_currency()) }}
{{-- RETURN TABLE --}} @if (!$purchase_returns->isEmpty())
{{ __('Returned Items') }}
@php $total_return_amount = 0; @endphp @foreach ($purchase_returns as $return) @foreach ($return->details as $detail) @php $total_return_amount += $detail->return_amount ?? 0; @endphp @endforeach @endforeach
{{ __('SL') }} {{ __('Date') }} {{ __('Returned Item') }} {{ __('Quantity') }} {{ __('Total Amount') }}
{{ $loop->iteration }} {{ formatted_date($return->return_date) }} {{ $detail->purchaseDetail->product->productName ?? '' }} {{ $detail->purchaseDetail?->stock?->batch_no ? '(' . $detail->purchaseDetail?->stock?->batch_no . ')' : '' }} {{ $detail->return_qty }} {{ currency_format($detail->return_amount, currency: business_currency()) }}
{{ amountInWords($total_return_amount) }}
{{ __('Paid by') }} : {{ $returnTransactionType ?? $purchase->paymentType ?? '' }}
{{ __('Total Return Amount') }} : {{ currency_format($total_return_amount, currency: business_currency()) }}
{{ __('Payable Amount') }} : {{ currency_format($purchase->totalAmount, currency: business_currency()) }}
{{ __('Paid Amount') }} : {{ currency_format($purchase->paidAmount, currency: business_currency()) }}
{{ __('Due') }} : {{ currency_format($purchase->dueAmount, currency: business_currency()) }}
@endif {{-- PAYMENT INFO --}}
{{-- SIGNATURE --}} {{-- WARRANTY --}} @if ((get_business_option('business-settings')['show_warranty'] ?? 0) == 1)
@if ((get_business_option('business-settings')['show_warranty'] ?? 0) == 1) {{ get_business_option('business-settings')['warranty_void_label'] ?? '' }} - @endif {{ get_business_option('business-settings')['warranty_void'] ?? '' }}
@endif
@endsection