subtract.

@param \Akaunting\Money\Money $subtrahend

@throws \InvalidArgumentException

@return \Akaunting\Money\Money
325751
public function subtract(self $subtrahend)
    {
        $this->assertSameCurrency($subtrahend);

        return new self($this->amount - $subtrahend->amount, $this->currency);
    }
628760
public static function subtractSecond($ts = null, $num = 1)
	{
		return sfTime::subtract($ts, $num, sfTime::SECOND);
	}
1099251
public function add(MoneyContainer $money) : MoneyBag
    {
        foreach ($money->getAmounts() as $currencyCode => $amount) {
            $this->amounts[$currencyCode] = $this->getAmount($currencyCode)->plus($amount);
        }

        return $this;
    }
726496
public function add(MoneyInterface $money)
    {
        if ($this->currency !== $money->getCurrency()) {
            throw new CurrencyMismatchException('Operations between different currencies are not supported');
        }

        $this->amount = $this->toInt($this->amount + $money->getAmount());
        return $this;
    }
333250
public BigDecimal subtract(BigDecimal subtrahend) {
        if (this.intCompact != INFLATED) {
            if ((subtrahend.intCompact != INFLATED)) {
                return add(this.intCompact, this.scale, -subtrahend.intCompact, subtrahend.scale);
            } else {
                return add(this.intCompact, this.scale, subtrahend.intVal.negate(), subtrahend.scale);
            }
        } else {
            if ((subtrahend.intCompact != INFLATED)) {
                // Pair of subtrahend values given before pair of
                // values from this BigDecimal to avoid need for
                // method overloading on the specialized add method
                return add(-subtrahend.intCompact, subtrahend.scale, this.intVal, this.scale);
            } else {
                return add(this.intVal, this.scale, subtrahend.intVal.negate(), subtrahend.scale);
            }
        }
    }
1212330
public function setTotalPrice(Money $money = null): OrderInterface
    {
        $this->totalPrice = $money->getAmount();

        return $this;
    }
100612
func (m *Money) Subtract(om *Money) (*Money, error) {
	if err := m.assertSameCurrency(om); err != nil {
		return nil, err
	}

	return &Money{amount: mutate.calc.subtract(m.amount, om.amount), currency: m.currency}, nil
}
955166
public function negate(MoneyInterface $money)
    {
        if ($this->isZero($money)) {
            return $money;
        } else {
            return $this->mul($money, '-1');
        }
    }
1092375
public function subTotal($format = true, $withDiscount = true, $taxedItemsOnly = false, $withTax = false)
    {
        $total = $this->price(false, $taxedItemsOnly) * $this->qty;

        if ($withDiscount) {
            $total -= $this->getDiscount(false);
        }

        if ($total < 0) {
            $total = 0;
        }

        if ($withTax) {
            $total += $this->tax(0, false, false, $withDiscount);
        }

        return LaraCart::formatMoney($total, $this->locale, $this->internationalFormat, $format);
    }
1056891
public function add(Money $money)
    {
        if (!$this->currency->equals($money->getCurrency())) {
            throw new CurrencyMismatchException($this.' does not match '.$money);
        }

        $amount = bcadd($this->amount, $money->getAmount(), self::BCSCALE);

        return self::valueOf($amount, $this->currency);
    }
1146002
public function ratioOf(Money $money)
    {
        if ($money->isZero()) {
            throw new \InvalidArgumentException('Cannot calculate a ratio of zero');
        }

        return $this->getCalculator()->divide($this->amount, $money->amount);
    }
141066
public function subtractDays($days)
    {
        $days = (int) $days;
        $days = -$days;
        return $this->addDays($days);
    }
280044
public function subtract(Money $other)
    {
        $other = $other->convertToCurrency($this->currency);
        $this->assertSameCurrency($this, $other);

        $value = $this->amount - $other->getAmount();

        $this->assertIsFloat($value);

        return $this->newMoney($value);
    }
208869
public static function sub($n1, $n2, $round = false)
    {
        $difference = bcsub($n1, $n2, self::$scale);

        return $round ? self::round($difference) : (float)$difference;
    }
432404
public static function subtract2(& $arg1, $arg2, $scale = null) : string {
		$arg1 = self::subtract($arg1, $arg2, $scale);
		return $arg1;
	}
679998
public function subtract($b)
    {
        switch (true) {
            case $b instanceof Matrix:
                $c = $this->subtractMatrix($b);
                break;

            case $b instanceof ColumnVector:
                $c = $this->subtractColumnVector($b);
                break;
                
            case $b instanceof Vector:
                $c = $this->subtractVector($b);
                break;

            case is_int($b) or is_float($b):
                $c = $this->subtractScalar($b);
                break;

            default:
                throw new InvalidArgumentException('Cannot subtract a '
                    . gettype($b) . ' from a matrix.');
        }

        return $c;
    }
1262663
public function minus(Decimal $that) : Decimal
    {
        $this->scaleValues($this, $that, $a, $b);

        $value = $a - $b;

        if (is_float($value)) {
            throw new \RangeException('The subtraction result overflows.');
        }

        $scale = max($this->scale, $that->scale);

        while ($scale !== 0) {
            if ($value % 10 !== 0) {
                break;
            }

            $value /= 10;
            $scale--;
        }

        return new Decimal($value, $scale);
    }