<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
    <meta charset="utf-8"/>
    <title>{{$customer_invoice->documentType->name}}-{{$customer_invoice->name}}</title>
    <link href="{{ public_path('css/custom_pdf.css') }}" rel="stylesheet">
    <style type="text/css">
        @page {
            margin-top: 310px;
            margin-bottom: 225px;
        }

        .header h1 {
            margin: 0;
        }

        .footer {
            bottom: 15px;
            font-size: 7pt;
            color: #333333;
        }

        .pagenum:before {
            content: counter(page);
        }

        .text-primary {
            color: {{ \App\Helpers\Helper::companyColorPrimary($customer_invoice->company_id) }}     !important;
        }

        .table-items thead th {
            background-color: #FFFFFF!important;
            color: #333333;
            border-bottom: 1px solid #cccccc;
        }
        .table-items tbody td {
            padding: 8px 2px;
            border: none;
            border-bottom: 1px solid #cccccc;
        }
        .table-footer td {
            background-color: #FEFEFE;
            border: none;
        }
        .table-items tfoot td {
            padding: 4px 2px;
            border: none;
            border-bottom: 1px solid #cccccc;
        }
        .table-secundary td {
            background-color: #FAFAFA;
            border: none;
            border-bottom: 1px solid #cccccc;
        }
        .table-resume td {
            background-color: {{ \App\Helpers\Helper::companyColorPrimary($customer_invoice->company_id) }}     !important;
            color: #FFFFFF;
        }
    </style>
