2007-07-19 12:40:28 +02:00
|
|
|
<?php
|
2008-01-08 07:37:50 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @package sapphire
|
|
|
|
* @subpackage model
|
|
|
|
*/
|
|
|
|
|
2007-07-19 12:40:28 +02:00
|
|
|
/**
|
2008-01-08 07:37:50 +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-01-09 05:18:36 +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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|