@php if (!function_exists('formatCnpj')) { function formatCnpj($value) { $value = preg_replace('/[^0-9]/', '', $value); if (strlen($value) === 14) { return preg_replace('/(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})/', '$1.$2.$3/$4-$5', $value); } if (strlen($value) === 11) { return preg_replace('/(\d{3})(\d{3})(\d{3})(\d{2})/', '$1.$2.$3-$4', $value); } return $value; } } if (!function_exists('formatTelefone')) { function formatTelefone($value) { $value = preg_replace('/[^0-9]/', '', $value); if (strlen($value) === 11) { return preg_replace('/(\d{2})(\d{5})(\d{4})/', '($1) $2-$3', $value); } elseif (strlen($value) === 10) { return preg_replace('/(\d{2})(\d{4})(\d{4})/', '($1) $2-$3', $value); } return $value; } } if (!function_exists('formatCep')) { function formatCep($value) { $value = preg_replace('/[^0-9]/', '', $value); if (strlen($value) === 8) { return preg_replace('/(\d{5})(\d{3})/', '$1-$2', $value); } return $value; } } @endphp Conferência de Estoque - #{{ $conferencia->id }}
Logo
{{ $destroca->nome ?? 'CENTRO DE DESTROCA' }}

CNPJ: {{ formatCnpj($destroca->cnpj) ?? '---' }}

{{ $destroca->endereco ?? '' }}, {{ $destroca->numero ?? '' }} {{ $destroca->complemento ? ' - ' . $destroca->complemento : '' }} - {{ $destroca->bairro ?? '' }}, {{ $destroca->ncidade ?? '' }} - CEP: {{ formatCep($destroca->cep) ?? '' }}

STATUS @php $statusMap = [ 1 => ['ABERTO', '#ed6c02'], 2 => ['AVALIAÇÃO', '#0288d1'], 3 => ['REJEITADO', '#d32f2f'], 4 => ['FECHADO', '#2e7d32'] ]; $st = $statusMap[$conferencia->status] ?? ['DESCONHECIDO', '#000']; @endphp
{{ $st[0] }}
RELATÓRIO DE CONFERÊNCIA DIÁRIA DE ESTOQUE
@if($conferencia->obs) @endif
ID CONFERÊNCIA #{{ $conferencia->id }} DATA REFERÊNCIA {{ \Carbon\Carbon::parse($conferencia->data)->format('d/m/Y') }} DATA ABERTURA {{ $conferencia->created_at->format('d/m/Y H:i') }} DATA FECHAMENTO {{ $conferencia->data_fechamento ? \Carbon\Carbon::parse($conferencia->data_fechamento)->format('d/m/Y H:i') : '---' }}
CONFERENTE responsÁVEL {{ $conferencia->conferente->name ?? '---' }} APROVADOR responsÁVEL {{ $conferencia->aprovador->name ?? '---' }}
OBSERVAÇÕES {{ $conferencia->obs }}
@php $tags = ['P05', 'P08', 'P13', 'P20', 'P45']; $totalSistema = 0; $totalConf = 0; $totalDiv = 0; @endphp @foreach($tags as $tag) @php // Encontrar valor do sistema no snapshot $snapMatch = $conferencia->itens->filter(function($i) use ($tag) { return stripos($i->produto->descricao ?? '', $tag) !== false; })->first(); $valSistema = $snapMatch ? intval($snapMatch->qtd_estoque ?? 0) : 0; // Encontrar valor conferido no historico (temp) $valConf = $conferencia->itensTemp->filter(function($i) use ($tag) { return stripos($i->produto->descricao ?? '', $tag) !== false; })->sum('qtd_conferencia'); $valConf = intval($valConf); $divergencia = $valConf - $valSistema; $totalSistema += $valSistema; $totalConf += $valConf; $totalDiv += $divergencia; $statusItem = "OK"; $colorItem = "#2e7d32"; if($divergencia > 0) { $statusItem = "SOBRA"; $colorItem = "#ed6c02"; } if($divergencia < 0) { $statusItem = "FALTA"; $colorItem = "#d32f2f"; } @endphp @endforeach
PRODUTO SISTEMA (ESTOQUE) CONFERÊNCIA (LANC.) DIVERGÊNCIA STATUS
{{ $tag }} {{ $valSistema }} {{ $valConf }} {{ $divergencia > 0 ? '+' . $divergencia : $divergencia }} {{ $statusItem }}
TOTAL GERAL {{ $totalSistema }} {{ $totalConf }} {{ $totalDiv > 0 ? '+' . $totalDiv : $totalDiv }} ---
Assinatura do Conferente
{{ $conferencia->conferente->name ?? '' }}
Assinatura do Aprovador
{{ $conferencia->aprovador->name ?? '' }}