Compute Subtotal
427098
def getSubtotal(self):
        
        if self.supplyorder_lineitems:
            return sum(
                [(Decimal(obj['Quantity']) * Decimal(obj['Price'])) for obj in self.supplyorder_lineitems])
        return 0
880561
def value(self, t):
        """"""
        fraction = min(float(t) / max(1, self.schedule_timesteps), 1.0)
        return self.initial_p + fraction * (self.final_p - self.initial_p)
896300
def sum(self, other):
        """"""
        return TimeSeries.merge(
            [self, other], operation=operations.ignorant_sum
        )
811109
def substract(self, pt):
        """"""
        if isinstance(pt, Point):
                return Point(pt.x - self.x, pt.y - self.y, pt.z - self.z)
        else:
            raise TypeError
498515
def get_and_subtract(self, delta):
        '''
        
        '''
        with self._lock.exclusive:
            oldval = self._value
            self._value -= delta
            return oldval
673792
def compute(self, base, precision=None):
        '''
        
        '''
        if base <= ZERO:
            return ZERO

        if self.rate_type == RATE_TYPE_FIXED:
            if not self.interval or base >= self.interval.lower:
                return quantize(self.rate, precision)
            return ZERO

        if not self.interval:
            return quantize(base * self.rate / 100, precision)

        if base > self.interval.lower:
            base = min(base, self.interval.upper) - self.interval.lower
            return quantize(base * self.rate / 100, precision)

        return ZERO
98425
public function getSubtotal()
    {
        $subtotal = 0;

        /** @var \Argentum\Common\Item $item */
        foreach ($this->getItems() as $item) {
            $subtotal += $item->getQuantity() * $item->getPrice();
        }

        return $subtotal;
    }
282978
public function getSubTotal()
    {
        $sub_total = 0;

        foreach ($this->getOrders() as $order)
        {
            $sub_total += $order->getSubTotal();
        }

        return $sub_total;
    }
907648
def subslice(inner,outer,section):
  ''
  # todo: think about constraints here. inner and outer ordered, inner[1] less than outer[1]-outer[0]
  # todo: this would make more sense as a member of a Slice class
  if section=='head': return outer[0],outer[0]+inner[0]
  elif section=='tail': return outer[0]+inner[1],outer[1]
  elif section=='middle': return outer[0]+inner[0],outer[0]+inner[1]
  else: raise ValueError('section val %s not one of (head,middle,tail)'%section)
653684
def average_price(quantity_1, price_1, quantity_2, price_2):
    """"""
    return (quantity_1 * price_1 + quantity_2 * price_2) / \
            (quantity_1 + quantity_2)
190845
def overall( self, node ):
        """"""
        return sum( [self.value(value,node) for value in self.children(node)] )
1068837
def getTotal(self):
        
        total = 0
        for lineitem in self.supplyorder_lineitems:
            total += Decimal(lineitem['Quantity']) * \
                     Decimal(lineitem['Price']) *  \
                     ((Decimal(lineitem['VAT']) /100) + 1)
        return total
321489
def _compute_value(power, wg):
    """"""
    if power not in wg:
        p1, p2 = power
        # y power
        if p1 == 0:
            yy = wg[(0, -1)]
            wg[power] = numpy.power(yy, p2 / 2).sum() / len(yy)
        # x power
        else:
            xx = wg[(-1, 0)]
            wg[power] = numpy.power(xx, p1 / 2).sum() / len(xx)
    return wg[power]
515302
def multiply(a, col):
    """"""
    a = a.reshape(4, 4, 4)
    col = col.reshape(4, 8)
    return fcat(
        rowxcol(a[0], col),
        rowxcol(a[1], col),
        rowxcol(a[2], col),
        rowxcol(a[3], col),
    )
382097
def sum(data, start=0):
    
    n, d = exact_ratio(start)
    T = type(start)
    partials = {d: n}  # map {denominator: sum of numerators}
    # Micro-optimizations.
    coerce_types_ = coerce_types
    exact_ratio_ = exact_ratio
    partials_get = partials.get
    # Add numerators for each denominator, and track the "current" type.
    for x in data:
        T = coerce_types_(T, type(x))
        n, d = exact_ratio_(x)
        partials[d] = partials_get(d, 0) + n
    if None in partials:
        assert issubclass(T, (float, Decimal))
        assert not isfinite(partials[None])
        return T(partials[None])
    total = Fraction()
    for d, n in sorted(partials.items()):
        total += Fraction(n, d)
    if issubclass(T, int):
        assert total.denominator == 1
        return T(total.numerator)
    if issubclass(T, Decimal):
        return T(total.numerator) / total.denominator
    return T(total)
943383
def _subtract(summary, o):
    """"""
    found = False
    row = [_repr(o), 1, _getsizeof(o)]
    for r in summary:
        if r[0] == row[0]:
            (r[1], r[2]) = (r[1] - row[1], r[2] - row[2])
            found = True
    if not found:
        summary.append([row[0], -row[1], -row[2]])
    return summary
721727
function subDWH(dxy, dwh) {
    if (dxy > 0) {
      return Math.max(dxy - dwh, 0);
    } else {
      return Math.min(dxy + dwh, 0);
    }
  }