@forelse($locations as $key => $value)

@lang('sale.location'): {{$value}}

@if($enable_expiry == 1 && $product->enable_stock == 1) @endif @if($enable_lot == 1) @endif @php $subtotal = 0; @endphp @foreach($product->variations as $variation) @if(empty($purchases[$key][$variation->id])) @php $purchases[$key][$variation->id][] = ['quantity' => 0, 'purchase_price' => $variation->default_purchase_price, 'purchase_line_id' => null, 'lot_number' => null, 'transaction_date' => null, 'purchase_line_note' => null, 'secondary_unit_quantity' => 0 ] @endphp @endif @foreach($purchases[$key][$variation->id] as $sub_key => $var) @php $purchase_line_id = $var['purchase_line_id']; $qty = $var['quantity']; $purcahse_price = $var['purchase_price']; $row_total = $qty * $purcahse_price; $subtotal += $row_total; $lot_number = $var['lot_number']; $transaction_date = $var['transaction_date']; $purchase_line_note = $var['purchase_line_note']; @endphp @if($enable_expiry == 1 && $product->enable_stock == 1) @endif @if($enable_lot == 1) @endif @endforeach @endforeach
@lang( 'product.product_name' ) @lang( 'lang_v1.quantity_left' ) @lang( 'purchase.unit_cost_before_tax' )Exp. Date@lang( 'lang_v1.lot_number' )@lang( 'purchase.subtotal_before_tax' ) @lang( 'lang_v1.date' ) @lang( 'brand.note' )  
{{ $product->name }} @if( $product->type == 'variable' ) ({{ $variation->product_variation->name }} : {{ $variation->name }}) @endif @if(!empty($purchase_line_id)) {!! Form::hidden('stocks[' . $key . '][' . $variation->id . '][' . $sub_key . '][purchase_line_id]', $purchase_line_id); !!} @endif
{!! Form::text('stocks[' . $key . '][' . $variation->id . '][' . $sub_key . '][quantity]', @format_quantity($qty) , ['class' => 'form-control input-sm input_number purchase_quantity input_quantity', 'required']); !!} {{ $product->unit->short_name }}
@if(!empty($product->second_unit))
@lang('lang_v1.quantity_in_second_unit', ['unit' => $product->second_unit->short_name])*:
{!! Form::text('stocks[' . $key . '][' . $variation->id . '][' . $sub_key . '][secondary_unit_quantity]', @format_quantity($var['secondary_unit_quantity']) , ['class' => 'form-control input-sm input_number input_quantity', 'required']); !!} @endif
{!! Form::text('stocks[' . $key . '][' . $variation->id . '][' . $sub_key . '][purchase_price]', @num_format($purcahse_price) , ['class' => 'form-control input-sm input_number unit_price', 'required']); !!} {!! Form::text('stocks[' . $key . '][' . $variation->id . '][' . $sub_key . '][exp_date]', !empty($var['exp_date']) ? @format_date($var['exp_date']) : null , ['class' => 'form-control input-sm os_exp_date', 'readonly']); !!} {!! Form::text('stocks[' . $key . '][' . $variation->id . '][' . $sub_key . '][lot_number]', $lot_number , ['class' => 'form-control input-sm']); !!} {{@num_format($row_total)}}
{!! Form::text('stocks[' . $key . '][' . $variation->id . '][' . $sub_key . '][transaction_date]', $transaction_date , ['class' => 'form-control input-sm os_date', 'readonly']); !!}
{!! Form::textarea('stocks[' . $key . '][' . $variation->id . '][' . $sub_key . '][purchase_line_note]', $purchase_line_note , ['class' => 'form-control input-sm', 'rows' => 3 ]); !!} @if($loop->index == 0) @else   @endif
@lang( 'lang_v1.total_amount_exc_tax' ): {{@num_format($subtotal)}}
@empty

@lang( 'lang_v1.product_not_assigned_to_any_location' )

@endforelse