Products: 6
Taxable:  6
Value:    £146.95
Delivery: £27.96
Discount: £13.20
Tax:      £25.75
Subtotal: £156.72
Total:    £182.47

@return Basket
168998
public function six()
    {
        $basket = new Basket(new UnitedKingdom);

        $basket = $this->addProductZero($basket);
        $basket = $this->addProductThree($basket);
        $basket = $this->addProductSeven($basket);

        return $basket;
    }
432194
public function products(Basket $basket)
    {
        $products = [];

        foreach ($basket->products() as $product) {
            $products[] = [
                'sku'            => $product->sku,
                'name'           => $product->name,
                'price'          => $product->price,
                'rate'           => $product->rate,
                'quantity'       => $product->quantity,
                'freebie'        => $product->freebie,
                'taxable'        => $product->taxable,
                'delivery'       => $product->delivery,
                'coupons'        => $product->coupons,
                'tags'           => $product->tags,
                'discount'       => $product->discount,
                'attributes'     => $product->attributes,
                'category'       => $product->category,
                'total_value'    => $this->reconciler->value($product),
                'total_discount' => $this->reconciler->discount($product),
                'total_delivery' => $this->reconciler->delivery($product),
                'total_tax'      => $this->reconciler->tax($product),
                'subtotal'       => $this->reconciler->subtotal($product),
                'total'          => $this->reconciler->total($product)
            ];
        }

        return $products;
    }
985981
protected function getAvailableTotals()
    {
        $vatAmount = 0.0;
        // No order_tax_info => no tax (?) => vatamount = 0.
        if (!empty($this->source->order_tax_info)) {
            foreach ($this->source->order_tax_info as $taxInfo) {
                if (!empty($taxInfo->tax_amount)) {
                    $vatAmount += $taxInfo->tax_amount;
                }
            }
        }
        return array(
            Meta::InvoiceAmountInc => $this->source->order_full_price,
            Meta::InvoiceVatAmount => $vatAmount,
        );
    }
685691
public function one()
    {
        $sku     = '1';
        $name    = 'The 4-Hour Work Week';
        $rate    = new UnitedKingdomValueAddedTax;
        $price   = new Money(1500, new Currency('GBP'));
        $product = new Product($sku, $name, $price, $rate);
        $product->category(new PhysicalBook);

        return $product;
    }
848529
function itemsInfo()
    {
        $basketInfo = array();
        // Build a price summary for the items based on VAT.
        foreach ( $this->items() as $item )
        {
            $vatValue = $item['vat_value'];
            $itemCount = abs( $item['item_count'] );
            $priceExVAT = $item['price_ex_vat'];
            $priceIncVAT = $item['price_inc_vat'];
            $totalPriceExVAT = $item['total_price_ex_vat'];
            $totalPriceIncVAT = $item['total_price_inc_vat'];

            if ( !isset( $basketInfo['price_info'][$vatValue]['price_ex_vat'] ) )
            {
                $basketInfo['price_info'][$vatValue]['price_ex_vat'] = ( $priceExVAT * $itemCount );
                $basketInfo['price_info'][$vatValue]['price_inc_vat'] = ( $priceIncVAT * $itemCount );
                $basketInfo['price_info'][$vatValue]['price_vat'] = ( $priceIncVAT - $priceExVAT ) * $itemCount;

                $basketInfo['price_info'][$vatValue]['total_price_ex_vat'] = $totalPriceExVAT;
                $basketInfo['price_info'][$vatValue]['total_price_inc_vat'] = $totalPriceIncVAT;
                $basketInfo['price_info'][$vatValue]['total_price_vat'] = $totalPriceIncVAT - $totalPriceExVAT;
            }
            else
            {
                $basketInfo['price_info'][$vatValue]['price_ex_vat'] += ( $priceExVAT * $itemCount );
                $basketInfo['price_info'][$vatValue]['price_inc_vat'] += ( $priceIncVAT * $itemCount );
                $basketInfo['price_info'][$vatValue]['price_vat'] += ( $priceIncVAT - $priceExVAT ) * $itemCount;

                $basketInfo['price_info'][$vatValue]['total_price_ex_vat'] += $totalPriceExVAT;
                $basketInfo['price_info'][$vatValue]['total_price_inc_vat'] += $totalPriceIncVAT;
                $basketInfo['price_info'][$vatValue]['total_price_vat'] += ( $totalPriceIncVAT - $totalPriceExVAT );
            }

            if ( !isset( $basketInfo['total_price_info']['total_price_ex_vat'] ) )
            {
                $basketInfo['total_price_info']['price_ex_vat'] = ( $priceExVAT * $itemCount );
                $basketInfo['total_price_info']['price_inc_vat'] = ( $priceIncVAT * $itemCount );
                $basketInfo['total_price_info']['price_vat'] = ( ( $priceIncVAT - $priceExVAT ) * $itemCount );

                $basketInfo['total_price_info']['total_price_ex_vat'] = $totalPriceExVAT;
                $basketInfo['total_price_info']['total_price_inc_vat'] = $totalPriceIncVAT;
                $basketInfo['total_price_info']['total_price_vat'] = ( $totalPriceIncVAT - $totalPriceExVAT );
            }
            else
            {
                $basketInfo['total_price_info']['price_ex_vat'] += ( $priceExVAT * $itemCount );
                $basketInfo['total_price_info']['price_inc_vat'] += ( $priceIncVAT * $itemCount );
                $basketInfo['total_price_info']['price_vat'] += ( ( $priceIncVAT - $priceExVAT ) * $itemCount );

                $basketInfo['total_price_info']['total_price_ex_vat'] += $totalPriceExVAT;
                $basketInfo['total_price_info']['total_price_inc_vat'] += $totalPriceIncVAT;
                $basketInfo['total_price_info']['total_price_vat'] += ( $totalPriceIncVAT - $totalPriceExVAT );
            }
        }

        // Add shipping cost to the total items price and add / update additional price information.
        $productCollectionID = $this->attribute( 'productcollection_id' );

        // Add additional calculated information to the basketInfo array, that can be used in the template.
        $shippingUpdateStatus = eZShippingManager::updatePriceInfo( $productCollectionID, $basketInfo );

        ksort( $basketInfo['price_info'] );
        return $basketInfo;
    }