</head>
<body style="background-color: white;">
@php
//Obtiene datos del Cfdi33
$draft = (int) $customer_invoice->status == \App\Models\Sales\CustomerInvoice::DRAFT ? true : false;
$cfdi33 = empty($data['cfdi33']) ? null : $data['cfdi33'];
$conceptos = null;
if($cfdi33){
    $conceptos = $cfdi33->conceptos;
    $conceptos = $conceptos();
}
@endphp
<section class="header" style="top: -287px;">
    @if($cfdi33 && $customer_invoice->customerInvoiceCfdi->pac->test)
    <h2 style="position: absolute; left: 37%; top: -15px; color: red;">*** @lang('general.text_test_cfdi') ***</h2>
    @endif
    <div>
    <table cellpadding="0" cellspacing="0" class="" width="100%">
        <tr>
            <td width="40%" style="">
                @if(!empty(setting('enabled_projects')) && !empty(setting('projects_logo_docs')))
                    <img src="{{ \App\Helpers\Helper::logoCompanyDocsProjects($customer_invoice->company_id,$customer_invoice->project_id) }}" class="" style="max-height: 45px; max-width: 240px;"/>
                @elseif(!empty(setting('branch_office_logo_docs')))
                    <img src="{{ \App\Helpers\Helper::logoCompanyDocsBranchOffices($customer_invoice->company_id,$customer_invoice->branch_office_id) }}" class="" style="max-height: 45px; max-width: 240px;"/>
                @else
                    <img src="{{ \App\Helpers\Helper::logoCompanyDocs($customer_invoice->company_id) }}" class="" style="max-height: 45px; max-width: 240px;"/>
                @endif
            </td>
            <td width="60%" class="text-right" style="vertical-align: middle;">
                <h2 style="margin: 0;">{{ mb_strtoupper($customer_invoice->documentType->name) }}</h2>
                <span class="text-primary">{{ mb_strtoupper($customer_invoice->company->comercial_name) }}</span>
            </td>
        </tr>
        <tr>
            <td colspan="2" class="text-right" style="border-bottom: 1px solid #cccccc; padding-top: 5px; padding-bottom: 5px;">
                <strong>{{ mb_strtoupper($customer_invoice->company->name) }} | {{ mb_strtoupper($customer_invoice->company->taxid) }} | {{ $data['tax_regimen'] ?? ($customer_invoice->taxRegimen->name_sat ?? $customer_invoice->company->taxRegimen->name_sat) }}</strong><br>
                <span>
                    @if(!empty($customer_invoice->company->address_1) || !empty($customer_invoice->company->address_2) || !empty($customer_invoice->company->address_3) || !empty($customer_invoice->company->address_4))
                        {{ $customer_invoice->company->address_1 ?? '' }} {{ $customer_invoice->company->address_2 ?? '' }} {{ $customer_invoice->company->address_3 ?? '' }} {{ $customer_invoice->company->address_4 ?? '' }}
                    @endif
                    @if(!empty($customer_invoice->company->city->name) || !empty($customer_invoice->company->state->name))
                        {{ !empty($customer_invoice->company->city->name) ? $customer_invoice->company->city->name . ', ' : '' }}{{ !empty($customer_invoice->company->state->name) ? $customer_invoice->company->state->name . ', ' : '' }}
                    @endif
                    {{ $customer_invoice->company->country->name ?? '' }}{!! ($customer_invoice->company->postcode ? '&nbsp;&nbsp;' . __('base/company.entry_postcode') . ': ' . $customer_invoice->company->postcode : '') !!} | {{ $customer_invoice->company->phone ?? ' ' }} | {{ $customer_invoice->company->email ?? ' ' }}
                </span>
            </td>
        </tr>
    </table>
    </div>
    <div>
    <table cellpadding="0" cellspacing="0" class="" width="100%" style="margin-top: 15px; margin-bottom: 10px;">
        <tr>
            <td width="60%" style="vertical-align: middle; padding-left: 5px;">
                <table cellpadding="0" cellspacing="0" class="" style="min-width: 50%;">
                    <tr>
                        <td class="text-primary" style="padding-top: 5px; padding-bottom: 5px;">
                            <p style="margin: 0; border-bottom: 1px solid #cccccc;">{{ __('general.text_customer') }}</p>
                        </td>
                    </tr>
                    <tr>
                        <td class="text-head" style="padding-top: 3px;">
                            <strong>{{ mb_strtoupper(!empty($cfdi33->Receptor['Nombre']) ? $cfdi33->Receptor['Nombre'] : $customer_invoice->customer->name) }} </strong>
                            @if(!empty($customer_invoice->customer->address_1) || !empty($customer_invoice->customer->address_2) || !empty($customer_invoice->customer->address_3) || !empty($customer_invoice->customer->address_4))
                                <br/>
                                {{ $customer_invoice->customer->address_1 ?? '' }} {{ $customer_invoice->customer->address_2 ?? '' }} {{ $customer_invoice->customer->address_3 ?? '' }} {{ $customer_invoice->customer->address_4 ?? '' }},
                            @endif
                            @if(!empty($customer_invoice->customer->city->name) || !empty($customer_invoice->customer->state->name))
                                <br/>
                                {{ $customer_invoice->customer->city->name ?? '' }}, {{ $customer_invoice->customer->state->name ?? '' }}
                            @endif
                            <br/>
                            {{ $customer_invoice->customer->country->name ?? '' }}{!! ($customer_invoice->customer->postcode ? '&nbsp;&nbsp;' . __('sales/customer.entry_postcode') . ': ' . $customer_invoice->customer->postcode : '') !!}
                            <br/>
                            @lang('sales/customer_invoice.entry_taxid'): {{ mb_strtoupper($cfdi33->Receptor['Rfc'] ?? $customer_invoice->customer->taxid) }}
                            <br />
                            @lang('sales/customer_invoice.entry_tax_regimen_customer_id2'): {{ $data['tax_regimen_customer'] ?? ($customer_invoice->taxRegimenCustomer->name_sat ?? $customer_invoice->customer->taxRegimen->name_sat) }}
                        </td>
                    </tr>
                </table>
            </td>
            <td width="40%" class="text-right" style="vertical-align: middle;">
                <table cellpadding="0" cellspacing="0" class="text-right" style="" width="100%">
                    <tr>
                        <td class="small" style=" color: #777777;"><strong>{{ __('sales/customer_invoice.entry_name') }}</strong></td>
                    </tr>
                    <tr>
                        <td class="text-head" style="">
                            <h3 style="margin: 0; padding: 0;">{{ $customer_invoice->name }}</h3>
                        </td>
                    </tr>
                    <tr>
                        <td class="small" style="padding-top: 7px; color: #777777;"><strong>@lang('sales/customer_invoice.entry_date')</strong></td>
                    </tr>
                    <tr>
                        <td class="text-head" style="">
                            <h3 style="margin: 0; padding: 0;">{{ \App\Helpers\Helper::convertSqlToDateTime($customer_invoice->date) }}</h3>
                        </td>
                    </tr>
                    <tr>
                        <td class="small" style="padding-top: 7px; color: #777777;"><strong>@lang('sales/customer_invoice.entry_date_due')</strong></td>
                    </tr>
                    <tr>
                        <td class="text-head" style="">
                            <h3 style="margin: 0; padding: 0;">{{ \App\Helpers\Helper::convertSqlToDate($customer_invoice->date_due) }}</h3>
                        </td>
                    </tr>
                    <tr>
                        <td class="small" style="padding-top: 7px; color: #777777;"><strong>@lang('general.text_amount_total')</strong></td>
                    </tr>
                    <tr>
                        <td class="text-head" style="">
                            <h3 style="margin: 0; padding: 0;">{{ money($customer_invoice->amount_total,$customer_invoice->currency->code,true) }}</h3>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    </div>
    <div>
    <table cellpadding="2" cellspacing="0" class="table-resume" width="100%" style="margin-top: 5px; font-size: 9px;">
        <tr>
            <td>
                <small style="font-weight: bold;">@lang('general.text_cfdi_uuid')</small><br>
                {{ $customer_invoice->customerInvoiceCfdi->uuid ?? '' }}
            </td>
            <td>
                <small style="font-weight: bold;">@lang('base/document_type.entry_cfdi_type_id')</small><br>
                {{ $customer_invoice->documentType->cfdiType->name_sat ?? '' }}
            </td>
            <td>
                <small style="font-weight: bold;">@lang('sales/customer_invoice.entry_payment_term_id')</small><br>
                {{ $customer_invoice->paymentTerm->name }}
            </td>
            <td>
                <small style="font-weight: bold;">@lang('sales/customer_invoice.entry_cfdi_use_id')</small><br>
                {{ $customer_invoice->cfdiUse->name_sat }}
            </td>
            <td>
                <small style="font-weight: bold;">@lang('general.text_issued_in')</small><br>
                {{ $customer_invoice->branchOffice->name ?? '' }} {!! ($customer_invoice->branchOffice->postcode ? '<strong>&nbsp;&nbsp;' . __('base/branch_office.entry_postcode') . ':</strong> ' . ($cfdi33['LugarExpedicion'] ?? $customer_invoice->branchOffice->postcode) : '') !!}
            </td>
        </tr>
    </table>
    </div>
