Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

12345678910111213141516171819202122232425262728293031323334
  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. }