{{-- FACTURA ELECTRONICA Nro: {{$resolution->prefix}} - {{$request->number}} --}} {{-- Header incluido en el template--}}
logo
{{$user->name}}
@if(isset($request->establishment_name) && $request->establishment_name != 'Oficina Principal') {{$request->establishment_name}}
@endif NIT: {{$company->identification_number}}-{{$company->dv}} - Dirección: {{$company->address}}
Tel: {{$company->phone}} - Correo: {{$user->email}}
FACTURA ELECTRONICA DE VENTA {{$resolution->prefix}} - {{$request->number}}
Fecha Emisión: {{$date}} - Fecha Validación DIAN: {{$date}}
Hora Validación DIAN: {{$time}}
@if(isset($request->ivaresponsable) && $request->ivaresponsable != $company->type_regime->name) {{$company->type_regime->name}} - {{$request->ivaresponsable}}
@endif @if(isset($request->nombretipodocid)) Tipo Documento ID: {{$request->nombretipodocid}}
@endif @if(isset($request->tarifaica) && $request->tarifaica != '100') TARIFA ICA: {{$request->tarifaica}}%
@endif @if(isset($request->actividadeconomica)) ACTIVIDAD ECONOMICA: {{$request->actividadeconomica}}
@endif @if(isset($request->seze)) Regimen SEZE Año: {{$aseze}} Constitución Sociedad Año: {{$asociedad}}
@endif Resolución de Facturación Electrónica No. {{$resolution->resolution}} de {{$resolution->resolution_date}}
Prefijo: {{$resolution->prefix}}, Rango {{$resolution->from}} al {{$resolution->to}}
Vigencia Desde: {{$resolution->date_from}} Hasta: {{$resolution->date_to}}
@if (isset($request->seze)) FAVOR ABSTENERSE DE PRACTICAR RETENCION EN LA FUENTE REGIMEN ESPECIAL DECRETO 2112 DE 2019
@endif
@if(isset($request->establishment_address)) {{$request->establishment_address}} - @else {{$company->address}} - @endif @inject('municipality', 'App\Municipality') @if(isset($request->establishment_municipality)) {{$municipality->findOrFail($request->establishment_municipality)['name']}} - {{$municipality->findOrFail($request->establishment_municipality)['department']['name']}} - @else {{$company->municipality->name}} - {{$municipality->findOrFail($company->municipality->id)['department']['name']}} - @endif {{$company->country->name}}
@if(isset($request->establishment_phone)) Teléfono: {{$request->establishment_phone}}
@else Teléfono: {{$company->phone}}
@endif @if(isset($request->establishment_email)) E-mail: {{$request->establishment_email}}
@else E-mail: {{$user->email}}
@endif
{{--Fin del Header--}}
@if($customer->company->country->id == 46) @else @endif
CC o NIT: {{$customer->company->identification_number}}-{{$request->customer['dv'] ?? NULL}}
Cliente: {{$customer->name}}
Régimen: {{$customer->company->type_regime->name}}
Obligación: {{$customer->company->type_liability->name}}
Dirección: {{$customer->company->address}}
Ciudad:{{$customer->company->municipality->name}} - {{$customer->company->country->name}} {{$customer->company->municipality_name}} - {{$customer->company->state_name}} - {{$customer->company->country->name}}
Teléfono: {{$customer->company->phone}}
Email: {{$customer->email}}
@if(isset($request['order_reference']['id_order'])) @endif @if(isset($request['order_reference']['issue_date_order'])) @endif @if(isset($healthfields)) @endif @if(isset($request['number_account'])) @endif @if(isset($request['deliveryterms'])) @inject('currency', 'App\TypeCurrency') @endif
Forma de Pago: {{$paymentForm->name}}
Medio de Pago: {{$paymentForm->nameMethod}}
Plazo Para Pagar: {{$paymentForm->duration_measure}} Dias
Fecha Vencimiento: {{$paymentForm->payment_due_date}}
Número Pedido: {{$request['order_reference']['id_order']}}
Fecha Pedido: {{$request['order_reference']['issue_date_order']}}
Inicio Periodo Facturación: {{$healthfields->invoice_period_start_date}}
Fin Periodo Facturación: {{$healthfields->invoice_period_end_date}}
Número de cuenta: {{$request['number_account'] }}
Terminos de Entrega: {{$request['deliveryterms']['loss_risk_responsibility_code']}} - {{ $request['deliveryterms']['loss_risk'] }}
T.R.M: {{number_format($request['calculationrate'], 2)}}
Fecha T.R.M: {{$request['calculationratedate']}}
Tipo Moneda: {{$currency->findOrFail($request['idcurrency'])['name']}}

