@extends('layouts.app') @section('title', __('purchase.add_purchase')) @section('content') @php $custom_labels = json_decode(session('business.custom_labels'), true); @endphp @include('layouts.partials.breadcrumb',['page_title'=> __( 'purchase.add_purchase') , 'bread_crumbs'=>array( array('title'=>__('purchase.purchases'),'url'=>'/purchases'),array('title'=> __('purchase.add_new_purchase'),'url'=>''))])
@include('layouts.partials.error') {!! Form::open(['url' => action([\App\Http\Controllers\PurchaseController::class, 'store']), 'method' => 'post', 'id' => 'add_purchase_form', 'files' => true ]) !!} @component('components.widget', ['title' => __('purchase.purchase_info'),'class' => '','icon'=>'',])
{!! Form::label('supplier_id', __('purchase.supplier') . ':') !!} @showRequiredAsterisk()
{!! Form::select('contact_id', [], null, ['class' => 'form-control', 'placeholder' => __('messages.please_select'), 'required', 'id' => 'supplier_id']); !!}
{!! Form::label('ref_no', __('purchase.ref_no').':') !!} @show_tooltip(__('app.leave_empty_to_autogenerate')) {!! Form::text('ref_no', null, ['class' => 'form-control']); !!}
{!! Form::label('transaction_date', __('purchase.purchase_date') . ':') !!} @showRequiredAsterisk()
{!! Form::text('transaction_date', @format_date('now'), ['class' => 'form-control', '', 'required']); !!}
{!! Form::label('status', __('purchase.purchase_status') . ':') !!} @showRequiredAsterisk() @show_tooltip(__('tooltip.order_status')) {!! Form::select('status', $orderStatuses, $default_purchase_status, ['class' => 'form-control select2', 'placeholder' => __('messages.please_select'), 'required']); !!}
{!! Form::label('is_local_purchase', __('purchase.purchase_type') . ':') !!} @show_tooltip(__('purchase.tooltip_is_local_purchase'))
{!! Form::checkbox('is_local_purchase', 1, false, ['class' => 'input-icheck', 'id' => 'is_local_purchase']); !!}
@if(count($business_locations) == 1) @php $default_location = current(array_keys($business_locations->toArray())); $search_disable = false; @endphp @else @php $default_location = null; $search_disable = true; @endphp @endif
{!! Form::label('location_id', __('purchase.business_location').':') !!} @showRequiredAsterisk() @show_tooltip(__('tooltip.purchase_location')) {!! Form::select('location_id', $business_locations, $default_location, ['class' => 'form-control select2', 'placeholder' => __('messages.please_select'), 'required'], $bl_attributes); !!}
{!! Form::label('exchange_rate', __('purchase.p_exchange_rate') . ':') !!} @showRequiredAsterisk() @show_tooltip(__('tooltip.currency_exchange_factor'))
{!! Form::number('exchange_rate', $currency_details->p_exchange_rate, ['class' => 'form-control', 'required', 'step' => 0.001]); !!}
@lang('purchase.diff_purchase_currency_help', ['currency' => $currency_details->name])
{!! Form::label('document', __('purchase.attach_document') . ':') !!} {!! Form::file('document', ['id' => 'upload_document', 'accept' => implode(',', array_keys(config('constants.document_upload_mimes_types')))]); !!}

@lang('purchase.max_file_size', ['size' => (config('constants.document_size_limit') / 1000000)]) @includeIf('components.document_help_text')

