mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 01:28:19 +01:00
Use color on the amount of the payment page of TakePOS module
FIX Use pricejs instead of toFixed to be compatible with all currencies WIP Prepare to be able to enter different payment modes on same invoice
This commit is contained in:
@@ -1009,6 +1009,25 @@ function getParameterByName(name, valueifnotfound)
|
||||
function dolroundjs(number, decimals) { return +(Math.round(number + "e+" + decimals) + "e-" + decimals); }
|
||||
|
||||
|
||||
/**
|
||||
* Function similar to PHP price()
|
||||
*
|
||||
* @param {number|string} amount The amount to show
|
||||
* @param {string} mode 'MT' or 'MU'
|
||||
* @return {string} The amount with digits
|
||||
*/
|
||||
function pricejs(amount, mode) {
|
||||
var main_max_dec_shown = <?php echo (int) str_replace('.', '', $conf->global->MAIN_MAX_DECIMALS_SHOWN); ?>;
|
||||
var main_rounding_unit = <?php echo (int) $conf->global->MAIN_MAX_DECIMALS_UNIT; ?>;
|
||||
var main_rounding_tot = <?php echo (int) $conf->global->MAIN_MAX_DECIMALS_TOT; ?>;
|
||||
|
||||
console.log(amount);
|
||||
|
||||
if (mode == 'MU') return amount.toFixed(main_rounding_unit);
|
||||
if (mode == 'MT') return amount.toFixed(main_rounding_tot);
|
||||
return 'Bad value for parameter mode';
|
||||
}
|
||||
|
||||
/**
|
||||
* Function similar to PHP price2num()
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user