@extends('layouts.app') @section('content')

{{ __('Sell Exchange') }}

@if (count($business_locations) > 0)
{!! Form::select( 'select_location_id', $business_locations, $default_location->id ?? null, ['class' => 'form-control input-sm', 'id' => 'select_location_id', 'required', 'autofocus'], $bl_attributes, ) !!} @show_tooltip(__('tooltip.sale_location'))
@endif @csrf @php $total_paid = 0; @endphp

Current Sell Details (Invoice:{{ $sell->invoice_no }})

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

{{-- @dd($sell, $sell->sell_lines) --}} @foreach ($sell->sell_lines as $sell_line) @php $lineId = $sell_line->id; @endphp @if ($sell->type == 'sales_order') @endif @endforeach
# Product Product Serial Quantity Unit Price Discount Tax Price inc. Tax Subtotal
{{ $loop->iteration }} {{ $sell_line->product->name }}
{{ $sell_line->variations->sub_sku }}
{{ $sell_line->product_serial ?? '-' }} {{ $sell_line->quantity - $sell_line->so_quantity_invoiced }} @if (!empty($sell_line->sub_unit)) {{ $sell_line->sub_unit->short_name }} @else {{ $sell_line->product->unit->short_name }} @endif @if ($sell_line->product->use_multi_unit == 1) @php $first_quantity = $sell_line->quantity / $sell_line->product->first_conversion_unit_rate; $first_unit = App\Unit::where( 'id', $line['first_conversion_unit_id'], )->first(); @endphp {{ $first_quantity }} {{ $first_unit->actual_name }}({{ $first_unit->short_name }}) @endif @if (!empty($for_ledger)) {{ @format_quantity($sell_line->quantity) }} @else {{ $sell_line->quantity }} @endif @if (!empty($sell_line->sub_unit)) {{ $sell_line->sub_unit->short_name }} @else {{ $sell_line->product->unit->short_name }} @endif @if (!empty($sell_line->product->second_unit) && $sell_line->secondary_unit_quantity != 0)
@if (!empty($for_ledger)) {{ @format_quantity($sell_line->secondary_unit_quantity) }} @else {{ $sell_line->secondary_unit_quantity }} @endif {{ $sell_line->product->second_unit->short_name }} @endif @if ($sell_line->product->use_multi_unit == 1) @if (!empty($sell_line->product->first_conversion_unit_id))
@php $first_quantity = $sell_line->quantity / $sell_line->product->first_conversion_unit_rate; $first_unit = App\Unit::where( 'id', $sell_line->product->first_conversion_unit_id, )->first(); @endphp {{ $first_quantity }} {{ $first_unit->actual_name }}({{ $first_unit->short_name }}) @endif @if (!empty($sell_line->product->second_conversion_unit_id))
@php $second_quantity = $sell_line->quantity / ($sell_line->product ->first_conversion_unit_rate * $sell_line->product ->second_conversion_unit_rate); $second_unit = App\Unit::where( 'id', $sell_line->product->second_conversion_unit_id, )->first(); @endphp {{ $second_quantity }} {{ $second_unit->actual_name }}({{ $second_unit->short_name }}) @endif @endif
@if (!empty($for_ledger)) @format_currency($sell_line->unit_price_before_discount) @else {{ $sell_line->unit_price_before_discount }} @endif @if (!empty($for_ledger)) @format_currency($sell_line->get_discount_amount()) @else {{ $sell_line->get_discount_amount() }} @endif @if ($sell_line->line_discount_type == 'percentage') ({{ $sell_line->line_discount_amount }}%) @endif @if (!empty($for_ledger)) @format_currency($sell_line->item_tax) @else {{ $sell_line->item_tax }} @endif @if (!empty($for_ledger)) @format_currency($sell_line->unit_price_inc_tax) @else {{ $sell_line->unit_price_inc_tax }} @endif @if (!empty($for_ledger)) @format_currency($sell_line->quantity * $sell_line->unit_price_inc_tax) @else {{ $sell_line->quantity * $sell_line->unit_price_inc_tax }} @endif

Total Exchange Amount: 0

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

@foreach ($sell->payment_lines as $payment_line) {{-- @dd($payment_line); --}} @php if ($payment_line->is_return == 1) { $total_paid -= $payment_line->amount; } else { $total_paid += $payment_line->amount; } @endphp @endforeach
# {{ __('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_types[$payment_line->method] ?? $payment_line->method }} @if ($payment_line->is_return == 1)
({{ __('lang_v1.change_return') }}) @endif
@if ($payment_line->note) {{ ucfirst($payment_line->note) }} @else -- @endif

