2007-07-19 12:40:28 +02:00
|
|
|
<?php
|
2008-02-25 03:10:37 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @package sapphire
|
|
|
|
* @subpackage model
|
|
|
|
*/
|
|
|
|
|
2007-07-19 12:40:28 +02:00
|
|
|
/**
|
2008-02-25 03:10:37 +01:00
|
|
|
* Represents a decimal field containing a currency amount.
|
2007-07-19 12:40:28 +02:00
|
|
|
* Currency the currency class only supports single currencies.
|
2008-02-25 03:10:37 +01:00
|
|
|
* @package sapphire
|
|
|
|
* @subpackage model
|
2007-07-19 12:40:28 +02:00
|
|
|
*/
|
|
|
|
class Currency extends Decimal {
|
|
|
|
|
|
|
|
function Nice() {
|
|
|
|
// return "<span title=\"$this->value\">$" . number_format($this->value, 2) . '</span>';
|
|
|
|
return '$' . number_format($this->value, 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
function Whole() {
|
|
|
|
return '$' . number_format($this->value, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
function setValue($value) {
|
|
|
|
$this->value = ereg_replace('[^0-9.]+','', $value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|