commit compras 2711
tests / ci (push) Waiting to run

This commit is contained in:
2026-11-27 13:49:31 +02:00
parent dc73540558
commit e709d900d1
81 changed files with 5352 additions and 107 deletions
+9
View File
@@ -142,6 +142,12 @@ class QuotationExchange
public function orderAmounts(PurchaseOrder $order, int $subtotal, int $tax): array
{
abort_unless($subtotal >= 0 && $tax >= 0, 409);
if ($order->currency !== 'MZN' && OrderPartsAccess::applies($order)) {
abort_unless($subtotal === $order->subtotal_minor && $tax === $order->tax_minor, 409,
'A conversão parcial exige a identificação das origens facturadas.');
return app(OrderPartsExchange::class)->orderAmounts($order);
}
if ($order->currency === 'MZN') {
abort_unless(($order->snapshot['exchange_basis'] ?? null) === null, 409, 'Base cambial incompatível com ordem em MZN.');
@@ -166,6 +172,9 @@ class QuotationExchange
*/
public function invoiceAmounts(PurchaseOrder $order, Invoice $invoice): array
{
if ($order->currency !== 'MZN' && OrderPartsAccess::applies($order)) {
return app(OrderPartsExchange::class)->invoiceAmounts($order, $invoice);
}
if ($order->currency === 'MZN') {
return ['subtotal_minor' => $invoice->subtotal_minor, 'tax_minor' => $invoice->tax_minor, 'total_minor' => $invoice->total_minor];
}