isite 2021.12.5 → 2021.12.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -408,6 +408,43 @@
|
|
|
408
408
|
return parseFloat(n);
|
|
409
409
|
};
|
|
410
410
|
|
|
411
|
+
site.to_money = site.toMoney = function (_num, fixed) {
|
|
412
|
+
let n = 0;
|
|
413
|
+
if (_num) {
|
|
414
|
+
_num = _num.toFixed(2).split('.');
|
|
415
|
+
let n1 = _num[0];
|
|
416
|
+
let n2 = _num[1];
|
|
417
|
+
if (n2) {
|
|
418
|
+
let n3 = n2[0];
|
|
419
|
+
let n4 = n2[1];
|
|
420
|
+
if (n4 && parseInt(n4) > 5) {
|
|
421
|
+
n3 = parseInt(n3) + 1;
|
|
422
|
+
n3 = n3 * 10;
|
|
423
|
+
if (n3 == 100) {
|
|
424
|
+
n3 = 0;
|
|
425
|
+
_num[0] = parseInt(_num[0]) + 1;
|
|
426
|
+
_num[1] = '';
|
|
427
|
+
} else {
|
|
428
|
+
_num[1] = n3;
|
|
429
|
+
}
|
|
430
|
+
} else if (n4 && parseInt(n4) == 5) {
|
|
431
|
+
_num[1] = n2;
|
|
432
|
+
} else if (n4 && parseInt(n4) > 2) {
|
|
433
|
+
n4 = 5;
|
|
434
|
+
n3 = parseInt(n3);
|
|
435
|
+
n3 = n3 * 10;
|
|
436
|
+
_num[1] = n3 + n4;
|
|
437
|
+
} else {
|
|
438
|
+
n3 = parseInt(n3);
|
|
439
|
+
n3 = n3 * 10;
|
|
440
|
+
_num[1] = n3;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
n = _num.join('.');
|
|
444
|
+
}
|
|
445
|
+
return parseFloat(n);
|
|
446
|
+
};
|
|
447
|
+
|
|
411
448
|
site.to_float = site.toFloat = function (_num) {
|
|
412
449
|
if (_num) {
|
|
413
450
|
return parseFloat(_num);
|