Re-using subtotal calculation from Mage_Checkout_Block_Cart_Sidebar

@return decimal subtotal amount including tax
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;
    }
1321898
public function calculateTotal()
    {
        $this->total = $this->getItemsTotal() + $this->getAdjustmentTotal();

        if ($this->total < 0) {
            $this->total = 0;
        }

        return $this;
    }
1193724
public function total($format = true, $withDiscount = true, $withTax = true, $withFees = true)
    {
        $total = $this->subTotal(false);

        if ($withFees) {
            $total += $this->feeTotals(false);
        }

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

        if ($withTax) {
            $total += $this->taxTotal(false, $withFees, false);
        }

        return $this->formatMoney($total, null, null, $format);
    }
374088
public function getDiscount()
    {
        $discount = 0.00;

        $coupons = $this->facade->getCurrentCoupons();

        if (\count($coupons) > 0) {
            $couponsKept = $this->sortCoupons($coupons);

            $discount = $this->getEffect($couponsKept);

            // Just In Case test
            $checkoutTotalPrice = $this->facade->getCartTotalTaxPrice();

            if ($discount >= $checkoutTotalPrice) {
                $discount = $checkoutTotalPrice;
            }
        }

        return $discount;
    }
1343508
public function getTax()
    {
        $rate = $this->taxRate / 100;
        $value = $this->price->multiply($rate);
        return $value;
    }
821716
public function getGrandTotalAttribute()
    {
        if (!$this->deliveryOption) return $this->total;

        return (float) round($this->total + $this->deliveryOption->price, 2);
    }
1167045
public function getSubTotal()
    {
        $total = 0;

        // Calculate total from items in the list
        foreach ($this->Items() as $item) {
            $total += $item->SubTotal;
        }
        
        $this->extend("updateSubTotal", $total);

        return $total;
    }
895007
public function getTotalTax()
    {
        $amount = 0;

        if ($this->Price && $this->TaxRate && $this->Quantity) {
            $amount = ((($this->Price * $this->Quantity) - $this->Discount) / 100) * $this->TaxRate;
        }
        
        return $amount;
    }
592889
public function getAmount(): float
    {
        $amounts = $this->map(
            function (CalculatedTax $calculatedTax) {
                return $calculatedTax->getTax();
            }
        );

        return array_sum($amounts);
    }
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;
    }
422286
public function totalExcludingTax()
    {
        return (float) array_sum(
            array_map(function (CartItem $item) {
                return $item->getTotalPriceExcludingTax();
            }, $this->items)
        );
    }
658603
public function getShippingMethodAmount()
    {
        $address = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress();
        $amount = $address->getShippingAmount();
        return Mage::helper('tax')->getShippingPrice($amount, true, $address);
    }
446276
public function total()
    {
        return (float) array_sum(
            array_map(function (CartItem $item) {
                return $item->getTotalPrice();
            }, $this->items)
        );
    }
1089836
public function getUnitTax()
    {
        $total = ($this->UnitPrice / 100) * $this->TaxRate;

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

        return $total;
    }
819604
public function getTaxTotal(): int
    {
        $taxTotal = 0;

        foreach ($this->getAdjustments(AdjustmentInterface::TAX_ADJUSTMENT) as $taxAdjustment) {
            $taxTotal += $taxAdjustment->getAmount();
        }
        foreach ($this->items as $item) {
            $taxTotal += $item->getTaxTotal();
        }

        return $taxTotal;
    }
799146
public function getTotal()
    {
        $content = $this->getContent();

        $total = $content->reduce(function (Money $total, CartItem $cartItem) {
            return $total->add($cartItem->getTotal());
        }, new Money(0, Config::get('shoppingcart.currency')));

        return $total;
    }
1081996
protected function getDiscountPriceWithoutTaxValueAttribute()
    {
        $fPrice = TaxHelper::instance()->getPriceWithoutTax($this->discount_price_value, $this->tax_percent);

        return $fPrice;
    }