@extends('layouts.app') @section('title', __('lang_v1.add_opening_stock')) @section('content')

@lang('lang_v1.add_opening_stock')

{!! Form::open(['url' => action('OpeningStockController@save'), 'method' => 'post', 'id' => 'add_opening_stock_form' ]) !!} {!! Form::hidden('product_id', $product->id); !!}
@foreach($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 ] @endphp @endif @foreach($purchases[$key][$variation->id] as $sub_key => $var) @php $purchase_line_id = $var['purchase_line_id']; $exp_date = null; if(!empty($var['exp_date'])){ $exp_date = \Carbon::createFromFormat('Y-m-d', $var['exp_date'])->format('d-m-Y'); } $qty = $var['quantity']; $purcahse_price = $var['purchase_price']; $row_total = $qty * $purcahse_price; $subtotal += $row_total; $lot_number = $var['lot_number']; @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' ) @lang( 'purchase.unit_cost_before_tax' )Exp. Date@lang( 'lang_v1.lot_number' )@lang( 'purchase.subtotal_before_tax' )  
{{ $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]', @num_format($qty) , ['class' => 'form-control input-sm input_number purchase_quantity', 'required']); !!} {{ $product->unit->short_name }}
{!! 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]', $exp_date , ['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)}} @if($loop->index == 0) @else   @endif
@lang( 'lang_v1.total_amount_exc_tax' ): {{@num_format($subtotal)}}
@endforeach
{!! Form::close() !!}
@stop @section('javascript') @endsection