@extends('layouts.app') @push('styles') @endpush @section('content')

REPORTE DETALLADO DEL FLUJO


















































































@php $i = 1; $blendingGroups = $liquidaciones->groupBy(function ($liq) { return optional($liq->ingreso->blendings->first())->cod ?? null; }); @endphp @foreach ($liquidaciones as $liq) @php $estadoLiq = strtolower(trim($liq->estado ?? '')); $ingreso = $liq->ingreso; $blending = $ingreso->blendings->first(); $despacho = $blending?->despacho; $retiro = $despacho?->retiros->first(); $codBlending = optional($blending)->cod; $comentario = strtoupper($liq->comentario ?? ''); $codComentario = null; if (preg_match('/B\d+/', $comentario, $matches)) { $codComentario = $matches[0]; } $esFilaResumen = $codComentario && is_null($blending); $grupo = $blendingGroups[$codComentario] ?? collect(); $totalTMH = $grupo->sum('peso') ?? 0; $totalTMS = $grupo->sum('tms') ?? 0; $porcentajeH2O = $totalTMH > 0 ? (($totalTMH - $totalTMS) / $totalTMH) * 100 : 0; $prom = fn($campo) => $totalTMS > 0 ? $grupo->sum(fn($l) => $l->tms * ($l->muestra->$campo ?? 0)) / $totalTMS : 0; $valorLote = $grupo->sum('valorporlote') ?? 0; $totalLiquidacion = $grupo->sum('total_liquidacion') ?? 0; @endphp @if ($estadoLiq === 'cierre' || $estadoLiq === '') {{-- PROMEDIOS O GUIONES --}} @if ($esFilaResumen) @else @endif @endif @endforeach @foreach ($ingresosSinLiquidacion as $ingreso) @endforeach
# NroSalida Peso Total Fecha Ingreso DNI / RUC NOMBRE / RAZON SOCIAL Material Procedencia Placa Guia Transporte Guia Remision Muestreo Preparacion Analisis Nasca Lab Analisis Lab Peru Lote Lista Cod Blending A / I Peso Blending ID Despacho TMH Despacho Mas/Menos Fecha Despacho Nro Salida Retiro Precinto Guia Bruto Tara Neto Tracto Carreta Guia Transporte RUC Despacho Razon Social Licencia Conductor ID Fecha Actualización Ruc Cliente Producto Notas Peso Humedad TMS Merma TMNS Cotización Cu Cotización Ag Cotización Au Ley Cu Pagable Cu Ley Ag Pagable Ag Ley Au Pagable Au Cu Ag Au As Sb Bi Pb Hg S Valor US Valor Lote IGV % Liquidación Adelantos Saldo Detracción Total Liquidación Proceso Planta Adelantos Extras Préstamos Otros Descuentos Total Final Fase Estado Liquidador TMH Grupo % H2O TMS Grupo Prom. Cu Prom. Ag Prom. Au Prom. As Prom. Sb Prom. Pb Prom. Zn Prom. Bi Prom. Hg Valor Lote Grupo Total Liquidación Grupo
{{ $i++ }} {{ $liq->NroSalida }} {{ number_format($ingreso->peso_total ?? 0, 3) }} {{ \Carbon\Carbon::parse($ingreso->fecha_ingreso)->format('d/m/Y') ?? 'N/A' }} {{ $ingreso->identificador ?? 'N/A' }} {{ $ingreso->nom_iden ?? 'N/A' }} {{ $ingreso->estado ?? 'N/A' }} {{ $ingreso->procedencia ?? 'N/A' }} {{ $ingreso->placa ?? 'N/A' }} {{ $ingreso->guia_transporte ?? 'N/A' }} {{ $ingreso->guia_remision ?? 'N/A' }} {{ $ingreso->muestreo ?? 'N/A' }} {{ $ingreso->preparacion ?? 'N/A' }} {{ $ingreso->req_analisis ?? 'N/A' }} {{ $ingreso->req_analisis1 ?? 'N/A' }} {{ $ingreso->ref_lote ?? 'N/A' }} {{ $blending->lista ?? 'N/A' }} {{ $blending->cod ?? 'N/A' }} {{ $blending->estado ?? 'N/A' }} {{ number_format($blending->pesoblending ?? 0, 3) }} {{ $despacho->id ?? 'N/A' }} {{ number_format($despacho->totalTMH ?? 0, 3) }} {{ $despacho->masomenos ?? '-' }} {{ $despacho->fecha ?? '-' }} {{ $retiro->nro_salida ?? '-' }} {{ $retiro->precinto ?? '-' }} {{ $retiro->guia ?? '-' }} {{ $retiro->bruto ?? '-' }} {{ $retiro->tara ?? '-' }} {{ $retiro->neto ?? '-' }} {{ $retiro->tracto ?? '-' }} {{ $retiro->carreta ?? '-' }} {{ $retiro->guia_transporte ?? '-' }} {{ $retiro->ruc_empresa ?? '-' }} {{ $retiro->razon_social ?? '-' }} {{ $retiro->licencia ?? '-' }} {{ $retiro->conductor ?? '-' }} {{ $liq->id ?? '-' }} {{ $liq->updated_at ?? '-' }} {{ $liq->cliente->documento_cliente ?? '-' }} {{ $liq->cliente->datos_cliente ?? '-' }} {{ $liq->producto }} @if (stripos($liq->comentario, 'SOBRANTE') !== false) {{ $liq->comentario }} @endif {{ $liq->peso ?? '-' }} {{ $liq->muestra->humedad ?? '-' }} {{ $liq->tms ?? '-' }} {{ $liq->merma2 ?? '-' }} {{ $liq->tmns ?? '-' }} {{ $liq->cotizacion_cu ?? '-' }} {{ $liq->cotizacion_ag ?? '-' }} {{ $liq->cotizacion_au ?? '-' }} {{ $liq->ley_cu ?? '-' }} {{ $liq->pagable_cu2 ?? '-' }} {{ $liq->ley_ag ?? '-' }} {{ $liq->pagable_ag2 ?? '-' }} {{ $liq->ley_au ?? '-' }} {{ $liq->pagable_au2 ?? '-' }} {{ $liq->muestra->cu ?? '-' }} {{ $liq->muestra->ag ?? '-' }} {{ $liq->muestra->au ?? '-' }} {{ $liq->muestra->as ?? '-' }} {{ $liq->muestra->sb ?? '-' }} {{ $liq->muestra->bi ?? '-' }} {{ $liq->muestra->pb ?? '-' }} {{ $liq->muestra->hg ?? '-' }} {{ $liq->muestra->s ?? '-' }} {{ $liq->total_us ?? '-' }} {{ $liq->valorporlote ?? '-' }} {{ $liq->valor_igv ?? '-' }} {{ $liq->total_porcentajeliqui ?? '-' }} {{ $liq->adelantos ?? '-' }} {{ $liq->saldo ?? '-' }} {{ $liq->detraccion ?? '-' }} {{ $liq->total_liquidacion ?? '-' }} {{ $liq->procesoplanta ?? '-' }} {{ $liq->adelantosextras ?? '-' }} {{ $liq->prestamos ?? '-' }} {{ $liq->otrosdescuentos ?? '-' }} {{ $liq->total }} {{ $ingreso->fase ?? '-' }} {{ $liq->estado ?? '-' }} {{ $liq->lastEditor->name ?? 'N/A' }}{{ number_format($totalTMH, 3) }} {{ number_format($porcentajeH2O, 3) }} {{ number_format($totalTMS, 3) }} {{ number_format($prom('cu'), 3) }} {{ number_format($prom('ag'), 3) }} {{ number_format($prom('au'), 3) }} {{ number_format($prom('as'), 3) }} {{ number_format($prom('sb'), 3) }} {{ number_format($prom('pb'), 3) }} {{ number_format($prom('zn'), 3) }} {{ number_format($prom('bi'), 3) }} {{ number_format($prom('hg'), 3) }} {{ number_format($valorLote, 2) }} {{ number_format($totalLiquidacion, 2) }}-
{{ $i++ }} {{ $ingreso->NroSalida ?? '-' }} {{ number_format($ingreso->peso_total ?? 0, 3) }} {{ \Carbon\Carbon::parse($ingreso->fecha_ingreso)->format('d/m/Y') ?? 'N/A' }} {{ $ingreso->identificador ?? '-' }} {{ $ingreso->nom_iden ?? '-' }} {{ $ingreso->producto ?? '-' }} {{ $ingreso->procedencia ?? '-' }} {{ $ingreso->placa ?? '-' }} {{ $ingreso->guia_transporte ?? '-' }} {{ $ingreso->guia_remision ?? '-' }} {{ $ingreso->muestreo ?? '-' }} {{ $ingreso->preparacion ?? '-' }} {{ $ingreso->req_analisis ?? '-' }} {{ $ingreso->req_analisis1 ?? '-' }} {{ $ingreso->ref_lote ?? '-' }} SIN DATOS SIN DATOS SIN DATOS -
@endsection @push('scripts') @endpush