@lang('sales/customer_transfer.document_title')

@include('flash::message') @if (!$errors->isEmpty()) @endif

@lang('general.text_add')

{!! Form::open(['route' => 'customer-transfers.store','method' => 'POST','class' => '','role' => 'form','id'=>'form']) !!} {!! Form::hidden('amount_total_tmp', old('amount_total_tmp',0)) !!}
@php $tmp_customers = []; if(!empty(old('customer_id',($duplicate_ci->customer_id ?? '')))){ $tmp_customers = \App\Models\Sales\Customer::where('id','=',old('customer_id',($duplicate_ci->customer_id ?? '')))->get()->pluck('text_select2','id'); } @endphp {!! html_entity_decode(Form::label('customer_id', __('sales/customer_transfer.entry_customer_id') . ' *', ['class' => 'control-label'])) !!}
{!! Form::select('customer_id', $tmp_customers,old('customer_id',($duplicate_ci->customer_id ?? '')), ['class' => 'form-control', 'placeholder' => __('general.text_select'),'required','autofocus']) !!}
@if ($errors->has('customer_id')) {{ $errors->first('customer_id') }} @endif
{!! html_entity_decode(Form::label('branch_office_id', __('sales/customer_transfer.entry_branch_office_id') . ' *', ['class' => 'control-label'])) !!} {!! Form::select('branch_office_id', $branch_offices,old('branch_office_id',$duplicate_ci->branch_office_id ?? \App\Models\Base\BranchOffice::where('company_id','=',\App\Helpers\Helper::defaultCompany()->id)->get()->first()->id), ['class' => 'form-control', 'placeholder' => __('general.text_select'),'required']) !!} @if ($errors->has('branch_office_id')) {{ $errors->first('branch_office_id') }} @endif
{!! html_entity_decode(Form::label('currency_id', __('sales/customer_transfer.entry_currency_id') . ' *', ['class' => 'control-label'])) !!} {!! Form::select('currency_id', $currencies,old('currency_id',$duplicate_ci->currency_id ?? \App\Models\Catalogs\Currency::first()->id), ['class' => 'form-control', 'placeholder' => __('general.text_select'),'required']) !!} @if ($errors->has('currency_id')) {{ $errors->first('currency_id') }} @endif
{!! html_entity_decode(Form::label('currency_value', __('sales/customer_transfer.entry_currency_value') . ' *', ['class' => 'control-label'])) !!} {!! Form::number('currency_value', old('currency_value'), ['class' => 'form-control text-center', 'placeholder' => __('sales/customer_transfer.entry_currency_value'),'required','step' => 'any']) !!} @if ($errors->has('currency_value')) {{ $errors->first('currency_value') }} @endif
{!! html_entity_decode(Form::label('date', __('sales/customer_transfer.entry_date') . ' *', ['class' => 'control-label'])) !!}
{!! Form::text('date', old('date',\App\Helpers\Helper::dateTime(Date::now())), ['class' => 'form-control', 'placeholder' => __('sales/customer_transfer.entry_date'),'required','autocomplete'=>'off']) !!}
@if ($errors->has('date')) {{ $errors->first('date') }} @endif
{!! html_entity_decode(Form::label('cfdi_use_id', __('sales/customer_transfer.entry_cfdi_use_id') . '', ['class' => 'control-label'])) !!} {!! Form::select('cfdi_use_id', $cfdi_uses,old('cfdi_use_id',($duplicate_ci->cfdi_use_id ?? '')), ['class' => 'form-control', 'placeholder' => __('general.text_select')]) !!} @if ($errors->has('cfdi_use_id')) {{ $errors->first('cfdi_use_id') }} @endif
{!! html_entity_decode(Form::label('payment_term_id', __('sales/customer_transfer.entry_payment_term_id') . ' *', ['class' => 'control-label'])) !!} {!! Form::select('payment_term_id', $payment_terms,old('payment_term_id',($duplicate_ci->payment_term_id ?? '')), ['class' => 'form-control', 'placeholder' => __('general.text_select'),'required']) !!} @if ($errors->has('payment_term_id')) {{ $errors->first('payment_term_id') }} @endif
{!! html_entity_decode(Form::label('document_type2', __('sales/customer_transfer.entry_document_type2') . ' *', ['class' => 'control-label'])) !!} {!! Form::select('document_type2', $list_document_type2,old('document_type2',($duplicate_ci->document_type2 ?? '')), ['class' => 'form-control', 'placeholder' => __('general.text_select'),'required']) !!} @if ($errors->has('document_type2')) {{ $errors->first('document_type2') }} @endif
{!! html_entity_decode(Form::label('date_due', __('sales/customer_transfer.entry_date_due') . '', ['class' => 'control-label'])) !!}
{!! Form::text('date_due', old('date_due'), ['class' => 'form-control', 'placeholder' => __('sales/customer_transfer.entry_date_due'),'autocomplete'=>'off']) !!}
@if ($errors->has('date_due')) {{ $errors->first('date_due') }} @endif
{!! html_entity_decode(Form::label('payment_way_id', __('sales/customer_transfer.entry_payment_way_id') . ' *', ['class' => 'control-label'])) !!} {!! Form::select('payment_way_id', $payment_ways,old('payment_way_id',($duplicate_ci->payment_way_id ?? '')), ['class' => 'form-control', 'placeholder' => __('general.text_select')]) !!} @if ($errors->has('payment_way_id')) {{ $errors->first('payment_way_id') }} @endif
{!! html_entity_decode(Form::label('payment_method_id', __('sales/customer_transfer.entry_payment_method_id') . ' *', ['class' => 'control-label'])) !!} {!! Form::select('payment_method_id', $payment_methods,old('payment_method_id',($duplicate_ci->payment_method_id ?? '')), ['class' => 'form-control', 'placeholder' => __('general.text_select')]) !!} @if ($errors->has('payment_method_id')) {{ $errors->first('payment_method_id') }} @endif
{!! html_entity_decode(Form::label('salesperson_id', __('sales/customer_transfer.entry_salesperson_id') . '', ['class' => 'control-label'])) !!} {!! Form::select('salesperson_id', $salespersons,old('salesperson_id',($duplicate_ci->salesperson_id ?? '')), ['class' => 'form-control', 'placeholder' => __('general.text_select')]) !!}
@if ($errors->has('item')) {{ $errors->first('item') }} @endif
@if ($errors->has('item_transfer')) {{ $errors->first('item_transfer') }} @endif
{!! html_entity_decode(Form::label('source_name', __('sales/customer_transfer.entry_source_name') . ' *', ['class' => 'control-label'])) !!} {!! Form::text('source_name', old('source_name',($duplicate_ci->source_name ?? '')), ['class' => 'form-control', 'placeholder' => __('sales/customer_transfer.entry_source_name'),'required']) !!} @if ($errors->has('source_name')) {{ $errors->first('source_name') }} @endif
{!! html_entity_decode(Form::label('source_address', __('sales/customer_transfer.entry_source_address') . ' *', ['class' => 'control-label'])) !!} {!! Form::textarea('source_address', old('source_address',($duplicate_ci->source_address ?? '')), ['class' => 'form-control', 'placeholder' => __('sales/customer_transfer.entry_source_address'),'required','rows' => '2']) !!} @if ($errors->has('source_address')) {{ $errors->first('source_address') }} @endif
{!! html_entity_decode(Form::label('source_delivery_on', __('sales/customer_transfer.entry_source_delivery_on') . ' *', ['class' => 'control-label'])) !!} {!! Form::text('source_delivery_on', old('source_delivery_on',($duplicate_ci->source_delivery_on ?? '')), ['class' => 'form-control', 'placeholder' => __('sales/customer_transfer.entry_source_delivery_on'),'required']) !!} @if ($errors->has('source_delivery_on')) {{ $errors->first('source_delivery_on') }} @endif
{!! html_entity_decode(Form::label('destination_name', __('sales/customer_transfer.entry_destination_name') . ' *', ['class' => 'control-label'])) !!} {!! Form::text('destination_name', old('destination_name',($duplicate_ci->destination_name ?? '')), ['class' => 'form-control', 'placeholder' => __('sales/customer_transfer.entry_destination_name'),'required']) !!} @if ($errors->has('destination_name')) {{ $errors->first('destination_name') }} @endif
{!! html_entity_decode(Form::label('destination_address', __('sales/customer_transfer.entry_destination_address') . ' *', ['class' => 'control-label'])) !!} {!! Form::textarea('destination_address', old('destination_address',($duplicate_ci->destination_address ?? '')), ['class' => 'form-control', 'placeholder' => __('sales/customer_transfer.entry_destination_address'),'required','rows' => '2']) !!} @if ($errors->has('destination_address')) {{ $errors->first('destination_address') }} @endif
{!! html_entity_decode(Form::label('destination_delivery_on', __('sales/customer_transfer.entry_destination_delivery_on') . ' *', ['class' => 'control-label'])) !!} {!! Form::text('destination_delivery_on', old('destination_delivery_on',($duplicate_ci->destination_delivery_on ?? '')), ['class' => 'form-control', 'placeholder' => __('sales/customer_transfer.entry_destination_delivery_on'),'required']) !!} @if ($errors->has('destination_delivery_on')) {{ $errors->first('destination_delivery_on') }} @endif

