commit melhorias compras1
tests / ci (push) Waiting to run

This commit is contained in:
2026-11-21 21:04:40 +02:00
parent 976271f948
commit 12dd6df28a
108 changed files with 4391 additions and 408 deletions
@@ -1,6 +1,6 @@
@if(!empty($terms))
<p class="small">Desconto por unidade antes do IVA; preço líquido arredondado ao centavo.</p>
@foreach($terms['lines'] as $line)
<p class="small">Linha #{{ $line['requisition_item_id'] }}: preço inicial {{ $money($line['gross_unit_minor']) }} · desconto {{ $line['discount_type'] === 'none' ? 'sem desconto' : ($line['discount_type'] === 'percent' ? $line['discount_value'].'%' : $line['discount_value'].' MZN/unidade') }} · preço líquido {{ $money($line['net_unit_minor']) }}.</p>
<p class="small">Linha #{{ $line['requisition_item_id'] }}: preço inicial {{ $money($line['gross_unit_minor']) }} · desconto {{ $line['discount_type'] === 'none' ? 'sem desconto' : ($line['discount_type'] === 'percent' ? $line['discount_value'].'%' : $line['discount_value'].' '.($currency ?? 'MZN').'/unidade') }} · preço líquido {{ $money($line['net_unit_minor']) }}.</p>
@endforeach
@endif
@@ -0,0 +1,6 @@
@if(!empty($basis))
<p class="small">Taxa congelada da proposta {{ $reference }}: 1 {{ $basis['currency'] }} = {{ $basis['rate'] }} MZN · {{ $basis['quoted_on'] }} · Fonte: {{ $basis['source'] }} · Finanças, utilizador #{{ $basis['recorded_by'] }}. Subtotal e IVA convertidos separadamente, com arredondamento ao centavo.</p>
@if(!empty($referenceAmounts))
<p class="small">Referência para comparação e alçadas: {{ number_format($referenceAmounts['total_minor'] / 100, 2, ',', ' ') }} MZN.</p>
@endif
@endif
@@ -32,6 +32,9 @@
<table><thead><tr><th>Nome</th><th>Qualidade</th><th>Participação</th><th>Assinatura manuscrita</th></tr></thead><tbody>
@foreach($opening->participants as $participant)<tr><td>{{ $participant['name'] }}</td><td>{{ $participant['capacity'] }}</td><td>{{ $participant['group'] === 'jury' ? 'Júri' : 'Participante' }}</td><td class="signature">____________________</td></tr>@endforeach
</tbody></table>
@foreach($snapshot['proposals'] as $proposal)
@include('purchases.exchange-basis', ['basis' => $proposal['exchange_basis'] ?? null, 'reference' => $proposal['reference'], 'referenceAmounts' => null])
@endforeach
<h2>Mapa das propostas registadas na aplicação</h2>
<p>Valores preservados à data deste registo, para conferência com os dados da sessão. Não inclui propostas adicionadas ou alteradas posteriormente.</p>
<table><thead><tr><th>Ordem</th><th>Concorrente e referência</th><th>Sem IVA</th><th>IVA</th><th>Total</th></tr></thead><tbody>
+7 -4
View File
@@ -20,9 +20,12 @@
</style>
</head>
<body>
@php($money = fn ($minor) => number_format($minor / 100, 2, ',', '.') . ' MZN')
@php($money = fn ($minor, $currency = null) => number_format($minor / 100, 2, ',', '.') . ' ' . ($currency ?? $order->currency))
<button type="button" class="no-print" onclick="window.print()">Imprimir ou guardar como PDF</button>
<h1>Ordem de compra {{ $order->number }}</h1>
@if(!empty($snapshot['exchange_basis']))
<p>Taxa congelada: 1 {{ $snapshot['exchange_basis']['currency'] }} = {{ $snapshot['exchange_basis']['rate'] }} MZN · {{ $snapshot['exchange_basis']['quoted_on'] }} · Fonte: {{ $snapshot['exchange_basis']['source'] }}. Referência orçamental: {{ $money($snapshot['reference_amounts']['total_minor'], 'MZN') }}. Os valores da ordem estão na moeda original.</p>
@endif
@if(($operationalState ?? 'issued') !== 'issued')
<p class="notice"><strong>{{ $operationalState === 'cancelled' ? 'Ordem cancelada' : 'Cancelamento pendente — execução suspensa' }}.</strong> Reprodução do documento original, preservado no histórico.</p>
@endif
@@ -35,7 +38,7 @@
<h2>Artigos e valores</h2>
@if(!empty($snapshot['investment_rules']))
<h2>Regra de investimento congelada</h2>
<p>Versão {{ $snapshot['investment_rules']['revision'] }} · Tecto {{ $money($snapshot['investment_rules']['ceiling_minor']) }} · {{ $snapshot['investment_rules']['includes_tax'] ? 'com IVA' : 'sem IVA' }} · Vigência {{ $snapshot['investment_rules']['valid_from'] }} a {{ $snapshot['investment_rules']['valid_until'] }}.</p>
<p>Versão {{ $snapshot['investment_rules']['revision'] }} · Tecto {{ $money($snapshot['investment_rules']['ceiling_minor'], 'MZN') }} · {{ $snapshot['investment_rules']['includes_tax'] ? 'com IVA' : 'sem IVA' }} · Vigência {{ $snapshot['investment_rules']['valid_from'] }} a {{ $snapshot['investment_rules']['valid_until'] }}.</p>
@foreach($snapshot['equipment_requests'] ?? [] as $context)<p class="pre">{{ $context['description'] }} · Área: {{ $context['production_area'] }}</p>@endforeach
@endif
<table><thead><tr><th>Descrição</th><th>Quantidade</th><th>Preço sem IVA</th><th>IVA</th><th>Total com IVA</th></tr></thead><tbody>
@@ -46,7 +49,7 @@
@foreach($snapshot['decision_matrix'] as $row)
@if(!empty($row['commercial_terms']))
<h3>{{ $row['supplier']['name'] }} · {{ $row['reference'] }}</h3>
@include('purchases.commercial-terms', ['terms' => $row['commercial_terms']])
@include('purchases.commercial-terms', ['terms' => $row['commercial_terms'], 'currency' => $row['currency'], 'money' => fn ($minor) => number_format($minor / 100, 2, ',', '.') . ' ' . $row['currency']])
@endif
@endforeach
<table class="totals"><tr><td>Subtotal sem IVA</td><td>{{ $money($order->subtotal_minor) }}</td></tr><tr><td>IVA</td><td>{{ $money($order->tax_minor) }}</td></tr><tr><th>Total com IVA</th><th>{{ $money($order->total_minor) }}</th></tr></table>
@@ -57,7 +60,7 @@
@endif
<table><thead><tr><th>Fornecedor / proposta</th><th>Total com IVA</th><th>Avaliações elegíveis</th><th>Pontuação</th></tr></thead><tbody>
@foreach($snapshot['decision_matrix'] as $row)
<tr><td>{{ $row['supplier']['name'] }} · {{ $row['reference'] }}<br>@foreach($row['evaluations'] as $evaluation)<span class="small">Avaliador #{{ $evaluation['evaluator_id'] }}: qualidade {{ $evaluation['quality'] }}, histórico {{ $evaluation['history'] }}, pagamento {{ $evaluation['payment'] }}. {{ $evaluation['comment'] }}</span><br>@endforeach</td><td>{{ $money($row['total_minor']) }}</td><td>{{ $row['evaluation_count'] }}</td><td>{{ $row['score'] === null ? 'Não elegível / incompleta' : number_format($row['score'], 2, ',', '.') . ' / 10' }}</td></tr>
<tr><td>{{ $row['supplier']['name'] }} · {{ $row['reference'] }}<br>@foreach($row['evaluations'] as $evaluation)<span class="small">Avaliador #{{ $evaluation['evaluator_id'] }}: qualidade {{ $evaluation['quality'] }}, histórico {{ $evaluation['history'] }}, pagamento {{ $evaluation['payment'] }}. {{ $evaluation['comment'] }}</span><br>@endforeach</td><td>{{ $money($row['total_minor'], $row['currency']) }}</td><td>{{ $row['evaluation_count'] }}</td><td>{{ $row['score'] === null ? 'Não elegível / incompleta' : number_format($row['score'], 2, ',', '.') . ' / 10' }}</td></tr>
@endforeach
</tbody></table>
<h2>Aprovações do valor final</h2><ul>@foreach($snapshot['final_approvals'] as $approval)<li>{{ \App\Enums\PurchasingRole::from($approval['role'])->label() }} · Utilizador #{{ $approval['approver_id'] }} · {{ $approval['decided_at'] }} · {{ $approval['comment'] }}</li>@endforeach</ul>
@@ -39,6 +39,9 @@
<tr><td>{{ $row['supplier_name'] }} · {{ $row['reference'] }}</td><td>{{ number_format($row['total_minor'] / 100, 2, ',', ' ') }} {{ $row['currency'] }}</td><td>{{ $row['evaluation_count'] }}</td><td>{{ $row['score_minor'] === null ? 'Por concluir' : number_format($row['score_minor'] / 100, 2, ',', ' ') }}</td><td>{{ $row['eligible'] ? 'Elegível, com admissão confirmada' : implode(' ', $row['ineligibility_reasons']) }}{{ in_array($row['id'], $attempt->snapshot['basis']['top_ids'], true) ? ' · Maior pontuação' : '' }}</td></tr>
@endforeach
</tbody></table>
@foreach($rows as $row)
@include('purchases.exchange-basis', ['basis' => $row['exchange_basis'] ?? null, 'reference' => $row['reference'], 'referenceAmounts' => $row['reference_amounts'] ?? null])
@endforeach
<h2>Referências de admissão preservadas</h2>
@foreach($attempt->snapshot['basis']['admissions'] as $admission)
<p>Proposta #{{ $admission['quotation_id'] }} · requisitos #{{ $admission['basis']['set_id'] ?? 'não disponíveis' }} · decisão #{{ $admission['decision']['id'] ?? 'não disponível' }} · conferências {{ implode(', ', array_column($admission['reviews'], 'id')) ?: 'sem registos' }}.</p>