Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Tax_Block_Adminhtml_Frontend_Region_Updater
  • Mage_Tax_Block_Checkout_Discount
  • Mage_Tax_Block_Checkout_Grandtotal
  • Mage_Tax_Block_Checkout_Shipping
  • Mage_Tax_Block_Checkout_Subtotal
  • Mage_Tax_Block_Checkout_Tax
  • Mage_Tax_Block_Sales_Order_Tax
  • Mage_Tax_Helper_Data
  • Mage_Tax_Model_Calculation
  • Mage_Tax_Model_Calculation_Rate
  • Mage_Tax_Model_Calculation_Rate_Title
  • Mage_Tax_Model_Calculation_Rule
  • Mage_Tax_Model_Class
  • Mage_Tax_Model_Class_Source_Customer
  • Mage_Tax_Model_Class_Source_Product
  • Mage_Tax_Model_Config
  • Mage_Tax_Model_Config_Price_Include
  • Mage_Tax_Model_Mysql4_Calculation
  • Mage_Tax_Model_Mysql4_Calculation_Collection
  • Mage_Tax_Model_Mysql4_Calculation_Rate
  • Mage_Tax_Model_Mysql4_Calculation_Rate_Collection
  • Mage_Tax_Model_Mysql4_Calculation_Rate_Title
  • Mage_Tax_Model_Mysql4_Calculation_Rate_Title_Collection
  • Mage_Tax_Model_Mysql4_Calculation_Rule
  • Mage_Tax_Model_Mysql4_Calculation_Rule_Collection
  • Mage_Tax_Model_Mysql4_Class
  • Mage_Tax_Model_Mysql4_Class_Collection
  • Mage_Tax_Model_Mysql4_Report_Collection
  • Mage_Tax_Model_Mysql4_Report_Tax
  • Mage_Tax_Model_Mysql4_Report_Updatedat_Collection
  • Mage_Tax_Model_Mysql4_Sales_Order_Tax
  • Mage_Tax_Model_Mysql4_Sales_Order_Tax_Collection
  • Mage_Tax_Model_Mysql4_Setup
  • Mage_Tax_Model_Observer
  • Mage_Tax_Model_Resource_Calculation
  • Mage_Tax_Model_Resource_Calculation_Collection
  • Mage_Tax_Model_Resource_Calculation_Rate
  • Mage_Tax_Model_Resource_Calculation_Rate_Collection
  • Mage_Tax_Model_Resource_Calculation_Rate_Title
  • Mage_Tax_Model_Resource_Calculation_Rate_Title_Collection
  • Mage_Tax_Model_Resource_Calculation_Rule
  • Mage_Tax_Model_Resource_Calculation_Rule_Collection
  • Mage_Tax_Model_Resource_Class
  • Mage_Tax_Model_Resource_Class_Collection
  • Mage_Tax_Model_Resource_Report_Collection
  • Mage_Tax_Model_Resource_Report_Tax
  • Mage_Tax_Model_Resource_Report_Tax_Createdat
  • Mage_Tax_Model_Resource_Report_Tax_Updatedat
  • Mage_Tax_Model_Resource_Report_Updatedat_Collection
  • Mage_Tax_Model_Resource_Sales_Order_Tax
  • Mage_Tax_Model_Resource_Sales_Order_Tax_Collection
  • Mage_Tax_Model_Resource_Sales_Order_Tax_Item
  • Mage_Tax_Model_Resource_Sales_Order_Tax_Item_Collection
  • Mage_Tax_Model_Resource_Setup
  • Mage_Tax_Model_Sales_Order_Tax
  • Mage_Tax_Model_Sales_Order_Tax_Item
  • Mage_Tax_Model_Sales_Pdf_Grandtotal
  • Mage_Tax_Model_Sales_Pdf_Shipping
  • Mage_Tax_Model_Sales_Pdf_Subtotal
  • Mage_Tax_Model_Sales_Pdf_Tax
  • Mage_Tax_Model_Sales_Total_Quote_Discount
  • Mage_Tax_Model_Sales_Total_Quote_Nominal_Subtotal
  • Mage_Tax_Model_Sales_Total_Quote_Nominal_Tax
  • Mage_Tax_Model_Sales_Total_Quote_Shipping
  • Mage_Tax_Model_Sales_Total_Quote_Subtotal
  • Mage_Tax_Model_Sales_Total_Quote_Tax
  • Mage_Tax_Model_System_Config_Source_Algorithm
  • Mage_Tax_Model_System_Config_Source_Apply
  • Mage_Tax_Model_System_Config_Source_PriceType
  • Mage_Tax_Model_System_Config_Source_Tax_Country
  • Mage_Tax_Model_System_Config_Source_Tax_Display_Type
  • Mage_Tax_Model_System_Config_Source_Tax_Region

