@lang('sales/customer_fee.document_title')

@include('flash::message')
@php //Obtiene datos del Cfdi33 $cfdi33 = !empty($data['cfdi33']) ? $data['cfdi33'] : []; @endphp

{{ $customer_fee->documentType->name }}

{{ mb_strtoupper($customer_fee->company->name) }}
{{ $data['tax_regimen'] ?? ($customer_fee->taxRegimen->name_sat ?? $customer_fee->company->taxRegimen->name_sat) }}
{{ $customer_fee->company->address_1 ?? '' }} {{ $customer_fee->company->address_2 ?? '' }} {{ $customer_fee->company->address_3 ?? '' }} {{ $customer_fee->company->address_4 ?? '' }}
{{ $customer_fee->company->city->name ?? '' }} , {{ ($customer_fee->company->state->name ?? '') }}
{{ $customer_fee->company->country->name ?? '' }}{!! ($customer_fee->company->postcode ? '  ' . __('base/company.entry_postcode') . ': ' . $customer_fee->company->postcode : '') !!}
{{ mb_strtoupper($customer_fee->company->taxid) }}
---
{{ $customer_fee->company->phone ?? ' ' }}
{{ $customer_fee->company->email ?? ' ' }}

# {{ $customer_fee->name }} {!! \App\Helpers\SalesHelper::statusCustomerFeeHtml($customer_fee->status) !!}

@lang('general.text_cfdi_uuid') : {{ $customer_fee->customerInvoiceCfdi->uuid ?? '' }}
@lang('base/document_type.entry_cfdi_type_id') : {{ $customer_fee->documentType->cfdiType->name_sat ?? '' }}
@lang('sales/customer_fee.entry_date') : {{ \App\Helpers\Helper::convertSqlToDateTime($customer_fee->date) }}
@lang('sales/customer_fee.entry_date_due') : {{ \App\Helpers\Helper::convertSqlToDate($customer_fee->date_due) }}
@lang('sales/customer_fee.entry_payment_term_id') : {{ $customer_fee->paymentTerm->name }}
@lang('sales/customer_fee.entry_cfdi_use_id') : {{ $customer_fee->cfdiUse->name_sat }}
@lang('general.text_issued_in') : {{ $customer_fee->branchOffice->name ?? '' }} {!! ($customer_fee->branchOffice->postcode ? '  ' . __('base/branch_office.entry_postcode') . ': ' . $customer_fee->branchOffice->postcode : '') !!}

{{ mb_strtoupper(__('general.text_customer')) }}

{{ mb_strtoupper($customer_fee->customer->name) }}
{{ $customer_fee->customer->address_1 ?? '' }} {{ $customer_fee->customer->address_2 ?? '' }} {{ $customer_fee->customer->address_3 ?? '' }} {{ $customer_fee->customer->address_4 ?? '' }}
{{ $customer_fee->customer->city->name ?? '' }} , {{ $customer_fee->customer->state->name ?? '' }}
{{ $customer_fee->customer->country->name ?? '' }}{!! ($customer_fee->customer->postcode ? '  ' . __('sales/customer.entry_postcode') . ': ' . $customer_fee->customer->postcode : '') !!}
{{ mb_strtoupper($cfdi33->Receptor['Rfc'] ?? $customer_fee->customer->taxid) }}
@lang('sales/customer_fee.entry_tax_regimen_customer_id2') : {{ $data['tax_regimen_customer'] ?? ($customer_fee->taxRegimenCustomer->name_sat ?? ($customer_fee->customer->taxRegimen->name_sat ?? '')) }}
@foreach($customer_fee->customerActiveInvoiceLines as $result) @endforeach
{{ mb_strtoupper(__('sales/customer_fee.column_line_name')) }} {{ mb_strtoupper(__('sales/customer_fee.column_line_sat_product_id')) }} {{ mb_strtoupper(__('sales/customer_fee.column_line_unit_measure_id')) }} {{ mb_strtoupper(__('sales/customer_fee.column_line_quantity')) }} {{ mb_strtoupper(__('sales/customer_fee.column_line_price_unit')) }} {{ mb_strtoupper(__('sales/customer_fee.column_line_discount')) }} {{ mb_strtoupper(__('sales/customer_fee.column_line_amount_untaxed')) }}
{{ $result->name }} {{ $result->satProduct->code }} {{ $result->unitMeasure->name_sat }} {{ \App\Helpers\Helper::numberFormat($result->quantity,$result->unitMeasure->decimal_place) }} {{ \App\Helpers\Helper::numberFormatMoney($result->price_unit,\App\Helpers\Helper::companyProductPriceDecimalPlace($customer_fee->company_id)) }} {{ \App\Helpers\Helper::numberFormat($result->discount,2) }} {{ money($result->amount_untaxed,$customer_fee->currency->code,true) }}
@lang('sales/customer_fee.entry_payment_way_id') : {{ $customer_fee->paymentWay->name_sat }}
@lang('sales/customer_fee.entry_payment_method_id') : {{ $customer_fee->paymentMethod->name_sat }}
@lang('sales/customer_fee.entry_currency_id') : {{ $customer_fee->currency->code }}{!! ($customer_fee->currency->code!='MXN' ? '   '.__('sales/customer_fee.entry_currency_value').': '.round($customer_fee->currency_value,4) :'') !!}
@if(!empty($cfdi33)) @lang('general.text_cfdi_certificado'): {{ $cfdi33['NoCertificado'] }}
@lang('general.text_cfdi_tfd_no_certificado_sat'): {{ $cfdi33->complemento->timbreFiscalDigital['NoCertificadoSAT'] }}
@lang('general.text_cfdi_tfd_fecha_timbrado'): {{ \App\Helpers\Helper::convertSqlToDateTime(str_replace('T',' ',$cfdi33->complemento->timbreFiscalDigital['FechaTimbrado'])) }}
@endif
@if($customer_fee->customerInvoiceTaxes->isNotEmpty()) @foreach($customer_fee->customerInvoiceTaxes as $result) @endforeach @endif
@lang('general.text_amount_untaxed') {{ money($customer_fee->amount_untaxed,$customer_fee->currency->code,true) }}
{{$result->name}} {{ money(abs($result->amount_tax),$customer_fee->currency->code,true) }}
{{ mb_strtoupper(__('general.text_amount_total')) }} {{ money($customer_fee->amount_total,$customer_fee->currency->code,true) }}
@if(!empty($customer_fee->cfdi_relation_id))

@lang('sales/customer_fee.tab_relations') - {{ $customer_fee->cfdiRelation->name_sat }}

@if($customer_fee->customerInvoiceRelations->isNotEmpty()) @foreach($customer_fee->customerInvoiceRelations as $result) {{$result->relation->name}}
@endforeach @endif
@if($customer_fee->customerInvoiceRelations->isNotEmpty()) @foreach($customer_fee->customerInvoiceRelations as $result) {{$result->relation->customerInvoiceCfdi->uuid}}
@endforeach @endif
@endif
@if(!empty($customer_fee->comment))

@lang('sales/customer_fee.entry_comment')

{{ $customer_fee->comment }}
@endif
@if(!empty($cfdi33))
@lang('general.text_cfdi_tfd_cadena_origen')
{{ $data['tfd_cadena_origen'] }}
@lang('general.text_cfdi_tfd_sello_cfdi')
{{ $cfdi33->complemento->timbreFiscalDigital['SelloCFD'] }}
@lang('general.text_cfdi_tfd_sello_sat')
{{ $cfdi33->complemento->timbreFiscalDigital['SelloSAT'] }}
@endif