{!! html_entity_decode(Form::label('compensation', __('sales/customer_transfer.entry_compensation') . '', ['class' => 'control-label'])) !!} {!! Form::textarea('compensation', old('compensation',($duplicate_ci->compensation ?? '')), ['class' => 'form-control', 'placeholder' => __('sales/customer_transfer.entry_compensation'),'rows' => '2']) !!} @if ($errors->has('compensation')) {{ $errors->first('compensation') }} @endif
{!! html_entity_decode(Form::label('comment', __('sales/customer_transfer.entry_comment') . '', ['class' => 'control-label'])) !!} {!! Form::textarea('comment', old('comment',($duplicate_ci->comment ?? '')), ['class' => 'form-control', 'placeholder' => __('sales/customer_transfer.entry_comment'),'rows' => '2']) !!} @if ($errors->has('comment')) {{ $errors->first('comment') }} @endif
{!! html_entity_decode(Form::label('driver', __('sales/customer_transfer.entry_driver') . '', ['class' => 'control-label'])) !!} {!! Form::text('driver', old('driver',($duplicate_ci->driver ?? '')), ['class' => 'form-control', 'placeholder' => __('sales/customer_transfer.entry_driver')]) !!} @if ($errors->has('driver')) {{ $errors->first('driver') }} @endif
{!! html_entity_decode(Form::label('vehicle', __('sales/customer_transfer.entry_vehicle') . '', ['class' => 'control-label'])) !!} {!! Form::text('vehicle', old('vehicle',($duplicate_ci->vehicle ?? '')), ['class' => 'form-control', 'placeholder' => __('sales/customer_transfer.entry_vehicle')]) !!} @if ($errors->has('vehicle')) {{ $errors->first('vehicle') }} @endif
{!! html_entity_decode(Form::label('vehicle_number', __('sales/customer_transfer.entry_vehicle_number') . '', ['class' => 'control-label'])) !!} {!! Form::text('vehicle_number', old('vehicle_number',($duplicate_ci->vehicle_number ?? '')), ['class' => 'form-control', 'placeholder' => __('sales/customer_transfer.entry_vehicle_number')]) !!} @if ($errors->has('vehicle_number')) {{ $errors->first('vehicle_number') }} @endif
{!! html_entity_decode(Form::label('vehicle_counter', __('sales/customer_transfer.entry_vehicle_counter') . '', ['class' => 'control-label'])) !!} {!! Form::text('vehicle_counter', old('vehicle_counter',($duplicate_ci->vehicle_counter ?? '')), ['class' => 'form-control', 'placeholder' => __('sales/customer_transfer.entry_vehicle_counter')]) !!} @if ($errors->has('vehicle_counter')) {{ $errors->first('vehicle_counter') }} @endif
{!! html_entity_decode(Form::label('date_delivery', __('sales/customer_transfer.entry_date_delivery') . ' *', ['class' => 'control-label'])) !!}
{!! Form::text('date_delivery', old('date_delivery',($duplicate_ci ? \App\Helpers\Helper::convertSqlToDate($duplicate_ci->date_delivery) : '')), ['class' => 'form-control', 'placeholder' => __('sales/customer_transfer.entry_date_delivery'),'required','autocomplete'=>'off']) !!}
@if ($errors->has('date_delivery')) {{ $errors->first('date_delivery') }} @endif
{!! html_entity_decode(Form::label('valid_amount', __('sales/customer_transfer.entry_valid_amount') . ' *', ['class' => 'control-label'])) !!} {!! Form::number('valid_amount', old('valid_amount',($duplicate_ci ? round($duplicate_ci->valid_amount,2) : '')), ['class' => 'form-control text-right', 'placeholder' => __('sales/customer_transfer.entry_valid_amount'),'required', 'step' => 'any', 'autocomplete' => 'off']) !!} @if ($errors->has('valid_amount')) {{ $errors->first('valid_amount') }} @endif
{!! html_entity_decode(Form::label('dangerous_material', __('sales/customer_transfer.entry_dangerous_material') , ['class' => 'control-label'])) !!}
@php $item_transfer_row = 1; $items_transfer = (empty(old('item_transfer')) ? ($duplicate_ci->customerActiveInvoiceLineTransfers ?? []) : old('item_transfer')); @endphp @foreach ($items_transfer as $item_transfer_row => $item) @php $item = !empty(old('item_transfer.' . $item_transfer_row . '')) ? (object) old('item_transfer.' . $item_transfer_row) : $item; @endphp @endforeach @php $item_transfer_row++; @endphp
@lang('general.column_actions') @lang('sales/customer_transfer.column_line_transfer_name') * @lang('sales/customer_transfer.column_line_transfer_weight') @lang('sales/customer_transfer.column_line_transfer_m3') @lang('sales/customer_transfer.column_line_transfer_liters')
{!! Form::textarea('item_transfer[' . $item_transfer_row . '][name]', old('item_transfer.' . $item_transfer_row . '.name',$item->name), ['class' => 'form-control input-sm ym-auto-resize col-transfer-name-id', 'required','autocomplete'=>'off','id' => 'item_transfer_name_' . $item_transfer_row, 'placeholder' => __('sales/customer_transfer.column_line_transfer_name'),'rows' => 2]) !!} @if ($errors->has('item_transfer.'.$item_transfer_row.'.name')) {{ $errors->first('item_transfer.'.$item_transfer_row.'.name') }} @endif
{!! Form::text('item_transfer[' . $item_transfer_row . '][weight]', old('item_transfer.' . $item_transfer_row . '.weight',$item->weight), ['class' => 'form-control input-sm text-center col-transfer-weight','id' => 'item_transfer_weight_' . $item_transfer_row]) !!} @if ($errors->has('item_transfer.'.$item_transfer_row.'.weight')) {{ $errors->first('item_transfer.'.$item_transfer_row.'.weight') }} @endif
{!! Form::number('item_transfer[' . $item_transfer_row . '][m3]', old('item_transfer.' . $item_transfer_row . '.m3',$item->m3), ['class' => 'form-control input-sm text-center col-transfer-m3','id' => 'item_transfer_m3_' . $item_transfer_row, 'step' => 'any']) !!} @if ($errors->has('item_transfer.'.$item_transfer_row.'.m3')) {{ $errors->first('item_transfer.'.$item_transfer_row.'.m3') }} @endif
{!! Form::number('item_transfer[' . $item_transfer_row . '][liters]', old('item_transfer.' . $item_transfer_row . '.liters',$item->liters), ['class' => 'form-control input-sm text-center col-transfer-liters','id' => 'item_transfer_liters_' . $item_transfer_row, 'step' => 'any']) !!} @if ($errors->has('item_transfer.'.$item_transfer_row.'.liters')) {{ $errors->first('item_transfer.'.$item_transfer_row.'.liters') }} @endif
@php $item_row = 1; $items = (empty(old('item')) ? ($duplicate_ci->customerActiveInvoiceLines ?? []) : old('item')); @endphp @foreach ($items as $item_row => $item) @php $item = !empty(old('item.' . $item_row . '')) ? (object) old('item.' . $item_row) : $item; $tmp_products = []; if(!empty(old('item.' . $item_row . '.product_id',$item->product_id))){ $tmp_products = \App\Models\Catalogs\Product::where('id','=',old('item.' . $item_row . '.product_id',$item->product_id))->get()->pluck('text_select2','id'); } $tmp_unit_measures = []; if(!empty(old('item.' . $item_row . '.unit_measure_id',$item->unit_measure_id))){ $tmp_unit_measures = \App\Models\Catalogs\UnitMeasure::where('id','=',old('item.' . $item_row . '.unit_measure_id',$item->unit_measure_id))->get()->pluck('description_select2','id'); } $tmp_sat_products = []; if(!empty(old('item.' . $item_row . '.sat_product_id',$item->sat_product_id))){ $tmp_sat_products = \App\Models\Catalogs\SatProduct::where('id','=',old('item.' . $item_row . '.sat_product_id',$item->sat_product_id))->get()->pluck('description_select2','id'); } @endphp @endforeach @php $item_row++; @endphp
@lang('general.column_actions') @lang('sales/customer_transfer.column_line_product_id') @lang('sales/customer_transfer.column_line_name') * @lang('sales/customer_transfer.column_line_unit_measure_id') * @lang('sales/customer_transfer.column_line_sat_product_id') * @lang('sales/customer_transfer.column_line_quantity') * @lang('sales/customer_transfer.column_line_price_unit') * @lang('sales/customer_transfer.column_line_discount') @lang('sales/customer_transfer.column_line_taxes') @lang('sales/customer_transfer.column_line_amount_untaxed')
{!! Form::select('item[' . $item_row . '][product_id]', $tmp_products,old('item.' . $item_row . '.product_id',$item->product_id), ['class' => 'form-control input-sm col-product-id', 'placeholder' => __('general.text_select'),'id' => 'item_product_id_' . $item_row,'data-row' => $item_row]) !!}
{!! Form::textarea('item[' . $item_row . '][name]', old('item.' . $item_row . '.name',$item->name), ['class' => 'form-control input-sm ym-auto-resize col-name-id', 'required','autocomplete'=>'off','id' => 'item_name_' . $item_row, 'placeholder' => __('sales/customer_transfer.column_line_name'),'rows' => 2, 'maxlength' => 1000]) !!} @if ($errors->has('item.'.$item_row.'.name')) {{ $errors->first('item.'.$item_row.'.name') }} @endif
{!! Form::select('item[' . $item_row . '][unit_measure_id]', $tmp_unit_measures,old('item.' . $item_row . '.unit_measure_id',$item->unit_measure_id), ['class' => 'form-control input-sm col-unit-measure-id', 'placeholder' => __('general.text_select'),'required','id' => 'item_unit_measure_id_' . $item_row]) !!}
@if ($errors->has('item.'.$item_row.'.unit_measure_id')) {{ $errors->first('item.'.$item_row.'.unit_measure_id') }} @endif
{!! Form::select('item[' . $item_row . '][sat_product_id]', $tmp_sat_products,old('item.' . $item_row . '.sat_product_id',$item->sat_product_id), ['class' => 'form-control input-sm col-sat-product-id', 'placeholder' => __('general.text_select'),'required','id' => 'item_sat_product_id_' . $item_row]) !!}
@if ($errors->has('item.'.$item_row.'.sat_product_id')) {{ $errors->first('item.'.$item_row.'.sat_product_id') }} @endif
{!! Form::number('item[' . $item_row . '][quantity]', old('item.' . $item_row . '.quantity',round($item->quantity,2)), ['class' => 'form-control input-sm text-right col-quantity', 'required','id' => 'item_quantity_' . $item_row, 'step' => 'any']) !!} @if ($errors->has('item.'.$item_row.'.quantity')) {{ $errors->first('item.'.$item_row.'.quantity') }} @endif
{!! Form::number('item[' . $item_row . '][price_unit]', old('item.' . $item_row . '.price_unit',round($item->price_unit,2)), ['class' => 'form-control input-sm text-right col-price-unit', 'required','id' => 'item_price_unit_' . $item_row, 'step' => 'any']) !!} @if ($errors->has('item.'.$item_row.'.price_unit')) {{ $errors->first('item.'.$item_row.'.price_unit') }} @endif
{!! Form::number('item[' . $item_row . '][discount]', old('item.' . $item_row . '.discount',round($item->discount,2)), ['class' => 'form-control input-sm text-center col-discount', 'id' => 'item_discount_' . $item_row, 'step' => 'any']) !!} @if ($errors->has('item.'.$item_row.'.discount')) {{ $errors->first('item.'.$item_row.'.discount') }} @endif
{!! Form::select('item[' . $item_row . '][taxes][]', $taxes,old('item.' . $item_row . '.taxes',$item->taxes ?? []), ['class' => 'form-control input-sm my-select2 col-taxes','multiple','id' => 'item_taxes_' . $item_row]) !!}
0
@lang('general.text_amount_untaxed') 0
@lang('general.text_amount_tax') 0
@lang('general.text_amount_total') 0
{!! html_entity_decode(Form::label('cfdi_relation_id', __('sales/customer_transfer.entry_cfdi_relation_id') . ' ', ['class' => 'control-label'])) !!} {!! Form::select('cfdi_relation_id', $cfdi_relations,old('cfdi_relation_id'), ['class' => 'form-control', 'placeholder' => __('general.text_select')]) !!} @if ($errors->has('cfdi_relation_id')) {{ $errors->first('cfdi_relation_id') }} @endif
@php $item_relation_row = 1; $items_relation = old('item_relation',[]); @endphp @foreach ($items_relation as $item_relation_row => $item) @php $tmp_uuid = ''; $tmp_customer_transfer_relations = []; if(!empty(old('item_relation.' . $item_relation_row . '.relation_id'))){ $tmp = \App\Models\Sales\CustomerInvoice::find(old('item_relation.' . $item_relation_row . '.relation_id')); $tmp_customer_transfer_relations = $tmp->get()->pluck('text_select2','id'); $tmp_uuid = !empty($tmp) ? $tmp->customerInvoiceCfdi->uuid : ''; } @endphp @endforeach @php $item_relation_row++; @endphp
@lang('general.column_actions') @lang('sales/customer_transfer.column_relation_relation_id') @lang('sales/customer_transfer.column_relation_uuid')
{!! Form::select('item_relation[' . $item_relation_row . '][relation_id]', $tmp_customer_transfer_relations,old('item_relation.' . $item_relation_row . '.relation_id'), ['class' => 'form-control input-sm col-relation-id', 'placeholder' => __('general.text_select'),'required','id' => 'item_relation_relation_id_' . $item_relation_row,'data-row' => $item_relation_row]) !!} @if ($errors->has('item_relation.'.$item_relation_row.'.relation_id')) {{ $errors->first('item_relation.'.$item_relation_row.'.relation_id') }} @endif
{{$tmp_uuid}}
{!! Form::close() !!}