@php $show_lot = session('business.enable_lot_number'); $show_exp = session('business.enable_product_expiry'); $total_cols = 5 + ($show_lot ? 1 : 0) + ($show_exp ? 1 : 0); $net_total = 0; $damage_loss_value = 0; $show_damage_loss = session('business.enable_damage_loss_tracking'); foreach ($purchase->purchase_lines as $pl) { $net_total += $pl->quantity * $pl->purchase_price; $damage_loss_value += ($pl->quantity_damaged + $pl->quantity_lost) * $pl->purchase_price_inc_tax; } $pay_term = ''; if (!empty($purchase->contact->pay_term_number) && !empty($purchase->contact->pay_term_type)) { $pay_term = $purchase->contact->pay_term_number . ' ' . ucfirst($purchase->contact->pay_term_type); } @endphp
{{ $purchase->business->name }}
{{ $purchase->location->name }} @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->location->mobile))  · {{ $purchase->location->mobile }} @endif
@lang('purchase.grn_title')
@lang('purchase.grn')
@if(!empty($purchase->status)) {{ strtoupper(__('lang_v1.' . $purchase->status)) }} @endif
@lang('purchase.grn_no')
{{ $purchase->ref_no }}
@lang('messages.date')
{{ @format_date($purchase->transaction_date) }}
@lang('restaurant.order_no')
{{ $purchase_order_nos ?: '--' }}
@lang('lang_v1.order_dates')
{{ $purchase_order_dates ?: '--' }}
@lang('purchase.payment_status')
{{ !empty($purchase->payment_status) ? __('lang_v1.' . $purchase->payment_status) : '--' }}
@lang('purchase.payment_terms')
{{ $pay_term ?: '--' }}
@lang('purchase.business_location')
{{ $purchase->location->name }}
@lang('purchase.supplier')
{{ $purchase->contact->name }}
{!! $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
@lang('purchase.received_by')
{{ $purchase->location->name }}
{!! $purchase->location->location_address !!} @if(!empty($purchase->sales_person))
{{ __('purchase.received_by') }}: {{ $purchase->sales_person->user_full_name }}@endif
{{ __('messages.date') }}: {{ @format_datetime($purchase->created_at) }}
@if($show_lot) @endif @if($show_exp) @endif @php $tax_array = []; @endphp @foreach($purchase->purchase_lines as $purchase_line) iteration % 2 == 0) style="background:#eef5f4;" @endif> @if($show_lot) @endif @if($show_exp) @endif @endforeach
# @lang('product.product_name')@lang('lang_v1.lot_number')@lang('product.exp_date')@lang('purchase.purchase_quantity') @lang('purchase.unit_cost_after_tax') @lang('purchase.line_total')
{{ $loop->iteration }} {{ $purchase_line->product->name }} @if( $purchase_line->product->type == 'variable') - {{ $purchase_line->variations->product_variation->name ?? '' }} - {{ $purchase_line->variations->name ?? '' }} @endif
@lang('product.sku'): {{ $purchase_line->product->type == 'variable' ? ($purchase_line->variations->sub_sku ?? '') : $purchase_line->product->sku }} @if($show_damage_loss && ($purchase_line->quantity_damaged || $purchase_line->quantity_lost))
@if($purchase_line->quantity_damaged) {{ @format_quantity($purchase_line->quantity_damaged) }} @lang('purchase.quantity_damaged') @endif @if($purchase_line->quantity_lost) {{ @format_quantity($purchase_line->quantity_lost) }} @lang('purchase.quantity_lost') @endif @if(!empty($purchase_line->damage_loss_reason)) - {{ __('lang_v1.' . $purchase_line->damage_loss_reason) }} @endif @endif
{{ $purchase_line->lot_number }} @if(!empty($purchase_line->exp_date)) {{ @format_date($purchase_line->exp_date) }} @endif {{@format_quantity($purchase_line->quantity)}} @if(!empty($purchase_line->sub_unit)) {{$purchase_line->sub_unit->actual_name}} @else {{$purchase_line->product->unit->actual_name}} @endif @format_currency($purchase_line->purchase_price_inc_tax) @php if (!empty($purchase_line->tax_id)) { $tax_array[$purchase_line->tax_id][] = ($purchase_line->item_tax * $purchase_line->quantity); } @endphp @format_currency($purchase_line->purchase_price_inc_tax * $purchase_line->quantity)
@lang('purchase.additional_notes')
{{ $purchase->additional_notes ?: '--' }}
@lang('purchase.net_total_amount'): @format_currency($net_total)
@if(!empty($purchase->discount_amount)) @lang('purchase.discount'): @if($purchase->discount_type == 'percentage') -@format_currency($purchase->discount_amount * $net_total / 100) ({{ $purchase->discount_amount }}%) @else -@format_currency($purchase->discount_amount) @endif
@endif @if(!empty($tax_array)) @foreach($tax_array as $key => $value) {{ $taxes->where('id', $key)->first()->name ?? '' }}: @format_currency(array_sum($value))
@endforeach @endif @if(!empty($purchase->shipping_charges)) @lang('purchase.additional_shipping_charges'): @format_currency($purchase->shipping_charges)
@endif @if($show_damage_loss && $damage_loss_value > 0) @lang('purchase.damage_loss_value'): @format_currency($damage_loss_value)
@endif @lang('purchase.purchase_total'): @format_currency($purchase->final_total)
{!!ucfirst($total_in_words)!!}
@lang('purchase.received_by')
{{ $purchase->sales_person->user_full_name ?? '' }}
@lang('purchase.checked_by') @lang('purchase.approved_by') @lang('purchase.supplier')
{{ $purchase->business->name }} · @lang('purchase.printed_on'): {{ @format_datetime(\Carbon\Carbon::now()) }}