var price = this.cart.items.reduce((price, item)=>{
return price + (item.quantity * item.medicine.mrp);
}, 0);
var taxPerc = this.cart.tax_percentage;
var discountPerc = this.cart.discount_percentage;
// var priceWithTax = price + ( price * (tax/100) );
var totalTax = price * ( taxPerc/100 );
var totalDiscount = price * (discountPerc/100);
[price, totalDiscount, totalTax] = [price, totalDiscount, totalTax].map( p => +(p.toFixed(2)) );
var totalPrice = ( price + totalTax ) - totalDiscount;
(see full text)