@php $establishment__ = \App\Models\Tenant\Establishment::where('id', $document->establishment_id)->first(); $establishment = $document->establishment; $configuration = \App\Models\Tenant\Configuration::first(); $configurations = \App\Models\Tenant\Configuration::first(); $company_name = $company->name; $company_owner = null; if ($configurations->trade_name_pdf) { $company_name = $company->trade_name; $company_owner = $company->name; } $customer = $document->customer; //$path_style = app_path('CoreFacturalo'.DIRECTORY_SEPARATOR.'Templates'.DIRECTORY_SEPARATOR.'pdf'.DIRECTORY_SEPARATOR.'style.css'); $left = $document->series ? $document->series : $document->prefix; $tittle = $left . '-' . str_pad($document->number, 8, '0', STR_PAD_LEFT); $configuration = \App\Models\Tenant\Configuration::first(); $configurations = \App\Models\Tenant\Configuration::first(); $company_name = $company->name; $company_owner = null; if ($configurations->trade_name_pdf) { $company_name = $company->trade_name; $company_owner = $company->name; } $configuration = \App\Models\Tenant\Configuration::first(); $configurations = \App\Models\Tenant\Configuration::first(); $company_name = $company->name; $company_owner = null; if ($configurations->trade_name_pdf) { $company_name = $company->trade_name; $company_owner = $company->name; } $configuration = \App\Models\Tenant\Configuration::first(); $configurations = \App\Models\Tenant\Configuration::first(); $company_name = $company->name; $company_owner = null; if ($configurations->trade_name_pdf) { $company_name = $company->trade_name; $company_owner = $company->name; } $payments = $document->payments; $company_name = $company->name; $company_owner = null; if ($configurations->trade_name_pdf) { $company_name = $company->trade_name; $company_owner = $company->name; } $company_name = $company->name; $company_owner = null; if ($configurations->trade_name_pdf) { $company_name = $company->trade_name; $company_owner = $company->name; } $accounts = \App\Models\Tenant\BankAccount::where('show_in_documents', true)->get(); $logo = "storage/uploads/logos/{$company->logo}"; if ($establishment->logo) { $logo = "{$establishment->logo}"; } $is_integrate_system = Modules\BusinessTurn\Models\BusinessTurn::isIntegrateSystem(); $quotation = null; if ($is_integrate_system) { $quotation = \App\Models\Tenant\Quotation::select(['number', 'prefix', 'shipping_address']) ->where('id', $document->quotation_id) ->first(); } $configuration = \App\Models\Tenant\Configuration::first(); $configuration = \App\Models\Tenant\Configuration::first(); $configurations = \App\Models\Tenant\Configuration::first(); $company_name = $company->name; $company_owner = null; if ($configurations->trade_name_pdf) { $company_name = $company->trade_name; $company_owner = $company->name; } $company_name = $company->name; $company_owner = null; if ($configurations->trade_name_pdf) { $company_name = $company->trade_name; $company_owner = $company->name; } $configuration_decimal_quantity = App\CoreFacturalo\Helpers\Template\TemplateHelper::getConfigurationDecimalQuantity(); $documment_columns = \App\Models\Tenant\DocumentColumn::where('is_visible', true) ->orderByRaw('CASE WHEN `order` = 0 THEN 0 ELSE 1 END, `order` ASC') ->get(); if ($logo === null && !file_exists(public_path("$logo}"))) { $logo = "{$company->logo}"; } $total_discount_items = 0; @endphp {{-- {{ $tittle }} --}} {{-- --}}
@if ($company->logo)
@else
@endif

{{ $company_name }}

@if ($company_owner) De: {{ $company_owner }} @endif
{{ $establishment->address !== '-' ? $establishment->address : '' }} {{ $establishment->district_id !== '-' ? ', ' . $establishment->district->description : '' }} {{ $establishment->province_id !== '-' ? ', ' . $establishment->province->description : '' }} {{ $establishment->department_id !== '-' ? '- ' . $establishment->department->description : '' }}
@isset($establishment->trade_address)
{{ $establishment->trade_address !== '-' ? 'D. Comercial: ' . $establishment->trade_address : '' }}
@endisset
{{ $establishment->telephone !== '-' ? '' . $establishment->telephone : '' }}
{{ $establishment->email !== '-' ? '' . $establishment->email : '' }}
@isset($establishment->web_address)
{{ $establishment->web_address !== '-' ? '' . $establishment->web_address : '' }}
@endisset @isset($establishment->aditional_information)
{{ $establishment->aditional_information !== '-' ? $establishment->aditional_information : '' }}
@endisset
{{ 'RUC ' . $company->number }}
{{ get_document_name('sale_note', 'Nota de venta') }}
{{ $tittle }}
@if ($document->due_date) @endif @if (isset($customer->location) && $customer->location != '') @endif @if ($customer->address !== '') @endif @if ($document->shipping_address) @endif @if ($quotation && $quotation->shipping_address) @endif @if ($document->plate_number !== null) @endif @if ($is_integrate_system) @if ($document->total_canceled) @else @if (is_integrate_system() && $document->payment_condition_id == '02') @endif @endif @else @if ($document->total_canceled) @else @endif @endif @if ($document->hotelRent) @endif @if ($configuration->show_dispatcher_documents_sale_notes_order_note) @isset($document->order_note) @php $order_note = $document->order_note; $ship_address = $order_note->shipping_address; $observation = $order_note->observation; @endphp @if ($ship_address) @endif @if ($observation) @endif @endisset @endif @if ($document->observation && !is_integrate_system()) @endif @if ($document->reference_data) @endif @if ($document->purchase_order) @endif
Cliente: {{ $customer->name }} Fecha de emisión: {{ $document->date_of_issue->format('Y-m-d') }}
{{ $customer->identity_document_type->description }}: {{ $customer->number }}Fecha Vencimiento: {{ $document->getFormatDueDate() }}
Ubicación: {{ $customer->location }}
Dirección: {{ strtoupper($customer->address) }} {{ $customer->district_id !== '-' ? ', ' . strtoupper($customer->district->description) : '' }} {{ $customer->province_id !== '-' ? ', ' . strtoupper($customer->province->description) : '' }} {{ $customer->department_id !== '-' ? '- ' . strtoupper($customer->department->description) : '' }}
Dir. de envío: {{ $document->shipping_address }}
Dir. de envío: {{ $quotation->shipping_address }}
Teléfono: {{ $customer->telephone }} Vendedor: @if ($document->seller_id != 0) {{ $document->seller->name }} @else {{ $document->user->name }} @endif
N° Placa: {{ $document->plate_number }}
Estado: @if ($document->total_canceled) PAGADO @else PENDIENTE DE PAGO @endif
Condición de pago: @if ($document->payment_condition) {{ $document->payment_condition->name }} @else CONTADO @endif Método de pago: @isset($document->payments) @php $first_payment = $document->payments->first(); @endphp @if ($first_payment) {{ $first_payment->payment_method_type->description }} @endif @endisset
Condición de pago: Crédito
Estado: CANCELADO
Estado: PENDIENTE DE PAGO
Destino: {{ $document->hotelRent->destiny }}
Dirección de envio: {{ $ship_address }}
Observación Pd: {{ $observation }}
Observación: {{ $document->observation }}
D. Referencia: {{ $document->reference_data }}
Orden de compra: {{ $document->purchase_order }}
@if ($document->isPointSystem())
P. ACUMULADOS : {{ $document->person->accumulated_points }} PUNTOS POR LA COMPRA : {{ $document->getPointsBySale() }}
@endif @if ($document->guides)
{{-- Guías: --}} @foreach ($document->guides as $guide) @if (isset($guide->document_type_description)) @else @endif @endforeach
{{ $guide->document_type_description }}{{ $guide->document_type_id }}: {{ $guide->number }}
@endif @if ($document->transport)
Transporte de pasajeros @php $transport = $document->transport; $origin_district_id = (array) $transport->origin_district_id; $destinatation_district_id = (array) $transport->destinatation_district_id; $origin_district = Modules\Order\Services\AddressFullService::getDescription($origin_district_id[2]); $destinatation_district = Modules\Order\Services\AddressFullService::getDescription( $destinatation_district_id[2], ); @endphp
{{ $transport->identity_document_type->description }} : {{ $transport->number_identity_document }} NOMBRE : {{ $transport->passenger_fullname }}
N° ASIENTO : {{ $transport->seat_number }} M. PASAJERO : {{ $transport->passenger_manifest }}
F. INICIO : {{ $transport->start_date }} H. INICIO : {{ $transport->start_time }}
U. ORIGEN : {{ $origin_district }} D. ORIGEN : {{ $transport->origin_address }}
U. DESTINO : {{ $destinatation_district }} D. DESTINO : {{ $transport->destinatation_address }}
@endif @if ($document->transport_dispatch)
Información de encomienda @php $transport_dispatch = $document->transport_dispatch; $sender_identity_document_type = $transport_dispatch->sender_identity_document_type->description; $recipient_identity_document_type = $transport_dispatch->recipient_identity_document_type->description; // $origin_district_id = (array) $transport_dispatch->origin_district_id; // $destinatation_district_id = (array) $transport_dispatch->destinatation_district_id; // $origin_district = Modules\Order\Services\AddressFullService::getDescription($origin_district_id[2]); // $destinatation_district = Modules\Order\Services\AddressFullService::getDescription($destinatation_district_id[2]); @endphp
REMITENTE
{{ $sender_identity_document_type }} : {{ $transport_dispatch->sender_number_identity_document }} NOMBRE : {{ $transport_dispatch->sender_passenger_fullname }}
TELÉFONO : {{ $transport_dispatch->sender_telephone }}
DESTINATARIO
{{ $recipient_identity_document_type }} : {{ $transport_dispatch->recipient_number_identity_document }} NOMBRE : {{ $transport_dispatch->recipient_passenger_fullname }}
TELÉFONO : {{ $transport_dispatch->recipient_telephone }}
@endif @php $width_description = 50; $width_column = 12; if ($configuration_decimal_quantity->change_decimal_quantity_unit_price_pdf) { if ( $configuration_decimal_quantity->decimal_quantity_unit_price_pdf > 6 && $configuration_decimal_quantity->decimal_quantity_unit_price_pdf <= 8 ) { $width_column = 13; } elseif ($configuration_decimal_quantity->decimal_quantity_unit_price_pdf > 8) { $width_column = 15; } else { $width_column = 12; } $width_description = 50 - $width_column; } @endphp
@if (!$configurations->document_columns) @else @foreach ($documment_columns as $column) @endforeach @endif @php $cycle = 24; $count_items = count($document->items); if ($count_items > 7) { $cycle = 0; } else { $cycle = 24 - $count_items; } @endphp @foreach ($document->items as $row) . @php // Mover el cálculo de descuentos fuera del if $total_discount_line = 0; if($row->discounts) { foreach ($row->discounts as $disto) { $amount = $disto->amount; if (isset($disto->is_split)) { $amount = $amount * 1.18; } $total_discount_line = $total_discount_line + $amount; $total_discount_items += $total_discount_line; } } @endphp @if (!$configurations->document_columns) @else @foreach ($documment_columns as $column) @endforeach @endif @php $colspan = 9; if ($configurations->document_columns) { $colspan = count($documment_columns) + 3; } @endphp {{-- --}} @endforeach @for ($i = 0; $i < $cycle; $i++) @if (!$configurations->document_columns) @else @foreach ($documment_columns as $column) @endforeach @endif @endfor
Cant. Unidad DescripciónP.Unit Dto. Total {{ $column->name }}
@if ((int) $row->quantity != $row->quantity) {{ $row->quantity }} @else {{ number_format($row->quantity, 0) }} @endif {{-- {{ $row->item->unit_type_id }} --}} {{ symbol_or_code($row->item->unit_type_id) }} @php $description = $row->name_product_pdf ?? $row->item->description; $description = trim($description); //remove all ' ' text literals $symbols = [' ', '&', '"', '<', '>']; $replacements = [' ', '&', '"', '<', '>']; $description = str_replace($symbols, $replacements, $description); $description = removePTag($description); @endphp {{-- $description --}} {!! $description !!} {{-- @if ($row->name_product_pdf) {!! $row->name_product_pdf !!} @else {!! $row->item->description !!} @endif --}} @if ($configurations->name_pdf) @php $item_name = \App\Models\Tenant\Item::select('name') ->where('id', $row->item_id) ->first(); @endphp @if ($item_name->name)
{{ $item_name->name }}
@endif @endif @if ( $configurations->presentation_pdf && isset($row->item->presentation) && isset($row->item->presentation->description))
{{ $row->item->presentation->description }}
@endif @if ($row->total_isc > 0)
ISC : {{ $row->total_isc }} ({{ $row->percentage_isc }}%) @endif {{-- --}} @if ($row->total_plastic_bag_taxes > 0)
ICBPER : {{ $row->total_plastic_bag_taxes }} @endif @if ($row->attributes) @foreach ($row->attributes as $attr)
{!! $attr->description !!} : {{ $attr->value }} @endforeach @endif @if ($row->discounts) @foreach ($row->discounts as $dtos) @if ($dtos->is_amount == false)
{{ $dtos->factor * 100 }}% {{ $dtos->description }} @endif @endforeach @endif @isset($row->item->sizes_selected) @if (count($row->item->sizes_selected) > 0) @foreach ($row->item->sizes_selected as $size)
Característica {{ $size->size }} | {{ $size->qty }} und.
@endforeach @endif @endisset @if ($row->charges) @foreach ($row->charges as $charge)
{{ $document->currency_type->symbol }} {{ $charge->amount }} ({{ $charge->factor * 100 }}%) {{ $charge->description }} @endforeach @endif @if ($row->item->is_set == 1 && $configurations->show_item_sets)
@inject('itemSet', 'App\Services\ItemSetService') @foreach ($itemSet->getItemsSet($row->item_id) as $item) {{ $item }}
@endforeach @endif @if ($row->item->used_points_for_exchange ?? false)
*** Canjeado por {{ $row->item->used_points_for_exchange }} puntos *** @endif @if ($document->has_prepayment)
*** Pago Anticipado *** @endif
@if ($configuration_decimal_quantity->change_decimal_quantity_unit_price_pdf) {{ $row->generalApplyNumberFormat($row->unit_price, $configuration_decimal_quantity->decimal_quantity_unit_price_pdf) }} @else {{ number_format($row->unit_price, 2) }} @endif @if ($configurations->discounts_acc) @if ($row->discounts_acc) @php $discounts_acc = (array) $row->discounts_acc; @endphp @foreach ($discounts_acc as $key => $disto) {{ $disto->percentage }}% @if ($key + 1 != count($discounts_acc)) + @endif @endforeach @endif @else {{ number_format($total_discount_line, 2) }} @endif @if (isDacta()) {{ number_format($row->total_value + $row->total_igv + $row->total_isc, 2) }} @else {{ number_format($row->total, 2) }} @endif @php $value = $column->getValudDocumentItem($row, $column->value); @endphp @if($column->value == 'image') Imagen @else {{ $value }} @endif