Exchange Product

@php $hide_tax = ''; if (session()->get('business.enable_inline_tax') == 0) { $hide_tax = 'hide'; } @endphp @component('components.widget', ['class' => 'box-solid'])
{!! Form::text('search_product', null, [ 'class' => 'form-control mousetrap', 'id' => 'search_product', 'placeholder' => __('lang_v1.search_product_placeholder'), 'disabled' => is_null($default_location) ? true : false, 'autofocus' => is_null($default_location) ? false : true, ]) !!}
@php $hide_tax = ''; if (session()->get('business.enable_inline_tax') == 0) { $hide_tax = 'hide'; } @endphp
@if (!empty($common_settings['enable_serial_number'])) @endif @if (!empty($pos_settings['show_multi_unit'])) @endif @if (!empty($pos_settings['inline_service_staff'])) @endif @if (!empty($common_settings['enable_product_warranty'])) @endif
@lang('sale.product') Product Serial @lang('sale.qty') Other Unit @lang('restaurant.service_staff') @lang('sale.unit_price') @lang('receipt.discount') @lang('sale.tax') @lang('sale.price_inc_tax') @lang('lang_v1.warranty') @lang('sale.subtotal')
@lang('sale.item'): 0      @lang('sale.total'): 0
@endcomponent @component('components.widget', ['class' => 'box-solid']) {{--
{!! Form::label('discount_type', __('sale.discount_type') . ':*') !!}
{!! Form::select( 'discount_type', ['fixed' => __('lang_v1.fixed'), 'percentage' => __('lang_v1.percentage')], 'percentage', [ 'class' => 'form-control', 'placeholder' => __('messages.please_select'), 'required', 'data-default' => 'percentage', ], ) !!}
--}} @php $max_discount = !is_null(auth()->user()->max_sales_discount_percent) ? auth()->user()->max_sales_discount_percent : ''; //if sale discount is more than user max discount change it to max discount $sales_discount = $business_details->default_sales_discount; if ($max_discount != '' && $sales_discount > $max_discount) { $sales_discount = $max_discount; } $default_sales_tax = $business_details->default_sales_tax; @endphp {{--
{!! Form::label('discount_amount', __('sale.discount_amount') . ':*') !!}
{!! Form::text('discount_amount', @num_format($sales_discount), [ 'class' => 'form-control input_number', 'data-default' => $sales_discount, 'data-max-discount' => $max_discount, 'data-max-discount-error_msg' => __('lang_v1.max_discount_error_msg', [ 'discount' => $max_discount != '' ? @num_format($max_discount) : '', ]), ]) !!}

@lang('sale.discount_amount'):(-) 0

{{ session('business.rp_name') }}

{!! Form::label('rp_redeemed_modal', __('lang_v1.redeemed') . ':') !!}
{!! Form::number('rp_redeemed_modal', 0, [ 'class' => 'form-control direct_sell_rp_input', 'data-amount_per_unit_point' => session('business.redeem_amount_per_unit_rp'), 'min' => 0, 'data-max_points' => 0, 'data-min_order_total' => session('business.min_order_total_for_redeem'), ]) !!}

@lang('lang_v1.available'): 0

@lang('lang_v1.redeemed_amount'): (-)0

{!! Form::label('tax_rate_id', __('sale.order_tax') . ':*') !!}
{!! Form::select( 'tax_rate_id', $taxesDropdown['tax_rates'], $default_sales_tax, ['placeholder' => __('messages.please_select'), 'class' => 'form-control', 'data-default' => $default_sales_tax], $taxesDropdown['attributes'], ) !!}
@lang('sale.order_tax'):(+) 0
--}} {{--
{!! Form::label('sell_note', __('sale.sell_note')) !!} {!! Form::textarea('sale_note', null, ['class' => 'form-control', 'rows' => 3]) !!}
--}} @endcomponent @php $is_enabled_download_pdf = config('constants.enable_download_pdf'); $payment_body_id = 'payment_rows_div'; if ($is_enabled_download_pdf) { $payment_body_id = ''; } @endphp @can('sell.payments') @component('components.widget', [ 'class' => 'box-solid', 'id' => $payment_body_id, 'title' => __('purchase.add_payment'), ]) @if ($is_enabled_download_pdf)
{!! Form::label('prefer_payment_method', __('lang_v1.prefer_payment_method') . ':') !!} @show_tooltip(__('lang_v1.this_will_be_shown_in_pdf'))
{!! Form::select('prefer_payment_method', $payment_types, 'cash', [ 'class' => 'form-control', 'style' => 'width:100%;', ]) !!}
{!! Form::label('prefer_payment_account', __('lang_v1.prefer_payment_account') . ':') !!} @show_tooltip(__('lang_v1.this_will_be_shown_in_pdf'))
{!! Form::select('prefer_payment_account', $accounts, null, [ 'class' => 'form-control', 'style' => 'width:100%;', ]) !!}
@endif @if (empty($status) || !in_array($status, ['quotation', 'draft']))
@lang('lang_v1.advance_balance'): {!! Form::hidden('advance_balance', null, [ 'id' => 'advance_balance', 'data-error-msg' => __('lang_v1.required_advance_balance_not_available'), ]) !!}
@include('sell_exchange.partials.payment_row', [ 'row_index' => 0, 'show_date' => true, 'show_denomination' => true, ])

