@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user