aboutsummaryrefslogtreecommitdiff
path: root/classes/Calculatable.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/Calculatable.php')
-rw-r--r--classes/Calculatable.php18
1 files changed, 9 insertions, 9 deletions
diff --git a/classes/Calculatable.php b/classes/Calculatable.php
index 086adc2..5d60704 100644
--- a/classes/Calculatable.php
+++ b/classes/Calculatable.php
@@ -22,15 +22,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+define('CALCULATABLE_SUBTOTAL', 1);
+define('CALCULATABLE_VAT', 2);
+define('CALCULATABLE_TOTAL', 3);
+
/**
* The calculatable trait, to be used by something of which subtotal, VAT and
* total can be calculated
*/
trait Calculatable {
- const SUBTOTAL = 1;
- const VAT = 2;
- const TOTAL = 3;
-
/**
* Calculate the subtotal
*
@@ -61,7 +61,7 @@ trait Calculatable {
* VAT: the sum of all the VAT from all the assignments
* Total: the sum of subtotal and total
*
- * @param int $what Any of Calculatable::SUBTOTAL, Calculatable::VAT and Calculatable::TOTAL
+ * @param int $what Any of CALCULATABLE_SUBTOTAL, CALCULATABLE_VAT and CALCULATABLE_TOTAL
* @param int $round How many decimals to round the result on
* @param bool $format Whether to format the number nicely (for output) or not (for calculations)
*
@@ -69,16 +69,16 @@ trait Calculatable {
*
* @return float|bool The calculated value rounded to $round decimals, or false on incorrect input
*/
- public function calculate($what = self::TOTAL, $round = 2, $format = true) {
+ public function calculate($what = CALCULATABLE_TOTAL, $round = 2, $format = true) {
$return = 0;
switch ($what) {
- case self::SUBTOTAL:
+ case CALCULATABLE_SUBTOTAL:
$return = $this->calculateSubtotal();
break;
- case self::VAT:
+ case CALCULATABLE_VAT:
$return = $this->calculateVAT();
break;
- case self::TOTAL:
+ case CALCULATABLE_TOTAL:
$return = $this->calculateTotal();
break;
default: