|
|
@@ -10,7 +10,7 @@ |
|
|
|
* @returns {string} |
|
|
|
*/ |
|
|
|
function getPrice(priceWithTax, taxRate) { |
|
|
|
return numberTwoDecimals(parseFloat(parseFloat(priceWithTax) / (taxRate + 1))); |
|
|
|
return numberDecimals(parseFloat(parseFloat(priceWithTax) / (taxRate + 1)), 3); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@@ -21,11 +21,11 @@ function getPrice(priceWithTax, taxRate) { |
|
|
|
* @returns {string} |
|
|
|
*/ |
|
|
|
function getPriceWithTax(priceWithoutTax, taxRate) { |
|
|
|
return numberTwoDecimals(parseFloat(parseFloat(priceWithoutTax) * (taxRate + 1))); |
|
|
|
return numberDecimals(parseFloat(parseFloat(priceWithoutTax) * (taxRate + 1)), 2); |
|
|
|
} |
|
|
|
|
|
|
|
function numberTwoDecimals(num) { |
|
|
|
return Number(num).toFixed(2) ; |
|
|
|
function numberDecimals(num, decimals) { |
|
|
|
return Number(num).toFixed(decimals) ; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@@ -35,7 +35,7 @@ function numberTwoDecimals(num) { |
|
|
|
* @returns {string} |
|
|
|
*/ |
|
|
|
function formatPrice(price) { |
|
|
|
return Number(price).toFixed(2).replace('.', ',') + ' €'; |
|
|
|
return numberTwoDecimals(price).replace('.', ',') + ' €'; |
|
|
|
} |
|
|
|
|
|
|
|
/** |