return the amount of the voucher used up in previous orders.

@return float
512703
public function GetValuePreviouslyUsed()
    {
        // we have to make sure that is value is accurate... so we will fetch it from database every time
        // performance should not be a big issue, since it only affects users that include a voucher in their basket
        $dValueUsed = 0;
        $query = "SELECT SUM(`value_used`) AS totalused
                  FROM `shop_voucher_use`
            INNER JOIN `shop_order` ON `shop_voucher_use`.`shop_order_id` = `shop_order`.`id`
                 WHERE `shop_voucher_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
                   AND `shop_order`.`canceled` = '0'
                 ";
        if ($aValue = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
            if (null !== $aValue['totalused']) {
                $dValueUsed = $aValue['totalused'];
            }
        }

        return $dValueUsed;
    }
1248719
public function getPaymorrowTotalAmount()
    {
        /** @var OxpsPaymorrowOxBasket|oxBasket $this */

        $dTotalPrice = (double) $this->getPrice()->getPrice();

        // Add surcharge price in case it is not yet included in basket
        $oSurchargePrice = $this->_getPaymentMethodSurcharge();

        if ( !empty( $oSurchargePrice ) and is_object( $oSurchargePrice ) ) {
            $dTotalPrice += (double) $oSurchargePrice->getPrice();
        }

        return $dTotalPrice;
    }
1002669
protected function extractCharging()
    {
        $lot_result = [];

        $count = count($this->registries) - 1;
        for ($lot_id = 1; $lot_id < $count; $lot_id++) {
            $buffer = [];
            $registry = $this->registries[$lot_id][2];

            foreach (static::CHARGING_TYPES as $type) {
                $count = "${type}_count";
                $total = "${type}_total";

                $buffer = array_merge(
                    $buffer,
                    [
                        $count => (int) $registry->{$count},
                        $total => (float) ($registry->{$total} / 100.0),
                    ]
                );
            }
            $buffer['warning'] = (int) $registry->warning;

            $lot_result[] = $buffer;
        }

        $result = array_shift($lot_result);
        foreach ($lot_result as $arr) {
            foreach ($arr as $key => $val) {
                $result[$key] += $val;
            }
        };

        return $result;
    }
1057501
public function getBasketTotal()
    {
        $total = $this->find()
            ->where([
                'id_user' => $this->idUser,
                'storage' => $this->owner->storageName
            ])
            ->sum('count');

        return ($total) ? $total : 0;
    }
219897
public function getDiscount()
    {
        $amount = 0;
        $cart = ShoppingCart::get();
        $items = $cart->TotalItems;
        $discount = $cart->getDiscount();
        
        if ($this->BasePrice && $discount && $discount->Amount) {
            if ($discount->Type == "Fixed") {
                $amount = ($discount->Amount / $items) * $this->Quantity;
            } elseif ($discount->Type == "Percentage") {
                $amount = (($this->Price / 100) * $discount->Amount) * $this->Quantity;
            }
        }
        
        return $amount;
    }
395502
private function _getOrderTotal()
    {
        return array_reduce(
            $this->_orderShipments, 
            function($runningTotal, $item) {
                $runningTotal += $item->price;
                return $runningTotal;
            }
        );
    }
1350082
public function getLineItemTotal()
    {
        $amount = 0;

        foreach ($this->getLineItems() as $lineItem)
        {
            $amount += ($lineItem->getPrice()*$lineItem->getQuantity());
        }

        return $amount;
    }
1191475
protected function _getVoucherSerie()
    {
        if ($this->_oVoucherSerie == null) {
            $oVoucherSerie = oxNew(\OxidEsales\Eshop\Application\Model\VoucherSerie::class);
            $sId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("voucherid");
            if ($oVoucherSerie->load($sId ? $sId : \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("voucherid"))) {
                $this->_oVoucherSerie = $oVoucherSerie;
            }
        }

        return $this->_oVoucherSerie;
    }
85899
public function getFormattedTotalVouchers()
    {
        return \OxidEsales\Eshop\Core\Registry::getLang()->formatCurrency($this->oxorder__oxvoucherdiscount->value, $this->getOrderCurrency());
    }
925843
public function getDiscountSumPayPalBasket()
    {
        // collect discounts
        $discount = 0.0;

        $totalDiscount = $this->getTotalDiscount();

        if ($totalDiscount) {
            $discount += $totalDiscount->getBruttoPrice();
        }

        //if payment costs are negative, adding them to discount
        if (($costs = $this->getPaymentCosts()) < 0) {
            $discount += ($costs * -1);
        }

        // vouchers..
        $vouchers = (array) $this->getVouchers();
        foreach ($vouchers as $voucher) {
            $discount += round($voucher->dVoucherdiscount, 2);
        }

        return $discount;
    }
118118
public function getSubTotal()
    {
        $total = $this->UnitPrice * $this->Quantity;

        $this->extend("updateSubTotal", $total);

        return $total;
    }
789419
public function getUsedDepth(): int
    {
        $maxDepth = 0;

        /** @var PackedItem $item */
        foreach ($this->items as $item) {
            $maxDepth = max($maxDepth, $item->getZ() + $item->getDepth());
        }

        return $maxDepth;
    }
799476
public function getItemCount()
    {
        if (null === $this->itemCount) {
            $this->itemCount = (int) $this->paginator->count();
        }

        return $this->itemCount;
    }
1309923
public function getOrderItemsCount()
    {
        if (\Yii::$app->user->isGuest) {
            $session = \Yii::$app->session;
            return count($session[self::SESSION_KEY]);
        } else {
            $order = Order::find()->where(['user_id' => \Yii::$app->user->id, 'status' => OrderStatus::STATUS_INCOMPLETE])->one();
            if (!empty($order)) {
                $count = OrderProduct::find()->asArray()->where(['order_id' => $order->id])->count();

            } else $count = 0;

        }
        return $count;
    }
186393
public function getUnsold()
    {
        $items = Auth::user()->items()
            ->with('purchases')
            ->where(function ($query) {
                $query->has('purchases', 0)
                    ->where('end_date', '<', time())
                    ->where('auction', false)
                    ->orWhere(function ($query) {
                        $query->where('auction', true)
                            ->where('end_date', '<', time())
                            ->where('winning_bid_id', 0);
                    });
            });

        $table = new InventoryUnsold($items);

        return view('mustard::inventory.unsold', [
            'table' => $table,
            'items' => $table->paginate(),
        ]);
    }
1006515
public function getPaymorrowTotalVatAmount()
    {
        /** @var OxpsPaymorrowOxBasket|oxBasket $this */

        // Products VAT
        $dTotalVat = (double) array_sum( (array) $this->getProductVats( false ) );

        // Get cost and add costs VATs
        $aCosts = (array) $this->getCosts();

        foreach ( $aCosts as $oPrice ) {
            $dTotalVat += (double) $this->_getVatForValidPrice( $oPrice );
        }

        // Add surcharge VAT amount in case it is not yet included in basket
        $dTotalVat += (double) $this->_getVatForValidPrice( $this->_getPaymentMethodSurcharge() );

        return $dTotalVat;
    }
804583
public function getPayPalGiftCardCosts()
    {
        $amount = 0.0;

        $giftCardCost = $this->getCosts('oxgiftcard');
        if ($giftCardCost) {
            $amount = $this->isCalculationModeNetto() ? $giftCardCost->getNettoPrice() : $giftCardCost->getBruttoPrice();
        }

        return $amount;
    }