@php $custom_field_1_label = !empty($custom_labels['purchase']['custom_field_1']) ? $custom_labels['purchase']['custom_field_1'] : ''; $is_custom_field_1_required = !empty($custom_labels['purchase']['is_custom_field_1_required']) && $custom_labels['purchase']['is_custom_field_1_required'] == 1 ? true : false; $custom_field_2_label = !empty($custom_labels['purchase']['custom_field_2']) ? $custom_labels['purchase']['custom_field_2'] : ''; $is_custom_field_2_required = !empty($custom_labels['purchase']['is_custom_field_2_required']) && $custom_labels['purchase']['is_custom_field_2_required'] == 1 ? true : false; $custom_field_3_label = !empty($custom_labels['purchase']['custom_field_3']) ? $custom_labels['purchase']['custom_field_3'] : ''; $is_custom_field_3_required = !empty($custom_labels['purchase']['is_custom_field_3_required']) && $custom_labels['purchase']['is_custom_field_3_required'] == 1 ? true : false; $custom_field_4_label = !empty($custom_labels['purchase']['custom_field_4']) ? $custom_labels['purchase']['custom_field_4'] : ''; $is_custom_field_4_required = !empty($custom_labels['purchase']['is_custom_field_4_required']) && $custom_labels['purchase']['is_custom_field_4_required'] == 1 ? true : false; @endphp @if(!empty($custom_field_1_label)) @php $label_1 = $custom_field_1_label . ':'; if($is_custom_field_1_required) { $label_1 .= '*'; } @endphp
{!! Form::label('custom_field_1', $label_1 ) !!} {!! Form::text('custom_field_1', null, ['class' => 'form-control','placeholder' => $custom_field_1_label, 'required' => $is_custom_field_1_required]); !!}
@endif @if(!empty($custom_field_2_label)) @php $label_2 = $custom_field_2_label . ':'; if($is_custom_field_2_required) { $label_2 .= '*'; } @endphp
{!! Form::label('custom_field_2', $label_2 ) !!} {!! Form::text('custom_field_2', null, ['class' => 'form-control','placeholder' => $custom_field_2_label, 'required' => $is_custom_field_2_required]); !!}
@endif @if(!empty($custom_field_3_label)) @php $label_3 = $custom_field_3_label . ':'; if($is_custom_field_3_required) { $label_3 .= '*'; } @endphp
{!! Form::label('custom_field_3', $label_3 ) !!} {!! Form::text('custom_field_3', null, ['class' => 'form-control','placeholder' => $custom_field_3_label, 'required' => $is_custom_field_3_required]); !!}
@endif @if(!empty($custom_field_4_label)) @php $label_4 = $custom_field_4_label . ':'; if($is_custom_field_4_required) { $label_4 .= '*'; } @endphp
{!! Form::label('custom_field_4', $label_4 ) !!} {!! Form::text('custom_field_4', null, ['class' => 'form-control','placeholder' => $custom_field_4_label, 'required' => $is_custom_field_4_required]); !!}
@endif
@if(!empty($common_settings['enable_purchase_order']))
{!! Form::label('purchase_order_ids', __('app.purchase_order').':') !!} {!! Form::select('purchase_order_ids[]', [], null, ['class' => 'form-control select2', 'multiple', 'id' => 'purchase_order_ids']); !!}
@endif @endcomponent @component('components.widget', ['title' => __('purchase.products'),'class' => '','icon'=>'',])
{!! Form::text('search_product', null, ['class' => 'form-control mousetrap', 'id' => 'search_product', 'placeholder' => __('app.search_product_placeholder'), 'disabled' => $search_disable]); !!}
@php $hide_tax = ''; if( session()->get('business.enable_inline_tax') == 0){ $hide_tax = 'hide'; } @endphp
@if(session('business.enable_lot_number')) @endif @if(session('business.enable_product_expiry')) @endif
# @lang( 'purchase.product' ) @lang( 'purchase.purchase_quantity' ) @lang( 'purchase.unit_cost_before_discount' ) @lang( 'purchase.subtotal_before_tax' ) @lang( 'purchase.product_tax' ) @lang( 'purchase.net_cost' ) @lang( 'purchase.line_total' ) @lang( 'purchase.profit_margin' ) @lang( 'purchase.unit_selling_price' ) @lang('app.lot_number') @lang('purchase.exp_date')
@endcomponent @component('components.widget', ['title' => __('purchase.purchase_discount_tax'),'class' => '','icon'=>'',])
{!! Form::hidden('tax_amount', 0, ['id' => 'tax_amount']); !!}
{!! Form::label('discount_type', __( 'purchase.discount_type' ) . ':') !!} {!! Form::select('discount_type', [ '' => __('app.none'), 'fixed' => __( 'app.fixed' ), 'percentage' => __( 'app.percentage' )], '', ['class' => 'form-control select2']); !!}
{!! Form::label('discount_amount', __( 'purchase.discount_amount' ) . ':') !!} {!! Form::text('discount_amount', 0, ['class' => 'form-control input_number', 'required']); !!}
   
{!! Form::label('additional_notes',__('purchase.additional_notes')) !!} {!! Form::textarea('additional_notes', null, ['class' => 'form-control', 'rows' => 3]); !!}
@endcomponent {!! Form::hidden('final_total', 0 , ['id' => 'grand_total_hidden']); !!} {!! Form::hidden('shipping_charges', 0, ['class' => 'form-control input_number', 'required']); !!} @component('components.widget', ['title' => __('purchase.add_payment'),'class' => '','icon'=>'',])
@lang('app.advance_balance'): 0 {!! Form::hidden('advance_balance', null, ['id' => 'advance_balance', 'data-error-msg' => __('app.required_advance_balance_not_available')]); !!}
@include('sale_pos.partials.payment_row_form', ['row_index' => 0, 'show_date' => true, 'show_denomination' => true])
@endcomponent {!! Form::close() !!}
@include('purchase.partials.import_purchase_products_modal') @endsection @section('javascript') @include('purchase.partials.keyboard_shortcuts') @endsection