@isset($healthfields)
INFORMACION REFERENCIAL SECTOR SALUD
@foreach ($healthfields->user_info as $item) @endforeach
Cod Prestador Info. Contrat. Info. de Pagos
{{$item->provider_code}}

Modalidad Contratacion: {{$item->health_contracting_payment_method()->name}}

Nro Contrato: {{$item->contract_number}}

Cobertura: {{$item->health_coverage()->name}}

Copago: {{number_format($item->co_payment, 2)}}

Cuota Moderardora: {{number_format($item->moderating_fee, 2)}}

Pagos Compartidos: {{number_format($item->shared_payment, 2)}}

Anticipos: {{number_format($item->advance_payment, 2)}}


@endisset @foreach($request['invoice_lines'] as $item) @inject('um', 'App\UnitMeasure') @if($item['description'] == 'Administración' or $item['description'] == 'Imprevisto' or $item['description'] == 'Utilidad') @if(isset($item['allowance_charges'])) @else @endif @else @if(isset($item['tax_totals'])) @if(isset($item['allowance_charges'])) @else @endif @else @if(isset($item['allowance_charges'])) @else @endif @endif @if(isset($item['tax_totals'])) @if(isset($item['tax_totals'][0]['tax_amount'])) @else @endif @else @endif @if(isset($item['allowance_charges'])) @if(isset($item['tax_totals'])) @else @endif @else @endif @endif @endforeach
# Código Descripción Cant. UM Val. Unit IVA/IC Dcto % Val. Item
{{$ItemNro}} {{$item['code']}} {{$item['description']}} {{number_format($item['price_amount'], 2)}} {{number_format($item['tax_totals'][0]['tax_amount'], 2)}}{{number_format($item['allowance_charges'][0]['amount'], 2)}} {{number_format(($item['allowance_charges'][0]['amount'] * 100) / $item['allowance_charges'][0]['base_amount'], 2)}}{{number_format("0", 2)}} {{number_format("0", 2)}}{{number_format($item['invoiced_quantity'] * $item['price_amount'], 2)}}{{$ItemNro}} {{$item['code']}} @if(isset($item['notes'])) {{$item['description']}}

{{$item['notes']}}

