@php //function check if a key exists in an array and return the value or return a default value function checkKey($array, $key, $default = null) { return array_key_exists($key, $array) ? $array[$key] : $default; } function get_operation($n_operation) { $catalogo = [ '01' => 'Venta', '02' => 'Compra', '04' => 'Traslado entre establecimientos de la misma empresa', '08' => 'Importación', '09' => 'Exportación', '13' => 'Otros no comprendido en ningún código del presente catálogo', '14' => 'Venta sujeta a confirmación del comprador', '16' => 'Saldo inicial', '18' => 'Traslado emisor itinerante de comprobantes de pago Aquí no se está considerando el traslado a zona primaria.', '19' => 'Traslado a zona primaria', '03' => 'Venta con entrega a terceros', '05' => 'Devolución', '07' => 'Recojo de bienes transformados', '17' => 'Traslado de bienes para transformación', ]; return $catalogo[$n_operation]; } function get_month($n_month) { $months = [ '01' => 'ENERO', '02' => 'FEBRERO', '03' => 'MARZO', '04' => 'ABRIL', '05' => 'MAYO', '06' => 'JUNIO', '07' => 'JULIO', '08' => 'AGOSTO', '09' => 'SETIEMBRE', '10' => 'OCTUBRE', '11' => 'NOVIEMBRE', '12' => 'DICIEMBRE', ]; return $months[$n_month]; } @endphp
FORMATO 13.1: "REGISTRO DE INVENTARIO PERMANENTE VALORIZADO" |
|||||||
PERÍODO: @if ($additionalData['month']) {{ get_month($additionalData['month']) }} @endif {{ $additionalData['period'] }} |
|||||||
RUC: {{ $company->number }} |
|||||||
{{ strtoupper($company->name) }} |
|||||||
ESTABLECIMIENTO (1): |
{{ optional($establishment)->description }} |
FECHA | DOCUMENTO | OPERACION | ENTRADAS | SALIDAS | SALDO | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Código: {{ $additionalData['internal_id'] }} | ||||||||||||||||
Unidad de medida: {{ $additionalData['unit_type_table_six']['code'] }} {{-- {{ $additionalData['unit_type_table_six']['description'] }} --}} | Saldo anterior | @if ($show_init) | {{-- {{ $balance_quantity }} --}} {{ number_format($init_stock,0) }} | {{-- {{ $balance_cost }} --}} {{ number_format($init_cost_unit,4) }} | {{-- {{ $balance_total }} --}} {{ number_format($init_cost_total,2) }} | @else@endif | ||||||||||
Descripción: {{ strtoupper($additionalData['description']) }} | ||||||||||||||||
Método de evaluación: COSTO PROMEDIO | ||||||||||||||||
{{ \Carbon\Carbon::parse($row['date_of_issue'])->format('d/m/Y') }} | {{--{{ $row['document_type_id'] }} | --}}{{ $row['series'] }} - {{ $row['number'] }} | {{----}} | {{ $row['operation_type_code'] }} {{ get_operation($row['operation_type_code']) }} | {{-- ENTRADAS --}}{{ number_format($row['input_quantity'],0)}} | {{ number_format($row['input_unit_price'],4) }} | {{ number_format($row['input_total'],2) }} | {{-- SALIDAS --}} @if ($row['type'] == 'output'){{ number_format($row['output_quantity'],0) }} | {{ number_format($row['output_unit_price'],4) }} | {{ number_format($row['output_total'],2) }} | @else@endif {{-- SALDO --}} @php // $balance_quantity += $row['quantity'] * $row['factor']; // $balance_total += $row['total'] * $row['factor']; // $balance_cost = ($balance_quantity != 0) ? round($balance_total / $balance_quantity, 4) : null; if ($row['type'] == 'input') { $totals['input_quantity'] += $row['input_quantity']; $totals['input_unit_price'] += $row['input_unit_price']; $totals['input_total'] += $row['input_total']; } else { $totals['output_quantity'] += $row['output_quantity']; $totals['output_unit_price'] += $row['output_unit_price']; $totals['output_total'] += $row['output_total']; } $totals['balance_quantity'] += $row['balance_quantity']; $totals['balance_total'] += $row['balance_total_cost']; $totals['balance_cost'] += $row['balance_unit_cost']; @endphp | {{-- {{ $balance_quantity }} --}} {{ number_format($row['balance_quantity'],0) }} | {{-- {{ $balance_cost }} --}} {{ number_format($row['balance_unit_cost'],4) }} | {{-- {{ $balance_total }} --}} {{ number_format($row['balance_total_cost'],2) }} | ||
{{ number_format(checkKey($last_input, 'input_quantity', 0),0) }} | {{ number_format(checkKey($last_input, 'input_unit_price', 0),4) }} | {{ number_format(checkKey($last_input, 'input_total', 0),2) }} | {{ number_format(checkKey($last_output, 'output_quantity', 0),0) }} | {{ number_format(checkKey($last_output, 'output_unit_price', 0),4) }} | {{ number_format(checkKey($last_output, 'output_total', 0),2) }} | {{ number_format(checkKey($last_row, 'balance_quantity', 0),0) }} | {{ number_format(checkKey($last_row, 'balance_unit_cost', 0),4) }} | {{ number_format(checkKey($last_row, 'balance_total_cost', 0),2) }} |