improve canvas-frame price calculations

This commit is contained in:
Martin
2016-11-08 13:24:08 +01:00
parent cf5fe9fc69
commit 1d6e2cc354
2 changed files with 25 additions and 18 deletions
+15 -14
View File
@@ -114,7 +114,7 @@ def canvas_price(width, height, market, framed=True, designer=None, reseller=Non
return round(price)
def canvas_frame_price(width, height, stock_price, additional_price=None):
def canvas_frame_price(width, height, stock_price, market, additional_price=None, reseller=None, rounded=True, inc_vat=True):
width, height = calculate_canvas_limits(width, height, framed=True)
circumference = (2 * width) + (2 * height)
circumference = max(circumference, 170)
@@ -127,16 +127,6 @@ def canvas_frame_price(width, height, stock_price, additional_price=None):
if width > additional_price_limit or height > additional_price_limit:
price += additional_price
return price
def old_canvas_diy_frame_price(width, height, market, reseller=None, inc_vat=True):
# todo: when product models are in place we should use stockproduct ""Do it yourself frame""
# instead of hardcoded values
stock_price = 1.61084
additional_price = 94.750000
price = canvas_frame_price(width, height, stock_price, additional_price)
# exchange to local currency
price *= market.exchange_rate
@@ -151,7 +141,18 @@ def old_canvas_diy_frame_price(width, height, market, reseller=None, inc_vat=Tru
if inc_vat:
price *= market.vat
return round_half_up(price)
if rounded:
price = round_half_up(price)
return price
def old_canvas_diy_frame_price(width, height, market, reseller=None, inc_vat=True):
# todo: when product models are in place we should use stockproduct ""Do it yourself frame""
# instead of hardcoded values
stock_price = 1.61084
additional_price = 94.750000
return canvas_frame_price(width, height, stock_price, market, additional_price, reseller=reseller, rounded=True, inc_vat=True)
def old_canvas_price(width, height, material, market, framed=True, designer=None, reseller=None, inc_vat=True):
@@ -170,8 +171,8 @@ def old_canvas_price(width, height, material, market, framed=True, designer=None
# "Canvasframe" instead of hardcoded values
stock_price = 1.04230824
additional_price = 94.750000
price += canvas_frame_price(width, height,
stock_price, additional_price)
price += canvas_frame_price(width, height, stock_price, market,
additional_price=additional_price, reseller=reseller, rounded=False, inc_vat=False)
# add vat
if inc_vat: