  |
1 | 1 | | <?php |
| |
2 | 2 | | /* |
  |
3 | | - | $Id: currencies.php 538 2006-04-27 16:53:59Z hpdl $ |
| |
| 3 | + | $Id: currencies.php 733 2006-08-20 15:32:32Z hpdl $ |
|
4 | 4 | | |
| |
5 | 5 | | osCommerce, Open Source E-Commerce Solutions |
| |
6 | 6 | | http://www.oscommerce.com |
| |
|
|
 |
… |
|
46 | 46 | | $currency_value = $this->currencies[$currency_code]['value']; |
| |
47 | 47 | | } |
| |
48 | 48 | | |
  |
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']; |
| |
| 49 | + | return $this->currencies[$currency_code]['symbol_left'] . number_format(osc_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 | 52 | | function formatRaw($number, $currency_code = '', $currency_value = '') { |
| |
|
|
 |
… |
|
58 | 58 | | $currency_value = $this->currencies[$currency_code]['value']; |
| |
59 | 59 | | } |
| |
60 | 60 | | |
  |
61 | | - | return number_format(tep_round($number * $currency_value, $this->currencies[$currency_code]['decimal_places']), $this->currencies[$currency_code]['decimal_places'], '.', ''); |
| |
| 61 | + | return number_format(osc_round($number * $currency_value, $this->currencies[$currency_code]['decimal_places']), $this->currencies[$currency_code]['decimal_places'], '.', ''); |
|
62 | 62 | | } |
| |
63 | 63 | | |
  |
64 | | - | function displayPrice($price, $tax_class_id, $quantity = 1) { |
| |
| 64 | + | function formatRawWithTaxRate($price, $tax_rate, $quantity = 1, $currency_code = '', $currency_value = '') { |
|
65 | 65 | | global $osC_Tax; |
| |
66 | 66 | | |
  |
67 | | - | $price = tep_round($price, $this->currencies[DEFAULT_CURRENCY]['decimal_places']); |
| |
| 67 | + | $price = osc_round($price, $this->currencies[DEFAULT_CURRENCY]['decimal_places']); |
|
68 | 68 | | |
  |
| 69 | + | if ( (DISPLAY_PRICE_WITH_TAX == '1') && ($tax_rate > 0) ) { |
| |
| 70 | + | $price += osc_round($price * ($tax_rate / 100), $this->currencies[DEFAULT_CURRENCY]['decimal_places']); |
| |
| 71 | + | } |
| |
| 72 | + | |
| |
| 73 | + | return $this->formatRaw($price * $quantity, $currency_code, $currency_value); |
| |
| 74 | + | } |
| |
| 75 | + | |
| |
| 76 | + | function displayPrice($price, $tax_class_id, $quantity = 1, $currency_code = null, $currency_value = null) { |
| |
| 77 | + | global $osC_Tax; |
| |
| 78 | + | |
| |
| 79 | + | $price = osc_round($price, $this->currencies[DEFAULT_CURRENCY]['decimal_places']); |
| |
| 80 | + | |
|
69 | 81 | | if ( (DISPLAY_PRICE_WITH_TAX == '1') && ($tax_class_id > 0) ) { |
  |
70 | | - | $price += tep_round($price * ($osC_Tax->getTaxRate($tax_class_id) / 100), $this->currencies[DEFAULT_CURRENCY]['decimal_places']); |
| |
| 82 | + | $price += osc_round($price * ($osC_Tax->getTaxRate($tax_class_id) / 100), $this->currencies[DEFAULT_CURRENCY]['decimal_places']); |
|
71 | 83 | | } |
| |
72 | 84 | | |
  |
73 | | - | return $this->format($price * $quantity); |
| |
| 85 | + | return $this->format($price * $quantity, $currency_code, $currency_value); |
|
74 | 86 | | } |
| |
75 | 87 | | |
| |
76 | 88 | | function displayPriceWithTaxRate($price, $tax_rate, $quantity = 1, $currency_code = '', $currency_value = '') { |
| |
77 | 89 | | global $osC_Tax; |
| |
78 | 90 | | |
  |
79 | | - | $price = tep_round($price, $this->currencies[DEFAULT_CURRENCY]['decimal_places']); |
| |
| 91 | + | $price = osc_round($price, $this->currencies[DEFAULT_CURRENCY]['decimal_places']); |
|
80 | 92 | | |
| |
81 | 93 | | if ( (DISPLAY_PRICE_WITH_TAX == '1') && ($tax_rate > 0) ) { |
  |
82 | | - | $price += tep_round($price * ($tax_rate / 100), $this->currencies[DEFAULT_CURRENCY]['decimal_places']); |
| |
| 94 | + | $price += osc_round($price * ($tax_rate / 100), $this->currencies[DEFAULT_CURRENCY]['decimal_places']); |
  |
83 | 95 | | } |
| |
84 | 96 | | |
| |
85 | 97 | | return $this->format($price * $quantity, $currency_code, $currency_value); |