</section>
<section class="footer">
    <div>
    <table cellpadding="0" cellspacing="0" class="table-footer" width="100%"
           style="margin-top: 5px; table-layout: fixed;">
        <tr>
            <td width="23%" class="text-center" style="vertical-align: middle; padding: 5px; word-wrap:break-word; border-top: 1px solid #cccccc;">
                @if(!empty($cfdi33))
                <img src="{{ $data['qr'] }}" width="137px" style="margin: 9px 0;"/>
                @endif
            </td>
            <td width="77%" style="vertical-align: middle; padding: 5px; word-wrap:break-word; height: 180px; border-top: 1px solid #cccccc;">
                @if(!empty($cfdi33))
                <strong>@lang('general.text_cfdi_tfd_cadena_origen')</strong><br/>
                <small>{{ $data['tfd_cadena_origen'] }}</small>
                <br/>
                <strong>@lang('general.text_cfdi_tfd_sello_cfdi')</strong><br/>
                <small>{{ $cfdi33->complemento->timbreFiscalDigital['SelloCFD'] }}</small>
                <br/>
                <strong>@lang('general.text_cfdi_tfd_sello_sat')</strong><br/>
                <small>{{ $cfdi33->complemento->timbreFiscalDigital['SelloSAT'] }}</small>
                <br/>
                @endif
            </td>
        </tr>
    </table>
    </div>
    <hr>
    <div>
    <table cellpadding="0" cellspacing="0" class="" width="100%">
        <tr>
            <td width="25%">
                <span>{{!empty(config('app.cfdi_footer')) ? config('app.cfdi_footer')  : config('app.name') . ' ' . 'v.' . config('app.version') }}</span>
            </td>
            <td width="50%" class="text-center">
                @lang('general.text_cfdi_40')
            </td>
            <td width="25%" class="text-right">
                @lang('general.text_page') <span class="pagenum"></span>
            </td>
        </tr>
    </table>
    </div>