@lang('lang_v1.balance'):
@endif @endcomponent @endcan

Current Sell Details

@if (in_array('types_of_service', $enabled_modules) && !empty($sell->packing_charge)) @endif @if (session('business.enable_rp') == 1 && !empty($sell->rp_redeemed)) @endif @if (!empty($line_taxes)) @endif @if (!empty($sell->additional_expense_value_1) && !empty($sell->additional_expense_key_1)) @endif @if (!empty($sell->additional_expense_value_2) && !empty($sell->additional_expense_key_2)) @endif @if (!empty($sell->additional_expense_value_3) && !empty($sell->additional_expense_key_3)) @endif @if (!empty($sell->additional_expense_value_4) && !empty($sell->additional_expense_key_4)) @endif @if ($sell->type != 'sales_order') @endif
{{ __('sale.total') }}: {{ $sell->total_before_tax }}
{{ __('sale.discount') }}: (-)
discount_type == 'fixed') data-currency_symbol="true" @endif>{{ $sell->discount_amount }} @if ($sell->discount_type == 'percentage') {{ '%' }} @endif
{{ __('lang_v1.packing_charge') }}: (+)
packing_charge_type == 'fixed') data-currency_symbol="true" @endif>{{ $sell->packing_charge }} @if ($sell->packing_charge_type == 'percent') {{ '%' }} @endif
{{ session('business.rp_name') }}: (-) {{ $sell->rp_redeemed_amount }}
{{ __('sale.order_tax') }}: (+) @if (!empty($order_taxes)) @foreach ($order_taxes as $k => $v) {{ $k }} - {{ $v }}
@endforeach @else 0.00 @endif
{{ __('lang_v1.line_taxes') }}: @if (!empty($line_taxes)) @foreach ($line_taxes as $k => $v) {{ $k }} - {{ $v }}
@endforeach @else 0.00 @endif
{{ __('sale.shipping') }}: @if ($sell->shipping_details) ({{ $sell->shipping_details }}) @endif (+) {{ $sell->shipping_charges }}
{{ $sell->additional_expense_key_1 }}: (+) {{ $sell->additional_expense_value_1 }}
{{ $sell->additional_expense_key_2 }}: (+) {{ $sell->additional_expense_value_2 }}
{{ $sell->additional_expense_key_3 }}: (+) {{ $sell->additional_expense_value_3 }}
{{ $sell->additional_expense_key_4 }}: (+) {{ $sell->additional_expense_value_4 }}
{{ __('lang_v1.round_off') }}: {{ $sell->round_off_amount }}
{{ __('sale.total_payable') }}: {{ $sell->final_total }}
{{ __('sale.total_paid') }}: {{ $total_paid }}
{{ __('sale.total_remaining') }}: @php $total_paid = (string) $total_paid; @endphp {{ $sell->final_total - $total_paid }}

Exchange Sell Details

{{ __('sale.total') }}:
{{ __('sale.discount') }}: (-)
{{ __('sale.order_tax') }}: (+) @if (!empty($order_taxes)) @foreach ($order_taxes as $k => $v) {{ $k }} -
@endforeach @else 0.00 @endif
{{ __('sale.total_payable') }}:
{!! Form::hidden('is_save_and_print', 0, ['id' => 'is_save_and_print']) !!}
@endsection @section('javascript') @if (in_array('tables', $enabled_modules) || in_array('modifiers', $enabled_modules) || in_array('service_staff', $enabled_modules)) @endif @endsection