@extends('layouts.app') @section('title', __('lang_v1.add_opening_stock')) @inject('warehouse_model', 'App\Warehouse') @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) @if (in_array('warehouse.warehouse', $package_modules)) @if (in_array('warehouse', $nature_of_business_modules)) @php $warehouses = $warehouse_model::where('business_id', $business_id)->where('location_id', $key)->select('id', 'name')->get(); @endphp @endif @endif

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

@if (in_array('warehouse.warehouse', $package_modules)) @if (in_array('warehouse', $nature_of_business_modules)) @if(count($warehouses) > 0)

@lang('sale.warehouse'):

@endif @endif @endif
@if($enable_lot == 1) @endif @if(json_decode(session('business.pos_settings'))->enable_serial_number && json_decode(session('business.pos_settings'))->enable_serial_number == 1 && $product->enable_sr_no ==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_lot == 1) @endif @if(json_decode(session('business.pos_settings'))->enable_serial_number && json_decode(session('business.pos_settings'))->enable_serial_number == 1 && $product->enable_sr_no ==1) @endif @endforeach @endforeach
@lang( 'product.product_name' ) @lang( 'lang_v1.quantity' ) @lang( 'purchase.unit_cost_before_tax' ) @lang( 'lang_v1.lot_number' )@lang( 'purchase.subtotal_before_tax' ) Serial Number
{{ $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::hidden('stocks[' . $key . '][' . $variation->id . '][' . $sub_key . '][quantity]', @num_format($qty) , ['class' => 'form-control input-sm input_number purchase_quantity', 'required']); !!} {!! Form::text('stocks[' . $key . '][' . $variation->id . '][' . $sub_key . '][quantity]', @num_format($qty) , ['class' => 'form-control input-sm input_number purchase_quantity', 'required', $product->enable_sr_no ==1 && json_decode(session('business.pos_settings'))->enable_serial_number == 1 ? 'disabled' : '']); !!} {{ $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 . '][lot_number]', $lot_number , ['class' => 'form-control input-sm']); !!} {{@num_format($row_total)}}
@lang( 'lang_v1.total_amount_exc_tax' ): {{@num_format($subtotal)}}
@endforeach
{!! Form::close() !!}
@stop @section('javascript') @endsection