This commit is contained in:
Sergey Shuchkin 2022-12-15 00:13:39 +06:00
parent 80091bb9be
commit 6d7608f8ca
1 changed files with 7 additions and 6 deletions

View File

@ -747,15 +747,16 @@ class SimpleXLSXGen
if (strlen($m[2]) < 3) { if (strlen($m[2]) < 3) {
$N = self::N_DEC; $N = self::N_DEC;
} }
} elseif (preg_match('/^(\$)?[-+]?[0-9\.]+( ₽| €)?$/u', $v, $m)) { // currency? } elseif (preg_match('/^\$[-+]?[0-9\.]+$/', $v)) { // currency $?
if ($m[1] === '$') { $N = self::N_DOLLAR;
$N = self::N_DOLLAR; $cv = ltrim($v, '+$');
} elseif ($m[2] === ' ₽') { } elseif (preg_match('/^[-+]?[0-9\.]+( ₽| €)$/u', $v, $m)) { // currency ₽ €?
if ($m[1] === ' ₽') {
$N = self::N_RUB; $N = self::N_RUB;
} elseif ($m[2] === ' €') { } elseif ($m[1] === ' €') {
$N = self::N_EURO; $N = self::N_EURO;
} }
$cv = trim($v, ' +$₽€'); $cv = trim($v, ' +₽€');
} elseif (preg_match('/^([-+]?\d+)%$/', $v, $m)) { } elseif (preg_match('/^([-+]?\d+)%$/', $v, $m)) {
$cv = round($m[1] / 100, 2); $cv = round($m[1] / 100, 2);
$N = self::N_PERCENT_INT; // [9] 0% $N = self::N_PERCENT_INT; // [9] 0%