/** * Add extra amount which should be taxable by regular tax * * @param Mage_Sales_Model_Quote_Item_Abstract $item * @param float $value * @param float $baseValue * @param float $rowValue * @param float $baseRowValue * @return Mage_Weee_Model_Total_Quote_Weee */ protected function _processTaxSettings($item, $value, $baseValue, $rowValue, $baseRowValue) { if ($rowValue) { $this->_isTaxAffected = true; $item->unsRowTotalInclTax()->unsBaseRowTotalInclTax()->unsPriceInclTax()->unsBasePriceInclTax(); } if ($this->_helper->isTaxable($this->_store) && !$this->_helper->isTaxIncluded($this->_store) && $rowValue) { if (!$this->_helper->includeInSubtotal($this->_store)) { $item->setExtraTaxableAmount($value)->setBaseExtraTaxableAmount($baseValue)->setExtraRowTaxableAmount($rowValue)->setBaseExtraRowTaxableAmount($baseRowValue); } } return $this; }
/** * Calculate the Weee tax based on the discount and rate * * @param float $rate * @param Mage_Sales_Model_Quote_Item_Abstract $item * @param float $discountAmount * @param float $weeeAmountIncludingTax * @param float $weeeAmountExclTax * @return mixed */ private function _getWeeeTax($rate, $item, $discountAmount, $weeeAmountIncludingTax, $weeeAmountExclTax) { $isWeeeTaxAlreadyIncluded = $this->_weeeHelper->isTaxIncluded($this->_store); if ($rate == $this->_calculator->getStoreRateForItem($item) && $isWeeeTaxAlreadyIncluded) { if (!$discountAmount || $discountAmount <= 0) { //We want to skip the re calculation and return the difference return max($weeeAmountIncludingTax - $weeeAmountExclTax, 0); } else { return $this->_calculator->calcTaxAmount($weeeAmountIncludingTax - $discountAmount, $rate, true, true); } } $discountAmount = !$discountAmount ? 0 : $discountAmount; ///Regular case where weee does not have the tax and we want to calculate the tax return $this->_calculator->calcTaxAmount($weeeAmountExclTax - $discountAmount, $rate, false, true); }