@lang('sale.sell_details') (@lang('sale.invoice_no'): {{ $sell->invoice_no ?? ''}})

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

{{ __('sale.invoice_no') }}: #{{ $sell->invoice_no ?? ''}}
{{ __('sale.status') }}: @if($sell->status == 'draft' && $sell->is_quotation == 1) {{ __('lang_v1.quotation') }} @else {{ ucfirst( $sell->status ) }} @endif
{{ __('sale.payment_status') }}: {{ ucfirst( $sell->payment_status ) }}
{{ __('Branch') }}: {{ $sell->location->name ?? '' }}
{{ __('sale.customer_name') }}: {{ $sell->contact->name }} {{ $sell->contact->mobile ? '('.$sell->contact->mobile.')' : '' }}
{{ __('business.address') }}:
@if($sell->contact->landmark) {{ $sell->contact->landmark }} @endif {{ ', ' . $sell->contact->city }} @if($sell->contact->state) {{ ', ' . $sell->contact->state }} @endif
@if($sell->contact->country) {{ $sell->contact->country }} @endif

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

@if( session()->get('business.enable_lot_number') == 1) @endif @php $total_before_tax = 0.00; @endphp @php $total = 0; $sum = 0; $oldInvoice = App\Transaction::orderBy('id', 'DESC')->where('type', 'sell_return')->where('invoice_no', $sell->old_invoice)->first(); @endphp @if(isset($oldInvoice)) @php $lines = $oldInvoice->purchase_lines; @endphp @foreach($lines as $key => $sells_line) @php $product = $sells_line->product; if($sells_line->line_discount_type == 'percentage') { $discount = ($sells_line->line_discount_amount/100) * ($sells_line->quantity*$sells_line->purchase_price_inc_tax); } else { $discount = $sells_line->line_discount_amount; } $price = ($sells_line->quantity*$sells_line->purchase_price_inc_tax) - $discount; $total = $total + $price; @endphp @endforeach @endif @foreach($sell->sell_lines as $sell_line) @php if($sell_line->line_discount_type == 'percentage') { $discount = ($sell_line->line_discount_amount/100) * ($sell_line->quantity*$sell_line->unit_price_inc_tax); } else { $discount = $sell_line->line_discount_amount; } $price = ($sell_line->quantity*$sell_line->unit_price_inc_tax) - $discount; @endphp @if( session()->get('business.enable_lot_number') == 1) @endif @if(!empty($sell_line->modifiers)) @foreach($sell_line->modifiers as $modifier) @if( session()->get('business.enable_lot_number') == 1) @endif @endforeach @endif @php $total_before_tax += ($price); @endphp @endforeach
# {{ __('sale.product') }}{{ __('lang_v1.lot_n_expiry') }}{{ __('sale.qty') }} {{ __('sale.unit_price') }} {{ __('sale.discount') }} {{ __('sale.subtotal') }}
  {{$product->name}} (Exchange) {{$sells_line->quantity}} {{@num_format($sells_line->purchase_price_inc_tax)}} {{@num_format($discount)}} {{@num_format($price)}}
  {{ $sell_line->product->name }} @if( $sell_line->product->type == 'variable') - {{ $sell_line->variations->product_variation->name or ''}} - {{ $sell_line->variations->name or ''}}, @endif {{ $sell_line->variations->sub_sku or ''}} @php $brand = $sell_line->product->brand; @endphp @if(!empty($brand->name)) , {{$brand->name}} @endif @if(!empty($sell_line->sell_line_note))
{{$sell_line->sell_line_note}} @endif @if($sell_line->is_return == 1) (Return)@endif
{{ $sell_line->lot_details->lot_number or '--' }} @if( session()->get('business.enable_product_expiry') == 1 && !empty($sell_line->lot_details->exp_date)) ({{@format_date($sell_line->lot_details->exp_date)}}) @endif {{ $sell_line->quantity }} {{ $sell_line->unit_price }} {{ $sell_line->get_discount_amount() }} @if($sell_line->line_discount_type == 'percentage') ({{$sell_line->line_discount_amount}}%) @endif {{ $price }}
  {{ $modifier->product->name }} - {{ $modifier->variations->name or ''}}, {{ $modifier->variations->sub_sku or ''}}  {{ $modifier->quantity }} {{ $modifier->unit_price }} {{ $modifier->quantity * $modifier->unit_price_inc_tax }}

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

@php $total_paid = 0; @endphp @foreach($sell->payment_lines as $payment_line) @php if($payment_line->is_return == 1){ $total_paid -= $payment_line->amount; } else { $total_paid += $payment_line->amount; } @endphp @endforeach
# Credit Date {{ __('purchase.ref_no') }} {{ __('sale.amount') }} {{ __('sale.payment_mode') }}
{{ $loop->iteration }} {{ $payment_line->credit_date ? @format_date($payment_line->credit_date) : '' }} {{ $payment_line->payment_ref_no }} {{ $payment_line->method !== 'credit' ? $payment_line->amount : $payment_line->credit_amount}} {{ ucfirst($payment_line->method) }} @if($payment_line->is_return == 1)
( {{ __('lang_v1.change_return') }} ) @endif
@php if($sell->discount_type == 'percentage') { $discounts = ($sell->discount_amount/100) * ($sell->total_before_tax); } else { $discounts = $sell->discount_amount; } @endphp
{{ __('sale.total') }}: {{ $total_before_tax }}
{{ __('sale.order_tax') }}: {{ $sell->tax_amount }}
{{ __('sale.discount') }}: ({{ $discounts }})
{{ __('Loyalty') }}: ({{ $sell->loyalty_amount ?? 0.00}})
{{ __('Exchange Point') }}: ({{ $sell->return_point ?? 0.00}})
{{ __('Gift Voucher') }}: ({{ $sell->gift_voucher_amount ?? 0.00 }})
{{ __('sale.total_payable') }}: {{ $sell->final_total }}
{{ __('sale.total_paid') }}: {{ $total_paid }}
{{ __('sale.total_remaining') }}: {{ $sell->final_total - $total_paid }}
{{ __( 'sale.sell_note')}}:

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

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

@if($sell->staff_note) {{ $sell->staff_note }} @else -- @endif

@lang("messages.print")