fetches the shipping costs from the active shipping group.
9959
protected function RecalculateShipping()
    {
        $this->dCostShipping = 0;

        // validate shipping group - reset if not valid
        if (null !== $this->GetActiveShippingGroup()) {
            if (false === $this->SetActiveShippingGroup($this->GetActiveShippingGroup())) {
                $this->SetActiveShippingGroup(null);
            }
        }

        // if the basket contains a voucher that is set to free_shipping, then we keep costs to zero
        if (is_null($this->GetActiveVouchers()) || !$this->GetActiveVouchers()->HasFreeShippingVoucher()) {
            if (!is_null($this->GetActiveShippingGroup())) {
                $this->dCostShipping = $this->GetActiveShippingGroup()->GetShippingCostsForBasket();
            }
        }
    }
417384
public function getAmountValue($withShipping = true)
    {
        $result = 0;
        foreach ($this->_items as $item) {
            if ($withShipping || !$item->isShipping()) {
                $result += $item->getAmount();
            }
        }
        return $result;
    }
640101
public function SetActiveShippingGroup($oShippingGroup)
    {
        $bGroupAssigned = false;
        if (!is_null($oShippingGroup)) {
            $oAvailableShippingGroups = $this->GetAvailableShippingGroups();
            if (!is_null($oAvailableShippingGroups) && $oAvailableShippingGroups->IsInList($oShippingGroup->id)) {
                $bGroupAssigned = true;
                $this->oActiveShippingGroup = $oShippingGroup;

                // if a payment method is selected, then we need to make sure it is available for the selected shipping group.
                // since the SetActivePaymentmethod performs the check we call it.
                if (!is_null($this->GetActivePaymentMethod())) {
                    $this->SetActivePaymentMethod($this->GetActivePaymentMethod());
                }
            }
        } else {
            $this->oActiveShippingGroup = null;
            $this->SetActivePaymentMethod(null);
        }

        return $bGroupAssigned;
    }
1035379
public function getTaxCost()
    {
        $total = 0;

        foreach ($this->items as $item) {
            if ($item->TotalTax) {
                $total += $item->TotalTax;
            }
        }

        if ($this->postage && $this->postage->Cost && $this->postage->Tax) {
            $total += ($this->postage->Cost / 100) * $this->postage->Tax;
        }
        
        return $total;
    }
579327
public function getShipping()
    {
        return new ApiShipping(
            $this->entity->getShipping(),
            $this->locale,
            $this->itemFactory,
            $this->priceFormatter
        );
    }
1171261
private function getAllowedShippingCountriesRaw()
    {
        $allowedCountries = array_fill_keys($this->mainShipHelper->getMageShippingCountries(), []);
        $carriers         = $this->mainShipHelper->getActiveCarriers();
        $countries        = [];

        /**
         * @var AbstractCarrier $carrier
         */
        foreach ($carriers as $carrier) {
            /* skip shopgate cause its a container carrier */
            if ($carrier->getCarrierCode() === Shipping\Carrier\Shopgate::CODE) {
                continue;
            }

            /* if any carrier is using the allowed_countries collection, merge this into the result */
            if ($carrier->getConfigData('sallowspecific') === '0') {
                $countries = array_merge_recursive($countries, $allowedCountries);
                continue;
            }

            /* fetching active shipping targets from rates direct from the database */
            if ($carrier->getCarrierCode() === Shipping\Carrier\TableRate::CODE) {
                $collection    = $this->tableRate->getTableRateCollection();
                $countryHolder = [];

                /** @var Tablerate $rate */
                foreach ($collection as $rate) {
                    $countryHolder[$rate->getData('dest_country_id')][$rate->getData('dest_region') ? : 'All'] = true;
                }
                $countries = array_merge_recursive($countryHolder, $countries);
                continue;
            }

            $specificCountries = $carrier->getConfigData('specificcountry');
            $countries         = array_merge_recursive(
                $countries,
                array_fill_keys(explode(",", $specificCountries), [])
            );
        }

        foreach ($countries as $countryCode => $item) {
            if (!isset($allowedCountries[$countryCode])) {
                unset($countries[$countryCode]);
            }
        }

        return $countries;
    }
346375
protected function getAvailableTotals()
    {
        $sign = $this->getSign();
        if ($this->getType() === Source::Order) {
            $amount = $this->source->getTotalProductsWithoutTaxes()
                      + $this->source->total_shipping_tax_excl
                      + $this->source->total_wrapping_tax_excl
                      - $this->source->total_discounts_tax_excl;
            $amountInc = $this->source->getTotalProductsWithTaxes()
                         + $this->source->total_shipping_tax_incl
                         + $this->source->total_wrapping_tax_incl
                         - $this->source->total_discounts_tax_incl;
        } else {
            // On credit notes, the amount ex VAT will not have been corrected
            // for discounts that are subtracted from the refund. This will be
            // corrected later in getDiscountLinesCreditNote().
            $amount = $this->source->total_products_tax_excl
                      + $this->source->total_shipping_tax_excl;
            $amountInc = $this->source->total_products_tax_incl
                         + $this->source->total_shipping_tax_incl;
        }

        return array(
            Meta::InvoiceAmountInc => $sign * $amountInc,
            Meta::InvoiceAmount => $sign * $amount,
        );
    }
