@php $establishment = $document->establishment; $customer = $document->customer; $document_note = ($document->note) ? $document->note : null; $affected_document_number = null; $document_number = $document->series.'-'.str_pad($document->number, 8, '0', STR_PAD_LEFT); if($document_note) { $affected_document_number = $document_note->getAffectedDocumentNumberFull(); } $document->load('reference_guides'); //calculate items $allowed_items = 80; $quantity_items = $document->items()->count(); $cycle_items = $allowed_items - ($quantity_items * 3); $total_weight = 0; $logo = "storage/uploads/logos/{$company->logo}"; if($establishment->logo) { $logo = "{$establishment->logo}"; } @endphp {{--{{ $document_number }}--}} {{----}} @if($document->state_type->id == '11')
anulado
@endif @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 : '' }}
@isset($establishment->trade_address)
{{ ($establishment->trade_address !== '-')? 'D. Comercial: '.$establishment->trade_address : '' }}
@endisset
{{ ($establishment->telephone !== '-')? 'Central telefónica: '.$establishment->telephone : '' }}
{{ ($establishment->email !== '-')? '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 }}

{{-- --}}
@if(!is_null($document_note)) @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_note->getNoteTypeDescription() }}
Descripción : {{ $document_note->note_description }}
@if($document->purchase_order) @endif {{-- @if($document->guides) @endif @if ($document->reference_guides) @if (count($document->reference_guides) > 0) @endif @endif --}} {{-- @if ($document->detraction) @endif @if ($document->detraction) @endif --}} {{-- @if ($document->retention) @endif @if ($document->retention) @endif --}}
Fecha Emisión : {{ $document->date_of_issue->format('Y-m-d') }} H. Emisión : {{ $document->time_of_issue }}
Moneda : {{ $document->currency_type->description }}
Orden de Compra : {{ $document->purchase_order }}


Guía de Remisión : @foreach ($document->guides as $item) {{ $item->document_type_description }}: {{ $item->number }}
@endforeach
Guías de Remisión : @foreach($document->reference_guides as $guide) {{ $guide->series }}-{{ $guide->number }} @endforeach
N. Cta. Detracciones : {{ $document->detraction->bank_account}} P. Detracción : {{ $document->detraction->percentage}}%
Monto Detracción : S/ {{ $document->detraction->amount}}
Información de la retención
Base imponible : {{ $document->currency_type->symbol}} {{ $document->retention->base }} Porcentaje : {{ $document->retention->percentage * 100 }}%
Monto : {{ $document->currency_type->symbol}} {{ $document->retention->amount }}
@foreach($document->items as $row) @endforeach @for($i = 0; $i < $cycle_items; $i++) @endfor @if(($document->retention || $document->detraction) && $document->total_pending_payment > 0) @endif
CÓDIGO CANT. U.M. DESCRIPCIÓN P.UNIT DCTO. TOTAL
{{ $row->item->internal_id }} @if(((int)$row->quantity != $row->quantity)) {{ $row->quantity }} @else {{ number_format($row->quantity, 0) }} @endif {{ $row->m_item->unit_type->description }} @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) @if($attr->attribute_type_id === '5032') @php $total_weight += $attr->value * $row->quantity; @endphp @endif
{!! $attr->description !!} : {{ $attr->value }} @endforeach @endif {{-- @if($row->discounts) @foreach($row->discounts as $dtos)
{{ $dtos->factor * 100 }}% {{$dtos->description }} @endforeach @endif --}} @if($row->item->is_set == 1)
@inject('itemSet', 'App\Services\ItemSetService') {{join( "-", $itemSet->getItemsSet($row->item_id) )}} @endif
{{ number_format($row->unit_price, 2) }} @if($row->discounts) @php $total_discount_line = 0; foreach ($row->discounts as $disto) { $total_discount_line = $total_discount_line + $disto->amount; } @endphp {{ number_format($total_discount_line, 2) }} @endif {{ number_format($row->total, 2) }}
VENDEDOR: {{ $document->user->name }} 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) }}
@if ($document->payment_condition_id === '02')
    @foreach($document->fee as $key => $quote)
  • {{ (empty($quote->getStringPaymentMethodType()) ? 'Cuota #'.( $key + 1) : $quote->getStringPaymentMethodType()) }} / Fecha: {{ $quote->date->format('d-m-Y') }} / Monto: {{ $quote->currency_type->symbol }}{{ $quote->amount }}
  • @endforeach
@endif
@php $total_packages = $document->items()->sum('quantity'); @endphp 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. (18%) {{$document->currency_type->symbol}} {{ number_format($document->total_igv, 2) }}
TOTAL A PAGAR. {{$document->currency_type->symbol}} {{ number_format($document->total, 2) }}
M. PENDIENTE: {{ $document->currency_type->symbol }} {{ number_format($document->total_pending_payment, 2) }}
@if ($document->terms_condition)
Términos y condiciones del servicio
{!! $document->terms_condition !!}
@endif