|
-
- export class SovPrices {
-
- static getPrice(priceWithTax, taxRate,round) {
- let price = parseFloat(parseFloat(priceWithTax) / ((taxRate/100) + 1));
- if(round ==false){
- return price;
- }
- return price.toFixed(4);
- }
-
- static getPriceWithTax(priceWithoutTax, taxRate, round) {
- let priceWithTax = parseFloat(parseFloat(priceWithoutTax) * ((taxRate/100) + 1));
- if(round ==false){
- return priceWithTax;
- }
- return priceWithTax.toFixed(2);
- }
-
- static getMargin(price, buyingPrice){
- return parseFloat(price - buyingPrice).toFixed(2);
- }
-
- static getMarginPercent(price, buyingPrice){
- return parseFloat(((price - buyingPrice) / price) * 100).toFixed(2);
- }
-
- static applyReductionPercent(price, percentage, round)
- {
- return this.applyPercent(price, -percentage,round);
- }
-
- static applyReductionAmount(price, amount, round)
- {
- let priceWithReduction = parseFloat(price - amount);
- if(round ==false){
- return priceWithReduction;
- }
- return priceWithReduction.toFixed(2);
- }
-
- static applyPercent(price, percentage, round)
- {
- let priceWithReduction = parseFloat(price * (percentage / 100 + 1));
- if(round ==false){
- return priceWithReduction;
- }
- return priceWithReduction.toFixed(2);
- }
- }
|