@php $invoice = $document->invoice; $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 {!! '<'.'?xml version="1.0" encoding="utf-8" standalone="no"?'.'>' !!} 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 }} {{ $detraction->amount }} @endif @if($document->payment_condition_id === '01') FormaPago Contado @endif @if($document->payment_condition_id === '02') 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) true {{ $charge->charge_type_id }} {{ $charge->factor }} {{ $charge->amount }} {{ $charge->base }} @endforeach @endif @if($document->discounts) @foreach($document->discounts as $discount) false {{ $discount->discount_type_id }} {{ $discount->factor }} {{ $discount->amount }} {{ $discount->base }} @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 {{ $document->total_taxes }} @if($document->total_isc > 0) {{ $document->total_base_isc }} {{ $document->total_isc }} 2000 ISC EXC @endif @if($document->total_taxed > 0) {{ $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 > 0) {{ $document->total_unaffected }} 0 9998 INA FRE @elseif(collect($document->prepayments)->count() > 0 && collect($document->discounts)->where('discount_type_id', '06')->count() === 1 && $document->total_unaffected >= 0) {{ $document->total_unaffected }} 0 9998 INA FRE @endif @if($document->total_exonerated > 0) {{ $document->total_exonerated }} 0 9997 EXO VAT @elseif(collect($document->prepayments)->count() > 0 && collect($document->discounts)->where('discount_type_id', '05')->count() === 1 && $document->total_exonerated >= 0) {{ $document->total_exonerated }} 0 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 }} 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 {{ $document->total_value }} {{-- no incluye cargos globales que no afectan a la base imponible --}} @if($tot_charges > 0) {{ $document->total - $tot_charges}} @else {{ $document->subtotal }} @endif {{-- @if($document->total_discount > 0) {{ $document->total_discount }} @endif --}} @if($total_discount_no_base > 0) {{ $total_discount_no_base }} @endif @if($document->total_charge > 0) {{ $document->total_charge }} @endif @if($document->total_prepayment > 0) {{ $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 --}} {{ $document->total }} @foreach($document->items as $row) {{ $loop->iteration }} {{ $row->quantity }} {{ $row->total_value }} {{ $row->unit_price }} {{ $row->price_type_id }} @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) true {{ $charge->charge_type_id }} {{ $charge->factor }} {{ $charge->amount }} {{ $charge->base }} @endforeach @endif @if($row->discounts) @foreach($row->discounts as $discount) false {{ $discount->discount_type_id }} {{ $discount->factor }} {{ $discount->amount }} {{ $discount->base }} @endforeach @endif {{ $row->total_taxes }} @if($row->total_isc > 0) {{ $row->total_base_isc }} {{ $row->total_isc }} {{ $row->percentage_isc }} {{ $row->system_isc_type_id }} 2000 ISC EXC @endif {{ $row->total_base_igv }} {{ $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) {{ $row->total_base_other_taxes }} {{ $row->total_other_taxes }} {{ $row->percentage_other_taxes }} 9999 OTROS OTH @endif @if($row->total_plastic_bag_taxes > 0) {{$row->total_plastic_bag_taxes}} {{ round($row->quantity,0) }} {{$row->item->amount_plastic_bag_taxes}} 7152 ICBPER OTH @endif @if($row->name_product_xml) name_product_xml }}]]> @else item->description }}]]> @endif @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 @if($row->attributes) @foreach($row->attributes as $attr) description }}]]> {{ $attr->attribute_type_id }} @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 @endforeach @endif {{ $row->unit_value }} @endforeach