shop-old/core/money.class.php
2026-04-20 01:03:43 +02:00

35 lines
839 B
PHP

<?php
class Money {
protected function __construct() {}
private function __clone() {}
public static function show_money($number) {
// $temp = number_format($number, 2, '.');
//
// return $temp;
return $number;
}
public static function get_price_with_taxes($price, $taxrate) {
$temp = Money::get_gross_price($price, $taxrate);
return $temp;
}
// get price without taxes from price with taxes and tax rate
public static function get_net_price($gross_price, $taxrate) {
$temp = number_format((float)$gross_price / ((float)(100 + $taxrate) / 100), 2, '.', '');
return $temp;
}
// get price with taxes from price without taxes and tax rate
public static function get_gross_price($net_price, $taxrate) {
$temp = number_format($net_price * (((float)(100 + $taxrate)) / 100.0 ), 2, '.', '');
return $temp;
}
}