No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

35 líneas
1.0KB

  1. export class SovPrices {
  2. static getPrice(priceWithTax, taxRate) {
  3. return parseFloat(parseFloat(priceWithTax) / ((taxRate/100) + 1)).toFixed(4);
  4. }
  5. static getPriceWithTax(priceWithoutTax, taxRate) {
  6. return parseFloat(parseFloat(priceWithoutTax) * ((taxRate/100) + 1)).toFixed(2);
  7. }
  8. static getMargin(price, buyingPrice){
  9. return parseFloat(price - buyingPrice).toFixed(2);
  10. }
  11. static getMarginPercent(price, buyingPrice){
  12. return parseFloat(((price - buyingPrice) / price) * 100).toFixed(2);
  13. }
  14. static applyReductionPercent(price, percentage)
  15. {
  16. return this.applyPercent(price, -percentage);
  17. }
  18. static applyReductionAmount(price, amount)
  19. {
  20. return parseFloat(price - amount).toFixed(2);
  21. }
  22. static applyPercent(price, percentage)
  23. {
  24. return parseFloat(price * (percentage / 100 + 1)).toFixed(2);
  25. }
  26. }