@else {{$item['description']}} @endif
{{number_format($item['invoiced_quantity'], 2)}} {{$um->findOrFail($item['unit_measure_id'])['name']}}{{number_format(($item['line_extension_amount'] + $item['allowance_charges'][0]['amount']) / $item['invoiced_quantity'], 2)}}{{number_format($item['line_extension_amount'] / $item['invoiced_quantity'], 2)}}{{number_format(($item['line_extension_amount'] + $item['allowance_charges'][0]['amount']) / $item['invoiced_quantity'], 2)}}{{number_format($item['line_extension_amount'] / $item['invoiced_quantity'], 2)}}{{number_format($item['tax_totals'][0]['tax_amount'] / $item['invoiced_quantity'], 2)}}{{number_format(0, 2)}}E{{number_format($item['allowance_charges'][0]['amount'] / $item['invoiced_quantity'], 2)}} {{number_format(($item['allowance_charges'][0]['amount'] * 100) / $item['allowance_charges'][0]['base_amount'], 2)}}{{number_format(($item['line_extension_amount'] + ($item['tax_totals'][0]['tax_amount'])), 2)}}{{number_format(($item['line_extension_amount']), 2)}}{{number_format("0", 2)}} {{number_format("0", 2)}} {{number_format($item['invoiced_quantity'] * ($item['line_extension_amount'] / $item['invoiced_quantity']), 2)}}
{{--seccion de immpuestos --}}
IVA
@if(isset($request->tax_totals)) @foreach($request->tax_totals as $item) @inject('tax', 'App\Tax')
{{$tax->findOrFail($item['tax_id'])['name']}} {{number_format($item['percent'], 2)}}%: {{number_format($item['tax_amount'], 2)}}
@endforeach @endif
Retenciones
@if(isset($withHoldingTaxTotal)) @foreach($withHoldingTaxTotal as $item) @inject('tax', 'App\Tax')
{{$tax->findOrFail($item['tax_id'])['name']}}: {{number_format($item['tax_amount'], 2)}}
@endforeach @endif
@if(isset($request->legal_monetary_totals['allowance_total_amount'])) @endif @if(isset($request->previous_balance) && $request->previous_balance > 0) @endif @if(isset($request->tarifaica)) @if(isset($request->legal_monetary_totals['allowance_total_amount'])) @if(isset($request->previous_balance)) @else @endif @else @if(isset($request->previous_balance)) @else @endif @endif @else @if(isset($request->previous_balance)) @else @endif @endif @if(isset($request->tarifaica)) @if(isset($request->legal_monetary_totals['allowance_total_amount'])) @if(isset($request->previous_balance)) @else @endif @else @if(isset($request->previous_balance)) @else @endif @endif @else @if(isset($request->previous_balance)) @else @endif @endif
Nro Lineas {{$ItemNro}}
Base {{number_format($request->legal_monetary_totals['line_extension_amount'], 2)}}
Impuestos {{number_format($TotalImpuestos, 2)}}
Retenciones {{number_format($TotalRetenciones, 2)}}
Descuentos {{number_format($request->legal_monetary_totals['allowance_total_amount'], 2)}}
Saldo Anterior {{number_format($request->previous_balance, 2)}}
Total Factura - Descuentos:{{number_format($request->legal_monetary_totals['payable_amount'] + $request->previous_balance - $TotalRetenciones, 2)}}{{number_format($request->legal_monetary_totals['payable_amount'] - $TotalRetenciones, 2)}}{{number_format($request->legal_monetary_totals['payable_amount'] + 0 + $request->previous_balance - $TotalRetenciones, 2)}}{{number_format($request->legal_monetary_totals['payable_amount'] + 0 - $TotalRetenciones, 2)}}{{number_format($request->legal_monetary_totals['payable_amount'] + $request->previous_balance - $TotalRetenciones, 2)}}{{number_format($request->legal_monetary_totals['payable_amount'] - $TotalRetenciones, 2)}}
Total a Pagar{{number_format($request->legal_monetary_totals['payable_amount'] + $request->previous_balance - $TotalRetenciones, 2)}}{{number_format($request->legal_monetary_totals['payable_amount'] - $TotalRetenciones, 2)}}{{number_format($request->legal_monetary_totals['payable_amount'] + 0 + $request->previous_balance - $TotalRetenciones, 2)}}{{number_format($request->legal_monetary_totals['payable_amount'] + 0 - $TotalRetenciones, 2)}}{{number_format($request->legal_monetary_totals['payable_amount'] + $request->previous_balance - $TotalRetenciones, 2)}}{{number_format($request->legal_monetary_totals['payable_amount'] - $TotalRetenciones, 2)}}
@inject('Varios', 'App\Custom\NumberSpellOut')

@php // Inicializamos con payable_amount $totalAmount = $request->legal_monetary_totals['payable_amount']; // Verificamos si existe previous_balance if (isset($request->previous_balance)) { $totalAmount += $request->previous_balance; } // Verificamos si existen retenciones y las restamos if (isset($TotalRetenciones)) { $totalAmount -= $TotalRetenciones; } // Finalmente, redondeamos el total a dos decimales $totalAmount = round($totalAmount, 2); // Definimos la moneda $idcurrency = $request->idcurrency ?? null; @endphp

SON: {{$Varios->convertir($totalAmount, $idcurrency)}} M/CTE*********.

@if(isset($notes))

NOTAS:

{{$notes}}

@endif {{--
@if(isset($request->disable_confirmation_text)) @if(!$request->disable_confirmation_text)

INFORME EL PAGO AL TELEFONO {{$company->phone}} o al e-mail {{$user->email}}
{{--

FIRMA ACEPTACIÓN:


CC:


FECHA:


@endif @endif
@if(isset($firma_facturacion) and !is_null($firma_facturacion))
@endif
--}}