public function getTotal($discounted = true)
    {
        $base = $this->base;

        if ($discounted && $this->hasDiscounts()) {
            foreach ($this->discounts as $discount) {
                $base -= $this->calculateAdjustment($discount, $base);
            }
        }

        $total = $base;

        if (!empty($this->taxes) && $this->mode === VatDisplayModes::MODE_ATI) {
            foreach ($this->taxes as $tax) {
                $total += $this->calculateAdjustment($tax, $base);
            }
        }

        return $total;
    }