Calculate the price tax.

@return Money
766436
public function calculatePriceTax()
    {
        $expression = $this->tax->calculator;

        $parser = new StdMathParser();
        $AST = $parser->parse($this->tax->calculator);
        $evaluator = new Evaluator();
        $evaluator->setVariables(['x' => $this->calculatePriceTaxable()->getAmount() / 100]);
        $value = $AST->accept($evaluator);
        $money = new Money(round($value, 2, PHP_ROUND_HALF_UP) * 100, new Currency($this->invoice->currency));

        return $money;
    }
895007
public function getTotalTax()
    {
        $amount = 0;

        if ($this->Price && $this->TaxRate && $this->Quantity) {
            $amount = ((($this->Price * $this->Quantity) - $this->Discount) / 100) * $this->TaxRate;
        }
        
        return $amount;
    }
215914
public function totals()
    {
        setlocale(LC_MONETARY, config('cart_manager.LC_MONETARY'));

        $totals = ['Subtotal' => money_format('%n', $this->subtotal)];

        if ($this->discount > 0) {
            $totals['Discount'] = money_format('%n', $this->discount);
        }

        if ($this->shippingCharges > 0) {
            $totals['Shipping charges'] = money_format('%n', $this->shippingCharges);
        }

        if ($this->subtotal != $this->netTotal) {
            $totals['Net total'] = money_format('%n', $this->netTotal);
        }

        $totals['Tax'] = money_format('%n', $this->tax);

        if ($this->roundOff != 0) {
            $totals['Total'] = money_format('%n', $this->total);
            $totals['Round off'] = money_format('%n', $this->roundOff);
        }

        $totals['Payable'] = money_format('%n', $this->payable);

        return $totals;
    }
422286
public function totalExcludingTax()
    {
        return (float) array_sum(
            array_map(function (CartItem $item) {
                return $item->getTotalPriceExcludingTax();
            }, $this->items)
        );
    }
689286
public function calculate()
    {
        $response = $this->http->get(WebService::CALC_PRICE_DEADLINE, [
            'query' => $this->payload(),
        ]);

        $services = $this->fetchCorreiosServices($response);

        return array_map([$this, 'transformCorreiosService'], $services);
    }
485455
public function loadConvertedPrices()
    {
        $product_sale_element_id  = \intval($this->getRequest()->get('product_sale_element_id', 0));
        $currency_id = \intval($this->getRequest()->get('currency_id', 0));

        $price_with_tax = $price_without_tax = $sale_price_with_tax = $sale_price_without_tax = 0;

        if (null !== $pse = ProductSaleElementsQuery::create()->findPk($product_sale_element_id)) {
            if ($currency_id > 0
                &&
                $currency_id != Currency::getDefaultCurrency()->getId()
                &&
                null !== $currency = CurrencyQuery::create()->findPk($currency_id)) {
                // Get the default currency price
                $productPrice = ProductPriceQuery::create()
                    ->filterByCurrency(Currency::getDefaultCurrency())
                    ->filterByProductSaleElementsId($product_sale_element_id)
                    ->findOne()
                ;

                // Calculate the converted price
                if (null !== $productPrice) {
                    $price_without_tax = $productPrice->getPrice() * $currency->getRate();
                    $sale_price_without_tax = $productPrice->getPromoPrice() * $currency->getRate();
                }
            }

            if (null !== $product = $pse->getProduct()) {
                $price_with_tax = $this->computePrice($price_without_tax, 'with_tax', $product);
                $sale_price_with_tax = $this->computePrice($sale_price_without_tax, 'with_tax', $product);
            }
        }

        return new JsonResponse(array(
            'price_with_tax'         => $this->formatPrice($price_with_tax),
            'price_without_tax'      => $this->formatPrice($price_without_tax),
            'sale_price_with_tax'    => $this->formatPrice($sale_price_with_tax),
            'sale_price_without_tax' => $this->formatPrice($sale_price_without_tax)
        ));
    }
126104
public function getDefaultPrice()
    {
        $prices = $this->getPrices();
        foreach ($prices as $price) {
            if ($price->from == 1) {
                return $price->value;
            }
        }
    }
151397
public function getTaxList()
    {
        $taxes = ArrayList::create();

        foreach ($this->Items() as $item) {
            $existing = null;
            $rate = $item->Tax();

            if ($rate->exists()) {
                $existing = $taxes->find("ID", $rate->ID);
            }

            if (!$existing) {
                $currency = DBCurrency::create();
                $currency->setValue($item->getTaxTotal());
                $taxes->push(ArrayData::create([
                    "ID" => $rate->ID,
                    "Rate" => $rate,
                    "Total" => $currency
                ]));
            } elseif ($rate && $existing) {
                $existing->Total->setValue(
                    $existing->Total->getValue() + $item->getTaxTotal()
                );
            }
        }

        return $taxes;
    }