@if ($document->prepayments) @foreach ($document->prepayments as $p) @endforeach @endif @if ($configuration->taxed_igv_visible_nv) @if ($document->total_exportation > 0) @endif @if ($document->total_free > 0) @endif @if ($document->total_unaffected > 0) @endif @if ($document->total_exonerated > 0) @endif @if ($document->document_type_id === '07') @if ($document->total_taxed >= 0) @endif @elseif($document->total_taxed > 0) @endif @if ($document->total_plastic_bag_taxes > 0) @endif @if ($document->total_isc > 0) @endif @if ($document->total_discount > 0 && $document->subtotal > 0) @endif @if ($document->total_discount > 0) @endif @if ($document->total_charge > 0) @if ($document->charges) @php $total_factor = 0; foreach ($document->charges as $charge) { $total_factor = ($total_factor + $charge->factor) * 100; } @endphp @else @endif @endif @endif @if ($document->perception) @elseif($document->retention) @else @endif @if (($document->retention || $document->detraction) && $document->total_pending_payment > 0) @endif
1 NIU Anticipo: {{ $p->document_type_id == '02' ? 'Factura' : 'Boleta' }} Nro. {{ $p->number }} -{{ number_format($p->total, 2) }} 0 -{{ number_format($p->total, 2) }}
Op. Exportación: {{ $document->currency_type->symbol }} {{ number_format($document->total_exportation, 2) }}
Op. Gratuitas: {{ $document->currency_type->symbol }} {{ number_format($document->total_free, 2) }}
Op. Inafectas: {{ $document->currency_type->symbol }} {{ number_format($document->total_unaffected, 2) }}
Op. Exoneradas: {{ $document->currency_type->symbol }} {{ number_format($document->total_exonerated, 2) }}
Op. Gravadas: {{ $document->currency_type->symbol }} {{ number_format($document->total_taxed, 2) }}
Op. Gravadas: {{ $document->currency_type->symbol }} {{ number_format($document->total_taxed, 2) }}
Icbper: {{ $document->currency_type->symbol }} {{ number_format($document->total_plastic_bag_taxes, 2) }}
IGV: {{ $document->currency_type->symbol }} {{ number_format($document->total_igv, 2) }}
ISC: {{ $document->currency_type->symbol }} {{ number_format($document->total_isc, 2) }}
Subtotal: {{ $document->currency_type->symbol }} {{ number_format($document->subtotal, 2) }}
{{ $document->total_prepayment > 0 ? 'Anticipo' : 'Descuento total' }} : {{ $document->currency_type->symbol }} @php $total_discount = $document->total_discount; $discounts = $document->discounts; $igv_prepayment = 1; if ($document->total_prepayment > 0) { $item = $document->items->first(); $has_affected = $item->affectation_igv_type_id < 20; if ($has_affected) { $igv_prepayment = 1.18; } } if ($discounts) { $discounts = get_object_vars($document->discounts); isset($discounts[0]) ? $discounts[0] : null; $is_split = isset($discount->is_split) ? $discount->is_split : false; if ($is_split) { $total_discount = $total_discount * 1.18; } } else { $total_discount = $total_discount_items; } @endphp {{ number_format($total_discount * $igv_prepayment, 2) }}
Cargos ({{ $total_factor }} %): {{ $document->currency_type->symbol }} {{ number_format($document->total_charge, 2) }}
Cargos: {{ $document->currency_type->symbol }} {{ number_format($document->total_charge, 2) }}
Importe total: {{ $document->currency_type->symbol }} {{ number_format($document->total, 2) }}
Percepción: {{ $document->currency_type->symbol }} {{ number_format($document->perception->amount, 2) }}
Total a pagar: {{ $document->currency_type->symbol }} {{ number_format($document->total + $document->perception->amount, 2) }}
Importe total: {{ $document->currency_type->symbol }} {{ number_format($document->total, 2) }}
Total retención ({{ $document->retention->percentage * 100 }} %): {{ $document->currency_type->symbol }} {{ number_format($document->retention->amount, 2) }}
Importe neto: {{ $document->currency_type->symbol }} {{ number_format($document->total - $document->retention->amount, 2) }}
Total a pagar: {{ $document->currency_type->symbol }} @if (isDacta()) {{ number_format($document->total_value + $document->total_igv + $document->total_isc, 2) }} @else {{ number_format($document->total, 2) }} @endif
M. Pendiente: {{ $document->currency_type->symbol }} {{ number_format($document->total_pending_payment, 2) }}
@if (is_integrate_system()) @php $cot = \App\Models\Tenant\Quotation::where('id', $document->quotation_id)->first(); @endphp @if ($cot) @endif @if ($cot) @endif @php $prod = \App\Models\Tenant\ProductionOrder::where('sale_note_id', $document->id)->first(); @endphp @if ($prod) @endif
Cotizacion : {{ $cot->prefix }}- {{ $cot->number }}
Observación com.: {{ $cot->description }}
Observación adm.: {{ $document->additional_information }}
Observación prod.: {{ $prod->observation }}
@endif