752905
public function getSumOfCostOfAllItemsPayPalBasket()
    {
        // basket items sum
        $allCosts = $this->getProductsPrice()->getSum($this->isCalculationModeNetto());

        //adding to additional costs only if payment is > 0
        if (($costs = $this->getPayPalPaymentCosts()) > 0) {
            $allCosts += $costs;
        }

        // wrapping costs
        $allCosts += $this->getPayPalWrappingCosts();

        // greeting card costs
        $allCosts += $this->getPayPalGiftCardCosts();

        return $allCosts;
    }
46230
public function getPayPalBasketVatValue()
    {
        $basketVatValue = 0;
        $basketVatValue += $this->getPayPalProductVat();
        $basketVatValue += $this->getPayPalWrappingVat();
        $basketVatValue += $this->getPayPalGiftCardVat();
        $basketVatValue += $this->getPayPalPayCostVat();

        if ($this->getDeliveryCosts() < round($this->getDeliveryCosts(), 2)) {
            return floor($basketVatValue * 100) / 100;
        }

        return $basketVatValue;
    }
169463
public function getSubtotalInclTax()
    {
        $cart = Mage::getModel('checkout/cart');
        $subtotal = 0;
        $totals = $cart->getQuote()->getTotals();
        // calculate subtotal from grand total and shipping
        // ignore Magento tax config, add tax to shipping depending on country
        $total = $shipping = 0;
        if(isset($totals['grand_total']) && $totals['grand_total']->getValue()) {
          $total = $totals["grand_total"]->getValue();
        }
        if(isset($totals['shipping']) && $totals['shipping']->getValue()) {
          $shipping = $totals["shipping"]->getValue(); 
          $address = $cart->getQuote()->getShippingAddress();
          $shipping = Mage::helper('tax')->getShippingPrice($shipping, true, $address);
        }
        $subtotal = $total - $shipping;
        return $subtotal;
    }
688134
public function getDiscountedProductsBruttoPrice()
    {
        if ($oProductsPrice = $this->getDiscountProductsPrice()) {
            $dPrice = $oProductsPrice->getBruttoSum();
        }

        // subtracting total discount
        if ($oPrice = $this->getTotalDiscount()) {
            $dPrice -= $oPrice->getBruttoPrice();
        }

        if ($oVoucherPrice = $this->getVoucherDiscount()) {
            $dPrice -= $oVoucherPrice->getBruttoPrice();
        }

        return $dPrice;
    }
925825
private function subTotalPrice()
    {
        return $this->items->sum(function ($item) {
            return bcmul($item['price'], $item['ammount'], $this->decimals);
        });
    }
282978
public function getSubTotal()
    {
        $sub_total = 0;

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

        return $sub_total;
    }
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;
    }
126068
public function seven()
    {
        $sku     = '7';
        $name    = 'Kettlebell';
        $rate    = new UnitedKingdomValueAddedTax;
        $price   = new Money(3299, new Currency('GBP'));
        $product = new Product($sku, $name, $price, $rate);
        $product->quantity(4);
        $product->discount(new PercentageDiscount(10));
        $product->delivery(new Money(699, new Currency('GBP')));

        return $product;
    }
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;
	}
446276
public function total()
    {
        return (float) array_sum(
            array_map(function (CartItem $item) {
                return $item->getTotalPrice();
            }, $this->items)
        );
    }
573687
public function four()
    {
        $sku     = '4';
        $name    = 'MacBook Air';
        $rate    = new UnitedKingdomValueAddedTax;
        $price   = new Money(99999, new Currency('GBP'));
        $product = new Product($sku, $name, $price, $rate);
        $product->discount(new PercentageDiscount(10));

        return $product;
    }
845041
public function four()
    {
        $basket = new Basket(new UnitedKingdom);

        $basket = $this->addProductSeven($basket);
        $basket = $this->addProductEight($basket);

        return $basket;
    }