  |
1 | 1 | | <?php |
| |
2 | 2 | | /* |
  |
3 | | - | $Id: currencies.php 410 2006-01-26 09:17:09Z hpdl $ |
| |
| 3 | + | $Id: currencies.php 554 2006-04-29 16:26:53Z hpdl $ |
|
4 | 4 | | |
| |
5 | 5 | | osCommerce, Open Source E-Commerce Solutions |
| |
6 | 6 | | http://www.oscommerce.com |
| |
|
|
 |
… |
|
49 | 49 | | return $this->currencies[$currency_code]['symbol_left'] . number_format(tep_round($number * $currency_value, $this->currencies[$currency_code]['decimal_places']), $this->currencies[$currency_code]['decimal_places'], $osC_Language->getNumericDecimalSeparator(), $osC_Language->getNumericThousandsSeparator()) . $this->currencies[$currency_code]['symbol_right']; |
| |
50 | 50 | | } |
| |
51 | 51 | | |
  |
| 52 | + | function formatRaw($number, $currency_code = '', $currency_value = '') { |
| |
| 53 | + | if (empty($currency_code) || ($this->exists($currency_code) == false)) { |
| |
| 54 | + | $currency_code = (isset($_SESSION['currency']) ? $_SESSION['currency'] : DEFAULT_CURRENCY); |
| |
| 55 | + | } |
| |
| 56 | + | |
| |
| 57 | + | if (empty($currency_value) || (is_numeric($currency_value) == false)) { |
| |
| 58 | + | $currency_value = $this->currencies[$currency_code]['value']; |
| |
| 59 | + | } |
| |
| 60 | + | |
| |
| 61 | + | return number_format(tep_round($number * $currency_value, $this->currencies[$currency_code]['decimal_places']), $this->currencies[$currency_code]['decimal_places'], '.', ''); |
| |
| 62 | + | } |
| |
| 63 | + | |
|
52 | 64 | | function displayPrice($price, $tax_class_id, $quantity = 1) { |
| |
53 | 65 | | global $osC_Tax; |
| |
54 | 66 | | |
| |
55 | 67 | | $price = tep_round($price, $this->currencies[DEFAULT_CURRENCY]['decimal_places']); |
| |
56 | 68 | | |
  |
57 | | - | if ( (DISPLAY_PRICE_WITH_TAX == 'true') && ($tax_class_id > 0) ) { |
| |
| 69 | + | if ( (DISPLAY_PRICE_WITH_TAX == '1') && ($tax_class_id > 0) ) { |
|
58 | 70 | | $price += tep_round($price * ($osC_Tax->getTaxRate($tax_class_id) / 100), $this->currencies[DEFAULT_CURRENCY]['decimal_places']); |
| |
59 | 71 | | } |
| |
60 | 72 | | |
| |
61 | 73 | | return $this->format($price * $quantity); |
| |
62 | 74 | | } |
| |
63 | 75 | | |
  |
| 76 | + | function displayPriceWithTaxRate($price, $tax_rate, $quantity = 1, $currency_code = '', $currency_value = '') { |
| |
| 77 | + | global $osC_Tax; |
| |
| 78 | + | |
| |
| 79 | + | $price = tep_round($price, $this->currencies[DEFAULT_CURRENCY]['decimal_places']); |
| |
| 80 | + | |
| |
| 81 | + | if ( (DISPLAY_PRICE_WITH_TAX == '1') && ($tax_rate > 0) ) { |
| |
| 82 | + | $price += tep_round($price * ($tax_rate / 100), $this->currencies[DEFAULT_CURRENCY]['decimal_places']); |
| |
| 83 | + | } |
| |
| 84 | + | |
| |
| 85 | + | return $this->format($price * $quantity, $currency_code, $currency_value); |
| |
| 86 | + | } |
| |
| 87 | + | |
  |
64 | 88 | | function exists($code) { |
| |
65 | 89 | | if (isset($this->currencies[$code])) { |
| |
66 | 90 | | return true; |