49444
public function taxTotal($format = true, $withFees = true, $grossTaxes = true)
    {
        $totalTax = 0;
        $discounted = 0;
        $totalDiscount = $this->totalDiscount(false, false);

        if (config('laracart.discountsAlreadyTaxed', false)) {
            $totalDiscount = 0;
        }

        if ($this->count() != 0) {
            /**
             * @var
             * @var CartItem $item
             */
            foreach ($this->getItems() as $index => $item) {
                if ($discounted >= $totalDiscount) {
                    $totalTax += $item->tax(null, $grossTaxes);
                } else {
                    $itemPrice = $item->subTotal(false, config('laracart.discountTaxable', false));
                    if (($discounted + $itemPrice) > $totalDiscount) {
                        $totalTax += config('laracart.discountTaxable', false) ? $item->tax() : $item->tax($totalDiscount - $discounted);
                    }

                    $discounted += $itemPrice;
                }
            }
        }

        if ($withFees) {
            foreach ($this->getFees() as $fee) {
                if ($fee->taxable) {
                    $totalTax += $fee->amount * $fee->tax;
                }
            }
        }

        return $this->formatMoney($totalTax, null, null, $format);
    }
1325637
public function calculateToPrice()
    {
        if (count($this->_aList) == 0) {
            return;
        }

        $dNetoTotal = 0;
        $dVatTotal = 0;

        foreach ($this->_aList as $oPrice) {
            $dNetoTotal += $oPrice->getNettoPrice();
            $dVatTotal += $oPrice->getVatValue();
        }

        $oPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);

        if ($dNetoTotal) {
            $dVat = $dVatTotal * 100 / $dNetoTotal;

            $oPrice->setNettoPriceMode();
            $oPrice->setPrice($dNetoTotal);
            $oPrice->setVat($dVat);
        }

        return $oPrice;
    }
18529
public static function prices()
    {
        // Helper Class Exists
        if (isset(self::$PricesHelper)) {
            return self::$PricesHelper;
        }
        // Initialize Class
        self::$PricesHelper = new PricesHelper();
        // Return Helper Class
        return self::$PricesHelper;
    }
166324
public function GetBasePrice()
    {
        $dBasePrice = $this->GetFromInternalCache('dBasePrice');
        if (is_null($dBasePrice)) {
            $dBasePrice = false;
            $oUnitsOfMeasurement = $this->GetFieldShopUnitOfMeasurement();
            if ($oUnitsOfMeasurement) {
                $dBasePrice = $oUnitsOfMeasurement->GetBasePrice($this->dPrice, $this->fieldQuantityInUnits);
            }
            $this->SetInternalCache('dBasePrice', $dBasePrice);
        }

        return $dBasePrice;
    }
1322799
public function getTaxesAmount()
    {
        $taxesAmount = 0;

        /** @var \Argentum\Common\Tax $tax */
        foreach ($this->getTaxes() as $tax) {
            $taxesAmount += $tax->getAmount($tax->getBaseAmount());
        }

        return $taxesAmount;
    }
230029
public function getActualValue()
    {
        $val = $this->value + ($this->tax_included ? 0 : $this->tax_value);
        return (float) $val;
    }
285315
public function getShippingTotal(): int
    {
        $shippingTotal = $this->getAdjustmentsTotal(AdjustmentInterface::SHIPPING_ADJUSTMENT);
        $shippingTotal += $this->getAdjustmentsTotal(AdjustmentInterface::ORDER_SHIPPING_PROMOTION_ADJUSTMENT);
        $shippingTotal += $this->getAdjustmentsTotal(AdjustmentInterface::TAX_ADJUSTMENT);

        return $shippingTotal;
    }
1343508
public function getTax()
    {
        $rate = $this->taxRate / 100;
        $value = $this->price->multiply($rate);
        return $value;
    }
814420
protected function _calcPaymentCost()
    {
        // resetting values
        $oPaymentPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);

        // payment
        if (($this->_sPaymentId = $this->getPaymentId())) {
            $oPayment = oxNew(\OxidEsales\Eshop\Application\Model\Payment::class);
            $oPayment->load($this->_sPaymentId);

            $oPayment->calculate($this);
            $oPaymentPrice = $oPayment->getPrice();
        }

        return $oPaymentPrice;
    }