@php $invoice = $document->invoice; $operation_type = $document->invoice->operation_type; $establishment = $document->establishment; $customer = $document->customer; $document_xml_service = new Modules\Document\Services\DocumentXmlService; // Cargos globales que no afectan la base imponible del IGV/IVAP $tot_charges = $document_xml_service->getGlobalChargesNoBase($document); //descuento global - item que no afectan la base imponible $total_discount_no_base = $document_xml_service->getGlobalDiscountsNoBase($document) + $document_xml_service->getItemsDiscountsNoBase($document); @endphp @php echo ''; @endphp 2.1 2.0 {{ $document->series }}-{{ $document->number }} {{ $document->date_of_issue->format('Y-m-d') }} {{ $document->time_of_issue }} @if($invoice->date_of_due) {{ $invoice->date_of_due->format('Y-m-d') }} @endif {{ $document->document_type_id }} @foreach($document->legends as $leg) value }}]]> @endforeach {{ $document->currency_type_id }} @if($document->purchase_order) {{ $document->purchase_order }} @endif @if($document->guides) @foreach($document->guides as $guide) {{ $guide->number }} {{ $guide->document_type_id }} @endforeach @endif @if($document->related) @foreach($document->related as $rel) {{ $rel->number }} {{ $rel->document_type_id }} @endforeach @endif @if($document->prepayments) @foreach($document->prepayments as $prepayment) {{ $prepayment->number }} {{ $prepayment->document_type_id }} {{ $loop->iteration }} {{ $company->number }} @endforeach @endif {{ config('configuration.signature_uri') }} {{ config('configuration.signature_note') }} {{ $company->number }} trade_name }}]]> #{{ config('configuration.signature_uri') }} {{ $company->number }} trade_name }}]]> name !!}]]> {{ $establishment->district_id }} {{ $establishment->code }} @if($establishment->urbanization) {{ $establishment->urbanization }} @endif {{ $establishment->province->description }} {{ $establishment->department->description }} {{ $establishment->district->description }} @if($establishment->address && $establishment->address !== '-') address }}]]> @endif {{ $establishment->country_id }} @if($establishment->email || $establishment->telephone) @if($establishment->telephone) {{ $establishment->telephone }} @endif @if($establishment->email) {{ $establishment->email }} @endif @endif {{ $customer->number }} name !!}]]> @if($customer->address && $customer->address !== '-') @if($customer->district_id) {{ $customer->district_id }} @endif address }}]]> {{ $customer->country_id }} @endif @if($customer->email || $customer->telephone) @if($customer->telephone) {{ $customer->telephone }} @endif @if($customer->email) {{ $customer->email }} @endif @endif @if($document->detraction) @php($detraction = $document->detraction) Detraccion {{ $detraction->payment_method_id }} {{ $detraction->bank_account }} Detraccion {{ $detraction->detraction_type_id }} {{ $detraction->percentage }} {{ property_exists($detraction, 'amount_pen')?$detraction->amount_pen:$detraction->amount}} @endif @if($document->payment_condition_id === '01') FormaPago Contado @else FormaPago Credito {{ $document->fee()->sum('amount') }} @foreach($document->fee as $fee) FormaPago Cuota{{ sprintf("%03d", $loop->iteration) }} {{ $fee->amount }} {{ $fee->date->format('Y-m-d') }} @endforeach @endif @if($document->perception) @php($perception = $document->perception) Percepcion {{ $perception->amount }} @endif @if($document->prepayments) @foreach($document->prepayments as $prepayment) {{ $loop->iteration }} {{ $prepayment->total }} @endforeach @endif @if($document->charges) @foreach($document->charges as $charge) @if(floatval($charge->amount) > 0) true {{ $charge->charge_type_id }} {{ $document->generalApplyNumberFormat($charge->factor, 5) }} {{-- {{ $charge->factor }} --}} {{ $charge->amount }} {{ $charge->base }} @endif @endforeach @endif @if($document->discounts) @foreach($document->discounts as $discount) @if(floatval($discount->amount) > 0) false {{ $discount->discount_type_id }} {{ $document->generalApplyNumberFormat($discount->factor, 5) }} {{ func_number_format_xml($discount->amount) }} {{ func_number_format_xml($discount->base) }} @endif @endforeach @endif @if($document->perception) @php($perception = $document->perception) true {{ $perception->code }} {{ $perception->percentage }} {{ $perception->amount }} {{ $perception->base }} @endif @if($document->retention) @php($retention = $document->retention) false {{ $retention->code }} {{ $retention->percentage }} {{ $retention->amount }} {{ $retention->base }} @endif {{ func_number_format_xml($document->total_taxes) }} @if($document->total_isc > 0) {{ $document->total_base_isc }} {{ $document->total_isc }} 2000 ISC EXC @endif @if($document->total_taxed >= 0 && !$operation_type->exportation) {{ $document->total_taxed }} {{ $document->total_igv }} 1000 IGV VAT {{-- @elseif(collect($document->prepayments)->count() > 0 && collect($document->discounts)->where('discount_type_id', '04')->count() === 1 && $document->total_taxed >= 0)--}} {{-- --}} {{-- {{ $document->total_taxed }}--}} {{-- {{ $document->total_igv }}--}} {{-- --}} {{-- --}} {{-- 1000--}} {{-- IGV--}} {{-- VAT--}} {{-- --}} {{-- --}} {{-- --}} @endif @if($document->total_unaffected_init > 0) {{ func_number_format_xml($document->total_unaffected_init - $document->total_prepayment_unaffected) }} 0 9998 INA FRE {{-- @elseif(collect($document->prepayments)->count() > 0 && collect($document->discounts)->where('discount_type_id', '06')->count() === 1 && $document->total_unaffected_init >= 0)--}} {{-- --}} {{-- {{ $document->total_unaffected }}--}} {{-- 0--}} {{-- --}} {{-- --}} {{-- 9998--}} {{-- INA--}} {{-- FRE--}} {{-- --}} {{-- --}} {{-- --}} @endif @if($document->total_exonerated_init > 0) {{ func_number_format_xml($document->total_exonerated_init - $document->total_prepayment_exonerated ) }} 0.00 9997 EXO VAT {{-- --}} @endif @if($document->total_free > 0) {{ $document->total_free }} {{-- @if($document->total_igv > 0) {{ $document->total_igv }} @else --}} {{-- {{ round($document->total_free * 0.18, 2) }} --}} {{-- @endif --}} {{ $document->total_igv_free }} 9996 GRA FRE @endif @if($document->total_exportation > 0) {{ $document->total_exportation_init }} 0 9995 EXP FRE @endif @if($document->total_other_taxes > 0) {{ $document->total_other_taxes }} {{ $document->total_base_other_taxes }} 9999 OTROS OTH @endif @if($document->total_plastic_bag_taxes > 0) {{ $document->total_plastic_bag_taxes }} 7152 ICBPER OTH @endif {{ func_number_format_xml($document->subtotal + $document->total_discount_no_base + $document->total_prepayment_taxed + $document->total_prepayment_unaffected + $document->total_prepayment_exonerated) }} {{-- no incluye cargos globales que no afectan a la base imponible --}} @if($tot_charges > 0) {{ $document->total - $tot_charges}} @else {{ func_number_format_xml($document->subtotal + $document->total_discount_no_base + $document->total_taxes + $document->total_prepayment) }} @endif {{-- @if($document->total_discount > 0) {{ $document->total_discount }} @endif --}} @if($document->total_discount_no_base > 0) {{ func_number_format_xml($document->total_discount_no_base) }} @endif @if($document->total_charge > 0) {{ $document->total_charge }} @endif @if($document->total_prepayment > 0) {{ func_number_format_xml($document->total_prepayment) }} @endif {{-- @if($total_discount_no_base > 0) {{ $document->total - $total_discount_no_base}} @else {{ $document->total }} @endif --}} {{-- @if($document->total_payable_amount > 0) {{ $document->total_payable_amount }} @endif --}} {{ func_number_format_xml($document->total) }} @foreach($document->items as $row) {{ $loop->iteration }} {{ $row->quantity }} {{ $row->total_value }} @if($row->price_type_id === '01') {{ func_number_format_xml($row->unit_price, 6) }} {{ $row->price_type_id }} @else {{ func_number_format_xml($row->total_value / $row->quantity, 6) }} {{ $row->price_type_id }} @endif @if($document->detraction && $invoice->operation_type_id == '1004') {{$document->detraction->trip_detail}} {{ $document->detraction->origin_location_id[2] }} {{$document->detraction->origin_address}} 01 {{$document->detraction->reference_value_service}} 02 {{$document->detraction->reference_value_effective_load}} 03 {{$document->detraction->reference_value_payload}} {{ $document->detraction->delivery_location_id[2] }} {{$document->detraction->delivery_address}} @endif @if($row->charges) @foreach($row->charges as $charge) @if(floatval($charge->amount) > 0) true {{ $charge->charge_type_id }} {{ $charge->factor }} {{ $charge->amount }} {{ $charge->base }} @endif @endforeach @endif @if($row->discounts) @foreach($row->discounts as $discount) @if(floatval($discount->amount) > 0) false {{ $discount->discount_type_id }} {{ $discount->factor }} {{ $discount->amount }} {{ $discount->base }} @endif @endforeach @endif {{ func_number_format_xml($row->total_taxes) }} @if($row->total_isc > 0) {{ func_number_format_xml($row->total_base_isc) }} {{ func_number_format_xml($row->total_isc) }} {{ $row->percentage_isc }} {{ $row->system_isc_type_id }} 2000 ISC EXC @endif {{ func_number_format_xml($row->total_base_igv) }} {{ func_number_format_xml($row->total_igv) }} {{ $row->percentage_igv }} {{ $row->affectation_igv_type_id }} @php($affectation = \App\CoreFacturalo\Templates\FunctionTribute::getByAffectation($row->affectation_igv_type_id)) {{ $affectation['id'] }} {{ $affectation['name'] }} {{ $affectation['code'] }} @if($row->total_other_taxes > 0) {{ func_number_format_xml($row->total_base_other_taxes) }} {{ func_number_format_xml($row->total_other_taxes) }} {{ $row->percentage_other_taxes }} 9999 OTROS OTH @endif @if($row->total_plastic_bag_taxes > 0) {{ func_number_format_xml($row->total_plastic_bag_taxes) }} {{ round($row->quantity, 0) }} {{$row->item->amount_plastic_bag_taxes}} 7152 ICBPER OTH @endif @foreach(func_get_item_name_xml($row) as $part) {{ $part }} @endforeach {{-- --}} @if($row->item->internal_id) {{ $row->item->internal_id }} @endif @if($row->item->item_code) {{ $row->item->item_code }} @endif @if($row->item->item_code_gs1) {{ $row->item->item_code_gs1 }} @endif {{-- 4000 Beneficio Hospedajes-Paquete turístico: Código de país de emisión del pasaporte--}} {{-- 4001 Beneficio Hospedajes: Código de país de residencia del sujeto no domiciliado--}} {{-- 4002 Beneficio Hospedajes: Fecha de ingreso al país--}} {{-- 4003 Beneficio Hospedajes: Fecha de Ingreso al Establecimiento--}} {{-- 4004 Beneficio Hospedajes: Fecha de Salida del Establecimiento--}} {{-- 4005 Beneficio Hospedajes: Número de Días de Permanencia--}} {{-- 4006 Beneficio Hospedajes: Fecha de Consumo--}} {{-- 4007 Beneficio Hospedajes-Paquete turístico: Nombres y apellidos del huesped--}} {{-- 4008 Beneficio Hospedajes-Paquete turístico: Tipo de documento de identidad del huesped--}} {{-- 4009 Beneficio Hospedajes-Paquete turístico: Número de documento de identidad del huesped--}} {{-- --}} {{-- --}} {{-- 4001--}} {{-- US--}} {{-- --}} {{-- --}} {{-- --}} {{-- 4007--}} {{-- CARLOS ERIQUE GASPAR--}} {{-- --}} {{-- --}} {{-- --}} {{-- 4008--}} {{-- 0--}} {{-- --}} {{-- --}} {{-- --}} {{-- 4009--}} {{-- 02148712--}} {{-- --}} {{-- @if($attr->value)--}} {{-- {{ $attr->value }}--}} {{-- @endif--}} {{-- @if($attr->start_date || $attr->end_date || $attr->duration)--}} {{-- --}} {{-- @if($attr->start_date)--}} {{-- {{ $attr->start_date }}--}} {{-- @endif--}} {{-- @if($attr->end_date)--}} {{-- {{ $attr->end_date }}--}} {{-- @endif--}} {{-- @if($attr->duration)--}} {{-- {{ $attr->duration }}--}} {{-- @endif--}} {{-- --}} {{-- @endif--}} {{-- --}} @if($document->invoice->operation_type_id === '0202') @foreach (func_get_accommodation_attributes($row->accommodation_attributes) as $aa) {{ $aa['code'] }} @if(!in_array($aa['code'], ['4002', '4003', '4004', '4005', '4006'])) {{ $aa['value'] }} @endif @if($aa['code'] === '4005') {{ $aa['value'] }} @endif @if(in_array($aa['code'], ['4002', '4003', '4004', '4006'])) {{ $aa['value'] }} @endif @endforeach @endif @if($row->attributes) @foreach($row->attributes as $attr) description }}]]> {{ $attr->attribute_type_id }} @if(!is_null($attr->value)) {{ $attr->value }} @endif @if($attr->start_date || $attr->end_date || $attr->duration) @if($attr->start_date) {{ $attr->start_date }} @endif @if($attr->end_date) {{ $attr->end_date }} @endif @if($attr->duration) {{ $attr->duration }} @endif @endif @endforeach @endif @if($row->unit_value == '0') {{ func_number_format_xml($row->unit_value, 6) }} @else {{ func_number_format_xml(func_calculate_unit_value_init($document, $row), 6) }} @endif @endforeach