예제 #1
0
def untaxed_discount_line_unit_price(cartitem, discount):
    """Returns the discounted line unit-price for this cart item"""
    price = cartitem.unit_price
    if discount and discount.valid_for_product(cartitem.product):
        price = calc_discounted_by_percentage(price, discount.percentage)

    return price
예제 #2
0
def untaxed_discount_line_total(cartitem, discount):
    """Returns the discounted line total for this cart item"""
    price = cartitem.line_total
    if discount and discount.valid_for_product(cartitem.product):
        price = calc_discounted_by_percentage(price, discount.percentage)
    
    return price
예제 #3
0
def untaxed_discount_line_unit_price(cartitem, discount):
    """Returns the discounted line unit-price for this cart item"""
    price = cartitem.unit_price
    if discount and discount.valid_for_product(cartitem.product):
        price = calc_discounted_by_percentage(price, discount.percentage)

    return price
예제 #4
0
def untaxed_discount_line_total(cartitem, discount):
    """Returns the discounted line total for this cart item"""
    price = cartitem.line_total
    if discount and discount.valid_for_product(cartitem.product):
        price = calc_discounted_by_percentage(price, discount.percentage)

    return price
예제 #5
0
def untaxed_sale_price(product):
    """Returns the product unit price with the best auto discount applied."""
    discount = find_best_auto_discount(product)
    price = product.unit_price
        
    if discount and discount.valid_for_product(cartitem.product):
        price = calc_discounted_by_percentage(price, disc.percentage)
    
    return price
예제 #6
0
def untaxed_sale_price(product):
    """Returns the product unit price with the best auto discount applied."""
    discount = find_best_auto_discount(product)
    price = product.unit_price

    if discount and discount.valid_for_product(product):
        price = calc_discounted_by_percentage(price, discount.percentage)

    return price
예제 #7
0
def untaxed_discount_price(product, discount):
    """Returns the product price with the discount applied.
    
    Ex: product|discount_price:sale
    """
    up = product.unit_price
    if discount and discount.valid_for_product(product):
        pcnt = calc_discounted_by_percentage(up, discount.percentage)
        return pcnt
    else:
        return up
예제 #8
0
def untaxed_discount_price(product, discount):
    """Returns the product price with the discount applied.

    Ex: product|discount_price:sale
    """
    up = product.unit_price
    if discount and discount.valid_for_product(product):
        pcnt = calc_discounted_by_percentage(up, discount.percentage)
        return pcnt
    else:
        return up
예제 #9
0
def untaxed_discount_saved(product, discount):
    """Returns the amount saved by the discount"""
    
    if discount and discount.valid_for_product(product):
        price = product.unit_price
        discounted = calc_discounted_by_percentage(price, discount.percentage)
        saved = price-discounted
        cents = Decimal("0.01")
        return saved.quantize(cents)
    else:
        return Decimal('0.00')