</section>
@if($customer_invoice->status == \App\Models\Sales\CustomerInvoice::CANCEL)
    <section class="watermark" style="bottom: 450px !important;">
        @if(!empty($customer_invoice->customerInvoiceCfdi->uuid))
            <span>@lang('general.text_canceled_cfdi')</span>
        @else
            <span>@lang('general.text_canceled')</span>
        @endif
    </section>
@endif
@if($draft)
    <section class="watermark" style="bottom: 450px !important;">
        <span>@lang('general.text_pre_invoice')</span>
    </section>
@endif
<section>
    <div>
    <table cellpadding="0" cellspacing="0" class="table-items" width="100%">
        <thead>
        <tr>
            <th class="text-left">{{ mb_strtoupper(__('sales/customer_invoice.column_line_name')) }}</th>
            <th width="9%">{{ mb_strtoupper(__('sales/customer_invoice.column_line_sat_product_id')) }}</th>
            <th width="14%">{{ mb_strtoupper(__('sales/customer_invoice.column_line_unit_measure_id')) }}</th>
            <th width="7%">{{ mb_strtoupper(__('sales/customer_invoice.column_line_quantity')) }}</th>
            <th width="9%">{{ mb_strtoupper(__('sales/customer_invoice.column_line_price_unit')) }}</th>
            <th width="7%">{{ mb_strtoupper(__('sales/customer_invoice.column_line_discount')) }}</th>
            <th width="11%">{{ mb_strtoupper(__('sales/customer_invoice.column_line_amount_untaxed')) }}</th>
        </tr>
        </thead>
        <tbody>
        @if($conceptos)
        @foreach($conceptos as $result)
            @php
                //Complemento concepto

            @endphp
            <tr>
                <td>
                    @if(!empty(setting('show_product_code_on_pdf')))
                        {{$result['NoIdentificacion'] ?? 'N/A'}} -
                    @endif
                    {!! nl2br($result['Descripcion']) !!}
                    @php
                    echo '<br />';
                    echo __('sales/customer_invoice.column_line_tax_object') . ': '.$result['ObjetoImp'].'<br />';
                    //Complemento IEDU
                    foreach(($result->ComplementoConcepto)() as $result2){
                        if((string)$result2 == 'instEducativas'){
                            echo '<br/><br/>';
                            echo __('sales/customer_invoice.column_line_iedu_iedu_nombre_alumno') . ': '.$result2['nombreAlumno'].'<br/>';
                            echo __('sales/customer_invoice.column_line_iedu_iedu_curp') . ': '.$result2['CURP'].'<br/>';
                            echo __('sales/customer_invoice.column_line_iedu_iedu_nivel_educativo') . ': '.$result2['nivelEducativo'].'<br/>';
                            echo __('sales/customer_invoice.column_line_iedu_iedu_aut_rvoe') . ': '.$result2['autRVOE'].'<br/>';
                            if(!empty($result2['rfcPago'])){
                                echo __('sales/customer_invoice.column_line_iedu_iedu_rfc_pago') . ': '.$result2['rfcPago'].'<br/>';
                            }
                            break;
                        }
                    }
                    //Numero pedimento
                    foreach(($result)() as $result2){
                        if((string)$result2 == 'InformacionAduanera'){
                            echo '<br/><br/>';
                            echo __('sales/customer_invoice.column_line_numero_pedimento') . ': '.$result2['NumeroPedimento'].'<br/>';
                            break;
                        }
                    }
                    @endphp
                </td>
                <td class="text-center">{{ $result['ClaveProdServ'] }}</td>
                <td class="text-center">[{{ $result['ClaveUnidad'] }}] {{ $result['Unidad'] }}</td>
                <td class="text-center">{{ \App\Helpers\Helper::numberFormatRealDecimalPlace($result['Cantidad']) }}</td>
                <td class="text-center">
                    {{ \App\Helpers\Helper::numberFormatMoneyRealDecimalPlace($result['ValorUnitario'], $customer_invoice->currency->code) }}
                        </td>
                <td class="text-center">{{ \App\Helpers\Helper::numberFormatMoney(!empty($result['Descuento']) ? $result['Descuento'] : 0,2, $customer_invoice->currency->code) }}</td>
                <td class="text-right">{{ money($result['Importe'],$customer_invoice->currency->code,true) }}</td>
            </tr>
        @endforeach
        @else
            @foreach($customer_invoice->customerActiveInvoiceLines as $result)
                <tr>
                    <td>
                        @if(!empty(setting('show_product_code_on_pdf')))
                            {{$result->product->code ?? 'N/A'}} -
                        @endif
                        {!! nl2br($result->name) !!}
                    </td>
                    <td class="text-center">{{ $result->satProduct->code }}</td>
                    <td class="text-center">{{ $result->unitMeasure->name_sat }}</td>
                    <td class="text-center">{{ \App\Helpers\Helper::numberFormat($result->quantity,$result->unitMeasure->decimal_place) }}</td>
                    <td class="text-center">
                            {{ \App\Helpers\Helper::numberFormatMoney($result->price_unit,!empty($result->product->price_decimal_place) ? $result->product->price_decimal_place : \App\Helpers\Helper::companyProductPriceDecimalPlace($customer_invoice->company_id), $customer_invoice->currency->code) }}
                        </td>
                    <td class="text-center">{{ $result->discount_type == 'A' ? \App\Helpers\Helper::numberFormatMoney($result->discount,2, $customer_invoice->currency->code) : \App\Helpers\Helper::numberFormatPercentRealDecimalPlace($result->discount) }}</td>
                    <td class="text-right">{{ money($result->amount_untaxed,$customer_invoice->currency->code,true) }}</td>
                </tr>
            @endforeach
        @endif
        </tbody>
        <tfoot>
        <tr>
            <td colspan="4" class="text-center" style="vertical-align: bottom;">
                <span style="line-height: 16px;">
                    ***({{\App\Helpers\Helper::numberToWordCurrency($customer_invoice->amount_total,$customer_invoice->currency->code,$customer_invoice->currency->decimal_place)}})***
                </span>
            </td>
            <td colspan="2" class="text-right" style="vertical-align: top; padding-right: 4px;">
                <strong>@lang('general.text_amount_untaxed')</strong><br/>
                @if($customer_invoice->customerInvoiceTaxes->isNotEmpty())
                    @foreach($customer_invoice->customerInvoiceTaxes as $result)
                        <span style="line-height: 16px;"><strong>{{$result->name}}</strong></span><br/>
                    @endforeach
                @endif
                <span style="line-height: 16px;"><strong>{{ mb_strtoupper(__('general.text_amount_total')) }}</strong></span>
            </td>
            <td class="text-right">
                {{ money($customer_invoice->amount_untaxed,$customer_invoice->currency->code,true) }}<br/>
                @if($customer_invoice->customerInvoiceTaxes->isNotEmpty())
                    @foreach($customer_invoice->customerInvoiceTaxes as $result)
                        <span style="line-height: 16px;">{{money(abs($result->amount_tax),$customer_invoice->currency->code,true)}}</span><br/>
                    @endforeach
                @endif
                <span style="line-height: 16px;"><strong>{{ money($customer_invoice->amount_total,$customer_invoice->currency->code,true) }}</strong></span>
            </td>
        </tr>
        </tfoot>
    </table>
    </div>
    <div>
    <table cellpadding="0" cellspacing="0" class="table-secundary" width="100%" style="margin-top: 5px;">
        <tr>
            <td width="50%" style="vertical-align: top; padding: 5px;">
                <strong>@lang('sales/customer_invoice.entry_payment_way_id'): </strong>{{ $customer_invoice->paymentWay->name_sat }}
                <br/>
                <strong>@lang('sales/customer_invoice.entry_payment_method_id'): </strong>{{ $customer_invoice->paymentMethod->name_sat }}
                <br/>
                <strong>@lang('sales/customer_invoice.entry_currency_id'): </strong>{{ $customer_invoice->currency->code }}{!! ($customer_invoice->currency->code!='MXN' ? '&nbsp;&nbsp;&nbsp;<strong>'.__('sales/customer_invoice.entry_currency_value').':</strong> '.round($customer_invoice->currency_value,4) :'') !!}
                <br/>
                @if(!empty($customer_invoice->origin))
                    <strong>@lang('sales/customer_invoice.entry_origin'): </strong>{{ $customer_invoice->origin }}
                    <br/>
                @endif
            </td>
            <td width="50%" style="vertical-align: top; padding: 5px;">
                @if(!empty($cfdi33))
                <strong>@lang('general.text_cfdi_certificado'): </strong>{{ $cfdi33['NoCertificado'] }}
                <br/>
                <strong>@lang('general.text_cfdi_tfd_no_certificado_sat'): </strong>{{ $cfdi33->complemento->timbreFiscalDigital['NoCertificadoSAT'] }}
                <br/>
                <strong>@lang('general.text_cfdi_tfd_fecha_timbrado'): </strong>{{ \App\Helpers\Helper::convertSqlToDateTime(str_replace('T',' ',$cfdi33->complemento->timbreFiscalDigital['FechaTimbrado'])) }}
                <br/>
                @endif
            </td>
        </tr>
    </table>
    </div>
    @if(!empty($customer_invoice->cfdi_relation_id))
        <div>
        <p style="margin-bottom: 2px;">
            <strong>@lang('sales/customer_invoice.tab_relations') - {{ $customer_invoice->cfdiRelation->name_sat }}</strong>
        </p>
        <table cellpadding="0" cellspacing="0" class="table-secundary" width="100%">
            <tr>
                <td width="15%" class="text-center" style="vertical-align: middle; padding: 5px;">
                    @if($customer_invoice->customerInvoiceRelations->isNotEmpty())
                        @foreach($customer_invoice->customerInvoiceRelations as $result)
                            {{$result->relation->name ?? ''}}<br/>
                        @endforeach
                    @endif
                </td>
                <td width="85%" style="vertical-align: middle; padding: 5px;">
                    @if($customer_invoice->customerInvoiceRelations->isNotEmpty())
                        @foreach($customer_invoice->customerInvoiceRelations as $result)
                            {{$result->uuid_related}}<br/>
                        @endforeach
                    @endif
                </td>
            </tr>
        </table>
        </div>
    @endif
    @if(!empty($data['cfdi33']->InformacionGlobal['Periodicidad']))
    <div>
        <p style="margin-bottom: 2px;"><strong>@lang('general.text_cfdi_global')</strong></p>
        <table cellpadding="0" cellspacing="0" class="table-secundary" width="100%">
            <tr>
                <td width="34%" class="text-center" style="padding: 3px;">
                    <b>@lang('sales/customer_invoice.entry_global_periodicity'): </b> {{!empty($global_periodicities[$data['cfdi33']->InformacionGlobal['Periodicidad']]) ? $global_periodicities[$data['cfdi33']->InformacionGlobal['Periodicidad']] : $data['cfdi33']->InformacionGlobal['Periodicidad'] }}
                </td>
                <td width="33%" class="text-center" style="padding: 3px;">
                    <b>@lang('sales/customer_invoice.entry_global_month'): </b> {{$data['cfdi33']->InformacionGlobal['Meses']}}
                </td>
                <td width="33%" class="text-center" style="padding: 3px;">
                    <b>@lang('sales/customer_invoice.entry_global_year'): </b> {{$data['cfdi33']->InformacionGlobal['Año']}}
                </td>
            </tr>
        </table>
    </div>
    @endif
    @if($customer_invoice->customerInvoiceTaxLegends->isNotEmpty())
        <div>
            <p style="margin-bottom: 2px;"><strong>@lang('general.text_complement_tax_legend')</strong></p>
            <table cellpadding="0" cellspacing="0" class="table-secundary" width="100%">
                <tr>
                    <td width="20%" class="text-center">
                        <b>@lang('sales/customer_invoice.column_tax_legend_disposicion_fiscal')</b>
                    </td>
                    <td width="25%" class="text-center">
                        <b>@lang('sales/customer_invoice.column_tax_legend_norma')</b>
                    </td>
                    <td width="50%" class="text-left">
                        <b>@lang('sales/customer_invoice.column_tax_legend_texto_leyenda')</b>
                    </td>
                </tr>
                @foreach($customer_invoice->customerInvoiceTaxLegends as $result)
                    <tr>
                        <td class="text-center">{{ $result->disposicion_fiscal }}</td>
                        <td class="text-center">{{ $result->norma }}</td>
                        <td>
                            {!! nl2br($result->texto_leyenda) !!}
                        </td>
                    </tr>
                @endforeach
            </table>
        </div>
    @endif
    @if(!empty($customer_invoice_complement->ine_process_type))
    <div>
        <p style="margin-bottom: 2px;"><strong>@lang('general.text_complement_ine')</strong></p>
        <table cellpadding="0" cellspacing="0" class="table-secundary" width="100%">
            <tr>
                <td  width="35%" class="text-left" style="vertical-align: top;">
                    <b>@lang('sales/customer_invoice.entry_ine_process_type'): </b> {{$customer_invoice_complement->ine_process_type}}
                    <br/>
                    <b>@lang('sales/customer_invoice.entry_ine_committee_type'): </b> {{$customer_invoice_complement->ine_committee_type}}
                    <br/>
                    <b>@lang('sales/customer_invoice.entry_ine_id_accounting'): </b> {{$customer_invoice_complement->ine_id_accounting}}
                    <br/>
                </td>
                <td  width="65%" class="text-center">
                    <div>
                        <table cellpadding="0" cellspacing="0" class="table-secundary" width="100%">
                            <tr>
                                <td width="20%" class="text-center" style="padding: 2px;">
                                    <b>@lang('sales/customer_invoice.column_ine_ine_entity')</b>
                                </td>
                                <td width="25%" class="text-center" style="padding: 2px;">
                                    <b>@lang('sales/customer_invoice.column_ine_ambit')</b>
                                </td>
                                <td width="50%" class="text-left" style="padding: 2px;">
                                    <b>@lang('sales/customer_invoice.column_ine_id_accounting')</b>
                                </td>
                            </tr>
                            @foreach($customer_invoice->customerActiveInvoiceInes as $result)
                                <tr>
                                    <td class="text-center" style="padding: 2px;">{{ $result->ine_entity_s }}</td>
                                    <td class="text-center" style="padding: 2px;">{{ $result->ambit }}</td>
                                    <td class="text-left" style="padding: 2px;">
                                        {!! $result->id_accounting !!}
                                    </td>
                                </tr>
                            @endforeach
                        </table>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    @endif
    @if(!empty($customer_invoice->comment))
        <div>
        <p style="margin-bottom: 2px;"><strong>@lang('sales/customer_invoice.entry_comment')</strong></p>
        <table cellpadding="0" cellspacing="0" class="table-secundary" width="100%">
            <tr>
                <td width="100%" style="vertical-align: top; padding: 5px;">
                    {!! nl2br($customer_invoice->comment) !!}
                </td>
            </tr>
        </table>
        </div>
    @endif
</section>
</body>
</html>
