
export class SovPrices {

        static getPrice(priceWithTax, taxRate) {
                return parseFloat(parseFloat(priceWithTax) / ((taxRate/100) + 1)).toFixed(4);
        }

        static getPriceWithTax(priceWithoutTax, taxRate) {
                return parseFloat(parseFloat(priceWithoutTax) * ((taxRate/100) + 1)).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)
        {
                return this.applyPercent(price, -percentage);
        }

        static applyReductionAmount(price, amount)
        {
                return parseFloat(price - amount).toFixed(2);
        }

        static applyPercent(price, percentage)
        {
                return parseFloat(price * (percentage / 100 + 1)).toFixed(2);
        }
}
