@php use App\CoreFacturalo\Helpers\Template\TemplateHelper; $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; } $establishment__ = \App\Models\Tenant\Establishment::find($document->establishment_id); $logo = $establishment__->logo ?? $company->logo; if ($logo === null && !file_exists(public_path("$logo}"))) { $logo = "{$company->logo}"; } if ($logo) { $logo = "storage/uploads/logos/{$logo}"; $logo = str_replace('storage/uploads/logos/storage/uploads/logos/', 'storage/uploads/logos/', $logo); } $customer = $document->customer; $invoice = $document->invoice; $document_base = $document->note ? $document->note : null; //$path_style = app_path('CoreFacturalo'.DIRECTORY_SEPARATOR.'Templates'.DIRECTORY_SEPARATOR.'pdf'.DIRECTORY_SEPARATOR.'style.css'); $document_number = $document->series . '-' . str_pad($document->number, 8, '0', STR_PAD_LEFT); $accounts = \App\Models\Tenant\BankAccount::all(); if ($document_base) { $affected_document_number = $document_base->affected_document ? $document_base->affected_document->series . '-' . str_pad($document_base->affected_document->number, 8, '0', STR_PAD_LEFT) : $document_base->data_affected_document->series . '-' . str_pad($document_base->data_affected_document->number, 8, '0', STR_PAD_LEFT); } else { $affected_document_number = null; } $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; } $document->load('reference_guides'); $total_payment = $document->payments->sum('payment'); $balance = $document->total - $total_payment - $document->payments->sum('change'); //calculate items // $allowed_items = 35 - \App\Models\Tenant\BankAccount::all()->count() * 3; $quantity_items = $document->items()->count(); // $cycle_items = $allowed_items - $quantity_items * 3; $cycle_items = 36; $total_weight = 0; // Condicion de pago $condition = TemplateHelper::getDocumentPaymentCondition($document); // Pago/Coutas detalladas $paymentDetailed = TemplateHelper::getDetailedPayment($document); $establishment__ = \App\Models\Tenant\Establishment::find($document->establishment_id); $logo = $establishment__->logo ?? $company->logo; if ($logo === null && !file_exists(public_path("$logo}"))) { $logo = "{$company->logo}"; } if ($logo) { $logo = "storage/uploads/logos/{$logo}"; $logo = str_replace('storage/uploads/logos/storage/uploads/logos/', 'storage/uploads/logos/', $logo); } @endphp {{-- {{ $document_number }} --}} {{-- --}} @if ($document->state_type->id == '11' || $document->state_type->id == '09')
anulado
@endif @if ($document->soap_type_id == '01')
anulado
@endif {{-- @if ($company->logo) @else @endif

{{ $company_name }}

@if ($company_owner) De: {{ $company_owner }} @endif
{{ 'RUC ' . $company->number }}
{{ $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 !== '-' ? 'Central telefónica: ' . $establishment->telephone : '' }}
{{ $establishment->email !== '-' ? : ' . $establishment->email : '' }}
@isset($establishment->web_address)
{{ $establishment->web_address !== '-' ? 'Web: ' . $establishment->web_address : '' }}
@endisset @isset($establishment->aditional_information)
{{ $establishment->aditional_information !== '-' ? $establishment->aditional_information : '' }}
@endisset

{{ 'R.U.C. ' . $company->number }}

{{ $document->document_type->description }}


{{ $document_number }}

--}}

{{ $company->name }}

{{ $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 @isset($establishment->aditional_information)
{{ $establishment->aditional_information !== '-' ? $establishment->aditional_information : '' }}
@endisset @isset($establishment->web_address)
{{ $establishment->web_address !== '-' ? ' ' . $establishment->web_address : '' }}
@endisset
{{ $establishment->telephone !== '-' ? 'CEL. ' . $establishment->telephone : '' }}

RUC: {{ $company->number }}

{{ $document->document_type->description }}

{{ $document_number }}

{{--
@if (!is_null($document_base)) @endif
Razón Social : {{ $customer->name }}
{{ $customer->identity_document_type->description }} : {{ $customer->number }}
Dirección : @if ($customer->address !== '') {{ $customer->address }} {{ $customer->district_id !== '-' ? ', ' . $customer->district->description : '' }} {{ $customer->province_id !== '-' ? ', ' . $customer->province->description : '' }} {{ $customer->department_id !== '-' ? '- ' . $customer->department->description : '' }} @endif
Doc. Afectado : {{ $affected_document_number }}
Tipo de nota : {{ $document_base->note_type === 'credit' ? $document_base->note_credit_type->description : $document_base->note_debit_type->description }}
Descripción : {{ $document_base->note_description }}
@if ($invoice) @endif @if ($document->purchase_order) @endif @if ($document->payments()->count() > 0) @endif @if ($document->guides) @endif
Fecha Emisión : {{ $document->date_of_issue->format('Y-m-d') }} H. Emisión : {{ $document->time_of_issue }}
Fecha de Vcto : {{ $invoice->date_of_due->format('Y-m-d') }} Moneda : {{ $document->currency_type->description }}
Orden de compra : {{ $document->purchase_order }} F. Pago : {{ $document->payments()->first()->payment_method_type->description }} - {{ $document->currency_type_id }} {{ $document->payments()->first()->payment }}
Condición de pago : {{ $condition }} Guía de Remisión : @foreach ($document->guides as $item) {{ $item->document_type_description }}: {{ $item->number }}
@endforeach
--}}
Señores: {{ $customer->name }} RUC: {{ $customer->number }}
Dirección {{ $customer->address }} {{ $customer->district_id !== '-' ? ', ' . $customer->district->description : '' }} {{ $customer->province_id !== '-' ? ', ' . $customer->province->description : '' }} {{ $customer->department_id !== '-' ? '- ' . $customer->department->description : '' }}
Guia de remisión: @isset($document->guides) @foreach ($document->guides as $guide) {{ $guide->number }} @endforeach @endisset O/Compra: {{ $document->purchase_order }}
@php $paymentCondition = \App\CoreFacturalo\Helpers\Template\TemplateHelper::getDocumentPaymentCondition($document); @endphp )
Fecha de emisión: {{ $document->date_of_issue->format('Y-m-d') }} {{ $document->time_of_issue }}
Tipo Moneda: {{ $document->currency_type->description }}
Forma de pago: {{ $paymentCondition }}
@php $all_items = $document->items->count(); $rest_items_count = 38 - $all_items; @endphp @foreach ($document->items as $idx => $row) @endforeach @for ($idx = 0; $idx < $rest_items_count; $idx++) @endfor {{-- --}}
Item CODIGO DESCRIPTION UM CANT. P.UNIT IMPORTE
{{ $idx + 1 }} {{ $row->item->internal_id }} @php if ($row->name_product_pdf) { $description = strtoupper($row->name_product_pdf); } else { $description = strtoupper($row->item->description); } @endphp {!! $description !!} @isset($row->item->lots) @foreach ($row->item->lots as $lot) @if (isset($lot->has_sale) && $lot->has_sale) {{ $lot->series }} @if (!$loop->last) - @endif @endif @endforeach @endisset @if ($row->attributes) @foreach ($row->attributes as $attr) @if ($attr->attribute_type_id === '5032') @php $total_weight += $attr->value * $row->quantity; @endphp @endif
{!! $attr->description !!} : {{ $attr->value }} @endforeach @endif @if ($row->item->is_set == 1)
@inject('itemSet', 'App\Services\ItemSetService') {{ join('-', $itemSet->getItemsSet($row->item_id)) }} @endif
{{ symbol_or_code($row->item->unit_type_id) }} @if ((int) $row->quantity != $row->quantity) {{ $row->quantity }} @else {{ number_format($row->quantity, 0) }} @endif {{ number_format($row->unit_price, 2) }} {{ number_format($row->total, 2) }}

Vendedor: @if ($document->seller) {{ $document->seller->name }} @else {{ $document->user->name }} @endif SON: @foreach (array_reverse((array) $document->legends) as $row) @if ($row->code == '1000') {{ $row->value }} {{ $document->currency_type->description }} @else {{ $row->code }}: {{ $row->value }} @endif @endforeach OP. GRAVADA {{ $document->currency_type->symbol }} {{ number_format($document->total_taxed, 2) }}
@php $total_packages = $document->items()->sum('quantity'); @endphp @if (!empty($paymentDetailed)) @foreach ($paymentDetailed as $detailed) {{ isset($paymentDetailed['PAGOS']) ? 'Pagos:' : 'Cuotas:' }}
@foreach ($detailed as $row) {{ $row['description'] }} - {{ $row['reference'] }} {{ $row['symbol'] }} {{ $row['amount'] }}
@endforeach @endforeach
@endif Total bultos: @if ((int) $total_packages != $total_packages) {{ $total_packages }} @else {{ number_format($total_packages, 0) }} @endif
Total Peso: {{ $total_weight }} KG
Observación: @foreach ($document->additional_information as $information) @if ($information) {{ $information }}
@endif @endforeach

Código Hash: {{ $document->hash }}
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. GRATUITAS {{ $document->currency_type->symbol }} {{ number_format($document->total_free, 2) }}
TOTAL DCTOS. {{ $document->currency_type->symbol }} {{ number_format($document->total_discount, 2) }}
I.G.V. {{ $document->currency_type->symbol }} {{ number_format($document->total_igv, 2) }}
TOTAL A PAGAR. {{ $document->currency_type->symbol }} {{ number_format($document->total, 2) }}
@foreach ($document->additional_information as $information) @if ($information) @if ($loop->first) Observación: @endif @if (\App\CoreFacturalo\Helpers\Template\TemplateHelper::canShowNewLineOnObservation()) {!! \App\CoreFacturalo\Helpers\Template\TemplateHelper::SetHtmlTag($information) !!} @else {{ $information }} @endif @endif @endforeach
@php $value = \App\CoreFacturalo\Helpers\Number\NumberLetter::convertToLetter($document->total); @endphp SON:{{ $value }}

{{ $document->hash }}


@foreach ($accounts as $account) @endforeach
{{ $company->name }}
{{ $account->bank->description }} - {{ $account->currency_type->description }}
N°: {{ $account->number }} @if ($account->cci) CCI: {{ $account->cci }} @endif

TOTAL OP. GRAV. {{ $document->currency_type->symbol }} {{ $document->total_value }}
ICBPER {{ $document->currency_type->symbol }} {{ $document->total_plastic_bag_taxes }}
TOTAL IGV 18% {{ $document->currency_type->symbol }} {{ $document->total_taxes }}
TOTAL A PAGAR {{ $document->currency_type->symbol }} {{ number_format($document->total, 2) }}
{{-- @if ($document != null) @foreach ($accounts as $account) @endforeach
Banco Moneda Código de Cuenta Interbancaria Código de Cuenta
{{ $account->bank->description }} {{ $account->currency_type->description }} @if ($account->cci) {{ $account->cci }} @endif {{ $account->number }}
@endif --}} @if ($document->terms_condition)
Términos y condiciones del servicio
{!! $document->terms_condition !!}
@endif @if ($document->detraction) @endif
Leyenda: Operación sujeta al Sistema de Pago de Obligaciones Tributarias con el Gobierno Central
@if ($document->detraction) @inject('detractionType', 'App\Services\DetractionTypeService') @endif @if ($document->detraction) @endif @if ($document->detraction) @endif @if ($document->detraction) @endif @if ($document->detraction) @endif @if ($document->detraction) @endif @if ($document->detraction && $invoice->operation_type_id == '1004') @endif
Bien o Servicio Sujeto a detracción :{{ $document->detraction->detraction_type_id }} - {{ $detractionType->getDetractionTypeDescription($document->detraction->detraction_type_id) }} Nro. Cta detracciones : {{ $document->detraction->bank_account }}
Porcentaje Detracción : {{ $document->detraction->percentage }}%Monto detracción : S/ {{ $document->detraction->amount }}
Medio de pago : {{ $detractionType->getPaymentMethodTypeDescription($document->detraction->payment_method_id) }}
Detalle - Servicios de transporte de carga
Ubigeo origen : {{ $document->detraction->origin_location_id[2] }} Dirección origen : {{ $document->detraction->origin_address }}
Ubigeo destino : {{ $document->detraction->delivery_location_id[2] }} Dirección destino : {{ $document->detraction->delivery_address }}
Valor referencial servicio de transporte : {{ $document->detraction->reference_value_service }} Valor referencia carga efectiva : {{ $document->detraction->reference_value_effective_load }}
Valor referencial carga útil : {{ $document->detraction->reference_value_payload }} Detalle del viaje : {{ $document->detraction->trip_detail }}