Retorna o valor da parcela
@param  float   $total
@param  integer $parcela
@param  float   $taxa
@return float
347848
public static function getValorParcela($total, $parcela, $taxa) {
        if (!is_numeric($total) || $total <= 0) {
            return (false);
        }
        if ((int) $parcela != $parcela) {
            return (false);
        }
        if (!is_numeric($taxa) || $taxa < 0) {
            return (false);
        }

        $taxa = $taxa / 100;

        $denominador = 0;
        if ($parcela > 1) {
            for ($i = 1; $i <= $parcela; $i++) {
                $denominador += 1 / pow(1 + $taxa, $i);
            }
        } else {
            $denominador = 1;
        }

        //echo "<br>";
        return ($total / $denominador);
    }
356178
public function collect(
        Quote $quote,
        ShippingAssignmentInterface $shippingAssignment,
        Total $total
    ) {
        parent::collect($quote, $shippingAssignment, $total);

        $baseInterest = (float) $quote->getBaseGabrielqsInstallmentsInterestAmount();
        $interest = (float) $quote->getGabrielqsInstallmentsInterestAmount();

        $total->addTotalAmount('gabrielqs_installments_interest_amount', $interest);
        $total->addBaseTotalAmount('gabrielqs_installments_interest_amount', $baseInterest);

        $total->setBaseGrandTotal($total->getBaseGrandTotal() + $baseInterest);
        $total->setGrandTotal($total->getGrandTotal() + $interest);

        return $this;
    }
1029410
protected function calculatePriceRules(&$total, array &$data, array &$components)
    {
        $options = array(
            'status' => 1,
            'store_id' => $data['order']['store_id']
        );

        $code = null;

        if (isset($data['order']['data']['pricerule_code'])) {
            $code = $data['order']['data']['pricerule_code'];
        }

        foreach ($this->price_rule->getTriggered($data, $options) as $price_rule) {

            if ($price_rule['code'] !== '' && !isset($code)) {
                $components[$price_rule['price_rule_id']] = array('rule' => $price_rule, 'price' => 0);
                continue;
            }

            if (isset($code) && !$this->priceRuleCodeMatches($price_rule['price_rule_id'], $code)) {
                $components[$price_rule['price_rule_id']] = array('rule' => $price_rule, 'price' => 0);
                continue;
            }

            $this->price_rule->calculate($total, $data, $components, $price_rule);
        }
    }
191175
public function calculate(&$total, $data, &$components, array $price_rule)
    {
        try {
            $callback = Handler::get($this->getTypes(), $price_rule['value_type'], 'calculate');
            call_user_func_array($callback, array(&$total, &$components, $price_rule, $data));
        } catch (Exception $ex) {
            trigger_error($ex->getMessage());
        }
    }
1089836
public function getUnitTax()
    {
        $total = ($this->UnitPrice / 100) * $this->TaxRate;

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

        return $total;
    }
1011122
protected function fact($n, $total = 1)
    {
        return (2 > $n) ? $total : $this->fact($n - 1, $total * $n);
    }
88688
public static function calcularParcelamento($capital, $taxa, $tempo, $semjuros) {
        $parcelamento = array();
        for ($i = 1; $i <= $tempo; $i++) {
            $m = $capital * pow((1 + $taxa / 100), $i);
            if ($i <= $semjuros) {
                $parcelamento[$i] = array(
                    'parcela' => self::formataValor(($capital / $i), '.', 2, ',', '.'),
                    'total' => self::formataValor($capital, '.', 2, ',', '.'),
                    'status' => 'sem juros'
                );
            } else {
                $parcelamento[$i] = array(
                    'parcela' => self::formataValor(($m / $i), '.', 2, ',', '.'),
                    'total' => self::formataValor($m, '.', 2, ',', '.'),
                    'status' => 'com juros'
                );
            }
        }

        return $parcelamento;
    }
1114078
public function total()
    {
        $total = array_reduce($this->examples, function($x, $e) {
            $x += $e instanceof Example ? 1 : $e->total();
            return $x;
        }, 0);

        return $total;
    }
806057
public function tax($decimals = null, $decimalPoint = null, $thousandSeperator = null)
    {
        $content = $this->getContent();

        $tax = $content->reduce(function ($tax, CartItem $cartItem) {
            return $tax + ($cartItem->qty * $cartItem->tax);
        }, 0);

        return $this->numberFormat($tax, $decimals, $decimalPoint, $thousandSeperator);
    }
872203
public function total_pages( $limit = null, $offset = null, $total = null ) {

		$this->do_hook( 'total_pages' );

		if ( null === $limit ) {
			$limit = $this->limit;
		}

		if ( null === $offset ) {
			$offset = $this->offset;
		}

		if ( null === $total ) {
			$total = $this->total_found();
		}

		return ceil( ( $total - $offset ) / $limit );

	}
98048
public function total(array $condition, array $data)
    {
        if (!isset($data['cart']['total']) || empty($data['cart']['currency'])) {
            return false;
        }

        $condition_value = explode('|', reset($condition['value']), 2);
        $condition_currency = $data['cart']['currency'];

        if (!empty($condition_value[1])) {
            $condition_currency = $condition_value[1];
        }

        $condition_value[0] = $this->price->amount($condition_value[0], $condition_currency);
        $value = $this->currency->convert($condition_value[0], $condition_currency, $data['cart']['currency']);

        return $this->compare($data['cart']['total'], $value, $condition['operator']);
    }
955082
public function getAmount($format = true, $withTax = false)
    {
        $total = $this->amount;

        if ($withTax) {
            $total += $this->tax * $total;
        }

        return LaraCart::formatMoney($total, $this->locale, $this->internationalFormat, $format);
    }
1003398
public function getTotal()
    {
        return (float)($this->valorDocumento + $this->taxa + $this->outrosAcrescimos) - ($this->desconto + $this->outrasDeducoes);
    }
249998
public function calculatePercentage($pointDifference, $total)
    {
        $upCount = 1000000;

        if($pointDifference > 0 and $total > 0)
            return round((100 * $pointDifference * $upCount ) / ($total * $upCount)) ;
        else
            return '0';
    }
1156951
public function setTotal($total)
    {
        $this->total = (int)$total;
        $this->setPages(ceil($total / $this->limit));

        return $this;
    }
351535
public function totalPrice()
	{
		$total = 0;
		$products = $this->content();
		foreach ($products as $product) {
			$total += ($product->qty * $product->price);
		}
		$total = ($total + ($total * ($this->taxRate/100)));
		$total += $this->deliveryCharges;
		return $total;
	}
1052427
public function totalPrice()
    {
        $total = 0;

        $cart = $this->getCart();

        if ($cart->isEmpty()) {
            return $total;
        }

        foreach ($cart as $row) {
            $total += $row->qty * $row->price;
        }

        return $total;
    }