Exceptions

  • Mage_Tax_Exception
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_Tax
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: /**
 28:  * Tax Calculation Model
 29:  *
 30:  * @author Magento Core Team <core@magentocommerce.com>
 31:  */
 32: class Mage_Tax_Model_Calculation extends Mage_Core_Model_Abstract
 33: {
 34:     const CALC_TAX_BEFORE_DISCOUNT_ON_EXCL      = '0_0';
 35:     const CALC_TAX_BEFORE_DISCOUNT_ON_INCL      = '0_1';
 36:     const CALC_TAX_AFTER_DISCOUNT_ON_EXCL       = '1_0';
 37:     const CALC_TAX_AFTER_DISCOUNT_ON_INCL       = '1_1';
 38: 
 39:     const CALC_UNIT_BASE                        = 'UNIT_BASE_CALCULATION';
 40:     const CALC_ROW_BASE                         = 'ROW_BASE_CALCULATION';
 41:     const CALC_TOTAL_BASE                       = 'TOTAL_BASE_CALCULATION';
 42: 
 43:     protected $_rates                           = array();
 44:     protected $_ctc                             = array();
 45:     protected $_ptc                             = array();
 46: 
 47:     protected $_rateCache                       = array();
 48:     protected $_rateCalculationProcess          = array();
 49: 
 50:     protected $_customer                        = null;
 51:     protected $_defaultCustomerTaxClass         = null;
 52: 
 53:     protected function _construct()
 54:     {
 55:         $this->_init('tax/calculation');
 56:     }
 57: 
 58:     /**
 59:      * Specify customer object which can be used for rate calculation
 60:      *
 61:      * @param   Mage_Customer_Model_Customer $customer
 62:      * @return  Mage_Tax_Model_Calculation
 63:      */
 64:     public function setCustomer(Mage_Customer_Model_Customer $customer)
 65:     {
 66:         $this->_customer = $customer;
 67:         return $this;
 68:     }
 69: 
 70:     public function getDefaultCustomerTaxClass($store = null)
 71:     {
 72:         if ($this->_defaultCustomerTaxClass === null) {
 73:             $defaultCustomerGroup = Mage::helper('customer')->getDefaultCustomerGroupId($store);
 74:             $this->_defaultCustomerTaxClass = Mage::getModel('customer/group')->getTaxClassId($defaultCustomerGroup);
 75:         }
 76:         return $this->_defaultCustomerTaxClass;
 77:     }
 78: 
 79:     /**
 80:      * Get customer object
 81:      *
 82:      * @return  Mage_Customer_Model_Customer | false
 83:      */
 84:     public function getCustomer()
 85:     {
 86:         if ($this->_customer === null) {
 87:             $session = Mage::getSingleton('customer/session');
 88:             if ($session->isLoggedIn()) {
 89:                 $this->_customer = $session->getCustomer();
 90:             } elseif ($session->getCustomerId()) {
 91:                 $this->_customer = Mage::getModel('customer/customer')->load($session->getCustomerId());
 92:             } else {
 93:                 $this->_customer = false;
 94:             }
 95:         }
 96:         return $this->_customer;
 97:     }
 98: 
 99:     /**
100:      * Delete calculation settings by rule id
101:      *
102:      * @param   int $ruleId
103:      * @return  Mage_Tax_Model_Calculation
104:      */
105:     public function deleteByRuleId($ruleId)
106:     {
107:         $this->_getResource()->deleteByRuleId($ruleId);
108:         return $this;
109:     }
110: 
111:     /**
112:      * Get calculation rates by rule id
113:      *
114:      * @param   int $ruleId
115:      * @return  array
116:      */
117:     public function getRates($ruleId)
118:     {
119:         if (!isset($this->_rates[$ruleId])) {
120:             $this->_rates[$ruleId] = $this->_getResource()->getDistinct('tax_calculation_rate_id', $ruleId);
121:         }
122:         return $this->_rates[$ruleId];
123:     }
124: 
125:     /**
126:      * Get allowed customer tax classes by rule id
127:      *
128:      * @param   int $ruleId
129:      * @return  array
130:      */
131:     public function getCustomerTaxClasses($ruleId)
132:     {
133:         if (!isset($this->_ctc[$ruleId])) {
134:             $this->_ctc[$ruleId] = $this->_getResource()->getDistinct('customer_tax_class_id', $ruleId);
135:         }
136:         return $this->_ctc[$ruleId];
137:     }
138: 
139:     /**
140:      * Get allowed product tax classes by rule id
141:      *
142:      * @param   int $ruleId
143:      * @return  array
144:      */
145:     public function getProductTaxClasses($ruleId)
146:     {
147:         if (!isset($this->_ptc[$ruleId])) {
148:             $this->_ptc[$ruleId] = $this->getResource()->getDistinct('product_tax_class_id', $ruleId);
149:         }
150:         return $this->_ptc[$ruleId];
151:     }
152: 
153:     /**
154:      * Aggregate tax calculation data to array
155:      *
156:      * @return array
157:      */
158:     protected function _formCalculationProcess()
159:     {
160:         $title = $this->getRateTitle();
161:         $value = $this->getRateValue();
162:         $id = $this->getRateId();
163: 
164:         $rate = array('code'=>$title, 'title'=>$title, 'percent'=>$value, 'position'=>1, 'priority'=>1);
165: 
166:         $process = array();
167:         $process['percent'] = $value;
168:         $process['id'] = "{$id}-{$value}";
169:         $process['rates'][] = $rate;
170: 
171:         return array($process);
172:     }
173: 
174:     /**
175:      * Get calculation tax rate by specific request
176:      *
177:      * @param   Varien_Object $request
178:      * @return  float
179:      */
180:     public function getRate($request)
181:     {
182:         if (!$request->getCountryId() || !$request->getCustomerClassId() || !$request->getProductClassId()) {
183:             return 0;
184:         }
185: 
186:         $cacheKey = $this->_getRequestCacheKey($request);
187:         if (!isset($this->_rateCache[$cacheKey])) {
188:             $this->unsRateValue();
189:             $this->unsCalculationProcess();
190:             $this->unsEventModuleId();
191:             Mage::dispatchEvent('tax_rate_data_fetch', array('request'=>$request));
192:             if (!$this->hasRateValue()) {
193:                 $rateInfo = $this->_getResource()->getRateInfo($request);
194:                 $this->setCalculationProcess($rateInfo['process']);
195:                 $this->setRateValue($rateInfo['value']);
196:             } else {
197:                 $this->setCalculationProcess($this->_formCalculationProcess());
198:             }
199:             $this->_rateCache[$cacheKey] = $this->getRateValue();
200:             $this->_rateCalculationProcess[$cacheKey] = $this->getCalculationProcess();
201:         }
202:         return $this->_rateCache[$cacheKey];
203:     }
204: 
205:     /**
206:      * Get cache key value for specific tax rate request
207:      *
208:      * @param   $request
209:      * @return  string
210:      */
211:     protected function _getRequestCacheKey($request)
212:     {
213:         $key = $request->getStore() ? $request->getStore()->getId() . '|' : '';
214:         $key.= $request->getProductClassId() . '|' . $request->getCustomerClassId() . '|'
215:             . $request->getCountryId() . '|'. $request->getRegionId() . '|' . $request->getPostcode();
216:         return $key;
217:     }
218: 
219:     /**
220:      * Get tax rate based on store shipping origin address settings
221:      * This rate can be used for conversion store price including tax to
222:      * store price excluding tax
223:      *
224:      * @param   Varien_Object $request
225:      * @return  float
226:      */
227:     public function getStoreRate($request, $store=null)
228:     {
229:         $storeRequest = $this->getRateOriginRequest($store)
230:             ->setProductClassId($request->getProductClassId());
231:         return $this->getRate($storeRequest);
232:     }
233: 
234:     /**
235:      * Get request object for getting tax rate based on store shippig original address
236:      *
237:      * @param   null|store $store
238:      * @return  Varien_Object
239:      */
240:     public function getRateOriginRequest($store = null)
241:     {
242:         $request = new Varien_Object();
243:         $request->setCountryId(Mage::getStoreConfig(Mage_Shipping_Model_Config::XML_PATH_ORIGIN_COUNTRY_ID, $store))
244:             ->setRegionId(Mage::getStoreConfig(Mage_Shipping_Model_Config::XML_PATH_ORIGIN_REGION_ID, $store))
245:             ->setPostcode(Mage::getStoreConfig(Mage_Shipping_Model_Config::XML_PATH_ORIGIN_POSTCODE, $store))
246:             ->setCustomerClassId($this->getDefaultCustomerTaxClass($store))
247:             ->setStore($store);
248:         return $request;
249:     }
250: 
251:     /**
252:      * Get request object with information necessary for getting tax rate
253:      * Request object contain:
254:      *  country_id (->getCountryId())
255:      *  region_id (->getRegionId())
256:      *  postcode (->getPostcode())
257:      *  customer_class_id (->getCustomerClassId())
258:      *  store (->getStore())
259:      *
260:      * @param   null|false|Varien_Object $shippingAddress
261:      * @param   null|false|Varien_Object $billingAddress
262:      * @param   null|int $customerTaxClass
263:      * @param   null|int $store
264:      * @return  Varien_Object
265:      */
266:     public function getRateRequest(
267:         $shippingAddress = null,
268:         $billingAddress = null,
269:         $customerTaxClass = null,
270:         $store = null)
271:     {
272:         if ($shippingAddress === false && $billingAddress === false && $customerTaxClass === false) {
273:             return $this->getRateOriginRequest($store);
274:         }
275:         $address    = new Varien_Object();
276:         $customer   = $this->getCustomer();
277:         $basedOn    = Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_BASED_ON, $store);
278: 
279:         if (($shippingAddress === false && $basedOn == 'shipping')
280:             || ($billingAddress === false && $basedOn == 'billing')) {
281:             $basedOn = 'default';
282:         } else {
283:             if ((($billingAddress === false || is_null($billingAddress) || !$billingAddress->getCountryId())
284:                 && $basedOn == 'billing')
285:                 || (($shippingAddress === false || is_null($shippingAddress) || !$shippingAddress->getCountryId())
286:                 && $basedOn == 'shipping')
287:             ){
288:                 if ($customer) {
289:                     $defBilling = $customer->getDefaultBillingAddress();
290:                     $defShipping = $customer->getDefaultShippingAddress();
291: 
292:                     if ($basedOn == 'billing' && $defBilling && $defBilling->getCountryId()) {
293:                         $billingAddress = $defBilling;
294:                     } else if ($basedOn == 'shipping' && $defShipping && $defShipping->getCountryId()) {
295:                         $shippingAddress = $defShipping;
296:                     } else {
297:                         $basedOn = 'default';
298:                     }
299:                 } else {
300:                     $basedOn = 'default';
301:                 }
302:             }
303:         }
304: 
305:         switch ($basedOn) {
306:             case 'billing':
307:                 $address = $billingAddress;
308:                 break;
309:             case 'shipping':
310:                 $address = $shippingAddress;
311:                 break;
312:             case 'origin':
313:                 $address = $this->getRateOriginRequest($store);
314:                 break;
315:             case 'default':
316:                 $address
317:                     ->setCountryId(Mage::getStoreConfig(
318:                         Mage_Tax_Model_Config::CONFIG_XML_PATH_DEFAULT_COUNTRY,
319:                         $store))
320:                     ->setRegionId(Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_DEFAULT_REGION, $store))
321:                     ->setPostcode(Mage::getStoreConfig(
322:                         Mage_Tax_Model_Config::CONFIG_XML_PATH_DEFAULT_POSTCODE,
323:                         $store));
324:                 break;
325:         }
326: 
327:         if (is_null($customerTaxClass) && $customer) {
328:             $customerTaxClass = $customer->getTaxClassId();
329:         } elseif (($customerTaxClass === false) || !$customer) {
330:             $customerTaxClass = $this->getDefaultCustomerTaxClass($store);
331:         }
332: 
333:         $request = new Varien_Object();
334:         $request
335:             ->setCountryId($address->getCountryId())
336:             ->setRegionId($address->getRegionId())
337:             ->setPostcode($address->getPostcode())
338:             ->setStore($store)
339:             ->setCustomerClassId($customerTaxClass);
340:         return $request;
341:     }
342: 
343:     /**
344:      * Compare data and rates for two tax rate requests for same products (product tax class ids).
345:      * Returns true if requests are similar (i.e. equal taxes rates will be applied to them)
346:      *
347:      * Notice:
348:      * a) productClassId MUST be identical for both requests, because we intend to check selling SAME products to DIFFERENT locations
349:      * b) due to optimization productClassId can be array of ids, not only single id
350:      *
351:      * @param   Varien_Object $first
352:      * @param   Varien_Object $second
353:      * @return  bool
354:      */
355:     public function compareRequests($first, $second)
356:     {
357:         $country = $first->getCountryId() == $second->getCountryId();
358:         // "0" support for admin dropdown with --please select--
359:         $region  = (int)$first->getRegionId() == (int)$second->getRegionId();
360:         $postcode= $first->getPostcode() == $second->getPostcode();
361:         $taxClass= $first->getCustomerClassId() == $second->getCustomerClassId();
362: 
363:         if ($country && $region && $postcode && $taxClass) {
364:             return true;
365:         }
366:         /**
367:          * Compare available tax rates for both requests
368:          */
369:         $firstReqRates = $this->_getResource()->getRateIds($first);
370:         $secondReqRates = $this->_getResource()->getRateIds($second);
371:         if ($firstReqRates === $secondReqRates) {
372:             return true;
373:         }
374: 
375:         /**
376:          * If rates are not equal by ids then compare actual values
377:          * All product classes must have same rates to assume requests been similar
378:          */
379:         $productClassId1 = $first->getProductClassId(); // Save to set it back later
380:         $productClassId2 = $second->getProductClassId(); // Save to set it back later
381: 
382:         // Ids are equal for both requests, so take any of them to process
383:         $ids = is_array($productClassId1) ? $productClassId1 : array($productClassId1);
384:         $identical = true;
385:         foreach ($ids as $productClassId) {
386:             $first->setProductClassId($productClassId);
387:             $rate1 = $this->getRate($first);
388: 
389:             $second->setProductClassId($productClassId);
390:             $rate2 = $this->getRate($second);
391: 
392:             if ($rate1 != $rate2) {
393:                 $identical = false;
394:                 break;
395:             }
396:         }
397: 
398:         $first->setProductClassId($productClassId1);
399:         $second->setProductClassId($productClassId2);
400: 
401:         return $identical;
402:     }
403: 
404:     protected function _getRates($request, $fieldName, $type)
405:     {
406:         $result = array();
407:         $classes = Mage::getModel('tax/class')->getCollection()
408:             ->addFieldToFilter('class_type', $type)
409:             ->load();
410:         foreach ($classes as $class) {
411:             $request->setData($fieldName, $class->getId());
412:             $result[$class->getId()] = $this->getRate($request);
413:         }
414: 
415:         return $result;
416:     }
417: 
418:     public function getRatesForAllProductTaxClasses($request)
419:     {
420:         return $this->_getRates($request, 'product_class_id', Mage_Tax_Model_Class::TAX_CLASS_TYPE_PRODUCT);
421:     }
422:     public function getRatesForAllCustomerTaxClasses($request)
423:     {
424:         return $this->_getRates($request, 'customer_class_id', Mage_Tax_Model_Class::TAX_CLASS_TYPE_CUSTOMER);
425:     }
426: 
427:     /**
428:      * Get information about tax rates applied to request
429:      *
430:      * @param   Varien_Object $request
431:      * @return  array
432:      */
433:     public function getAppliedRates($request)
434:     {
435:         $cacheKey = $this->_getRequestCacheKey($request);
436:         if (!isset($this->_rateCalculationProcess[$cacheKey])) {
437:             $this->_rateCalculationProcess[$cacheKey] = $this->_getResource()->getCalculationProcess($request);
438:         }
439:         return $this->_rateCalculationProcess[$cacheKey];
440:     }
441: 
442:     public function reproduceProcess($rates)
443:     {
444:         return $this->getResource()->getCalculationProcess(null, $rates);
445:     }
446: 
447:     public function getRatesByCustomerTaxClass($customerTaxClass)
448:     {
449:         return $this->getResource()->getRatesByCustomerTaxClass($customerTaxClass);
450:     }
451: 
452:     public function getRatesByCustomerAndProductTaxClasses($customerTaxClass, $productTaxClass)
453:     {
454:         return $this->getResource()->getRatesByCustomerTaxClass($customerTaxClass, $productTaxClass);
455:     }
456: 
457:     /**
458:      * Calculate rated tax abount based on price and tax rate.
459:      * If you are using price including tax $priceIncludeTax should be true.
460:      *
461:      * @param   float $price
462:      * @param   float $taxRate
463:      * @param   boolean $priceIncludeTax
464:      * @return  float
465:      */
466:     public function calcTaxAmount($price, $taxRate, $priceIncludeTax=false, $round=true)
467:     {
468:         $taxRate = $taxRate/100;
469: 
470:         if ($priceIncludeTax) {
471:             $amount = $price*(1-1/(1+$taxRate));
472:         } else {
473:             $amount = $price*$taxRate;
474:         }
475: 
476:         if ($round) {
477:             return $this->round($amount);
478:         }
479: 
480:         return $amount;
481:     }
482: 
483:     /**
484:      * Truncate number to specified precision
485:      *
486:      * @param   float $price
487:      * @param   int $precision
488:      * @return  float
489:      */
490:     public function truncate($price, $precision=4)
491:     {
492:         $exp = pow(10,$precision);
493:         $price = floor($price*$exp)/$exp;
494:         return $price;
495:     }
496: 
497:     /**
498:      * Round tax amount
499:      *
500:      * @param   float $price
501:      * @return  float
502:      */
503:     public function round($price)
504:     {
505:         return Mage::app()->getStore()->roundPrice($price);
506:     }
507: 
508:     /**
509:      * Round price up
510:      *
511:      * @param   float $price
512:      * @return  float
513:      */
514:     public function roundUp($price)
515:     {
516:         return ceil($price*100)/100;
517:     }
518: }
519: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0