$taxes =
[];
if ($this->_order
['taxfree'
]) { $this->_amountNetto +=
$this->_order
['invoice_shipping'
];
} else { if ($this->_order
['is_proportional_calculation'
]) { $taxes =
Shopware()->
Container()->
get('shopware.cart.proportional_tax_calculator'
)->
calculate($this->_order
['invoice_shipping'
],
$this->
getPricePositions(), false
);
$taxNet = 0;
foreach ($taxes as $tax) { $taxNet +=
$tax->
getNetPrice();
$this->_tax
[number_format($tax->
getTaxRate(), 2
)] +=
$tax->
getTax();
} $this->_amountNetto +=
$taxNet;
} else { $this->_amountNetto
+= ($this->_order
['invoice_shipping'
] /
(100 +
$taxShipping) * 100
);
if (!
empty($taxShipping) && !
empty($this->_order
['invoice_shipping'
])) { $shippingTax =
Shopware()->
Container()->
get(TaxAggregatorInterface::
class)->
shippingCostsTaxSum([ CheckoutKey::SHIPPING_COSTS_TAX =>
(float) $this->_order
['invoice_shipping_tax_rate'
],
CheckoutKey::SHIPPING_COSTS_NET =>
(float) $this->_order
['invoice_shipping_net'
],
CheckoutKey::SHIPPING_COSTS_WITH_TAX =>
(float) $this->_order
['invoice_shipping'
],
]);