@php $title = $purchase->type == 'purchase_order' ? __('lang_v1.purchase_order_details') : __('purchase.purchase_details'); $custom_labels = json_decode(session('business.custom_labels'), true); @endphp

{{ $title }} (@lang('purchase.ref_no'): #{{ $purchase->ref_no }})

@lang('messages.date'): {{ @format_date($purchase->transaction_date) }}

@lang('purchase.supplier'):
{!! $purchase->contact->contact_address !!} @if (!empty($purchase->contact->tax_number))
@lang('contact.tax_no'): {{ $purchase->contact->tax_number }} @endif @if (!empty($purchase->contact->mobile))
@lang('contact.mobile'): {{ $purchase->contact->mobile }} @endif @if (!empty($purchase->contact->email))
@lang('business.email'): {{ $purchase->contact->email }} @endif
@if ($purchase->document_path)  {{ __('purchase.download_document') }} @endif
@lang('business.business'):
{{ $purchase->business->name }} {{ $purchase->location->name }} @if (!empty($purchase->location->landmark))
{{ $purchase->location->landmark }} @endif @if (!empty($purchase->location->city) || !empty($purchase->location->state) || !empty($purchase->location->country))
{{ implode(',', array_filter([$purchase->location->city, $purchase->location->state, $purchase->location->country])) }} @endif @if (!empty($purchase->business->tax_number_1))
{{ $purchase->business->tax_label_1 }}: {{ $purchase->business->tax_number_1 }} @endif @if (!empty($purchase->business->tax_number_2))
{{ $purchase->business->tax_label_2 }}: {{ $purchase->business->tax_number_2 }} @endif @if (!empty($purchase->location->mobile))
@lang('contact.mobile'): {{ $purchase->location->mobile }} @endif @if (!empty($purchase->location->email))
@lang('business.email'): {{ $purchase->location->email }} @endif
@lang('purchase.ref_no'): #{{ $purchase->ref_no }}
@lang('messages.date'): {{ @format_date($purchase->transaction_date) }}
@if (!empty($purchase->status)) @lang('purchase.purchase_status'): @if ($purchase->type == 'purchase_order') {{ $po_statuses[$purchase->status]['label'] ?? '' }} @else {{ __('lang_v1.' . $purchase->status) }} @endif
@endif @if (!empty($purchase->payment_status)) @lang('purchase.payment_status'): {{ __('lang_v1.' . $purchase->payment_status) }} @endif @if (!empty($custom_labels['purchase']['custom_field_1']))
{{ $custom_labels['purchase']['custom_field_1'] ?? '' }}: {{ $purchase->custom_field_1 }} @endif @if (!empty($custom_labels['purchase']['custom_field_2']))
{{ $custom_labels['purchase']['custom_field_2'] ?? '' }}: {{ $purchase->custom_field_2 }} @endif @if (!empty($custom_labels['purchase']['custom_field_3']))
{{ $custom_labels['purchase']['custom_field_3'] ?? '' }}: {{ $purchase->custom_field_3 }} @endif @if (!empty($custom_labels['purchase']['custom_field_4']))
{{ $custom_labels['purchase']['custom_field_4'] ?? '' }}: {{ $purchase->custom_field_4 }} @endif @if (!empty($purchase_order_nos)) @lang('restaurant.order_no'): {{ $purchase_order_nos }} @endif @if (!empty($purchase_order_dates))
@lang('lang_v1.order_dates'): {{ $purchase_order_dates }} @endif @if ($purchase->type == 'purchase_order') @php $custom_labels = json_decode(session('business.custom_labels'), true); @endphp @lang('sale.shipping'): {{ $shipping_statuses[$purchase->shipping_status] ?? '' }}
@if (!empty($purchase->shipping_address())) {{ $purchase->shipping_address() }} @else {{ $purchase->shipping_address ?? '--' }} @endif @if (!empty($purchase->delivered_to))
@lang('lang_v1.delivered_to'): {{ $purchase->delivered_to }} @endif @if (!empty($purchase->shipping_custom_field_1))
{{ $custom_labels['shipping']['custom_field_1'] ?? '' }}: {{ $purchase->shipping_custom_field_1 }} @endif @if (!empty($purchase->shipping_custom_field_2))
{{ $custom_labels['shipping']['custom_field_2'] ?? '' }}: {{ $purchase->shipping_custom_field_2 }} @endif @if (!empty($purchase->shipping_custom_field_3))
{{ $custom_labels['shipping']['custom_field_3'] ?? '' }}: {{ $purchase->shipping_custom_field_3 }} @endif @if (!empty($purchase->shipping_custom_field_4))
{{ $custom_labels['shipping']['custom_field_4'] ?? '' }}: {{ $purchase->shipping_custom_field_4 }} @endif @if (!empty($purchase->shipping_custom_field_5))
{{ $custom_labels['shipping']['custom_field_5'] ?? '' }}: {{ $purchase->shipping_custom_field_5 }} @endif @php $medias = $purchase->media->where('model_media_type', 'shipping_document')->all(); @endphp @if (count($medias)) @include('sell.partials.media_table', ['medias' => $medias]) @endif @endif

@if($image_view) @endif @if ($purchase->type == 'purchase_order') @endif @if (auth()->user()->can('hide_system_price')) @endif @if ($purchase->type != 'purchase_order') @if (session('business.enable_lot_number')) @endif @if (session('business.enable_product_expiry')) @endif @endif @if (auth()->user()->can('hide_system_price')) @endif @php $total_before_tax = 0.0; @endphp @foreach ($purchase->purchase_lines as $purchase_line) @if($image_view) @endif @if ($purchase->type == 'purchase_order') @endif @if (auth()->user()->can('hide_system_price')) @endif @if ($purchase->type != 'purchase_order') @if (session('business.enable_lot_number')) @endif @if (session('business.enable_product_expiry')) @endif @endif @if (auth()->user()->can('hide_system_price')) @endif @php $total_before_tax += $purchase_line->quantity * $purchase_line->purchase_price; @endphp @endforeach
#{{ __('lang_v1.product_image') }} @lang('product.product_name') @lang('product.sku')@lang('lang_v1.quantity_remaining') @if ($purchase->type == 'purchase_order') @lang('lang_v1.order_quantity') @else @lang('purchase.purchase_quantity') @endif @lang('lang_v1.unit_cost_before_discount') @lang('lang_v1.discount_percent') @lang('purchase.unit_cost_before_tax') @lang('purchase.subtotal_before_tax') @lang('sale.tax') @lang('purchase.unit_cost_after_tax')@lang('lang_v1.lot_number')@lang('product.mfg_date') @lang('product.exp_date')@lang('sale.subtotal')
{{ $loop->iteration }} @if(!empty($purchase_line->product->image)) {{ $purchase_line->product->name ?? 'Product' }} @else Default Product @endif {{ $purchase_line->product->name }} @if ($purchase_line->product->type == 'variable') - {{ $purchase_line->variations->product_variation->name }} - {{ $purchase_line->variations->name }} @endif @if ($purchase_line->product->type == 'variable') {{ $purchase_line->variations->sub_sku }} @else {{ $purchase_line->product->sku }} @endif {{ $purchase_line->quantity - $purchase_line->po_quantity_purchased }} @if (!empty($purchase_line->actual_name)) {{ $purchase_line->sub_unit->actual_name }} @else {{ $purchase_line->product->unit->actual_name }} @endif {{ $purchase_line->quantity }} @if (!empty($purchase_line->sub_unit)) {{ $purchase_line->sub_unit->actual_name }} @else {{ $purchase_line->product->unit->actual_name }} @endif @if ($purchase_line->product->unit->sub_units) @foreach ($purchase_line->product->unit->sub_units as $sub_unit) @if ($sub_unit->id == $purchase_line->sub_unit_id) ({{ (float) $sub_unit->base_unit_multiplier }} {{ $purchase_line->product->unit->short_name }}) @endif @endforeach @endif @if (!empty($purchase_line->product->second_unit) && $purchase_line->secondary_unit_quantity != 0)
{{ $purchase_line->secondary_unit_quantity }} {{ $purchase_line->product->second_unit->actual_name }} @endif
{{ $purchase_line->pp_without_discount }} {{ $purchase_line->discount_percent }} % {{ $purchase_line->purchase_price }} {{ $purchase_line->quantity * $purchase_line->purchase_price }} {{ $purchase_line->item_tax }}
@if (!empty($taxes[$purchase_line->tax_id])) ( {{ $taxes[$purchase_line->tax_id] }} ) @endif
{{ $purchase_line->purchase_price_inc_tax }} {{ $purchase_line->lot_number }} @if (!empty($purchase_line->mfg_date)) {{ @format_date($purchase_line->mfg_date) }} @endif @if (!empty($purchase_line->exp_date)) {{ @format_date($purchase_line->exp_date) }} @endif {{ $purchase_line->purchase_price_inc_tax * $purchase_line->quantity }}

@if (!empty($purchase->type == 'purchase'))

{{ __('sale.payment_info') }}:

@php $total_paid = 0; @endphp @forelse($purchase->payment_lines as $payment_line) @php $total_paid += $payment_line->amount; @endphp @empty @endforelse
# {{ __('messages.date') }} {{ __('purchase.ref_no') }} {{ __('sale.amount') }} {{ __('sale.payment_mode') }} {{ __('sale.payment_note') }}
{{ $loop->iteration }} {{ @format_date($payment_line->paid_on) }} {{ $payment_line->payment_ref_no }} {{ $payment_line->amount }} {{ $payment_methods[$payment_line->method] ?? '' }} @if ($payment_line->note) {{ ucfirst($payment_line->note) }} @else -- @endif
@lang('purchase.no_payments')
@endif
@if (!empty($purchase->shipping_charges)) @endif @if (!empty($purchase->additional_expense_value_1) && !empty($purchase->additional_expense_key_1)) @endif @if (!empty($purchase->additional_expense_value_2) && !empty($purchase->additional_expense_key_2)) @endif @if (!empty($purchase->additional_expense_value_3) && !empty($purchase->additional_expense_key_3)) @endif @if (!empty($purchase->additional_expense_value_4) && !empty($purchase->additional_expense_key_4)) @endif
@lang('purchase.net_total_amount'): {{ $total_before_tax }}
@lang('purchase.discount'): (-) @if ($purchase->discount_type == 'percentage') ({{ $purchase->discount_amount }} %) @endif @if ($purchase->discount_type == 'percentage') {{ ($purchase->discount_amount * $total_before_tax) / 100 }} @else {{ $purchase->discount_amount }} @endif
@lang('purchase.purchase_tax'): (+) @if (!empty($purchase_taxes)) @foreach ($purchase_taxes as $k => $v) {{ $k }} - {{ $v }}
@endforeach @else 0.00 @endif
@lang('purchase.additional_shipping_charges'): (+) {{ $purchase->shipping_charges }}
{{ $purchase->additional_expense_key_1 }}: (+) {{ $purchase->additional_expense_value_1 }}
{{ $purchase->additional_expense_key_2 }}: (+) {{ $purchase->additional_expense_value_2 }}
{{ $purchase->additional_expense_key_3 }}: (+) {{ $purchase->additional_expense_value_3 }}
{{ $purchase->additional_expense_key_4 }}: (+) {{ $purchase->additional_expense_value_4 }}
@lang('purchase.purchase_total'): {{ $purchase->final_total }}
@lang('purchase.shipping_details'):

{{ $purchase->shipping_details ?? '' }} @if (!empty($purchase->shipping_custom_field_1))
{{ $custom_labels['purchase_shipping']['custom_field_1'] ?? '' }}: {{ $purchase->shipping_custom_field_1 }} @endif @if (!empty($purchase->shipping_custom_field_2))
{{ $custom_labels['purchase_shipping']['custom_field_2'] ?? '' }}: {{ $purchase->shipping_custom_field_2 }} @endif @if (!empty($purchase->shipping_custom_field_3))
{{ $custom_labels['purchase_shipping']['custom_field_3'] ?? '' }}: {{ $purchase->shipping_custom_field_3 }} @endif @if (!empty($purchase->shipping_custom_field_4))
{{ $custom_labels['purchase_shipping']['custom_field_4'] ?? '' }}: {{ $purchase->shipping_custom_field_4 }} @endif @if (!empty($purchase->shipping_custom_field_5))
{{ $custom_labels['purchase_shipping']['custom_field_5'] ?? '' }}: {{ $purchase->shipping_custom_field_5 }} @endif

@lang('purchase.additional_notes'):

@if ($purchase->additional_notes) {{ $purchase->additional_notes }} @else -- @endif

@if (!empty($activities))
{{ __('lang_v1.activities') }}:
@includeIf('activity_log.activities', ['activity_type' => 'purchase'])
@endif {{-- Barcode --}}