@foreach ($accounts as $account)

{{ $account->bank->description }} {{ $account->currency_type->description }} N°: {{ $account->number }} @if ($account->cci) - CCI: {{ $account->cci }} @endif

@endforeach

@if ($document->payment_method_type_id && $payments->count() == 0)
Pago: {{ $document->payment_method_type->description }}
@endif @if ($payments->count()) @php $payment = 0; @endphp @foreach ($payments as $row) @php $payment += (float) $row->payment; @endphp @endforeach
Pagos:
- {{ $row->date_of_payment->format('d/m/Y') }} - {{ $row->payment_method_type->description }} - {{ $row->reference ? $row->reference . ' - ' : '' }} {{ $document->currency_type->symbol }} {{ $row->payment + $row->change }}
Saldo: {{ $document->currency_type->symbol }} {{ number_format($document->total - $payment, 2) }}
@endif @if ($document->fee->count()) @foreach ($document->fee as $key => $quote) @endforeach
@if (!$configuration->show_the_first_cuota_document) • {{ 'Cuota #' . ($key + 1) }} / Fecha: {{ $quote->date }} / Monto: {{ $quote->currency_type->symbol }}{{ $quote->amount }} @else @if ($key == 0) • {{ 'Cuota #' . ($key + 1) }} / Fecha: {{ $quote->date }} / Monto: {{ $quote->currency_type->symbol }}{{ $quote->amount }} @endif @endif
@endif @php $establishment_data = \App\Models\Tenant\Establishment::find($document->establishment_id); @endphp @if ($configuration->yape_qr_sale_notes && $establishment_data->yape_logo) @php $yape_logo = $establishment_data->yape_logo; @endphp @endif @if ($configuration->plin_qr_sale_notes && $establishment_data->plin_logo) @php $plin_logo = $establishment_data->plin_logo; @endphp @endif
Qr yape
@if ($establishment_data->yape_owner) Nombre: {{ $establishment_data->yape_owner }} @endif @if ($establishment_data->yape_number)
Número: {{ $establishment_data->yape_number }} @endif
Qr plin
@if ($establishment_data->plin_owner) Nombre: {{ $establishment_data->plin_owner }} @endif @if ($establishment_data->plin_number)
Número: {{ $establishment_data->plin_number }} @endif
@if ($document->terms_condition)
Términos y condiciones del servicio
{!! $document->terms_condition !!}
@endif