@php $establishment = $document->establishment; $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); @endphp {{--{{ $document_number }}--}} {{----}} @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 }}

{{ '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 : '' }}
{{ ($establishment->email !== '-')? $establishment->email : '' }}
{{ ($establishment->telephone !== '-')? $establishment->telephone : '' }}

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

{{ $document_number }}

@if($document->transfer_reason_type_id === '09') @else @endif @if ($customer->telephone) @endif
DESTINATARIO
Razón Social: {{ $customer->name }}
{{ $customer->identity_document_type->description }}: {{ $customer->number }}
Dirección: {{ $customer->address }} - {{ $customer->country->description }} Dirección: {{ $customer->address }} {{ ($customer->district_id !== '-')? ', '.$customer->district->description : '' }} {{ ($customer->province_id !== '-')? ', '.$customer->province->description : '' }} {{ ($customer->department_id !== '-')? '- '.$customer->department->description : '' }}
Teléfono:{{ $customer->telephone }}
Vendedor: {{ $document->user->name }}
@if($document->transfer_reason_description) @endif @if($document->related) @endif @if($document->packages_number) @endif @if($document->order_form_external) @endif @if($document->date_delivery_to_transport) @endif
ENVIO
Fecha Emisión: {{ $document->date_of_issue->format('Y-m-d') }} Fecha Inicio de Traslado: {{ $document->date_of_shipping->format('Y-m-d') }}
Motivo Traslado: {{ $document->transfer_reason_type->description }} Modalidad de Transporte: {{ $document->transport_mode_type->description }}
Descripción de motivo de traslado: {{ $document->transfer_reason_description }}
Número de documento (DAM): {{ $document->related->number }} Tipo documento relacionado: {{ $document->getRelatedDocumentTypeDescription() }}
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 }} {{ ($establishment->address !== '-')? $establishment->address : '' }} {{ ($establishment->district_id !== '-')? ', '.$establishment->district->description : '' }} {{ ($establishment->province_id !== '-')? ', '.$establishment->province->description : '' }} {{ ($establishment->department_id !== '-')? '- '.$establishment->department->description : '' }}
P.Llegada: {{ $document->delivery->location_id }} - {{ $document->delivery->address }} @php use Illuminate\Support\Facades\DB; $delivery = DB::connection('tenant')->table('districts') ->join('provinces', 'districts.province_id', '=', 'provinces.id') ->join('departments', 'provinces.department_id', '=', 'departments.id') ->where('districts.id', '=', $document->delivery->location_id) ->select('districts.description as district_description', 'provinces.description as province_description','departments.description as department_description') ->first(); @endphp {{ ($delivery->district_description !== '-')? ', '.$delivery->district_description : '' }} {{ ($delivery->province_description !== '-')? ', '.$delivery->province_description : '' }} {{ ($delivery->department_description !== '-')? '- '.$delivery->department_description : '' }}
Orden de pedido: {{ $document->order_form_external }}Fecha de entrega de bienes al Transportista: {{$document->date_delivery_to_transport->format('Y-m-d')}}
@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 @if($document->transport_data) @endif @if($document->transport_data['tuc']) @endif @if($document->driver->number) @endif @if($document->secondary_license_plates) @if($document->secondary_license_plates->semitrailer) @endif @endif @if($document->driver->license) @endif @endif
TRANSPORTE
Nombre y/o razón social: {{ $document->dispatcher->name }} {{ $document_type_dispatcher->description }}: {{ $document->dispatcher->number }}
Número de placa del vehículo Principal: {{ $document->transport_data['plate_number'] }}Certificado de habilitación vehicular: {{ $document->transport_data['tuc'] }}
Conductor Principal: {{$document->driver->name}}
Número de placa semirremolque: {{ $document->secondary_license_plates->semitrailer }}Licencia del conductor: {{ $document->driver->license }}
@if($document->secondary_transports) @foreach($document->secondary_transports as $row) @if($row["plate_number"]) @endif @if($row['tuc']) @endif @endforeach
Vehículos Secundarios
Número de placa del vehículo: {{ $row["plate_number"] }}Certificado de habilitación vehicular: {{ $row['tuc'] }}
@endif @if($document->secondary_drivers) @foreach($document->secondary_drivers as $row) @if($row['name']) @endif @if($row['number']) @endif @if($row['license']) @endif @endforeach
Conductores Secundarios
Conductor: {{$row['name']}}Documento: {{ $row['number'] }}Licencia: {{ $row['license'] }}
@endif @if($configuration["enabled_price_items_dispatch"]) @else @endif @foreach($document->items as $row) @if($configuration["enabled_price_items_dispatch"]) {{-- --}} @else {{-- --}} {{-- --}} @endif @endforeach
Item Código Descripción Serie Modelo Unidad Cantidad Precio Total
Item Código Descripción Serie Modelo Unidad Cantidad
{{ $loop->iteration }} {{ $row->item->internal_id }} @if($row->name_product_pdf) {!!$row->name_product_pdf!!} @else {!!$row->item->description!!} @endif @if (!empty($row->item->presentation)) {!!$row->item->presentation->description!!} @endif @if($row->attributes) @foreach($row->attributes as $attr)
{!! $attr->description !!} : {{ $attr->value }} @endforeach @endif @if($row->discounts) @foreach($row->discounts as $dtos)
{{ $dtos->factor * 100 }}% {{$dtos->description }} @endforeach @endif @if($row->relation_item->is_set == 1)
@inject('itemSet', 'App\Services\ItemSetService') @foreach ($itemSet->getItemsSet($row->item_id) as $item) {{$item}}
@endforeach @endif @if($document->has_prepayment)
*** Pago Anticipado *** @endif
@php $current_item = $items ? $items->where('item_id', $row->item_id)->first() : null; @endphp @if($current_item && count($current_item->item->lots) > 0) @foreach($current_item->item->lots as $lot) {{$lot->series}} @if(!$loop->first && $loop->last) - @endif @endforeach @endif {{ $row->item->model ?? '' }} {{ $row->item->unit_type_id }} @if(((int)$row->quantity != $row->quantity)) {{ $row->quantity }} @else {{ number_format($row->quantity, 0) }} @endif {{ number_format($row->item->unit_price, 2) }} {{ number_format($row->item->total, 2) }}
{{ $loop->iteration }} {{ $row->item->internal_id }} @if($row->name_product_pdf) {!!$row->name_product_pdf!!} @else {!!$row->item->description!!} @endif @if (!empty($row->item->presentation)) {!!$row->item->presentation->description!!} @endif @if($row->attributes) @foreach($row->attributes as $attr)
{!! $attr->description !!} : {{ $attr->value }} @endforeach @endif @if($row->discounts) @foreach($row->discounts as $dtos)
{{ $dtos->factor * 100 }}% {{$dtos->description }} @endforeach @endif @if($row->relation_item->is_set == 1)
@inject('itemSet', 'App\Services\ItemSetService') @foreach ($itemSet->getItemsSet($row->item_id) as $item) {{$item}}
@endforeach @endif @if($document->has_prepayment)
*** Pago Anticipado *** @endif
@php $current_item = $items ? $items->where('item_id', $row->item_id)->first() : null; @endphp @if($current_item && count($current_item->item->lots) > 0) @foreach($current_item->item->lots as $lot) {{$lot->series}} @if(!$loop->first && $loop->last) - @endif @endforeach @endif {{ $row->item->model ?? '' }} @php $current_item = $items ? $items->where('item_id', $row->item_id)->first() : null; @endphp @if($current_item && count($current_item->item->lots) > 0) @foreach($current_item->item->lots as $lot) {{$lot->series}} @if(!$loop->first && $loop->last) - @endif @endforeach @endif {{ $row->item->model ?? '' }} {{ $row->item->unit_type_id }} @if(((int)$row->quantity != $row->quantity)) {{ $row->quantity }} @else {{ number_format($row->quantity, 0) }} @endif
{{-- @php $invoice = $document->reference_document()->where('id', $document->reference_document_id)->first(); $items = $invoice ? $invoice->items : null; @endphp --}} @if($document->observations)
OBSERVACIONES
{{ $document->observations }}
@endif @if ($document->reference_document) @if($document->reference_document) @endif
{{$document->reference_document->document_type->description}}
{{ ($document->reference_document) ? $document->reference_document->number_full : "" }}
@endif @if ($document->data_affected_document) @php $document_data_affected_document = $document->data_affected_document; $number = (property_exists($document_data_affected_document,'number'))?$document_data_affected_document->number:null; $series = (property_exists($document_data_affected_document,'series'))?$document_data_affected_document->series:null; $document_type_id = (property_exists($document_data_affected_document,'document_type_id'))?$document_data_affected_document->document_type_id:null; @endphp @if($number !== null && $series !== null && $document_type_id !== null) @php $documentType = App\Models\Tenant\Catalogs\DocumentType::find($document_type_id); $textDocumentType = $documentType->getDescription(); @endphp
{{$textDocumentType}}
{{$series }}-{{$number}}
@endif @endif @if ($document->reference_order_form_id) @if($document->order_form) @endif
ORDEN DE PEDIDO
{{ ($document->order_form) ? $document->order_form->number_full : "" }}
@elseif ($document->order_form_external)
ORDEN DE PEDIDO
{{ $document->order_form_external }}
@endif @if ($document->reference_sale_note_id) @if($document->sale_note) @endif
NOTA DE VENTA
{{ ($document->sale_note) ? $document->sale_note->number_full : "" }}
@endif @if($document->qr)
@endif @if ($document->terms_condition)
Términos y condiciones del servicio
{!! $document->terms_condition !!}
@endif