@php $common_settings = session()->get('business.common_settings'); $multiplier = 1; $action = !empty($action) ? $action : ''; $is_mobile = isMobile(); @endphp @foreach($sub_units as $key => $value) @if(!empty($product->sub_unit_id) && $product->sub_unit_id == $key) @php $multiplier = $value['multiplier']; @endphp @endif @endforeach transaction_sell_lines_id)) @if($product->not_for_selling == 1)style="display: none;"@endif @endif data-row_index="{{$row_count}}" @if(!empty($so_line)) data-so_id="{{$so_line->transaction_id}}" @endif> @if(!empty($so_line)) @endif @php $product_name = $product->product_name; $barcode = $product->sub_sku; if(!empty($product->brand)){ $product_name .= ' ' . $product->brand ;} @endphp {{-- Product name and barcode (inline) - clickable to show purchase details --}} {{ $product_name }}@if(!empty($barcode)){{ $barcode }}@endif @php $hide_tax = 'hide'; if(session()->get('business.enable_inline_tax') == 1){ $hide_tax = ''; } $tax_id = $product->tax_id; $item_tax = !empty($product->item_tax) ? $product->item_tax : 0; $unit_price_inc_tax = $product->sell_price_inc_tax; if($hide_tax == 'hide'){ $tax_id = null; $unit_price_inc_tax = $product->default_sell_price; } if(!empty($so_line) && $action !== 'edit') { $tax_id = $so_line->tax_id; $item_tax = $so_line->item_tax; $unit_price_inc_tax = $so_line->unit_price_inc_tax; } $discount_type = !empty($product->line_discount_type) ? $product->line_discount_type : 'fixed'; $discount_amount = !empty($product->line_discount_amount) ? $product->line_discount_amount : 0; if(!empty($discount)) { $discount_type = $discount->discount_type; $discount_amount = $discount->discount_amount; } if(!empty($so_line) && $action !== 'edit') { $discount_type = $so_line->line_discount_type; $discount_amount = $so_line->line_discount_amount; } $sell_line_note = ''; if(!empty($product->sell_line_note)){ $sell_line_note = $product->sell_line_note; } if(!empty($so_line)){ $sell_line_note = $so_line->sell_line_note; } @endphp @if(!empty($discount)) {!! Form::hidden("products[$row_count][discount_id]", $discount->id); !!} @endif @php $warranty_id = !empty($action) && $action == 'edit' && !empty($product->warranties->first()) ? $product->warranties->first()->id : $product->warranty_id; if($discount_type == 'fixed') { $discount_amount = $discount_amount * $multiplier; } @endphp {{-- Modal removed - Unit Price, Discount Type, and Discount Amount are now inline in the table --}} @if($product->enable_stock) {{ @num_format($product->qty_available) }} {{$product->unit}} @lang('lang_v1.in_stock') @else -- @endif @php $custom_labels = json_decode(session('business.custom_labels'), true); $product_custom_fields = !empty($custom_labels['product']) ? $custom_labels['product'] : []; $product_cf_details = !empty($custom_labels['product_cf_details']) ? $custom_labels['product_cf_details'] : []; $custom_fields_display = []; $iteration = 1; foreach($product_custom_fields as $cf){ if(!empty($cf)){ $db_field_name = 'product_custom_field' . $iteration; $cf_type = !empty($product_cf_details[$iteration]['type']) ? $product_cf_details[$iteration]['type'] : 'text'; $dropdown = !empty($product_cf_details[$iteration]['dropdown_options']) ? explode(PHP_EOL, $product_cf_details[$iteration]['dropdown_options']) : []; $value = $product->$db_field_name ?? null; $display_value = ''; if(in_array($cf_type, ['text', 'date'])){ $display_value = $value; } elseif($cf_type == 'dropdown'){ $display_value = !empty($dropdown[$product->$db_field_name]) ? $dropdown[$product->$db_field_name] : ''; } if(!empty($display_value) || $display_value === '0'){ $custom_fields_display[] = $cf . ': ' . $display_value; } else { $custom_fields_display[] = $cf . ':'; } $iteration++; } } @endphp @if(!empty($custom_fields_display)) | {{ implode(' | ', $custom_fields_display) }} @endif @if(in_array('modifiers' , $enabled_modules))
@if(!empty($product->product_ms)) @include('restaurant.product_modifier_set.modifier_for_product', array('edit_modifiers' => true, 'row_count' => $loop->index, 'product_ms' => $product->product_ms ) ) @endif
@endif @php $max_quantity = $product->qty_available; $formatted_max_quantity = $product->formatted_qty_available; if(!empty($action) && $action == 'edit') { if(!empty($so_line)) { $qty_available = $so_line->quantity - $so_line->so_quantity_invoiced + $product->quantity_ordered; $max_quantity = $qty_available; $formatted_max_quantity = number_format($qty_available, session('business.quantity_precision', 2), session('currency')['decimal_separator'], session('currency')['thousand_separator']); } } else { if(!empty($so_line) && $so_line->qty_available <= $max_quantity) { $max_quantity = $so_line->qty_available; $formatted_max_quantity = $so_line->formatted_qty_available; } } $max_qty_rule = $max_quantity; $max_qty_msg = __('validation.custom-messages.quantity_not_available', ['qty'=> $formatted_max_quantity, 'unit' => $product->unit ]); @endphp @if( session()->get('business.enable_lot_number') == 1 || session()->get('business.enable_product_expiry') == 1) @php $lot_enabled = session()->get('business.enable_lot_number'); $exp_enabled = session()->get('business.enable_product_expiry'); $lot_no_line_id = ''; if(!empty($product->lot_no_line_id)){ $lot_no_line_id = $product->lot_no_line_id; } @endphp @if(!empty($product->lot_numbers) && empty($is_sales_order)) @endif @endif @if(!empty($is_direct_sell))