546788
protected function ProcessStep()
    {
        $bContinue = parent::ProcessStep();
        $oMsgManager = TCMSMessageManager::GetInstance();

        // we may continue only if a shipping group and payment method is set
        if ($bContinue && is_null($this->oActiveShippingGroup)) {
            $oMsgManager->AddMessage(self::MSG_SHIPPING_GROUP, 'ERROR-BASKET-NO-SHIPPING-GROUP');
            $bContinue = false;
        }
        if ($bContinue && is_null($this->oActivePaymentMethod)) {
            $oMsgManager->AddMessage(self::MSG_PAYMENT_METHOD, 'ERROR-BASKET-NO-PAYMENT-METHOD');
            $bContinue = false;
        }

        $oPaymentHandler = null;
        if ($bContinue) {
            // check payment method data
            $oPaymentHandler = &$this->oActivePaymentMethod->GetFieldShopPaymentHandler();
            $bContinue = $oPaymentHandler->ValidateUserInput();
        }

        if ($bContinue) {
            // set payment method and shipping group in basket
            $oBasket = TShopBasket::GetInstance();
            $oBasket->SetActiveShippingGroup($this->oActiveShippingGroup);
            $oBasket->SetActivePaymentMethod($this->oActivePaymentMethod);
            $oBasket->RecalculateBasket();
            $bContinue = $this->postSelectPaymentHook();

            // if things fail here, we need to redirect to the active step to clear our parameter list - and refresh the payment list
            if (false === $bContinue) {
                $this->JumpToStep($this);
            }
        }

        return $bContinue;
    }
395502
private function _getOrderTotal()
    {
        return array_reduce(
            $this->_orderShipments, 
            function($runningTotal, $item) {
                $runningTotal += $item->price;
                return $runningTotal;
            }
        );
    }
152854
private int getTotal(Class<?> clazz) {
        StringBuilder sql = new StringBuilder();
        sql.append(SQLUtils.getSelectCountSQL(clazz));
        sql.append(SQLUtils.autoSetSoftDeleted("", clazz));

        log(sql);
        long start = System.currentTimeMillis();
        int rows = jdbcTemplate.queryForObject(sql.toString(), Integer.class);

        long cost = System.currentTimeMillis() - start;
        logSlow(cost, sql.toString(), null);
        return rows;
    }
532936
def shipping_rate(context, **kwargs):
    
    settings = Configuration.for_site(context["request"].site)
    code = kwargs.get('code', None)
    name = kwargs.get('name', None)
    return get_shipping_cost(settings, code, name)
169241
def shipping_cost
      currency = 'USD'
      shipping = @contents.inject(0) { |total,item|
        total + item[:regular_shipping].to_i
      }.to_s
    end
1164361
def _cost_method(self, *args, **kwargs):
        

        return np.sum([operator.cost(data) for operator, data in
                       zip(self.operators, args[0])])
1167828
public function getPercentShipped(){
        if (isset($this->data['NumberOfItemsShipped']) && isset($this->data['NumberOfItemsUnshipped'])){
            $total = $this->data['NumberOfItemsShipped'] + $this->data['NumberOfItemsUnshipped'];
            
            if ($total == 0){
                return 0;
            }
            
            $ratio = $this->data['NumberOfItemsShipped'] / $total;
            return $ratio;
        } else {
            return false;
        }
    }
1314971
def get_item_prices(self, package_id):
        
        mask = 'mask[pricingLocationGroup[locations]]'

        prices = self.package_svc.getItemPrices(id=package_id, mask=mask)
        return prices
215914
public function totals()
    {
        setlocale(LC_MONETARY, config('cart_manager.LC_MONETARY'));

        $totals = ['Subtotal' => money_format('%n', $this->subtotal)];

        if ($this->discount > 0) {
            $totals['Discount'] = money_format('%n', $this->discount);
        }

        if ($this->shippingCharges > 0) {
            $totals['Shipping charges'] = money_format('%n', $this->shippingCharges);
        }

        if ($this->subtotal != $this->netTotal) {
            $totals['Net total'] = money_format('%n', $this->netTotal);
        }

        $totals['Tax'] = money_format('%n', $this->tax);

        if ($this->roundOff != 0) {
            $totals['Total'] = money_format('%n', $this->total);
            $totals['Round off'] = money_format('%n', $this->roundOff);
        }

        $totals['Payable'] = money_format('%n', $this->payable);

        return $totals;
    }
1024551
def PriceUnits(self):
		

		try:
			units = clc.v2.API.Call('GET','billing/%s/serverPricing/%s' % (self.alias,self.name),session=self.session)
		except clc.APIFailedResponse:
			raise(clc.ServerDeletedException)


		return({
				'cpu': units['cpu'],
				'memory': units['memoryGB'],
				'storage': units['storageGB'],
				'managed_os': units['managedOS'],
			})