@php $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; //$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); // $document_type_driver = App\Models\Tenant\Catalogs\IdentityDocumentType::findOrFail($document->driver->identity_document_type_id); // $document_type_dispatcher = App\Models\Tenant\Catalogs\IdentityDocumentType::findOrFail($document->dispatcher->identity_document_type_id); $allowed_items = 60; $quantity_items = $document->items()->count(); $cycle_items = $allowed_items - $quantity_items * 5; $total_weight = 0; @endphp {{-- {{ $document_number }} --}} {{-- --}} @if ($document->state_type->id == '11' || $document->state_type->id == '09' || $document->state_type->id == '55' || $document->state_type->id == '01' || $document->state_type->id == '03')
anulado
@endif @if ($document->soap_type_id == '01')
anulado
@endif @if ($company->logo) @else @endif
logo}")) }};base64, {{ base64_encode(file_get_contents(public_path("storage/uploads/logos/{$company->logo}"))) }}" alt="{{ $company->name }}" alt="{{ $company->name }}" class="company_logo" style="max-width: 300px"> {{-- --}}

{{ $company->name }}

{{ $establishment->address !== '-' ? $establishment->address : '' }} {{ $establishment->district_id !== '-' ? ', ' . $establishment->district->description : '' }} {{ $establishment->province_id !== '-' ? ', ' . $establishment->province->description : '' }} {{ $establishment->department_id !== '-' ? '- ' . $establishment->department->description : '' }}
{{ $establishment->email !== '-' ? $establishment->email : '' }}
{{ $establishment->telephone !== '-' ? $establishment->telephone : '' }}

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

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


{{ $document_number }}

@if ($document->reference_document) @else @endif @if ($document->reference_document) @if ($document->reference_document->purchase_order) @else @endif @else @endif
DESTINATARIO
Razón Social: {{ $customer->name }}COMPROBANTE: {{ $document->reference_document->document_type->description }} {{ $document->reference_document->number_full }}
RUC: {{ $customer->number }}O. COMPRA: {{ $document->reference_document->purchase_order }}
Dirección: {{ $customer->address }} {{ $customer->district_id !== '-' ? ', ' . $customer->district->description : '' }} {{ $customer->province_id !== '-' ? ', ' . $customer->province->description : '' }} {{ $customer->department_id !== '-' ? '- ' . $customer->department->description : '' }}
{{-- --}}
ENVIO
Fecha Emisión: {{ $document->date_of_issue->format('d/m/Y') }}

PUNTO DE PARTIDA

Fecha de Traslado: {{ $document->date_of_shipping->format('d/m/Y') }}
Motivo Traslado: {{ $document->transfer_reason_type->description }}

PUNTO DE LLEGADA

Modalidad de Transporte: {{ $document->transport_mode_type->description }}
Peso Bruto Total({{ $document->unit_type_id }}): {{ $document->total_weight }} Número de Bultos: {{ $document->packages_number }}
P.Partida: {{ $document->origin->location_id }} - {{ $document->origin->address }} P.Llegada: {{ $document->delivery->location_id }} - {{ $document->delivery->address }}
@if ($document->transport_mode_type_id === '02') {{-- @if ($document->secondary_license_plates) @if ($document->secondary_license_plates->semitrailer) @endif @endif @if ($document->driver->license) @endif --}} @else @endif
Unidad DE TRANSPORTE - CONDUCTOR
Conductor: @if ($document->driver->name) {{ $document->driver->name }} @endif
N° Doc: @if ($document->driver->number) {{ $document->driver->number }} @endif
Placa N°: @if ($document->transport_data) {{ $document->transport_data['plate_number'] }} @endif
N° Licencia: @if ($document->driver->license) {{ $document->driver->license }} @endif
Número de placa semirremolque: {{ $document->secondary_license_plates->semitrailer }}Licencia del conductor: {{ $document->driver->license }}
N° Doc: {{ $document->driver->identity_document_type_id }}: {{ $document->driver->number }}
Placa N°: {{ $document->license_plate }}
N° Licencia: {{ $document->driver->license }}
@if ($document->transport_mode_type_id === '01') @php $document_type_dispatcher = App\Models\Tenant\Catalogs\IdentityDocumentType::findOrFail( $document->dispatcher->identity_document_type_id, ); @endphp @else @endif
EMPRESA DE TRANSPORTE
Nombre y/o razón social: {{ $document->dispatcher->name }}
{{ $document_type_dispatcher->description }}: {{ $document->dispatcher->number }}
 
Transportista:  
 
 
 
@foreach ($document->items as $row) @php $total_weight_line = 0; @endphp @endforeach @for ($i = 0; $i < $cycle_items; $i++) @endfor
# CODIGO DETALLE UND LOTE F. VENC. CANT. PESO
{{ $loop->iteration }} {{ $row->item->internal_id }} {!! $row->item->description !!} @if ($row->relation_item->attributes) @foreach ($row->relation_item->attributes as $attr) @if ($attr->attribute_type_id === '5032') @php $total_weight += $attr->value * $row->quantity; $total_weight_line += $attr->value * $row->quantity; @endphp @endif
{!! $attr->description !!} : {{ $attr->value }} @endforeach @endif
{{ symbol_or_code($row->item->unit_type_id) }} @inject('itemLotGroup', 'App\Services\ItemLotsGroupService') @if ($row->item->IdLoteSelected) @php $lote = $itemLotGroup->getLote($row->item->IdLoteSelected,"@"); $fechaVencimiento = $itemLotGroup->getLotDateOfDue($row->item->IdLoteSelected); $loteParts = explode('/', $lote); // $fechaParts = explode('/', $fechaVencimiento); @endphp @foreach ($loteParts as $part)
{{ $part }}
@endforeach @endif
@inject('itemLotGroup', 'App\Services\ItemLotsGroupService') @if ($row->item->IdLoteSelected) @php $lote = $itemLotGroup->getLote($row->item->IdLoteSelected,"@"); $fechaVencimiento = $itemLotGroup->getLotDateOfDue($row->item->IdLoteSelected); // $loteParts = explode('/', $lote); $fechaParts = explode('/', $fechaVencimiento); @endphp @foreach ($fechaParts as $part)
{{ $part }}
@endforeach @endif
@if ((int) $row->quantity != $row->quantity) {{ $row->quantity }} @else {{ number_format($row->quantity, 0) }} @endif {{ $row->item->weight }}
@php $total_packages = $document->items()->sum('quantity'); @endphp
TOTAL NÚMERO DE BULTOS: @if ((int) $total_packages != $total_packages) {{ $total_packages }} @else {{ number_format($total_packages, 0) }} @endif
PESO TOTAL: {{ $document->unit_type_id }}: {{ $document->total_weight }}
Observaciones:
{{ $document->observations }}
@if ($document->qr)
@endif @if ($document->terms_condition)
Términos y condiciones del servicio
{!! $document->terms_condition !!}
@endif