@lang('lang_v1.sell_line_description_help')

@endif @if(!empty($common_settings['enable_serial_number'])) @if($product->enable_serial_number == "1") @if(!empty($action) && $action == 'edit')
@php $product_serial_numbers = App\SerialNumber::where('location_id', $location_id) ->where('product_id', $product->product_id) ->where('variation_id', $product->variation_id) ->where('purchase_status', 'received') ->where('stock_status', "available") ->get(); $product_sell_serial_numbers = App\SerialNumber::where('location_id', $location_id) ->where('product_id', $product->product_id) ->where('variation_id', $product->variation_id) ->where('stock_status', 'out') ->where('transaction_id', $product->transaction_id) ->get(); @endphp
@else @endif {{-- Quantity Column --}} {{-- If edit then transaction sell lines will be present --}} @if(!empty($product->transaction_sell_lines_id)) @endif @if(empty($product->quantity_ordered)) @php $product->quantity_ordered = 1; @endphp @endif @php $allow_decimal = true; if($product->unit_allow_decimal != 1) { $allow_decimal = false; } @endphp @foreach($sub_units as $key => $value) @if(!empty($product->sub_unit_id) && $product->sub_unit_id == $key) @php $max_qty_rule = $max_qty_rule / $multiplier; $unit_name = $value['name']; $max_qty_msg = __('validation.custom-messages.quantity_not_available', ['qty'=> $max_qty_rule, 'unit' => $unit_name ]); if(!empty($product->lot_no_line_id)){ $max_qty_msg = __('lang_v1.quantity_error_msg_in_lot', ['qty'=> $max_qty_rule, 'unit' => $unit_name ]); } if($value['allow_decimal']) { $allow_decimal = true; } @endphp @endif @endforeach
enable_stock && empty($pos_settings['allow_overselling']) && empty($is_sales_order) ) data-rule-max-value="{{$max_qty_rule}}" data-qty_available="{{$product->qty_available}}" data-msg-max-value="{{$max_qty_msg}}" data-msg_max_default="@lang('validation.custom-messages.quantity_not_available', ['qty'=> $product->formatted_qty_available, 'unit' => $product->unit ])" @endif >
@if(!empty($product->second_unit))
@lang('lang_v1.quantity_in_second_unit', ['unit' => $product->second_unit])*:
@endif {{-- Unit Column --}} @php $sell_unit_multiplier = null; @endphp @if(count($sub_units) > 0) @else {{$product->unit}} @endif {{-- Unit Price Column --}} @php $pos_unit_price = !empty($product->unit_price_before_discount) ? $product->unit_price_before_discount : $product->default_sell_price; @endphp {{-- Discount Amount Column --}} {!! Form::text("products[$row_count][line_discount_amount]", @num_format($discount_amount), ['class' => 'form-control input_number row_discount_amount input-sm', 'style' => 'width: 60px; padding: 2px 5px; font-size: 11px;']); !!} {{-- Discount Type Column --}} {!! Form::select("products[$row_count][line_discount_type]", ['fixed' => __('lang_v1.fixed'), 'percentage' => __('lang_v1.percentage')], $discount_type , ['class' => 'form-control row_discount_type input-sm']); !!} {{-- Hidden fields for combo products --}} @if($product->product_type == 'combo'&& !empty($product->combo_products)) @foreach($product->combo_products as $k => $combo_product) @if(!empty($action) && $action == 'edit') @php $combo_product['qty_required'] = $combo_product['quantity'] / $product->quantity_ordered; $qty_total = $combo_product['quantity']; @endphp @else @php $qty_total = $combo_product['qty_required']; @endphp @endif @if(!empty($action) && $action == 'edit') @endif @endforeach @endif @else No Serial {{-- Quantity Column --}} {{-- If edit then transaction sell lines will be present --}} @if(!empty($product->transaction_sell_lines_id)) @endif @if(empty($product->quantity_ordered)) @php $product->quantity_ordered = 1; @endphp @endif @php $allow_decimal = true; if($product->unit_allow_decimal != 1) { $allow_decimal = false; } @endphp @foreach($sub_units as $key => $value) @if(!empty($product->sub_unit_id) && $product->sub_unit_id == $key) @php $max_qty_rule = $max_qty_rule / $multiplier; $unit_name = $value['name']; $max_qty_msg = __('validation.custom-messages.quantity_not_available', ['qty'=> $max_qty_rule, 'unit' => $unit_name ]); if(!empty($product->lot_no_line_id)){ $max_qty_msg = __('lang_v1.quantity_error_msg_in_lot', ['qty'=> $max_qty_rule, 'unit' => $unit_name ]); } if($value['allow_decimal']) { $allow_decimal = true; } @endphp @endif @endforeach
enable_stock && empty($pos_settings['allow_overselling']) && empty($is_sales_order) ) data-rule-max-value="{{$max_qty_rule}}" data-qty_available="{{$product->qty_available}}" data-msg-max-value="{{$max_qty_msg}}" data-msg_max_default="@lang('validation.custom-messages.quantity_not_available', ['qty'=> $product->formatted_qty_available, 'unit' => $product->unit ])" @endif >
@if(!empty($product->second_unit))
@lang('lang_v1.quantity_in_second_unit', ['unit' => $product->second_unit])*:
@endif {{-- Hidden fields for combo products --}} @if($product->product_type == 'combo'&& !empty($product->combo_products)) @foreach($product->combo_products as $k => $combo_product) @if(isset($action) && $action == 'edit') @php $combo_product['qty_required'] = $combo_product['quantity'] / $product->quantity_ordered; $qty_total = $combo_product['quantity']; @endphp @else @php $qty_total = $combo_product['qty_required']; @endphp @endif @if(isset($action) && $action == 'edit') @endif @endforeach @endif @if(!empty($is_direct_sell)) @php $sell_unit_multiplier = null; @endphp @if(count($sub_units) > 0) @else {{$product->unit}} @endif @endif @if(empty($is_direct_sell)) {{-- Unit Column --}} @php $sell_unit_multiplier = null; @endphp @if(count($sub_units) > 0) @else {{$product->unit}} @endif @endif {{-- Unit Price Column --}} @php $pos_unit_price = !empty($product->unit_price_before_discount) ? $product->unit_price_before_discount : $product->default_sell_price; if(!empty($so_line) && $action !== 'edit') { $pos_unit_price = $so_line->unit_price_before_discount; } @endphp {{-- Discount Amount Column --}} @if(!empty($is_direct_sell)) {!! Form::text("products[$row_count][line_discount_amount]", @num_format($discount_amount), ['class' => 'form-control input_number row_discount_amount input-sm']); !!} {!! Form::select("products[$row_count][line_discount_type]", ['fixed' => __('lang_v1.fixed'), 'percentage' => __('lang_v1.percentage')], $discount_type , ['class' => 'form-control row_discount_type input-sm']); !!} @else {!! Form::text("products[$row_count][line_discount_amount]", @num_format($discount_amount), ['class' => 'form-control input_number row_discount_amount input-sm', 'style' => 'width: 60px; padding: 2px 5px; font-size: 11px;']); !!} @endif @if(empty($is_direct_sell)) {{-- Discount Type Column --}} {!! Form::select("products[$row_count][line_discount_type]", ['fixed' => __('lang_v1.fixed'), 'percentage' => __('lang_v1.percentage')], $discount_type , ['class' => 'form-control row_discount_type input-sm']); !!} @endif @endif @else {{-- Quantity Column --}} {{-- If edit then transaction sell lines will be present --}} @if(!empty($product->transaction_sell_lines_id)) @endif @if(empty($product->quantity_ordered)) @php $product->quantity_ordered = 1; @endphp @endif @php $allow_decimal = true; if($product->unit_allow_decimal != 1) { $allow_decimal = false; } @endphp @foreach($sub_units as $key => $value) @if(!empty($product->sub_unit_id) && $product->sub_unit_id == $key) @php $max_qty_rule = $max_qty_rule / $multiplier; $unit_name = $value['name']; $max_qty_msg = __('validation.custom-messages.quantity_not_available', ['qty'=> $max_qty_rule, 'unit' => $unit_name ]); if(!empty($product->lot_no_line_id)){ $max_qty_msg = __('lang_v1.quantity_error_msg_in_lot', ['qty'=> $max_qty_rule, 'unit' => $unit_name ]); } if($value['allow_decimal']) { $allow_decimal = true; } @endphp @endif @endforeach
enable_stock && empty($pos_settings['allow_overselling']) && empty($is_sales_order) ) data-rule-max-value="{{$max_qty_rule}}" data-qty_available="{{$product->qty_available}}" data-msg-max-value="{{$max_qty_msg}}" data-msg_max_default="@lang('validation.custom-messages.quantity_not_available', ['qty'=> $product->formatted_qty_available, 'unit' => $product->unit ])" @endif >
@if(!empty($product->second_unit))
@lang('lang_v1.quantity_in_second_unit', ['unit' => $product->second_unit])*:
@endif {{-- Hidden fields for combo products --}} @if($product->product_type == 'combo'&& !empty($product->combo_products)) @foreach($product->combo_products as $k => $combo_product) @if(isset($action) && $action == 'edit') @php $combo_product['qty_required'] = $combo_product['quantity'] / $product->quantity_ordered; $qty_total = $combo_product['quantity']; @endphp @else @php $qty_total = $combo_product['qty_required']; @endphp @endif @if(isset($action) && $action == 'edit') @endif @endforeach @endif {{-- Unit Column --}} @php $sell_unit_multiplier = null; @endphp @if(count($sub_units) > 0) @else {{$product->unit}} @endif {{-- Unit Price Column --}} @php $pos_unit_price = !empty($product->unit_price_before_discount) ? $product->unit_price_before_discount : $product->default_sell_price; @endphp {{-- Discount Amount Column --}} {!! Form::text("products[$row_count][line_discount_amount]", @num_format($discount_amount), ['class' => 'form-control input_number row_discount_amount input-sm', 'style' => 'width: 60px; padding: 2px 5px; font-size: 11px;']); !!} {{-- Discount Type Column --}} {!! Form::select("products[$row_count][line_discount_type]", ['fixed' => __('lang_v1.fixed'), 'percentage' => __('lang_v1.percentage')], $discount_type , ['class' => 'form-control row_discount_type input-sm']); !!} @endif @if ($product->use_multi_unit == 1) @php $pos_unit_price = !empty($product->unit_price_before_discount) ? $product->unit_price_before_discount : $product->default_sell_price; @endphp @if (!empty($product->first_conversion_unit_id)) @endif @if(!empty($pos_settings['show_multi_unit'])) @php $first_unit_id = null; $second_unit_id = null; $first_unit_c_rate = null; $second_unit_c_rate = null; $first_quantity = $product->quantity_ordered; $second_quantity = $product->quantity_ordered; $first_unit_name = null; $second_unit_name = null; if ($product->sell_unit_id == $product->unit_id || empty($product->sell_unit_id)) { $first_unit_id = $product->first_conversion_unit_id; $second_unit_id = $product->second_conversion_unit_id; $first_unit_c_rate = $product->first_conversion_unit_rate; $second_unit_c_rate = $product->second_conversion_unit_rate; if (!empty($first_unit_id)) { $first_unit = App\Unit::where('id', $first_unit_id)->first(); $first_unit_name = $first_unit->short_name; $first_quantity = $product->quantity_ordered/$first_unit_c_rate; } if (!empty($second_unit_id)) { $second_unit = App\Unit::where('id', $second_unit_id)->first(); $second_unit_name = $second_unit->short_name; $second_quantity = $product->quantity_ordered/$second_unit_c_rate; } } if (($product->sell_unit_id == $product->first_conversion_unit_id) && !empty($product->sell_unit_id)) { $first_unit_id = $product->unit_id; $second_unit_id = $product->second_conversion_unit_id; $first_unit_c_rate = 1*$product->first_conversion_unit_rate; $second_unit_c_rate = ''; if ($product->second_conversion_unit_rate>0) { $second_unit_c_rate = 1/$product->second_conversion_unit_rate; } if (!empty($first_unit_id)) { $first_unit = App\Unit::where('id', $first_unit_id)->first(); $first_unit_name = $first_unit->short_name; $first_quantity = $product->quantity_ordered*$first_unit_c_rate; } if (!empty($second_unit_id)) { $second_unit = App\Unit::where('id', $second_unit_id)->first(); $second_unit_name = $second_unit->short_name; $second_quantity = $product->quantity_ordered*$second_unit_c_rate; } } if (($product->sell_unit_id == $product->second_conversion_unit_id) && !empty($product->sell_unit_id)) { $first_unit_id = $product->unit_id; $second_unit_id = $product->first_conversion_unit_id; $first_unit_c_rate = 1*($product->first_conversion_unit_rate*$product->second_conversion_unit_rate); $second_unit_c_rate = 1*$product->second_conversion_unit_rate; if (!empty($first_unit_id)) { $first_unit = App\Unit::where('id', $first_unit_id)->first(); $first_unit_name = $first_unit->short_name; $first_quantity = $product->quantity_ordered*$first_unit_c_rate; } if (!empty($second_unit_id)) { $second_unit = App\Unit::where('id', $second_unit_id)->first(); $second_unit_name = $second_unit->short_name; $second_quantity = $product->quantity_ordered*$second_unit_c_rate; } } // if (!empty($first_unit_id)) { // $first_unit = App\Unit::where('id', $first_unit_id)->first(); // $first_unit_name = $first_unit->short_name; // $first_quantity = $product->quantity_ordered*$first_unit_c_rate; // } // if (!empty($second_unit_id)) { // $second_unit = App\Unit::where('id', $second_unit_id)->first(); // $second_unit_name = $second_unit->short_name; // $second_quantity = $product->quantity_ordered*$second_unit_c_rate; // } @endphp {{-- {{ $product->sell_unit_id }} --}} @if (!empty($product->first_conversion_unit_rate)) {{ $first_quantity }} {{ $first_unit_name }} @else -- @endif @if (!empty($product->second_conversion_unit_rate)) {{ $second_quantity }} {{ $second_unit_name }} @else -- @endif @endif @else @if(!empty($pos_settings['show_multi_unit'])) -- @endif @endif {{-- For direct sell, these columns are already added above --}} @if(!empty($is_direct_sell)) @if(!empty($pos_settings['inline_service_staff']))
{!! Form::select("products[" . $row_count . "][res_service_staff_id]", $waiters, !empty($product->res_service_staff_id) ? $product->res_service_staff_id : null, ['class' => 'form-control select2 order_line_service_staff', 'placeholder' => __('restaurant.select_service_staff'), 'required' => (!empty($pos_settings['is_service_staff_required']) && $pos_settings['is_service_staff_required'] == 1) ? true : false ]); !!}
@endif {!! Form::hidden("products[$row_count][item_tax]", @num_format($item_tax), ['class' => 'item_tax']); !!} {!! Form::select("products[$row_count][tax_id]", $tax_dropdown['tax_rates'], $tax_id, ['placeholder' => 'Select', 'class' => 'form-control tax_id'], $tax_dropdown['attributes']); !!} @else @if(!empty($pos_settings['inline_service_staff']))
{!! Form::select("products[" . $row_count . "][res_service_staff_id]", $waiters, !empty($product->res_service_staff_id) ? $product->res_service_staff_id : null, ['class' => 'form-control select2 order_line_service_staff', 'placeholder' => __('restaurant.select_service_staff'), 'required' => (!empty($pos_settings['is_service_staff_required']) && $pos_settings['is_service_staff_required'] == 1) ? true : false ]); !!}
@endif @endif @if(!empty($common_settings['enable_product_warranty']) && !empty($is_direct_sell)) {!! Form::select("products[$row_count][warranty_id]", $warranties, $warranty_id, ['placeholder' => __('messages.please_select'), 'class' => 'form-control']); !!} @endif @php $subtotal_type = !empty($pos_settings['is_pos_subtotal_editable']) ? 'text' : 'hidden'; @endphp {{$product->quantity_ordered*$unit_price_inc_tax}}