75 lines
5.0 KiB
PHP
75 lines
5.0 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="pt">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Requisição RA-{{ $record->id }} · SGC</title>
|
|
<style>
|
|
@page { size: A4 landscape; margin: 15mm; }
|
|
body { font: 12px/1.5 Arial, sans-serif; color: #111; max-width: 1100px; margin: 24px auto; }
|
|
table { width: 100%; border-collapse: collapse; margin: 18px 0; }
|
|
th, td { border: 1px solid #bbb; padding: 8px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
|
|
thead { display: table-header-group; } tr { break-inside: avoid; }
|
|
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
@media print { .no-print { display: none; } body { margin: 0; max-width: none; } }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
@php
|
|
$states = ['draft'=>'Rascunho', 'submitted'=>'Por autorizar', 'authorized'=>'Autorizada', 'partial'=>'Entrega parcial', 'delivered'=>'Entregue', 'closed'=>'Recepção confirmada', 'rejected'=>'Rejeitada', 'cancelled'=>'Cancelada'];
|
|
$actions = ['submit'=>'Submissão', 'authorize'=>'Autorização', 'reject'=>'Rejeição', 'cancel'=>'Cancelamento', 'reserve'=>'Reserva', 'deliver'=>'Entrega', 'receive'=>'Recepção'];
|
|
@endphp
|
|
<button class="no-print" type="button" onclick="window.print()">Imprimir ou guardar como PDF</button>
|
|
<h1>Requisição RA-{{ $record->id }}</h1>
|
|
<p><strong>Uso interno · Sem factura</strong> · {{ $states[$progress['state']] ?? $progress['state'] }} · Versão {{ $progress['version'] }}<br>Consulta em {{ $generatedAt }}</p>
|
|
<p>Resumo de acompanhamento da requisição. As quantidades pedidas ou reservadas não representam uma saída. Cada entrega tem o seu documento individual, ligado abaixo. Esta consulta não regista autorizações, movimentos ou assinaturas.</p>
|
|
<h2>Utilização e origem</h2>
|
|
<p>Requisitante: {{ $record->snapshot['requester']['name'] }}<br>
|
|
Armazém: {{ $record->snapshot['warehouse']['code'] }} · {{ $record->snapshot['warehouse']['name'] }}<br>
|
|
Centro de custo: {{ $record->snapshot['cost_center']['code'] }} · {{ $record->snapshot['cost_center']['name'] }}<br>
|
|
Destino: {{ $record->snapshot['destination'] }}</p>
|
|
<p class="pre">Finalidade: {{ $record->snapshot['reason'] }}</p>
|
|
<table>
|
|
<thead><tr><th>Artigo / unidade</th><th>Utilização</th><th>Pedida</th><th>Reservada agora</th><th>Entregue acumulada</th><th>Por entregar</th><th>Cancelada</th></tr></thead>
|
|
<tbody>
|
|
@foreach($record->snapshot['lines'] as $index => $line)
|
|
<tr>
|
|
<td>{{ $line['item']['code'] }} · {{ $line['item']['name'] }}<br>{{ $line['item']['unit'] }}</td>
|
|
<td>{{ $line['destination'] }}
|
|
@if($line['equipment'] ?? null)<br>{{ $line['equipment']['code'] }} · {{ $line['equipment']['description'] }}@endif
|
|
</td>
|
|
@foreach([$line['quantity_milli'], $progress['reserved'][$index], $progress['delivered'][$index], $progress['remaining'][$index], $progress['cancelled'][$index]] as $quantity)
|
|
<td>{{ number_format($quantity / 1000, 3, ',', '.') }}</td>
|
|
@endforeach
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
@unless($progress['reservation_ready'])<p>Consulta de reservas indisponível nesta instalação; os zeros não certificam ausência de compromissos.</p>@endunless
|
|
<p>Entregas acumuladas reproduzem as saídas registadas. Não descontam devoluções ou correcções posteriores; consulte esses processos para o saldo físico.</p>
|
|
<h2>Autorizações, entregas e confirmações</h2>
|
|
<table>
|
|
<thead><tr><th>Registo / versão</th><th>Intervenção</th><th>Responsável / data</th><th>Motivo e documento</th></tr></thead>
|
|
<tbody>
|
|
@forelse($progress['events'] as $event)
|
|
<tr>
|
|
<td>#{{ $event['id'] }} / {{ $event['version'] }}</td>
|
|
<td>{{ $actions[$event['action']] ?? $event['action'] }}</td>
|
|
<td>{{ $event['data']['actor']['name'] ?? 'Utilizador #'.$event['actor_id'] }}<br>{{ $event['created_at'] }}</td>
|
|
<td><span class="pre">{{ $event['reason'] }}</span>
|
|
@if($event['action'] === 'deliver')
|
|
<br><a href="{{ url('/stock/requisicoes/'.$record->id.'/entregas/'.$event['id'].'/imprimir') }}">Documento da entrega #{{ $event['id'] }}</a>
|
|
<br>{{ in_array($event['id'], $progress['received_deliveries'], true) ? 'Recepção confirmada' : 'Recepção por confirmar' }}
|
|
@elseif($event['action'] === 'receive')
|
|
<br>Entrega #{{ $event['data']['delivery_event_id'] ?? '' }}
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr><td colspan="4">Sem intervenções registadas. O rascunho não constitui autorização nem saída.</td></tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</body>
|
|
</html>
|