@foreach( $variations as $variation)
{{ $product->name }} ({{$variation->sub_sku}})
@if( $product->type == 'variable' )
({{ $variation->product_variation->name }} : {{ $variation->name }})
@endif
@if($product->enable_stock == 1)
@lang('report.current_stock'): @if(!empty($variation->variation_location_details->first())) {{@num_format($variation->variation_location_details->first()->qty_available)}} @else 0 @endif {{ $product->unit->short_name }}
@endif
@if(!empty($purchase_order_line))
{!! Form::hidden('purchases[' . $row_count . '][purchase_order_line_id]', $purchase_order_line->id ); !!}
@endif
{!! Form::hidden('purchases[' . $row_count . '][product_id]', $product->id ); !!}
{!! Form::hidden('purchases[' . $row_count . '][variation_id]', $variation->id , ['class' => 'hidden_variation_id']); !!}
@php
$check_decimal = 'false';
if($product->unit->allow_decimal == 0){
$check_decimal = 'true';
}
$currency_precision = session('business.currency_precision', 2);
$quantity_precision = session('business.quantity_precision', 2);
$quantity_value = !empty($purchase_order_line) ? $purchase_order_line->quantity : 1;
$max_quantity = !empty($purchase_order_line) ? $purchase_order_line->quantity - $purchase_order_line->po_quantity_purchased : 0;
$quantity_value = !empty($imported_data) ? $imported_data['quantity'] : $quantity_value;
@endphp
@if(!empty($sub_units))
@else
{{ $product->unit->short_name }}
@endif
@if(!empty($product->second_unit))
@lang('lang_v1.quantity_in_second_unit', ['unit' => $product->second_unit->short_name])*:
@endif
@php
$pp_without_discount = !empty($purchase_order_line) ? $purchase_order_line->pp_without_discount/$purchase_order->exchange_rate : $variation->default_purchase_price;
$discount_percent = !empty($purchase_order_line) ? $purchase_order_line->discount_percent : 0;
$purchase_price = !empty($purchase_order_line) ? $purchase_order_line->purchase_price/$purchase_order->exchange_rate : $variation->default_purchase_price;
$tax_id = !empty($purchase_order_line) ? $purchase_order_line->tax_id : $product->tax;
$tax_id = !empty($imported_data['tax_id']) ? $imported_data['tax_id'] : $tax_id;
$pp_without_discount = !empty($imported_data['unit_cost_before_discount']) ? $imported_data['unit_cost_before_discount'] : $pp_without_discount;
$discount_percent = !empty($imported_data['discount_percent']) ? $imported_data['discount_percent'] : $discount_percent;
@endphp
{!! Form::text('purchases[' . $row_count . '][pp_without_discount]',
number_format($pp_without_discount, $currency_precision, $currency_details->decimal_separator, $currency_details->thousand_separator), ['class' => 'form-control input-sm purchase_unit_cost_without_discount input_number', 'required']); !!}
@if(!empty($last_purchase_line))
@lang('lang_v1.prev_unit_price'): @format_currency($last_purchase_line->pp_without_discount)
@endif
{!! Form::text('purchases[' . $row_count . '][discount_percent]', number_format($discount_percent, $currency_precision, $currency_details->decimal_separator, $currency_details->thousand_separator), ['class' => 'form-control input-sm inline_discounts input_number', 'required']); !!}
@if(!empty($last_purchase_line))
@lang('lang_v1.prev_discount'):
{{@num_format($last_purchase_line->discount_percent)}}%
@endif
{!! Form::text('purchases[' . $row_count . '][purchase_price]',
number_format($purchase_price, $currency_precision, $currency_details->decimal_separator, $currency_details->thousand_separator), ['class' => 'form-control input-sm purchase_unit_cost input_number', 'required']); !!}
0
{!! Form::hidden('purchases[' . $row_count . '][item_tax]', 0, ['class' => 'purchase_product_unit_tax']); !!}
0.00
@php
$dpp_inc_tax = number_format($variation->dpp_inc_tax, $currency_precision, $currency_details->decimal_separator, $currency_details->thousand_separator);
if($hide_tax == 'hide'){
$dpp_inc_tax = number_format($variation->default_purchase_price, $currency_precision, $currency_details->decimal_separator, $currency_details->thousand_separator);
}
$dpp_inc_tax = !empty($purchase_order_line) ? number_format($purchase_order_line->purchase_price_inc_tax/$purchase_order->exchange_rate, $currency_precision, $currency_details->decimal_separator, $currency_details->thousand_separator) : $dpp_inc_tax;
@endphp
{!! Form::text('purchases[' . $row_count . '][purchase_price_inc_tax]', $dpp_inc_tax, ['class' => 'form-control input-sm purchase_unit_cost_after_tax input_number', 'required']); !!}
0
{!! Form::text('purchases[' . $row_count . '][profit_percent]', number_format($variation->profit_percent, $currency_precision, $currency_details->decimal_separator, $currency_details->thousand_separator), ['class' => 'form-control input-sm input_number profit_percent', 'required']); !!}
@if(empty($is_purchase_order))
@if(session('business.enable_editing_product_from_purchase'))
{!! Form::text('purchases[' . $row_count . '][default_sell_price]', number_format($variation->sell_price_inc_tax, $currency_precision, $currency_details->decimal_separator, $currency_details->thousand_separator), ['class' => 'form-control input-sm input_number default_sell_price', 'required']); !!}
@else
{{ number_format($variation->sell_price_inc_tax, $currency_precision, $currency_details->decimal_separator, $currency_details->thousand_separator)}}
@endif
@if(session('business.enable_lot_number'))
@php
$lot_number = !empty($imported_data['lot_number']) ? $imported_data['lot_number'] : null;
@endphp
{!! Form::text('purchases[' . $row_count . '][lot_number]', $lot_number, ['class' => 'form-control input-sm']); !!}
@endif
@if(session('business.enable_product_expiry'))
{{-- Maybe this condition for checkin expiry date need to be removed --}}
@php
$expiry_period_type = !empty($product->expiry_period_type) ? $product->expiry_period_type : 'month';
@endphp
@if(!empty($expiry_period_type))
@if(session('business.expiry_type') == 'add_manufacturing')
@php
$hide_mfg = false;
@endphp
@else
@php
$hide_mfg = true;
@endphp
@endif
@php
$mfg_date = !empty($imported_data['mfg_date']) ? $imported_data['mfg_date'] : null;
$exp_date = !empty($imported_data['exp_date']) ? $imported_data['exp_date'] : null;
@endphp
@lang('product.mfg_date'):
{!! Form::text('purchases[' . $row_count . '][mfg_date]', $mfg_date, ['class' => 'form-control input-sm expiry_datepicker mfg_date', 'readonly']); !!}
@lang('product.exp_date'):
{!! Form::text('purchases[' . $row_count . '][exp_date]', $exp_date, ['class' => 'form-control input-sm expiry_datepicker exp_date', 'readonly']); !!}
@else
@lang('product.not_applicable')
@endif
@endif
@endif
@endforeach