@lang('sales/customer_foreign_trade.document_title')

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

{{ $customer_foreign_trade->name }}

{!! Form::model($customer_foreign_trade,['route' => ['customer-foreign-trades.update',$customer_foreign_trade->id],'method' => 'PUT','class' => '','role' => 'form','id' => 'form']) !!} {!! Form::hidden('amount_total_tmp', old('amount_total_tmp',0)) !!}
@if($tax_regimens->isNotEmpty())
{!! html_entity_decode(Form::label('tax_regimen_id', __('sales/customer_foreign_trade.entry_tax_regimen_id') . ' ', ['class' => 'control-label'])) !!} {!! Form::select('tax_regimen_id', $tax_regimens,old('tax_regimen_id', !empty($customer_foreign_trade->tax_regimen_id) ? $customer_foreign_trade->tax_regimen_id : \App\Helpers\Helper::defaultCompany()->tax_regimen_id), ['class' => 'form-control', 'placeholder' => __('general.text_select')]) !!} @if ($errors->has('tax_regimen_id')) {{ $errors->first('tax_regimen_id') }} @endif
@endif
@php $tmp_customers = []; if(!empty(old('customer_id',$customer_foreign_trade->customer_id))){ $tmp_customers = \App\Models\Sales\Customer::where('id','=',old('customer_id',$customer_foreign_trade->customer_id))->get()->pluck('text_select2','id'); } @endphp {!! html_entity_decode(Form::label('customer_id', __('sales/customer_foreign_trade.entry_customer_id') . ' *', ['class' => 'control-label'])) !!}
{!! Form::select('customer_id', $tmp_customers,old('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('tax_regimen_customer_id', __('sales/customer_foreign_trade.entry_tax_regimen_customer_id') . '', ['class' => 'control-label'])) !!} {!! Form::select('tax_regimen_customer_id', $tax_regimen_customers,old('tax_regimen_customer_id'), ['class' => 'form-control', 'placeholder' => __('general.text_select')]) !!} @if ($errors->has('tax_regimen_customer_id')) {{ $errors->first('tax_regimen_customer_id') }} @endif
{!! html_entity_decode(Form::label('branch_office_id', __('sales/customer_foreign_trade.entry_branch_office_id') . ' *', ['class' => 'control-label'])) !!} {!! Form::select('branch_office_id', $branch_offices,old('branch_office_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_foreign_trade.entry_currency_id') . ' *', ['class' => 'control-label'])) !!} {!! Form::select('currency_id', $currencies,old('currency_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_foreign_trade.entry_currency_value') . ' *', ['class' => 'control-label'])) !!} {!! Form::number('currency_value', old('currency_value',round($customer_foreign_trade->currency_value,4)), ['class' => 'form-control text-center', 'placeholder' => __('sales/customer_foreign_trade.entry_currency_value'),'required','step' => 'any']) !!} @if ($errors->has('currency_value')) {{ $errors->first('currency_value') }} @endif
{!! html_entity_decode(Form::label('date', __('sales/customer_foreign_trade.entry_date') . ' *', ['class' => 'control-label'])) !!}
{!! Form::text('date', old('date',\App\Helpers\Helper::dateTime(Date::parse($customer_foreign_trade->date))), ['class' => 'form-control', 'placeholder' => __('sales/customer_foreign_trade.entry_date'),'required','autocomplete'=>'off']) !!}
@if ($errors->has('date')) {{ $errors->first('date') }} @endif
{!! html_entity_decode(Form::label('payment_term_id', __('sales/customer_foreign_trade.entry_payment_term_id') . ' *', ['class' => 'control-label'])) !!} {!! Form::select('payment_term_id', $payment_terms,old('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('date_due', __('sales/customer_foreign_trade.entry_date_due') . '', ['class' => 'control-label'])) !!}
{!! Form::text('date_due', old('date_due',\App\Helpers\Helper::date(Date::parse($customer_foreign_trade->date_due))), ['class' => 'form-control', 'placeholder' => __('sales/customer_foreign_trade.entry_date_due'),'autocomplete'=>'off']) !!}
@if ($errors->has('date_due')) {{ $errors->first('date_due') }} @endif
{!! html_entity_decode(Form::label('salesperson_id', __('sales/customer_foreign_trade.entry_salesperson_id') . '', ['class' => 'control-label'])) !!} {!! Form::select('salesperson_id', $salespersons,old('salesperson_id'), ['class' => 'form-control', 'placeholder' => __('general.text_select')]) !!}
{!! html_entity_decode(Form::label('payment_way_id', __('sales/customer_foreign_trade.entry_payment_way_id') . ' *', ['class' => 'control-label'])) !!} {!! Form::select('payment_way_id', $payment_ways,old('payment_way_id'), ['class' => 'form-control', 'placeholder' => __('general.text_select'),'required']) !!} @if ($errors->has('payment_way_id')) {{ $errors->first('payment_way_id') }} @endif
{!! html_entity_decode(Form::label('payment_method_id', __('sales/customer_foreign_trade.entry_payment_method_id') . ' *', ['class' => 'control-label'])) !!} {!! Form::select('payment_method_id', $payment_methods,old('payment_method_id'), ['class' => 'form-control', 'placeholder' => __('general.text_select'),'required']) !!} @if ($errors->has('payment_method_id')) {{ $errors->first('payment_method_id') }} @endif
{!! html_entity_decode(Form::label('cfdi_use_id', __('sales/customer_foreign_trade.entry_cfdi_use_id') . ' *', ['class' => 'control-label'])) !!} {!! Form::select('cfdi_use_id', $cfdi_uses,old('cfdi_use_id'), ['class' => 'form-control', 'placeholder' => __('general.text_select'),'required']) !!} @if ($errors->has('cfdi_use_id')) {{ $errors->first('cfdi_use_id') }} @endif
@if(!empty(setting('enabled_projects')))
{!! html_entity_decode(Form::label('project_id', __('sales/customer_foreign_trade.entry_project_id') . ' ', ['class' => 'control-label'])) !!} {!! Form::select('project_id', $projects,old('project_id'), ['class' => 'form-control', 'placeholder' => __('general.text_select')]) !!} @if ($errors->has('project_id')) {{ $errors->first('project_id') }} @endif
@endif
@if ($errors->has('item')) {{ $errors->first('item') }} @endif
@php $item_row = 1; $items = old('item',$customer_foreign_trade->customerActiveInvoiceLines); @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'); } $tmp_tariff_fractions = []; if(!empty(old('item.' . $item_row . '.tariff_fraction_id',$item->customerInvoiceLineComplement->tariff_fraction_id ?? $item->tariff_fraction_id ?? ''))){ $tmp_tariff_fractions = \App\Models\Catalogs\TariffFraction::where('id','=',old('item.' . $item_row . '.tariff_fraction_id',$item->customerInvoiceLineComplement->tariff_fraction_id ?? $item->tariff_fraction_id ?? ''))->get()->pluck('description_select2','id'); } $tmp_uom_customs = []; if(!empty(old('item.' . $item_row . '.uom_custom_id',$item->customerInvoiceLineComplement->uom_custom_id ?? $item->uom_custom_id ?? ''))){ $tmp_uom_customs = \App\Models\Catalogs\UomCustom::where('id','=',old('item.' . $item_row . '.uom_custom_id',$item->customerInvoiceLineComplement->uom_custom_id ?? $item->uom_custom_id ?? ''))->get()->pluck('description_select2','id'); } @endphp @endforeach @php $item_row++; @endphp
@lang('general.column_actions') @lang('sales/customer_foreign_trade.column_line_product_id') @lang('sales/customer_foreign_trade.column_line_name') * @lang('sales/customer_foreign_trade.column_line_unit_measure_id') * @lang('sales/customer_foreign_trade.column_line_sat_product_id') * @lang('sales/customer_foreign_trade.column_line_quantity')* @lang('sales/customer_foreign_trade.column_line_price_unit') * @lang('sales/customer_foreign_trade.column_line_discount') @lang('sales/customer_foreign_trade.column_line_tariff_fraction_id') @lang('sales/customer_foreign_trade.column_line_customs_quantity') @lang('sales/customer_foreign_trade.column_line_uom_custom_id') @lang('sales/customer_foreign_trade.column_line_price_unit_usd') @lang('sales/customer_foreign_trade.column_line_taxes') @lang('sales/customer_foreign_trade.column_line_tax_object') @lang('sales/customer_foreign_trade.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_foreign_trade.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 . '][tariff_fraction_id]', $tmp_tariff_fractions,old('item.' . $item_row . '.tariff_fraction_id',$item->customerInvoiceLineComplement->tariff_fraction_id ?? $item->tariff_fraction_id ?? ''), ['class' => 'form-control input-sm col-tariff-fraction-id', 'placeholder' => __('general.text_select'),'id' => 'item_tariff_fraction_id_' . $item_row]) !!}
@if ($errors->has('item.'.$item_row.'.tariff_fraction_id')) {{ $errors->first('item.'.$item_row.'.tariff_fraction_id') }} @endif
{!! Form::number('item[' . $item_row . '][customs_quantity]', old('item.' . $item_row . '.customs_quantity',round($item->customerInvoiceLineComplement->customs_quantity ?? $item->customs_quantity ?? '',3)), ['class' => 'form-control input-sm text-right col-customs-quantity','id' => 'item_customs_quantity_' . $item_row, 'step' => 'any']) !!} @if ($errors->has('item.'.$item_row.'.customs_quantity')) {{ $errors->first('item.'.$item_row.'.customs_quantity') }} @endif
{!! Form::select('item[' . $item_row . '][uom_custom_id]', $tmp_uom_customs,old('item.' . $item_row . '.uom_custom_id',$item->customerInvoiceLineComplement->uom_custom_id ?? $item->uom_custom_id ?? ''), ['class' => 'form-control input-sm col-uom-custom-id', 'placeholder' => __('general.text_select'),'id' => 'item_uom_custom_id_' . $item_row]) !!}
@if ($errors->has('item.'.$item_row.'.uom_custom_id')) {{ $errors->first('item.'.$item_row.'.uom_custom_id') }} @endif
{!! Form::number('item[' . $item_row . '][price_unit_usd]', old('item.' . $item_row . '.price_unit_usd',round($item->customerInvoiceLineComplement->price_unit_usd ?? $item->price_unit_usd ?? '',2)), ['class' => 'form-control input-sm text-right col-price-unit-usd','id' => 'item_price_unit_usd_' . $item_row, 'step' => 'any']) !!} @if ($errors->has('item.'.$item_row.'.price_unit_usd')) {{ $errors->first('item.'.$item_row.'.price_unit_usd') }} @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]) !!}
{!! Form::select('item[' . $item_row . '][tax_object]', $tax_objects,old('item.' . $item_row . '.tax_object',$item->tax_object ?? ''), ['class' => 'form-control input-sm col-tax-object','id' => 'item_tax_object_' . $item_row]) !!}
0
{!! Form::textarea('comment', old('comment'), ['class' => 'form-control input-sm ym-auto-resize', 'placeholder' => __('sales/customer_foreign_trade.entry_comment'),'rows' => '3']) !!} @lang('general.text_amount_untaxed') 0
@lang('general.text_amount_total') 0
{!! html_entity_decode(Form::label('exchange_rate_usd', __('sales/customer_foreign_trade.entry_exchange_rate_usd') . ' *', ['class' => 'control-label'])) !!} {!! Form::number('exchange_rate_usd', old('exchange_rate_usd',round($customer_foreign_trade->exchange_rate_usd,4)), ['class' => 'form-control text-center', 'placeholder' => __('sales/customer_foreign_trade.entry_exchange_rate_usd'),'required','step' => 'any']) !!} @if ($errors->has('exchange_rate_usd')) {{ $errors->first('exchange_rate_usd') }} @endif
{!! html_entity_decode(Form::label('operation_type_id', __('sales/customer_foreign_trade.entry_operation_type_id') . ' *', ['class' => 'control-label'])) !!} {!! Form::select('operation_type_id', $operation_types,old('operation_type_id',\App\Models\Catalogs\OperationType::first()->id), ['class' => 'form-control', 'placeholder' => __('general.text_select'),'required']) !!} @if ($errors->has('operation_type_id')) {{ $errors->first('operation_type_id') }} @endif
{!! html_entity_decode(Form::label('pediment_id', __('sales/customer_foreign_trade.entry_pediment_id') . ' *', ['class' => 'control-label'])) !!} {!! Form::select('pediment_id', $pediments,old('pediment_id',\App\Models\Catalogs\Pediment::first()->id), ['class' => 'form-control', 'placeholder' => __('general.text_select'),'required']) !!} @if ($errors->has('pediment_id')) {{ $errors->first('pediment_id') }} @endif
{!! html_entity_decode(Form::label('reliable_exporter_number', __('sales/customer_foreign_trade.entry_reliable_exporter_number') . '', ['class' => 'control-label'])) !!} {!! Form::text('reliable_exporter_number', old('reliable_exporter_number'), ['class' => 'form-control', 'placeholder' => __('sales/customer_foreign_trade.entry_reliable_exporter_number')]) !!}
{!! html_entity_decode(Form::label('incoterm_id', __('sales/customer_foreign_trade.entry_incoterm_id') . ' *', ['class' => 'control-label'])) !!} {!! Form::select('incoterm_id', $incoterms,old('incoterm_id'), ['class' => 'form-control', 'placeholder' => __('general.text_select'),'required']) !!} @if ($errors->has('incoterm_id')) {{ $errors->first('incoterm_id') }} @endif
{!! html_entity_decode(Form::label('origin_certificate', __('sales/customer_foreign_trade.entry_origin_certificate') . ' *', ['class' => 'control-label'])) !!} {!! Form::select('origin_certificate', $list_origin_certificates,old('origin_certificate','0'), ['class' => 'form-control', 'placeholder' => __('general.text_select'),'required']) !!} @if ($errors->has('origin_certificate')) {{ $errors->first('origin_certificate') }} @endif
{!! html_entity_decode(Form::label('number_origin_certificate', __('sales/customer_foreign_trade.entry_number_origin_certificate') . '', ['class' => 'control-label'])) !!} {!! Form::text('number_origin_certificate', old('number_origin_certificate'), ['class' => 'form-control', 'placeholder' => __('sales/customer_foreign_trade.entry_number_origin_certificate')]) !!}
{!! html_entity_decode(Form::label('comment_foreign_trade', __('sales/customer_foreign_trade.entry_comment_foreign_trade') . '', ['class' => 'control-label'])) !!} {!! Form::textarea('comment_foreign_trade', old('comment_foreign_trade'), ['class' => 'form-control', 'placeholder' => __('sales/customer_foreign_trade.entry_comment_foreign_trade'),'rows' => 3]) !!}
{!! html_entity_decode(Form::label('cfdi_relation_id', __('sales/customer_foreign_trade.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',$customer_foreign_trade->customerInvoiceRelations); @endphp @foreach ($items_relation as $item_relation_row => $item) @php $item = !empty(old('item_relation.' . $item_relation_row . '')) ? (object) old('item_relation.' . $item_relation_row) : $item; $tmp_customer_foreign_trade_relations = []; if(!empty(old('item_relation.' . $item_relation_row . '.relation_id',$item->relation_id))){ $tmp = \App\Models\Sales\CustomerInvoice::find(old('item_relation.' . $item_relation_row . '.relation_id',$item->relation_id)); $tmp_customer_foreign_trade_relations = $tmp->get()->pluck('text_select2','id'); } @endphp @endforeach @php $item_relation_row++; @endphp
@lang('general.column_actions') @lang('sales/customer_foreign_trade.column_relation_relation_id') @lang('sales/customer_foreign_trade.column_relation_uuid')
{!! Form::select('item_relation[' . $item_relation_row . '][relation_id]', $tmp_customer_foreign_trade_relations,old('item_relation.' . $item_relation_row . '.relation_id',$item->relation_id), ['class' => 'form-control input-sm col-relation-id', 'placeholder' => __('general.text_select'),'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
{!! Form::text('item_relation[' . $item_relation_row . '][uuid_related]',old('item_relation.' . $item_relation_row . '.uuid_related',$item->uuid_related), ['class' => 'form-control text-center input-sm col-uuid-related','required','id' => 'item_relation_uuid_related_' . $item_relation_row,'data-row' => $item_relation_row]) !!} @if ($errors->has('item_relation.'.$item_relation_row.'.uuid_related')) {{ $errors->first('item_relation.'.$item_relation_row.'.uuid_related') }} @endif
{!! Form::close() !!}