def sub_total(self): grand_total = 0 for obj in self.rows.all(): total = obj.quantity * obj.rate discount = get_discount_with_percent(total, obj.discount) grand_total += total - discount return grand_total
def sub_total(self): grand_total = 0 for obj in self.rows.all(): total = obj.quantity * obj.rate discount = get_discount_with_percent(total, obj.discount) grand_total += total - discount return grand_total
def total(self): amount = self.sub_total if self.tax == "exclusive": amount = self.sub_total + self.tax_amount if self.discount: discount = get_discount_with_percent(amount, self.discount) amount = amount - discount return amount
def total(self): amount = self.sub_total if self.tax == "exclusive": amount = self.sub_total + self.tax_amount if self.discount: discount = get_discount_with_percent(amount, self.discount) amount = amount - discount return amount
def get_total(self): rate = float(self.rate) tax_scheme = None if self.purchase.tax == 'inclusive': tax_scheme = self.purchase.tax_scheme or self.tax_scheme if tax_scheme: rate = (100 * rate) / (100 + tax_scheme.percent) total = float(self.quantity) * rate discount = get_discount_with_percent(total, self.discount) if self.purchase.tax == 'inclusive': if not tax_scheme: tax_scheme = self.purchase.tax_scheme or self.tax_scheme if tax_scheme: discount = (100 * discount) / (100 + tax_scheme.percent) return total - discount
def get_total(self): rate = float(self.rate) tax_scheme = None if self.purchase.tax == 'inclusive': tax_scheme = self.purchase.tax_scheme or self.tax_scheme if tax_scheme: rate = (100 * rate) / (100 + tax_scheme.percent) total = float(self.quantity) * rate discount = get_discount_with_percent(total, self.discount) if self.purchase.tax == 'inclusive': if not tax_scheme: tax_scheme = self.purchase.tax_scheme or self.tax_scheme if tax_scheme: discount = (100 * discount) / (100 + tax_scheme.percent) return total - discount
def get_total(self): total = float(self.quantity) * float(self.rate) discount = get_discount_with_percent(total, self.discount) return total - discount