LIQUIDACION DE DOCUMENTOS POR TRANSPORTISTA DEL DIA {{$date_of_issue}}


Empresa:

{{ $company->name }}

Fecha:

{{ date('Y-m-d') }}

Ruc:

{{ $company->number }}

@php $sellers = $records ->map(function ($record) { return $record->seller_number ?: $record->seller_name; }) ->unique() ->toArray(); @endphp @if (!empty($records))
TRANSPORTISTA: {{ $dispatcher->name }} - {{ $dispatcher->number }}
VENDEDORES: {{ implode(', ', $sellers) }}
@foreach ($records as $key => $value) @php $payment_method_type_id = $value->payment_method_type_id; $customer_id = $value->customer_id; $total_due = App\Models\Tenant\Person::getAccumulatedDue($customer_id); $payment_method_explode = explode(',', $payment_method_type_id); $payment_method_description = ''; foreach ($payment_method_explode as $item) { $payment_method = App\Models\Tenant\PaymentMethodType::find($item); $payment_method_description .= $payment_method ? $payment_method->description . ', ' : ''; } $document_type_id = $value->document_type_id; $document_number = $value->number_full; $customer_internal_id = $value->customer_internal_id; $customer_name = $value->customer_name; $sale_price = $value->total; $payment_method = null; $document_type = App\Models\Tenant\Catalogs\DocumentType::find($document_type_id); $document_type_description = $document_type ? $document_type->description : ''; if (strlen($payment_method_description) > 0) { $payment_method_description = substr($payment_method_description, 0, -2); } $seller_code = null; if ($value->seller_number) { $seller_code = $value->seller_number; } else { $seller_code = $value->seller_name; } $record = (object) [ 'payment_condition' => $value->payment_condition_id == '01' ? 'Contado' : 'Crédito', 'seller_code' => $seller_code, 'payment_method_description' => $payment_method_description, // 'Método de pago 'document_type_description' => $document_type_description, // 'Tipo de documento 'document_type_id' => $document_type_id, 'document_number' => $document_number, 'customer_internal_id' => $customer_internal_id, 'customer_name' => $customer_name, 'sale_price' => $sale_price, 'payment_method' => $payment_method, 'due' => $total_due, ]; @endphp @endforeach
# Tipo Documento Comprobante Código Cliente Nombre / Razón Social Precio Venta Forma de pago Contado Crédito Devolución Deuda
{{ $key + 1 }} {{ $record->document_type_description }} {{ $record->document_number }} {{ $record->customer_internal_id }} {{ $record->customer_name }} {{ $record->sale_price }} {{ $record->payment_method_description }} {{ $record->due }}
TOTAL DOCUMENTOS: {{ count($records) }} TOTAL VENTAS: {{ number_format($records->sum('total'), 2) }}
@else

No se encontraron registros.

@endif