@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);
$logo = "storage/uploads/logos/{$company->logo}";
if($establishment->logo) {
$logo = "{$establishment->logo}";
}
$transport_principal_plate_number = null;
$transport_principal_tuce_number = null;
$transport_principal_authorization_entity_id = null;
$transport_principal_authorization_entity_number = null;
$transport_secondaries = [];
if ($document->transport_mode_type_id === '02') {
$transport_principal = $document->transports->first();
if($transport_principal) {
$transport_principal_plate_number = $transport_principal->transport_data['plate_number'];
$transport_principal_tuce_number = $transport_principal->transport_data['tuce_number'];
$transport_principal_authorization_entity_id = $transport_principal->transport_data['authorization_entity_id'];
$transport_principal_authorization_entity_number = $transport_principal->transport_data['authorization_entity_number'];
$transport_secondaries = $document->transports
->where('transport_id', '<>', $transport_principal->transport_id)
->transform(function ($row) {
return [
'plate_number' => $row->transport_data['plate_number'],
'tuce_number' => $row->transport_data['tuce_number'],
'authorization_entity_id' => $row->transport_data['authorization_entity_id'],
'authorization_entity_number' => $row->transport_data['authorization_entity_number']
];
});
}
}
@endphp
{{--{{ $document_number }}--}}
{{----}}
@if($company->logo)
{{--@else--}}
{{----}}
{{--
 }})
--}}
{{--
--}}
@endif
{{ $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 }} |
| DESTINATARIO |
| Razón Social: {{ $customer->name }} |
| RUC: {{ $customer->number }}
|
| Dirección: {{ $customer->address }}
{{ ($customer->district_id !== '-')? ', '.func_str_to_upper_utf8($customer->district->description) : '' }}
{{ ($customer->province_id !== '-')? ', '.func_str_to_upper_utf8($customer->province->description) : '' }}
{{ ($customer->department_id !== '-')? '- '.func_str_to_upper_utf8($customer->department->description) : '' }}
|
@if ($customer->telephone)
| Teléfono:{{ $customer->telephone }} |
@endif
| Vendedor: {{ $document->user->name }} |
| 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 }} |
@if($document->related && isset($document->related->number))
| Número de documento (DAM): {{ $document->related->number }} |
Tipo documento relacionado: {{ $document->getRelatedDocumentTypeDescription() }} |
@endif
| Peso Bruto Total({{ $document->unit_type_id }}): {{ $document->total_weight }} |
@if($document->packages_number)
Número de Bultos: {{ $document->packages_number }} |
@endif
@if($document->is_transport_category_m1l)
| Indicador traslado en vehículos de categoría M1 o L: Si |
@endif
| P.Partida: {{ $document->origin["location_id"] }} - {{ func_get_address_customer($document->origin) }} |
P.Llegada: {{ $document->delivery["location_id"] }} - {{ func_get_address_customer($document->delivery) }} |
| TRANSPORTE |
@if($document->is_transport_category_m1l)
@if($document->plate_number)
| Placa de vehículo: {{ $document->plate_number }} |
@endif
@else
@if($document->transport_mode_type_id === '01')
@if($document->dispatcher->number)
@php
$document_type_dispatcher = App\Models\Tenant\Catalogs\IdentityDocumentType::findOrFail($document->dispatcher->identity_document_type_id);
@endphp
| Nombre y/o razón social: {{ $document->dispatcher->name }} |
{{ $document_type_dispatcher->description }}: {{ $document->dispatcher->number }} |
@endif
@else
@if($transport_principal_plate_number)
| Datos de los vehículos: |
| Principal: |
| Número de placa: {{ $transport_principal_plate_number }} |
@if($transport_principal_tuce_number)
| Número de TUCE o Certificado de Habiltación
Vehicular: {{ $transport_principal_tuce_number }} |
@endif
|
@endif
@foreach($transport_secondaries as $ts)
| Secundario {{ $loop->iteration }}: |
| Número de placa: {{ $ts['plate_number'] }} |
@if($ts['tuce_number'])
| Número de TUCE o Certificado de Habiltación Vehicular: {{ $ts['tuce_number'] }} |
@endif
|
@endforeach
@if($document->driver)
@if($document->driver->number)
| Conductor: {{ $document->driver->number }} |
@endif
@if($document->driver->license)
| Licencia del Conductor: {{ $document->driver->license }} |
@endif
@endif
@endif
@endif
| Item |
Código |
Descripción |
Modelo |
Unidad |
Cantidad |
@foreach($document->items as $row)
| {{ $loop->iteration }} |
{{ $row->item->internal_id }} |
{!! func_get_item_name_pdf($row) !!}
@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->is_prepayment)
*** Pago Anticipado ***
@endif
@if($row->comment)
- {{$row->comment}}
@endif
|
{{ $row->item->model ?? '' }} |
{{ $row->item->unit_type_id }} |
@if(((int)$row->quantity != $row->quantity))
{{ $row->quantity }}
@else
{{ number_format($row->quantity, 0) }}
@endif
|
@endforeach
@if($document->observations)
| OBSERVACIONES |
| {{ $document->observations }} |
@endif
@if ($document->reference_document)
@if($document->reference_document)
| {{$document->reference_document->document_type->description}} |
| {{ ($document->reference_document) ? $document->reference_document->number_full : "" }} |
@endif
@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)
| ORDEN DE PEDIDO |
| {{ ($document->order_form) ? $document->order_form->number_full : "" }} |
@endif
@elseif ($document->order_form_external)
| ORDEN DE PEDIDO |
| {{ $document->order_form_external }} |
@endif
@if ($document->reference_sale_note_id)
@if($document->sale_note)
| NOTA DE VENTA |
| {{ ($document->sale_note) ? $document->sale_note->number_full : "" }} |
@endif
@endif
@if($document->qr)
@endif
@if ($document->terms_condition)
Términos y condiciones del servicio
{!! $document->terms_condition !!}
|
@endif